this is similar to ospfd's hello.c rev 1.23.

OK?

Remi


Index: hello.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/hello.c,v
retrieving revision 1.19
diff -u -p -r1.19 hello.c
--- hello.c     11 Dec 2019 21:33:56 -0000      1.19
+++ hello.c     22 Dec 2019 20:46:01 -0000
@@ -173,10 +173,16 @@ recv_hello(struct iface *iface, struct i
                nbr->dr.s_addr = hello.d_rtr;
                nbr->bdr.s_addr = hello.bd_rtr;
                nbr->priority = LSA_24_GETHI(ntohl(hello.opts));
+               /* XXX neighbor address shouldn't be stored on virtual links */
+               nbr->addr = *src;
+       }
+
+       if (memcmp(&nbr->addr, src, sizeof(struct in6_addr)) != 0) {
+               log_warnx("%s: neighbor ID %s changed its address to %s",
+                   __func__, inet_ntoa(nbr->id), log_in6addr(src));
+               nbr->addr = *src;
        }
 
-       /* actually the neighbor address shouldn't be stored on virtual links */
-       nbr->addr = *src;
        nbr->options = opts;
 
        nbr_fsm(nbr, NBR_EVT_HELLO_RCVD);

Reply via email to