Hi, ospfd sends LSAs with MAX_METRIC for carp interfaces in state backup. This does the same for ospf6d.
While here also document how ospf6d treats carp interfaces. OK? Remi Index: ospf6d.conf.5 =================================================================== RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.conf.5,v retrieving revision 1.12 diff -u -p -r1.12 ospf6d.conf.5 --- ospf6d.conf.5 14 Feb 2016 20:05:55 -0000 1.12 +++ ospf6d.conf.5 17 Apr 2018 21:01:55 -0000 @@ -273,9 +273,15 @@ The default value is 10; valid range is .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. Index: rde.c =================================================================== RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v retrieving revision 1.74 diff -u -p -r1.74 rde.c --- rde.c 10 Jun 2018 14:39:38 -0000 1.74 +++ rde.c 11 Jun 2018 14:09:06 -0000 @@ -1479,9 +1482,18 @@ orig_intra_lsa_rtr(struct area *area, st 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 */ @@ -1517,6 +1529,13 @@ orig_intra_lsa_rtr(struct area *area, st 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); @@ -1526,9 +1545,9 @@ orig_intra_lsa_rtr(struct area *area, st 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,