Hi,
successfully tested. I like the feature!
Some (mostly cosmetic) comments inline.
Index: ospfe.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v
retrieving revision 1.51
diff -u -p -r1.51 ospfe.c
--- ospfe.c 12 Aug 2017 16:27:50 -0000 1.51
+++ ospfe.c 11 Jul 2018 11:29:44 -0000
@@ -295,9 +295,27 @@ ospfe_dispatch_main(int fd, short event,
fatalx("IFINFO imsg with wrong len");
ifp = imsg.data;
+ LIST_FOREACH(area, &oeconf->area_list, entry) {
+ LIST_FOREACH(i, &area->iface_list, entry) {
+ if (strcmp(i->dependon,
+ ifp->name) == 0) {
+ log_warnx("interface %s"
+ " changed state, %s"
+ " depends on it",
+ ifp->name, i->name);
+ i->depend_ok =
+ ifstate_is_up(ifp);
+ if (ifstate_is_up(i))
+ orig_rtr_lsa(i);
+ }
+ }
+ }
+
+ if (!(ifp->cflags & F_IFACE_CONFIGURED))
+ break;
iface = if_find(ifp->ifindex);
if (iface == NULL)
- fatalx("interface lost in ospfe");
+ break;
You added the F_IFACE_CONFIGURED check in your second version of the diff,
because I found a bug. Is it still necessary to remove fatalx("interface lost in
ospfe") ?
wasvalid = (iface->flags & IFF_UP) &&
LINK_STATE_IS_UP(iface->linkstate);
@@ -834,7 +852,11 @@ orig_rtr_lsa_area(struct area *area)
log_debug("orig_rtr_lsa: point-to-point, "
"interface %s", iface->name);
rtr_link.type = LINK_TYPE_POINTTOPOINT;
- rtr_link.metric = htons(iface->metric);
+ if (iface->dependon[0] != '\0' &&
+ iface->depend_ok ==0)
Whitespace before 0
+ rtr_link.metric = MAX_METRIC;
+ else
+ rtr_link.metric = htons(iface->metric);
rtr_link.iface_id = htonl(iface->ifindex);
rtr_link.nbr_iface_id = htonl(nbr->iface_id);
rtr_link.nbr_rtr_id = nbr->id.s_addr;
@@ -859,7 +881,12 @@ orig_rtr_lsa_area(struct area *area)
"interface %s", iface->name);
rtr_link.type = LINK_TYPE_TRANSIT_NET;
- rtr_link.metric = htons(iface->metric);
+ if (iface->dependon[0] != '\0' &&
+ iface->depend_ok ==0)
Whitespace before 0
+ rtr_link.metric = MAX_METRIC;
+ else
+ rtr_link.metric =
+ htons(iface->metric);
rtr_link.iface_id =
htonl(iface->ifindex);
rtr_link.nbr_iface_id =
htonl(iface->dr->iface_id);
rtr_link.nbr_rtr_id =
iface->dr->id.s_addr;
Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v
retrieving revision 1.76
diff -u -p -r1.76 rde.c
--- rde.c 12 Jun 2018 20:12:36 -0000 1.76
+++ rde.c 10 Jul 2018 09:52:42 -0000
@@ -706,6 +706,25 @@ rde_dispatch_parent(int fd, short event,
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;
+ }
unnecessary curly braces