I'd like to get a notification when a neighbor changes the src IP address
for hello packets. Either it is a planned change or something bad happens
in the network.
OK?
Remi
Index: hello.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/hello.c,v
retrieving revision 1.23
diff -u -p -r1.23 hello.c
--- hello.c 15 Jul 2019 18:26:39 -0000 1.23
+++ hello.c 11 Aug 2019 09:36:13 -0000
@@ -189,10 +189,16 @@ recv_hello(struct iface *iface, struct i
nbr->dr.s_addr = hello.d_rtr;
nbr->bdr.s_addr = hello.bd_rtr;
nbr->priority = hello.rtr_priority;
+ /* XXX neighbor address shouldn't be stored on virtual links */
+ nbr->addr.s_addr = src.s_addr;
+ }
+
+ if (nbr->addr.s_addr != src.s_addr) {
+ log_warnx("%s: neighbor ID %s changed its IP address",
+ __func__, inet_ntoa(nbr->id));
+ nbr->addr.s_addr = src.s_addr;
}
- /* actually the neighbor address shouldn't be stored on virtual links */
- nbr->addr.s_addr = src.s_addr;
nbr->options = hello.opts;
nbr_fsm(nbr, NBR_EVT_HELLO_RCVD);