summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-02-16 18:10:09 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-02-16 18:10:09 +0000
commit975b2b6b6555c17180e88f6d1d3c601210b90101 (patch)
tree762aad83fb971382eb40eb6a9629d857efed69bf /usr.sbin/ospfd
parentf5f4e7d769a5fdc3352d3236d6d2864c009fe37f (diff)
Lets violate the RFC once more. Change the way we map hello packets to
neighbors from using the source IP on broadcast interfaces to using the router-id all the time. The interface lookup will already check for matching subnets so there is no conflict possible. This makes ospfd finally grok router-id changes without freaking out. Additionally whinge when an other router is using the same router-id instead of failing in a very horrible way. OK sthen@, dlg@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r--usr.sbin/ospfd/hello.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/usr.sbin/ospfd/hello.c b/usr.sbin/ospfd/hello.c
index d461102cf0e..0c46bdabea2 100644
--- a/usr.sbin/ospfd/hello.c
+++ b/usr.sbin/ospfd/hello.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hello.c,v 1.16 2010/02/01 10:22:06 jacekm Exp $ */
+/* $OpenBSD: hello.c,v 1.17 2010/02/16 18:10:08 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -161,30 +161,26 @@ recv_hello(struct iface *iface, struct in_addr src, u_int32_t rtr_id, char *buf,
return;
}
- switch (iface->type) {
- case IF_TYPE_POINTOPOINT:
- case IF_TYPE_VIRTUALLINK:
- /* match router-id */
- LIST_FOREACH(nbr, &iface->nbr_list, entry) {
- if (nbr == iface->self)
- continue;
- if (nbr->id.s_addr == rtr_id)
- break;
- }
- break;
- case IF_TYPE_BROADCAST:
- case IF_TYPE_NBMA:
- case IF_TYPE_POINTOMULTIPOINT:
- /* match src IP */
- LIST_FOREACH(nbr, &iface->nbr_list, entry) {
- if (nbr == iface->self)
- continue;
- if (nbr->addr.s_addr == src.s_addr)
- break;
+ /*
+ * Match router-id, in case of conflict moan and ignore hello.
+ * Only the router-id is compared since the source IP on NBMA,
+ * broadcast and point-to-multipoint interfaces was already
+ * compared in find_iface() and only IPs in the same subnet
+ * are accepted. This is not excatly what the RFC specifies
+ * but works far better.
+ */
+ LIST_FOREACH(nbr, &iface->nbr_list, entry) {
+ if (nbr == iface->self) {
+ if (nbr->id.s_addr == rtr_id) {
+ log_warnx("recv_hello: Router-ID colision on "
+ "interface %s neighbor IP %s", iface->name,
+ inet_ntoa(src));
+ return;
+ }
+ continue;
}
- break;
- default:
- fatalx("recv_hello: unknown interface type");
+ if (nbr->id.s_addr == rtr_id)
+ break;
}
if (!nbr) {