diff options
author | remi <remi@cvs.openbsd.org> | 2018-06-12 20:12:37 +0000 |
---|---|---|
committer | remi <remi@cvs.openbsd.org> | 2018-06-12 20:12:37 +0000 |
commit | 80e3646371df6d43058af44d6691142fbe053cea (patch) | |
tree | 4ac991af0c1ead3104094ccf0746d55a7f9e618d /usr.sbin/ospf6d | |
parent | 31ca9ad3346d59918a761a351eaca78a63a0a3e0 (diff) |
Send LSAs with MAX_METRIC for carp interfaces in state backup.
This is similar to what ospfd does.
ok jca@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.conf.5 | 10 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 26 |
2 files changed, 29 insertions, 7 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.conf.5 b/usr.sbin/ospf6d/ospf6d.conf.5 index 598aae206f6..137fc7b8b1e 100644 --- a/usr.sbin/ospf6d/ospf6d.conf.5 +++ b/usr.sbin/ospf6d/ospf6d.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ospf6d.conf.5,v 1.12 2016/02/14 20:05:55 reyk Exp $ +.\" $OpenBSD: ospf6d.conf.5,v 1.13 2018/06/12 20:12:36 remi Exp $ .\" .\" Copyright (c) 2005 Esben Norby <norby@openbsd.org> .\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -17,7 +17,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: February 14 2016 $ +.Dd $Mdocdate: June 12 2018 $ .Dt OSPF6D.CONF 5 .Os .Sh NAME @@ -273,9 +273,15 @@ The default value is 10; valid range is 1\-65535 seconds. .It Ic metric Ar cost Set the interface metric a.k.a. cost. The default value is 10; valid range is 1\-65535. +A metric of 65535 is used for +.Xr carp 4 +interfaces with status backup. .It Ic passive Prevent transmission and reception of OSPF packets on this interface. The specified interface will be announced as a stub network. +Passive mode is enforced for +.Xr carp 4 +interfaces. .It Ic retransmit-interval Ar seconds Set retransmit interval. The default value is 5 seconds; valid range is 5\-3600 seconds. diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index 4acca43e9b7..68317d54661 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.75 2018/06/12 20:02:13 remi Exp $ */ +/* $OpenBSD: rde.c,v 1.76 2018/06/12 20:12:36 remi Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -1482,9 +1482,18 @@ orig_intra_lsa_rtr(struct area *area, struct vertex *old) numprefix = 0; LIST_FOREACH(iface, &area->iface_list, entry) { if (!((iface->flags & IFF_UP) && - LINK_STATE_IS_UP(iface->linkstate))) - /* interface or link state down */ + LINK_STATE_IS_UP(iface->linkstate)) && + !(iface->if_type == IFT_CARP)) + /* interface or link state down + * and not a carp interface */ continue; + + if (iface->if_type == IFT_CARP && + (iface->linkstate == LINK_STATE_UNKNOWN || + iface->linkstate == LINK_STATE_INVALID)) + /* carp interface in state invalid or unknown */ + continue; + if ((iface->state & IF_STA_DOWN) && !(iface->cflags & F_IFACE_PASSIVE)) /* passive interfaces stay in state DOWN */ @@ -1520,6 +1529,13 @@ 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) { + /* carp interfaces in state backup are + * announced with high metric for faster + * failover. */ + lsa_prefix->prefixlen = ia->prefixlen; + lsa_prefix->metric = MAX_METRIC; } else { lsa_prefix->prefixlen = ia->prefixlen; lsa_prefix->metric = htons(iface->metric); @@ -1529,9 +1545,9 @@ orig_intra_lsa_rtr(struct area *area, struct vertex *old) lsa_prefix->options |= OSPF_PREFIX_LA; log_debug("orig_intra_lsa_rtr: area %s, interface %s: " - "%s/%d", inet_ntoa(area->id), + "%s/%d, metric %d", inet_ntoa(area->id), iface->name, log_in6addr(&ia->addr), - lsa_prefix->prefixlen); + lsa_prefix->prefixlen, ntohs(lsa_prefix->metric)); prefix = (struct in6_addr *)(lsa_prefix + 1); inet6applymask(prefix, &ia->addr, |