More log
This commit is contained in:
parent
465fbcd627
commit
3e1ec391a3
1 changed files with 10 additions and 2 deletions
12
zip.go
12
zip.go
|
@ -18,6 +18,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
"gitea.drjosh.dev/josh/jrouter/atalk/atp"
|
"gitea.drjosh.dev/josh/jrouter/atalk/atp"
|
||||||
"gitea.drjosh.dev/josh/jrouter/atalk/zip"
|
"gitea.drjosh.dev/josh/jrouter/atalk/zip"
|
||||||
|
@ -107,15 +108,20 @@ func handleZIP(pcapHandle *pcap.Handle, srcHWAddr, myHWAddr ethernet.Addr, myAdd
|
||||||
|
|
||||||
switch zipkt := zipkt.(type) {
|
switch zipkt := zipkt.(type) {
|
||||||
case *zip.QueryPacket:
|
case *zip.QueryPacket:
|
||||||
|
log.Printf("ZIP: Got Query for networks %v", zipkt.Networks)
|
||||||
// TODO: multiple packets
|
// TODO: multiple packets
|
||||||
|
networks := zones.Query(zipkt.Networks)
|
||||||
resp = &zip.ReplyPacket{
|
resp = &zip.ReplyPacket{
|
||||||
Extended: false,
|
Extended: false,
|
||||||
Networks: zones.Query(zipkt.Networks),
|
Networks: networks,
|
||||||
}
|
}
|
||||||
|
log.Printf("ZIP: Replying with non-extended Reply: %v", networks)
|
||||||
|
|
||||||
case *zip.GetNetInfoPacket:
|
case *zip.GetNetInfoPacket:
|
||||||
|
log.Printf("ZIP: Got GetNetInfo for zone %q", zipkt.ZoneName)
|
||||||
|
|
||||||
// Only running a network with one zone for now.
|
// Only running a network with one zone for now.
|
||||||
resp = &zip.GetNetInfoReplyPacket{
|
gnir := &zip.GetNetInfoReplyPacket{
|
||||||
ZoneInvalid: zipkt.ZoneName != cfg.EtherTalk.ZoneName,
|
ZoneInvalid: zipkt.ZoneName != cfg.EtherTalk.ZoneName,
|
||||||
UseBroadcast: true, // TODO: add multicast addr computation
|
UseBroadcast: true, // TODO: add multicast addr computation
|
||||||
OnlyOneZone: true,
|
OnlyOneZone: true,
|
||||||
|
@ -125,6 +131,8 @@ func handleZIP(pcapHandle *pcap.Handle, srcHWAddr, myHWAddr ethernet.Addr, myAdd
|
||||||
MulticastAddr: ethertalk.AppleTalkBroadcast,
|
MulticastAddr: ethertalk.AppleTalkBroadcast,
|
||||||
DefaultZoneName: cfg.EtherTalk.ZoneName,
|
DefaultZoneName: cfg.EtherTalk.ZoneName,
|
||||||
}
|
}
|
||||||
|
log.Printf("ZIP: Replying with GetNetInfo-Reply: %+v", gnir)
|
||||||
|
resp = gnir
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("TODO: handle type %T", zipkt)
|
return fmt.Errorf("TODO: handle type %T", zipkt)
|
||||||
|
|
Loading…
Reference in a new issue