aboutsummaryrefslogtreecommitdiff
path: root/cmd/vrouter
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-10-22 09:22:31 -0400
committersotech117 <michael_foiani@brown.edu>2023-10-22 09:22:31 -0400
commit36b61f5f38bd2aae78353fa112c0787f0a89a31f (patch)
tree5ff772aeacbe6f3caf54cd8685a9ee8b19c4d0cb /cmd/vrouter
parenta935739d332ccb82174ddb925dcf5e473dfae41f (diff)
forwarding works as expected among multiple subnets, but checksum fails. will focus more on RIP timeouts next.
Diffstat (limited to 'cmd/vrouter')
-rw-r--r--cmd/vrouter/main.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/vrouter/main.go b/cmd/vrouter/main.go
index ba7f285..59e2816 100644
--- a/cmd/vrouter/main.go
+++ b/cmd/vrouter/main.go
@@ -72,9 +72,15 @@ 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] {
- if neighbor.VipAddr == netip.MustParseAddr(ipAddr) {
+ if neighbor.VipAddr == hop.VIP ||
+ neighbor.VipAddr == netip.MustParseAddr(ipAddr) ||
+ hop.Type == "S" {
err = ipstack.SendIP(&myAddr, neighbor, ipstack.TEST_PROTOCOL, messageToSendBytes, ipAddr, nil)
if err != nil {
fmt.Println(err)