diff --git a/aarp.go b/aarp.go index fc1e65b..336d9f3 100644 --- a/aarp.go +++ b/aarp.go @@ -136,7 +136,7 @@ func (a *AARPMachine) Run(ctx context.Context, incomingCh <-chan *ethertalk.Pack log.Printf("AARP: Who has %v? Tell %v", aapkt.Dst.Proto, aapkt.Src.Proto) // Glean that aapkt.Src.Proto -> aapkt.Src.Hardware a.addressMappingTable.Learn(aapkt.Src.Proto, aapkt.Src.Hardware) - log.Printf("AARP: Gleaned that %v -> %v", aapkt.Src.Proto, aapkt.Src.Hardware) + log.Printf("AARP: Gleaned that %d.%d -> %v", aapkt.Src.Proto.Network, aapkt.Src.Proto.Node, aapkt.Src.Hardware) if !(aapkt.Dst.Proto == a.myAddr.Proto && a.assigned) { continue diff --git a/aurp/domain.go b/aurp/domain.go index e453063..edaffe6 100644 --- a/aurp/domain.go +++ b/aurp/domain.go @@ -84,6 +84,8 @@ type DomainIdentifier interface { // NullDomainIdentifier represents a null domain identifier. type NullDomainIdentifier struct{} +func (NullDomainIdentifier) String() string { return "(null DI)" } + // WriteTo writes the encoded form of the domain identifier to w. func (NullDomainIdentifier) WriteTo(w io.Writer) (int64, error) { n, err := w.Write([]byte{0x01, 0x00}) @@ -93,6 +95,8 @@ func (NullDomainIdentifier) WriteTo(w io.Writer) (int64, error) { // IPDomainIdentifier represents an IP address in a domain identifier. type IPDomainIdentifier net.IP +func (i IPDomainIdentifier) String() string { return net.IP(i).String() } + // WriteTo writes the encoded form of the domain identifier to w. func (i IPDomainIdentifier) WriteTo(w io.Writer) (int64, error) { v4 := net.IP(i).To4() diff --git a/main.go b/main.go index eba3813..530193e 100644 --- a/main.go +++ b/main.go @@ -224,10 +224,11 @@ func main() { ddpkt.SrcNet, ddpkt.SrcNode, ddpkt.SrcSocket, ddpkt.DstNet, ddpkt.DstNode, ddpkt.DstSocket, ddpkt.Proto, len(ddpkt.Data)) + // Glean address info for AMT srcAddr := ddp.Addr{Network: ddpkt.SrcNet, Node: ddpkt.SrcNode} aarpMachine.Learn(srcAddr, ethFrame.Src) - log.Printf("DDP: Gleaned that %v -> %v", srcAddr, ethFrame.Src) + log.Printf("DDP: Gleaned that %d.%d -> %v", srcAddr.Network, srcAddr.Node, ethFrame.Src) // Packet for us? First, who am I? myAddr, ok := aarpMachine.Address() @@ -249,10 +250,12 @@ func main() { // Is it for a network in the routing table? rt := lookupRoute(ddpkt.DstNet) if rt == nil { + log.Printf("DDP: no route for network %d", ddpkt.DstNet) continue } // Encap ethPacket.Payload into an AURP packet + log.Printf("DDP: forwarding to AURP peer %v", rt.peer.tr.RemoteDI) if _, err := rt.peer.send(rt.peer.tr.NewAppleTalkPacket(ethFrame.Payload)); err != nil { log.Printf("DDP: Couldn't forward packet to AURP peer: %v", err) }