diff options
author | remi <remi@cvs.openbsd.org> | 2019-08-12 20:21:59 +0000 |
---|---|---|
committer | remi <remi@cvs.openbsd.org> | 2019-08-12 20:21:59 +0000 |
commit | db227084bb630557aace5069af77167dcf42cc33 (patch) | |
tree | d1a13c296df6a4f6b6725dbef1475851459c41be | |
parent | 7eec424752ba0222f149d9801a3f3cafdd94be5e (diff) |
Warn when a neighbor changes its source IP address. Either it is because
of a planned change or something bad is happening in the network.
ok benno@
-rw-r--r-- | usr.sbin/ospfd/hello.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/ospfd/hello.c b/usr.sbin/ospfd/hello.c index 12339ad0cf0..9ae07cd4f91 100644 --- a/usr.sbin/ospfd/hello.c +++ b/usr.sbin/ospfd/hello.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hello.c,v 1.23 2019/07/15 18:26:39 remi Exp $ */ +/* $OpenBSD: hello.c,v 1.24 2019/08/12 20:21:58 remi Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -189,10 +189,16 @@ recv_hello(struct iface *iface, struct in_addr src, u_int32_t rtr_id, char *buf, 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); |