diff options
author | 2019-04-29 05:14:38 +0000 | |
---|---|---|
committer | 2019-04-29 05:14:38 +0000 | |
commit | 8a9f8fc96da52adc861ede26ce6b29d93c16a17e (patch) | |
tree | 1fa4fe33e4d98850243ffd797dedb51a9a72b047 | |
parent | tr_unit is unused, so gc it (diff) | |
download | wireguard-openbsd-8a9f8fc96da52adc861ede26ce6b29d93c16a17e.tar.xz wireguard-openbsd-8a9f8fc96da52adc861ede26ce6b29d93c16a17e.zip |
Check that depend on interfaces are in the same rdomain. If they are not
the daemon wouldn't notice state changes for those interfaces.
ok benno@
-rw-r--r-- | usr.sbin/ospf6d/parse.y | 33 | ||||
-rw-r--r-- | usr.sbin/ospfd/parse.y | 37 |
2 files changed, 60 insertions, 10 deletions
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y index 093198c2ef0..633634dba6b 100644 --- a/usr.sbin/ospf6d/parse.y +++ b/usr.sbin/ospf6d/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.42 2019/02/13 22:57:08 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.43 2019/04/29 05:14:38 remi Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -1151,18 +1151,41 @@ conf_get_area(struct in_addr id) int conf_check_rdomain(u_int rdomain) { - struct area *a; - struct iface *i; - int errs = 0; + struct area *a; + struct iface *i, *idep; + struct redistribute *r; + int errs = 0; + + SIMPLEQ_FOREACH(r, &conf->redist_list, entry) + if (r->dependon[0] != '\0') { + idep = if_findname(r->dependon); + if (idep->rdomain != rdomain) { + logit(LOG_CRIT, + "depend on %s: interface not in rdomain %u", + idep->name, rdomain); + errs++; + } + } LIST_FOREACH(a, &conf->area_list, entry) - LIST_FOREACH(i, &a->iface_list, entry) + LIST_FOREACH(i, &a->iface_list, entry) { if (i->rdomain != rdomain) { logit(LOG_CRIT, "interface %s not in rdomain %u", i->name, rdomain); errs++; } + if (i->dependon[0] != '\0') { + idep = if_findname(i->dependon); + if (idep->rdomain != rdomain) { + logit(LOG_CRIT, + "depend on %s: interface not in " + "rdomain %u", + idep->name, rdomain); + errs++; + } + } + } return (errs); } diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index 7e7e1ddf654..01d410ed838 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.95 2019/02/13 22:57:08 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.96 2019/04/29 05:14:38 remi Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -1371,18 +1371,45 @@ conf_get_if(struct kif *kif, struct kif_addr *ka) int conf_check_rdomain(unsigned int rdomain) { - struct area *a; - struct iface *i; - int errs = 0; + struct area *a; + struct iface *i; + struct in_addr addr; + struct kif *kif; + struct redistribute *r; + int errs = 0; + + SIMPLEQ_FOREACH(r, &conf->redist_list, entry) + if (r->dependon[0] != '\0') { + bzero(&addr, sizeof(addr)); + kif = kif_findname(r->dependon, addr, NULL); + if (kif->rdomain != rdomain) { + logit(LOG_CRIT, + "depend on %s: interface not in rdomain %u", + kif->ifname, rdomain); + errs++; + } + } LIST_FOREACH(a, &conf->area_list, entry) - LIST_FOREACH(i, &a->iface_list, entry) + LIST_FOREACH(i, &a->iface_list, entry) { if (i->rdomain != rdomain) { logit(LOG_CRIT, "interface %s not in rdomain %u", i->name, rdomain); errs++; } + if (i->dependon[0] != '\0') { + bzero(&addr, sizeof(addr)); + kif = kif_findname(i->dependon, addr, NULL); + if (kif->rdomain != rdomain) { + logit(LOG_CRIT, + "depend on %s: interface not in " + "rdomain %u", + kif->ifname, rdomain); + errs++; + } + } + } return (errs); } |