aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-10-23 11:12:49 -0400
committersotech117 <michael_foiani@brown.edu>2023-10-23 11:12:49 -0400
commitcb605f4bd1868c443799f4764e9400ada2c08eb8 (patch)
tree2cc3ed66855374c80952934ce08ce93889539bf6
parent097e6330ec777698cbaf87e008df9295e9978782 (diff)
send triggered updates when any! entry in the table is created, updated, or deleted
-rw-r--r--pkg/ipstack/ipstack.go11
-rwxr-xr-xvhostbin3104664 -> 3105056 bytes
-rwxr-xr-xvrouterbin3104672 -> 3105056 bytes
3 files changed, 11 insertions, 0 deletions
diff --git a/pkg/ipstack/ipstack.go b/pkg/ipstack/ipstack.go
index c8a4fe8..4556f0f 100644
--- a/pkg/ipstack/ipstack.go
+++ b/pkg/ipstack/ipstack.go
@@ -843,6 +843,7 @@ func handleRIP(src *Interface, dest *Neighbor, message []byte, hdr *ipv4header.I
destination := entry.prefix.Masked()
// fmt.Println(prefix.String())
+ triggeredEntries := make([]RIPEntry, 0)
// check if the entry is already in the routing table and update if need be
if hop, ok := routingTable[destination]; ok {
// if the hop is the same as the incoming neighbor,
@@ -853,8 +854,10 @@ func handleRIP(src *Interface, dest *Neighbor, message []byte, hdr *ipv4header.I
if entry.cost == INFINITY {
// if we receive infinity from the same neighbor, then delete the route
delete(routingTable, destination)
+ triggeredEntries = append(triggeredEntries, RIPEntry{destination, INFINITY})
} else {
routingTable[destination] = Hop{entry.cost + 1, "R", src, hdr.Src}
+ triggeredEntries = append(triggeredEntries, RIPEntry{destination, entry.cost + 1})
}
}
@@ -863,8 +866,10 @@ func handleRIP(src *Interface, dest *Neighbor, message []byte, hdr *ipv4header.I
if entry.cost < hop.Cost {
if entry.cost == INFINITY {
routingTable[destination] = Hop{entry.cost, "R", src, hdr.Src}
+ triggeredEntries = append(triggeredEntries, RIPEntry{destination, entry.cost})
} else {
routingTable[destination] = Hop{entry.cost + 1, "R", src, hdr.Src}
+ triggeredEntries = append(triggeredEntries, RIPEntry{destination, entry.cost + 1})
}
}
@@ -883,7 +888,13 @@ func handleRIP(src *Interface, dest *Neighbor, message []byte, hdr *ipv4header.I
// routingTable[destination] = Hop{0, "R", src, hdr.Src}
//} else {
routingTable[destination] = Hop{entry.cost + 1, "R", src, hdr.Src}
+ triggeredEntries = append(triggeredEntries, RIPEntry{destination, entry.cost + 1})
// }
+
+ // send out triggered updates
+ if len(triggeredEntries) > 0 {
+ sendTriggeredUpdates(triggeredEntries)
+ }
}
}
diff --git a/vhost b/vhost
index 88948dc..66761c1 100755
--- a/vhost
+++ b/vhost
Binary files differ
diff --git a/vrouter b/vrouter
index 45624ed..e62754d 100755
--- a/vrouter
+++ b/vrouter
Binary files differ