From 12f30095de852a47bd03e27f09cf53b3a633d283 Mon Sep 17 00:00:00 2001 From: Jim Colderwood Date: Mon, 15 Apr 2024 22:10:01 +0100 Subject: [PATCH] cleanup --- ripv2/ripv2.go | 4 +++- ripv2/routes/routes.go | 2 +- ripv2/types.go | 2 +- rtable/table.go | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ripv2/ripv2.go b/ripv2/ripv2.go index 5e12052..9ff852d 100644 --- a/ripv2/ripv2.go +++ b/ripv2/ripv2.go @@ -9,7 +9,9 @@ import ( ) func New() Message { - return Message{} + var message Message + message.RIP = make([]RIP, 25) + return message } func (m *Message) MParse(b *[]byte, n int) error { diff --git a/ripv2/routes/routes.go b/ripv2/routes/routes.go index 59bbf6a..483198f 100644 --- a/ripv2/routes/routes.go +++ b/ripv2/routes/routes.go @@ -46,7 +46,7 @@ func (r *Routes) append(route Route) { r.Routes[string(bs)] = k } -func (r *Routes) ParseRoutes(addr net.UDPAddr, rip *[25]ripv2.RIP) { +func (r *Routes) ParseRoutes(addr net.UDPAddr, rip *[]ripv2.RIP) { var route Route for _, rip := range *rip { /* if not af_inet */ diff --git a/ripv2/types.go b/ripv2/types.go index f01dc77..f7075ae 100644 --- a/ripv2/types.go +++ b/ripv2/types.go @@ -18,7 +18,7 @@ type Message struct { Command Command Version Version Zero uint16 - RIP [25]RIP + RIP []RIP } type RIP struct { diff --git a/rtable/table.go b/rtable/table.go index cabc80b..cb772d9 100644 --- a/rtable/table.go +++ b/rtable/table.go @@ -27,7 +27,6 @@ func command(command COMMAND, r *routes.Route) error { default: return errors.New("command not supported") } - return cmd.Run() }