From 36b6ad3b3381d909d3dc4d3e62b141b1dd109962 Mon Sep 17 00:00:00 2001 From: Jim Colderwood Date: Thu, 25 Apr 2024 14:19:28 +0100 Subject: [PATCH] Clean up --- main.go | 4 ++-- ripv2/ripv2.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 7d3f1f3..1531df3 100644 --- a/main.go +++ b/main.go @@ -13,12 +13,12 @@ func callback(r *ripv2.Routes) { } func main() { - config := config.Read("config.json") + conf := config.Read("config.json") rip := ripv2.New() routes := ripv2.Init() log.Println("Running") routes.Timer() - rip.Run(config, callback) + rip.Run(conf, callback) /* NOT REACHED */ } diff --git a/ripv2/ripv2.go b/ripv2/ripv2.go index d17d211..11ec7aa 100644 --- a/ripv2/ripv2.go +++ b/ripv2/ripv2.go @@ -44,9 +44,9 @@ func (m *Message) MParse(b *[]byte, n int) error { for i := 0; i < (n-4)/20; i++ { m.RIP[i].AFI = binary.BigEndian.Uint16(ripentry[0:2]) m.RIP[i].RouteTag = binary.BigEndian.Uint16(ripentry[2:4]) - m.RIP[i].Addr = binary.BigEndian.Uint32(ripentry[4:8]) //net.IPv4(ripentry[4], ripentry[5], ripentry[6], ripentry[7]) - m.RIP[i].Subnet = binary.BigEndian.Uint32(ripentry[8:12]) //net.IPv4Mask(ripentry[8], ripentry[9], ripentry[10], ripentry[11]) - m.RIP[i].Nexthop = binary.BigEndian.Uint32(ripentry[12:16]) //net.IPv4(ripentry[12], ripentry[13], ripentry[14], ripentry[15]) + m.RIP[i].Addr = binary.BigEndian.Uint32(ripentry[4:8]) + m.RIP[i].Subnet = binary.BigEndian.Uint32(ripentry[8:12]) + m.RIP[i].Nexthop = binary.BigEndian.Uint32(ripentry[12:16]) m.RIP[i].Metric = binary.BigEndian.Uint32(ripentry[16:20]) indexA += 20 indexB += 20