aboutsummaryrefslogtreecommitdiff
path: root/cmd/vhost
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/vhost')
-rw-r--r--cmd/vhost/main.go9
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())
+
}
}
}