aboutsummaryrefslogtreecommitdiff
path: root/pkg/ipstack
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ipstack')
-rw-r--r--pkg/ipstack/ipstack.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkg/ipstack/ipstack.go b/pkg/ipstack/ipstack.go
index 2ab2a5f..f6c86a8 100644
--- a/pkg/ipstack/ipstack.go
+++ b/pkg/ipstack/ipstack.go
@@ -226,7 +226,18 @@ func InterfaceUp(iface *Interface) {
ripEntries := make([]RIPEntry, 0)
ripEntries = append(ripEntries, RIPEntry{iface.IpPrefix.Masked(), LOCAL_COST})
sendTriggeredUpdates(ripEntries)
+
+ // send a request to all neighbors of this iface to get info ASAP
+ for _, neighbor := range myNeighbors[iface.Name] {
+ message := makeRipMessage(1, nil)
+ addr := iface.IpPrefix.Addr()
+ _, err := SendIP(&addr, neighbor, RIP_PROTOCOL, message, neighbor.VipAddr.String(), nil)
+ if err != nil {
+ fmt.Println("Error sending RIP request to neighbor on interfaceup", err)
+ }
+ }
}
+
}
func InterfaceUpREPL(ifaceName string) {
@@ -379,7 +390,7 @@ func CleanUp() {
func SendIP(src *netip.Addr, dest *Neighbor, protocolNum int, message []byte, destIP string, hdr *ipv4header.IPv4Header) (int, error) {
iface, err := GetInterfaceByName(dest.Name)
if !iface.State {
- return -1, errors.New("error: interface is down")
+ return -1, errors.Errorf("error SEND: %s is down", iface.Name)
}
if hdr == nil {
@@ -466,7 +477,7 @@ func RecvIP(iface *Interface, isOpen *bool) error {
}
if !*isOpen {
- return errors.New("interface is down")
+ return errors.Errorf("error RECV: %s is down", iface.Name)
}
// Marshal the received byte array into a UDP header