On Wed, Jun 01, 2011 at 10:46:29PM +0200, Martin Pelikan wrote: > Hi! > > So my last attempt wasn't met with much appreciation, so I'll slow down: > > - when I add a vlan(4), vether(4) or something, my ospf6d dies > - I don't like that > - therefore, with new release comes new diff > - this time I tried to make it as small as possible, in separate parts > > It doesn't fix departures (if_leave_group jumps on a non-existing > interface), but I guess people don't remove interfaces that often. > I will rewrite and post the rest of the big one if someone shows > interest in this bit. >
The diff is somewhat wrong and confused me for a few days until my brain got kickstarted with some good scotch. The problem is not IFADD/IFDELETE but IFADDRADD and IFADDRDEL. The ospf engine should only have interfaces that are configured in their interface list (aka cflags & F_IFACE_CONFIGURED) the other interfaces do not matter at all and only the parent needs to track them. So here is a what I suppose as a fix for this problem. This seems to work acording to my quick testing. -- :wq Claudio Index: kroute.c =================================================================== RCS file: /cvs/src/usr.sbin/ospf6d/kroute.c,v retrieving revision 1.33 diff -u -p -r1.33 kroute.c --- kroute.c 7 Jul 2011 03:56:59 -0000 1.33 +++ kroute.c 7 Jul 2011 04:52:53 -0000 @@ -812,10 +812,13 @@ if_change(u_short ifindex, int flags, st if (wasvalid == isvalid) return; /* nothing changed wrt validity */ - /* notify ospfe about interface link state */ - if (iface->cflags & F_IFACE_CONFIGURED) + /* inform engine and rde about state change if interface is used */ + if (iface->cflags & F_IFACE_CONFIGURED) { main_imsg_compose_ospfe(IMSG_IFINFO, 0, iface, sizeof(struct iface)); + main_imsg_compose_rde(IMSG_IFINFO, 0, iface, + sizeof(struct iface)); + } /* update redistribute list */ RB_FOREACH(kr, kroute_tree, &krt) { @@ -899,12 +902,15 @@ if_newaddr(u_short ifindex, struct socka } TAILQ_INSERT_TAIL(&iface->ifa_list, ia, entry); - ifc.addr = ia->addr; - ifc.dstbrd = ia->dstbrd; - ifc.prefixlen = ia->prefixlen; - ifc.ifindex = ifindex; - main_imsg_compose_ospfe(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc)); - main_imsg_compose_rde(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc)); + /* inform engine and rde if interface is used */ + if (iface->cflags & F_IFACE_CONFIGURED) { + ifc.addr = ia->addr; + ifc.dstbrd = ia->dstbrd; + ifc.prefixlen = ia->prefixlen; + ifc.ifindex = ifindex; + main_imsg_compose_ospfe(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc)); + main_imsg_compose_rde(IMSG_IFADDRNEW, 0, &ifc, sizeof(ifc)); + } } void @@ -944,14 +950,17 @@ if_deladdr(u_short ifindex, struct socka log_debug("if_deladdr: ifindex %u, addr %s/%d", ifindex, log_in6addr(&ia->addr), ia->prefixlen); TAILQ_REMOVE(&iface->ifa_list, ia, entry); - ifc.addr = ia->addr; - ifc.dstbrd = ia->dstbrd; - ifc.prefixlen = ia->prefixlen; - ifc.ifindex = ifindex; - main_imsg_compose_ospfe(IMSG_IFADDRDEL, 0, &ifc, - sizeof(ifc)); - main_imsg_compose_rde(IMSG_IFADDRDEL, 0, &ifc, - sizeof(ifc)); + /* inform engine and rde if interface is used */ + if (iface->cflags & F_IFACE_CONFIGURED) { + ifc.addr = ia->addr; + ifc.dstbrd = ia->dstbrd; + ifc.prefixlen = ia->prefixlen; + ifc.ifindex = ifindex; + main_imsg_compose_ospfe(IMSG_IFADDRDEL, 0, &ifc, + sizeof(ifc)); + main_imsg_compose_rde(IMSG_IFADDRDEL, 0, &ifc, + sizeof(ifc)); + } free(ia); return; }