diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-10-23 03:42:05 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-10-23 03:42:05 -0400 |
commit | 512c4c2785e6dbf53106b5a6f60e0e1992977016 (patch) | |
tree | 284ede052af9a1efc2a962d7da6f9abde588b7ac /cmd/vhost/main.go | |
parent | 7ec4f310ec01100f648a42dd52cb0ac635ac0b10 (diff) |
add RIP request and reponse
Diffstat (limited to 'cmd/vhost/main.go')
-rw-r--r-- | cmd/vhost/main.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/vhost/main.go b/cmd/vhost/main.go index 17b4a02..468409d 100644 --- a/cmd/vhost/main.go +++ b/cmd/vhost/main.go @@ -58,14 +58,21 @@ func main() { messageToSendBytes := []byte(messageToSend) hop, err := ipstack.LongestPrefix(netip.MustParseAddr(ipAddr)) + if err != nil { + fmt.Println(err) + continue + } myAddr := hop.Interface.IpPrefix.Addr() for _, neighbor := range ipstack.GetNeighbors()[hop.Interface.Name] { // TODO: fix multiple send bug here on static route if neighbor.VipAddr == netip.MustParseAddr(ipAddr) || neighbor.VipAddr == hop.VIP && hop.Type == "S" { - err = ipstack.SendIP(&myAddr, neighbor, ipstack.TEST_PROTOCOL, messageToSendBytes, ipAddr, nil) + bytesWritten, err := ipstack.SendIP(&myAddr, neighbor, ipstack.TEST_PROTOCOL, messageToSendBytes, ipAddr, nil) if err != nil { fmt.Println(err) + } else { + fmt.Printf("Sent %d bytes to %s\n", bytesWritten, neighbor.VipAddr.String()) + } } } |