diff options
author | remi <remi@openbsd.org> | 2018-07-12 12:19:05 +0000 |
---|---|---|
committer | remi <remi@openbsd.org> | 2018-07-12 12:19:05 +0000 |
commit | a66c91f28b18519c5399bcf1794de7b53f089505 (patch) | |
tree | 27243b62eab2002cf1cc839a7a1fbdefaa031e03 /usr.sbin/ospf6d/rde.c | |
parent | Allow to use configured/running VMs as templates for other VM instances. (diff) | |
download | wireguard-openbsd-a66c91f28b18519c5399bcf1794de7b53f089505.tar.xz wireguard-openbsd-a66c91f28b18519c5399bcf1794de7b53f089505.zip |
With the "depend on" option routes are sent out with a metric of 65535 if
the referenced interface is down or in state backup. This is especially
useful on a carp cluster to ensure all traffic goes to the carp master.
ok friehm@ jca@
Diffstat (limited to 'usr.sbin/ospf6d/rde.c')
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index 7e630e6ed4e..eaeccace4f0 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.77 2018/07/10 21:21:56 friehm Exp $ */ +/* $OpenBSD: rde.c,v 1.78 2018/07/12 12:19:05 remi Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -633,7 +633,7 @@ rde_dispatch_parent(int fd, short event, void *bula) { static struct area *narea; struct area *area; - struct iface *iface, *ifp; + struct iface *iface, *ifp, *i; struct ifaddrchange *ifc; struct iface_addr *ia, *nia; struct imsg imsg; @@ -643,7 +643,7 @@ rde_dispatch_parent(int fd, short event, void *bula) struct lsa *lsa; struct vertex *v; ssize_t n; - int shut = 0, link_ok, prev_link_ok; + int shut = 0, link_ok, prev_link_ok, orig_lsa; unsigned int ifindex; if (event & EV_READ) { @@ -709,6 +709,24 @@ rde_dispatch_parent(int fd, short event, void *bula) fatalx("IFINFO imsg with wrong len"); ifp = imsg.data; + + LIST_FOREACH(area, &rdeconf->area_list, entry) { + orig_lsa = 0; + LIST_FOREACH(i, &area->iface_list, entry) { + if (strcmp(i->dependon, + ifp->name) == 0) { + i->depend_ok = + ifstate_is_up(ifp); + if (ifstate_is_up(i)) + orig_lsa = 1; + } + } + if (orig_lsa) + orig_intra_area_prefix_lsas(area); + } + + if (!(ifp->cflags & F_IFACE_CONFIGURED)) + break; iface = if_find(ifp->ifindex); if (iface == NULL) fatalx("interface lost in rde"); @@ -1532,8 +1550,9 @@ orig_intra_lsa_rtr(struct area *area, struct vertex *old) iface->state & IF_STA_LOOPBACK) { lsa_prefix->prefixlen = 128; lsa_prefix->metric = 0; - } else if (iface->if_type == IFT_CARP && - iface->linkstate == LINK_STATE_DOWN) { + } else if ((iface->if_type == IFT_CARP && + iface->linkstate == LINK_STATE_DOWN) || + !(iface->depend_ok)) { /* carp interfaces in state backup are * announced with high metric for faster * failover. */ |