summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2019-08-12 20:21:58 +0000
committerremi <remi@openbsd.org>2019-08-12 20:21:58 +0000
commit2fa3752858384f9da2dd36084eb56dec60f86787 (patch)
tree06fa82415cfb5385f14fcc165680221295cc8a06 /usr.sbin/ospfd
parentFix typo; spotted by Krystian Lewandowski. (diff)
downloadwireguard-openbsd-2fa3752858384f9da2dd36084eb56dec60f86787.tar.xz
wireguard-openbsd-2fa3752858384f9da2dd36084eb56dec60f86787.zip
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@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/hello.c12
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);