Another TODO to do

This commit is contained in:
Josh Deprez 2024-04-19 16:56:39 +10:00
parent 0005f827e5
commit e37c4e48e2
No known key found for this signature in database

13
main.go
View file

@ -142,7 +142,7 @@ func main() {
} }
// -------------------------------- Tables -------------------------------- // -------------------------------- Tables --------------------------------
routing := router.NewRoutingTable() routes := router.NewRoutingTable()
zones := router.NewZoneTable() zones := router.NewZoneTable()
zones.Upsert(cfg.EtherTalk.NetStart, cfg.EtherTalk.ZoneName, true) zones.Upsert(cfg.EtherTalk.NetStart, cfg.EtherTalk.ZoneName, true)
@ -168,7 +168,7 @@ func main() {
UDPConn: ln, UDPConn: ln,
RemoteAddr: raddr, RemoteAddr: raddr,
RecieveCh: make(chan aurp.Packet, 1024), RecieveCh: make(chan aurp.Packet, 1024),
RoutingTable: routing, RoutingTable: routes,
ZoneTable: zones, ZoneTable: zones,
} }
aurp.Inc(&nextConnID) aurp.Inc(&nextConnID)
@ -186,7 +186,7 @@ func main() {
AARP: aarpMachine, AARP: aarpMachine,
Config: cfg, Config: cfg,
PcapHandle: pcapHandle, PcapHandle: pcapHandle,
RoutingTable: routing, RoutingTable: routes,
} }
rtmpCh := make(chan *ddp.ExtPacket, 1024) rtmpCh := make(chan *ddp.ExtPacket, 1024)
go rtmpMachine.Run(ctx, rtmpCh) go rtmpMachine.Run(ctx, rtmpCh)
@ -197,7 +197,7 @@ func main() {
PcapHandle: pcapHandle, PcapHandle: pcapHandle,
MyHWAddr: myHWAddr, MyHWAddr: myHWAddr,
// MyDDPAddr: ..., // MyDDPAddr: ...,
RouteTable: routing, RouteTable: routes,
ZoneTable: zones, ZoneTable: zones,
} }
@ -268,9 +268,10 @@ func main() {
// it specifies the local network to which the node is // it specifies the local network to which the node is
// connected. Packets whose destination network number is 0 are // connected. Packets whose destination network number is 0 are
// addressed to a node on the local network." // addressed to a node on the local network."
// TODO: more generic routing
if ddpkt.DstNet != 0 && (ddpkt.DstNet < cfg.EtherTalk.NetStart || ddpkt.DstNet > cfg.EtherTalk.NetEnd) { if ddpkt.DstNet != 0 && (ddpkt.DstNet < cfg.EtherTalk.NetStart || ddpkt.DstNet > cfg.EtherTalk.NetEnd) {
// Is it for a network in the routing table? // Is it for a network in the routing table?
rt := routing.LookupRoute(ddpkt.DstNet) rt := routes.LookupRoute(ddpkt.DstNet)
if rt == nil { if rt == nil {
log.Printf("DDP: no route for network %d", ddpkt.DstNet) log.Printf("DDP: no route for network %d", ddpkt.DstNet)
continue continue
@ -436,7 +437,7 @@ func main() {
UDPConn: ln, UDPConn: ln,
RemoteAddr: raddr, RemoteAddr: raddr,
RecieveCh: make(chan aurp.Packet, 1024), RecieveCh: make(chan aurp.Packet, 1024),
RoutingTable: routing, RoutingTable: routes,
ZoneTable: zones, ZoneTable: zones,
} }
aurp.Inc(&nextConnID) aurp.Inc(&nextConnID)