Try to fix local NBP BrRq

This commit is contained in:
Josh Deprez 2024-04-23 10:59:53 +10:00
parent bb2a5dff27
commit f53f0233a9
Signed by: josh
SSH key fingerprint: SHA256:zZji7w1Ilh2RuUpbQcqkLPrqmRwpiCSycbF2EfKm6Kw

View file

@ -24,7 +24,6 @@ import (
"gitea.drjosh.dev/josh/jrouter/atalk/nbp" "gitea.drjosh.dev/josh/jrouter/atalk/nbp"
"github.com/sfiera/multitalk/pkg/ddp" "github.com/sfiera/multitalk/pkg/ddp"
"github.com/sfiera/multitalk/pkg/ethernet" "github.com/sfiera/multitalk/pkg/ethernet"
"github.com/sfiera/multitalk/pkg/ethertalk"
) )
func (rtr *Router) HandleNBP(srcHWAddr ethernet.Addr, ddpkt *ddp.ExtPacket) error { func (rtr *Router) HandleNBP(srcHWAddr ethernet.Addr, ddpkt *ddp.ExtPacket) error {
@ -53,11 +52,6 @@ func (rtr *Router) HandleNBP(srcHWAddr ethernet.Addr, ddpkt *ddp.ExtPacket) erro
// There must be 1! // There must be 1!
tuple := &nbpkt.Tuples[0] tuple := &nbpkt.Tuples[0]
ethDst := ethertalk.AppleTalkBroadcast
if tuple.Zone != "*" && tuple.Zone != "" {
ethDst = atalk.MulticastAddr(tuple.Zone)
}
zones := rtr.ZoneTable.LookupName(tuple.Zone) zones := rtr.ZoneTable.LookupName(tuple.Zone)
for _, z := range zones { for _, z := range zones {
if z.Local { if z.Local {
@ -77,10 +71,11 @@ func (rtr *Router) HandleNBP(srcHWAddr ethernet.Addr, ddpkt *ddp.ExtPacket) erro
outDDP := *ddpkt outDDP := *ddpkt
outDDP.Size = uint16(len(nbpRaw)) + atalk.DDPExtHeaderSize outDDP.Size = uint16(len(nbpRaw)) + atalk.DDPExtHeaderSize
outDDP.DstNet = 0x0000 // Local network broadcast
outDDP.DstNode = 0xFF // Broadcast node address within the dest network outDDP.DstNode = 0xFF // Broadcast node address within the dest network
outDDP.Data = nbpRaw outDDP.Data = nbpRaw
if err := rtr.sendEtherTalkDDP(ethDst, &outDDP); err != nil { if err := rtr.ZoneMulticastEtherTalkDDP(tuple.Zone, &outDDP); err != nil {
return err return err
} }