NBP LkUp-Reply minor cleanup
This commit is contained in:
parent
fd2ab2918b
commit
6b88025d19
1 changed files with 15 additions and 8 deletions
23
nbp.go
23
nbp.go
|
@ -21,6 +21,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"gitea.drjosh.dev/josh/jrouter/atalk"
|
||||||
"gitea.drjosh.dev/josh/jrouter/atalk/nbp"
|
"gitea.drjosh.dev/josh/jrouter/atalk/nbp"
|
||||||
"github.com/google/gopacket/pcap"
|
"github.com/google/gopacket/pcap"
|
||||||
"github.com/sfiera/multitalk/pkg/aarp"
|
"github.com/sfiera/multitalk/pkg/aarp"
|
||||||
|
@ -73,14 +74,20 @@ func handleNBP(pcapHandle *pcap.Handle, myHWAddr, srcHWAddr ethernet.Addr, myAdd
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't marshal LkUp-Reply: %v", err)
|
return fmt.Errorf("couldn't marshal LkUp-Reply: %v", err)
|
||||||
}
|
}
|
||||||
ddpkt.DstNet = ddpkt.SrcNet
|
outDDP := ddp.ExtPacket{
|
||||||
ddpkt.DstNode = ddpkt.SrcNode
|
ExtHeader: ddp.ExtHeader{
|
||||||
ddpkt.DstSocket = ddpkt.SrcSocket
|
Size: uint16(len(respRaw)) + atalk.DDPExtHeaderSize,
|
||||||
ddpkt.SrcNet = myAddr.Proto.Network
|
Cksum: 0,
|
||||||
ddpkt.SrcNode = myAddr.Proto.Node
|
DstNet: ddpkt.SrcNet,
|
||||||
ddpkt.SrcSocket = 2
|
DstNode: ddpkt.SrcNode,
|
||||||
ddpkt.Data = respRaw
|
DstSocket: ddpkt.SrcSocket,
|
||||||
outFrame, err := ethertalk.AppleTalk(myHWAddr, *ddpkt)
|
SrcNet: myAddr.Proto.Network,
|
||||||
|
SrcNode: myAddr.Proto.Node,
|
||||||
|
SrcSocket: 2,
|
||||||
|
},
|
||||||
|
Data: respRaw,
|
||||||
|
}
|
||||||
|
outFrame, err := ethertalk.AppleTalk(myHWAddr, outDDP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue