Re: OpenOSPF6d does not send LSAs for passive interfaces
On Mon, Jul 04, 2011 at 06:13:29AM +0200, Claudio Jeker wrote: > On Tue, Jun 28, 2011 at 04:42:09PM +1000, David Gwynne wrote: > > this works great for me. i'll pressure claudio@ to have a look at it over > > the > > next week or two. > > > > I just commited this (a modified version of the diff by Patrick Coleman) > and will now look at the interface add problem (and Martin Pelikan's > diff which needs some changes as well). > I refactored the code a bit since I don't like that ospfe is forwarding link state changes to the rde. The rde should get the change directly from the parent and the ospfe only needs to send the state changes of the FSM to the RDE. IMO this is more clear. Maybe I should create a new IMSG type for the state change but that is just the icing on the cake. please test -- :wq Claudio ? obj Index: interface.c === RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v retrieving revision 1.18 diff -u -p -r1.18 interface.c --- interface.c 4 Jul 2011 04:34:14 - 1.18 +++ interface.c 7 Jul 2011 05:05:01 - @@ -145,12 +145,12 @@ if_fsm(struct iface *iface, enum iface_e if (iface->state != old_state) { orig_rtr_lsa(iface); orig_link_lsa(iface); + + /* state change inform RDE */ + ospfe_imsg_compose_rde(IMSG_IFINFO, iface->self->peerid, 0, + &iface->state, sizeof(iface->state)); } - /* Inform RDE in any case since the link state may have changed */ - ospfe_imsg_compose_rde(IMSG_IFINFO, - iface->self->peerid, 0, iface, sizeof(struct iface)); - if (old_state & (IF_STA_MULTI | IF_STA_POINTTOPOINT) && (iface->state & (IF_STA_MULTI | IF_STA_POINTTOPOINT)) == 0) ospfe_demote_iface(iface, 0); 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.c7 Jul 2011 03:56:59 - 1.33 +++ kroute.c7 Jul 2011 05:05:01 - @@ -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) { Index: ospfe.c === RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v retrieving revision 1.36 diff -u -p -r1.36 ospfe.c --- ospfe.c 7 Jul 2011 04:13:23 - 1.36 +++ ospfe.c 7 Jul 2011 05:05:01 - @@ -286,9 +286,10 @@ ospfe_dispatch_main(int fd, short event, iface = if_find(ifp->ifindex); if (iface == NULL) fatalx("interface lost in ospfe"); - iface->flags = ifp->flags; - iface->linkstate = ifp->linkstate; + if_update(iface, ifp->mtu, ifp->flags, ifp->media_type, + ifp->linkstate, ifp->baudrate); + if ((iface->flags & IFF_UP) && LINK_STATE_IS_UP(iface->linkstate)) { if_fsm(iface, IF_EVT_UP); Index: rde.c === RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v retrieving revision 1.57 diff -u -p -r1.57 rde.c --- rde.c 7 Jul 2011 04:37:56 - 1.57 +++ rde.c 7 Jul 2011 05:05:01 - @@ -252,7 +252,6 @@ rde_dispatch_imsg(int fd, short event, v struct lsa *lsa; struct area *area; struct vertex *v; - struct iface*iface, *ifp; char*buf; ssize_t n; time_t now; @@ -578,32 +577,16 @@ rde_dispatch_imsg(int fd, short event, v break; case IMSG_IFINFO: if (imsg.hdr.len != IMSG_HEADER_SIZE + - sizeof(struct iface)) + sizeof(int)) fatalx("IFINFO imsg with wrong len"); - ifp = imsg.data; - - iface = if_find(ifp->ifindex); - if (iface == NULL) - fatalx("interface lost in rde"); - - /* -
Re: OpenOSPF6d does not send LSAs for passive interfaces
On Tue, Jun 28, 2011 at 04:42:09PM +1000, David Gwynne wrote: > this works great for me. i'll pressure claudio@ to have a look at it over the > next week or two. > I just commited this (a modified version of the diff by Patrick Coleman) and will now look at the interface add problem (and Martin Pelikan's diff which needs some changes as well). -- :wq Claudio
Re: OpenOSPF6d does not send LSAs for passive interfaces
this works great for me. i'll pressure claudio@ to have a look at it over the next week or two. cheers, dlg On 25/04/2011, at 8:44 PM, Patrick Coleman wrote: > On Wed, Jan 5, 2011 at 8:32 PM, Jan Johansson wrote: >> >> So I found a bug here. >> >> Your mk2 patch (didn't try the mk1) does not advertise gif >> tunnels this works with the unpatched binary. > > Apologies for the delay on this one - finally got around to setting up > a test environment today. See [1] for an updated patch. > > I've reworked the logic a bit (basically, it wasn't correctly dealing > with interfaces with unknown physical link states before). I've tested > the patch and it works with CARP and loopback interfaces, and gif > interfaces should work the same. > > Comments appreciated. > > Cheers, > > Patrick > > 1. Also uploaded to > http://patrick.ld.net.au/ospf6d-fix-passive-interfaces-mk3.patch > > Index: interface.c > === > RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v > retrieving revision 1.15 > diff -u -p -r1.15 interface.c > --- interface.c 20 Sep 2009 20:45:06 - 1.15 > +++ interface.c 25 Apr 2011 10:35:00 - > @@ -145,11 +145,15 @@ if_fsm(struct iface *iface, enum iface_e > if (iface->state != old_state) { > orig_rtr_lsa(iface); > orig_link_lsa(iface); > - > - /* state change inform RDE */ > - ospfe_imsg_compose_rde(IMSG_IFINFO, > - iface->self->peerid, 0, iface, sizeof(struct iface)); > } > + > + /* > + * Send interface update to RDE regardless of whether state changes - a > + * passive interface will remain in the DOWN state but may need to have > + * prefix LSAs sent regardless. > + */ > + ospfe_imsg_compose_rde(IMSG_IFINFO, > + iface->self->peerid, 0, iface, sizeof(struct iface)); > > if (old_state & (IF_STA_MULTI | IF_STA_POINTTOPOINT) && > (iface->state & (IF_STA_MULTI | IF_STA_POINTTOPOINT)) == 0) > Index: rde.c > === > RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v > retrieving revision 1.50 > diff -u -p -r1.50 rde.c > --- rde.c 22 Aug 2010 20:55:10 - 1.50 > +++ rde.c 25 Apr 2011 10:35:03 - > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -587,11 +588,20 @@ rde_dispatch_imsg(int fd, short event, v > iface = if_find(ifp->ifindex); > if (iface == NULL) > fatalx("interface lost in rde"); > - iface->flags = ifp->flags; > - iface->linkstate = ifp->linkstate; > iface->nh_reachable = ifp->nh_reachable; > - if (iface->state != ifp->state) { > + > + /* > + * Resend LSAs if interface flags change - carp/passive > interfaces > + * can come up and down without changing state. > + */ > + if ((iface->state != ifp->state) || > + (iface->linkstate != ifp->linkstate) || > + (iface->flags != ifp->flags)) { > + > iface->state = ifp->state; > + iface->flags = ifp->flags; > + iface->linkstate = ifp->linkstate; > + > area = area_find(rdeconf, iface->area_id); > if (!area) > fatalx("interface lost area"); > @@ -1459,8 +1469,43 @@ orig_intra_lsa_rtr(struct area *area, st > > numprefix = 0; > LIST_FOREACH(iface, &area->iface_list, entry) { > - if (iface->state & IF_STA_DOWN) > + /* > + * Do not send a LSA for interfaces that: > + * - are down (kernel flags) > + * > + * - are not carp and have a physical link state of down, > excluding > + *unknown interfaces: if an interface has a link state of > unknown > + *then the driver supplies no information about the > physical link > + *state > + * > + * - are carp and have a physical link state of down or > unknown: carp > + *uses the DOWN state for the backup interface, and the > UNKNOWN link > + *state if something broke > + * > + * - are in the down state, and are not [carp or marked as > passive]: > + *carp and passive interfaces will always have an OSPF > state of > + *DOWN. > + * > + * Note we recheck interface flags and link state here in > addition to > + * if_act_* as passive interfaces can change link state while > remaining > +
Re: OpenOSPF6d does not send LSAs for passive interfaces
On Wed, Jan 5, 2011 at 8:32 PM, Jan Johansson wrote: > > So I found a bug here. > > Your mk2 patch (didn't try the mk1) does not advertise gif > tunnels this works with the unpatched binary. Apologies for the delay on this one - finally got around to setting up a test environment today. See [1] for an updated patch. I've reworked the logic a bit (basically, it wasn't correctly dealing with interfaces with unknown physical link states before). I've tested the patch and it works with CARP and loopback interfaces, and gif interfaces should work the same. Comments appreciated. Cheers, Patrick 1. Also uploaded to http://patrick.ld.net.au/ospf6d-fix-passive-interfaces-mk3.patch Index: interface.c === RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v retrieving revision 1.15 diff -u -p -r1.15 interface.c --- interface.c 20 Sep 2009 20:45:06 - 1.15 +++ interface.c 25 Apr 2011 10:35:00 - @@ -145,11 +145,15 @@ if_fsm(struct iface *iface, enum iface_e if (iface->state != old_state) { orig_rtr_lsa(iface); orig_link_lsa(iface); - - /* state change inform RDE */ - ospfe_imsg_compose_rde(IMSG_IFINFO, - iface->self->peerid, 0, iface, sizeof(struct iface)); } + + /* +* Send interface update to RDE regardless of whether state changes - a +* passive interface will remain in the DOWN state but may need to have +* prefix LSAs sent regardless. +*/ + ospfe_imsg_compose_rde(IMSG_IFINFO, + iface->self->peerid, 0, iface, sizeof(struct iface)); if (old_state & (IF_STA_MULTI | IF_STA_POINTTOPOINT) && (iface->state & (IF_STA_MULTI | IF_STA_POINTTOPOINT)) == 0) Index: rde.c === RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v retrieving revision 1.50 diff -u -p -r1.50 rde.c --- rde.c 22 Aug 2010 20:55:10 - 1.50 +++ rde.c 25 Apr 2011 10:35:03 - @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -587,11 +588,20 @@ rde_dispatch_imsg(int fd, short event, v iface = if_find(ifp->ifindex); if (iface == NULL) fatalx("interface lost in rde"); - iface->flags = ifp->flags; - iface->linkstate = ifp->linkstate; iface->nh_reachable = ifp->nh_reachable; - if (iface->state != ifp->state) { + + /* +* Resend LSAs if interface flags change - carp/passive interfaces +* can come up and down without changing state. +*/ + if ((iface->state != ifp->state) || + (iface->linkstate != ifp->linkstate) || + (iface->flags != ifp->flags)) { + iface->state = ifp->state; + iface->flags = ifp->flags; + iface->linkstate = ifp->linkstate; + area = area_find(rdeconf, iface->area_id); if (!area) fatalx("interface lost area"); @@ -1459,8 +1469,43 @@ orig_intra_lsa_rtr(struct area *area, st numprefix = 0; LIST_FOREACH(iface, &area->iface_list, entry) { - if (iface->state & IF_STA_DOWN) + /* +* Do not send a LSA for interfaces that: +* - are down (kernel flags) +* +* - are not carp and have a physical link state of down, excluding +*unknown interfaces: if an interface has a link state of unknown +*then the driver supplies no information about the physical link +*state +* +* - are carp and have a physical link state of down or unknown: carp +*uses the DOWN state for the backup interface, and the UNKNOWN link +*state if something broke +* +* - are in the down state, and are not [carp or marked as passive]: +*carp and passive interfaces will always have an OSPF state of +*DOWN. +* +* Note we recheck interface flags and link state here in addition to +* if_act_* as passive interfaces can change link state while remaining +* in IF_STA_DOWN. +*/ + if (!(iface->flags & IFF_UP) || + ((iface->media_type != IFT_CARP) && + !(LINK_STATE_IS_UP(iface->linkstate)) && + (iface->linkstate != LINK_STATE_UNKNOWN)) || +
Re: OpenOSPF6d does not send LSAs for passive interfaces
Hello! Just a FYI. I have now upgraded our five IPv6 routers with the first patch Patrick sent out. We are seeing some problems with the fib and kernel routing getting out of sync when rebooting the core routers. This is fixed by doing "down" and "up" on the gif tunnel interface. We see this as good enough for our v6 network. I will be happy to test any patches. Jan J
Re: OpenOSPF6d does not send LSAs for passive interfaces
Patrick Coleman wrote: > Ok, the following should fix this. It's a little more involved; here's > what's new: > > http://patrick.ld.net.au/ospf6d-fix-passive-interfaces-mk2.patch So I found a bug here. Your mk2 patch (didn't try the mk1) does not advertise gif tunnels this works with the unpatched binary. Config: router-id AAA.BBB.154.120 # Temporary until area routers are doing OSPF. redistribute static area 0.0.0.0 { interface bge0 # %%INTERFACES%% interface gif10 interface gif12 interface gif14 } Interface: gif10: flags=8051 mtu 1280 priority: 0 groups: gif physical address inet AAA.BBB.154.120 --> AAA.BBB.154.93 inet6 2001:dead:5:ffa::1 -> prefixlen 64 inet6 fe80::206:5bff:feef:8128%gif10 -> prefixlen 64 scopeid 0x5
Re: OpenOSPF6d does not send LSAs for passive interfaces
Patrick Coleman wrote: > Ok, the following should fix this. It's a little more involved; here's > what's new: > - Avoid sending LSAs if the link state is down (to avoid > double-advertising CARP interfaces). OSPFd does this a little more > elegantly using metrics[1], but I wasn't able to get that to work, > perhaps I'm not understanding the protocol. Suggestions appreciated. > - Don't send LSAs if the interface is down (ifconfig carp1 down), > because that's silly > - Make the OSPF engine update the RDE about interface changes even > when the interface state does not change, so the RDE is informed when > a passive interface's link state changes (so we can then make a > decision using that data) > - Resend intra-area LSAs in the RDE when interface flags change, not > just interface state (avoids a race condition where LSAs get sent > before the OSPF engine updates the RDE with new linkstate data) Initial testing looks good. With your first patch: Cisco# show ipv6 route 2001:dead:5:7357::13 IPv6 Routing Table - 23 entries Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP U - Per-user Static route I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 O 2001:DEAD:5:7357::/64 [110/10] via FE80::214:22FF:FE73:466B, GigabitEthernet2/1 via FE80::214:22FF:FE73:44A3, GigabitEthernet2/1 Now: Cisco# show ipv6 route 2001:dead:5:7357::13 IPv6 Routing Table - 23 entries Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP U - Per-user Static route I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 O 2001:DEAD:5:7357::/64 [110/10] via FE80::214:22FF:FE73:466B, GigabitEthernet2/1 And then lets shift the CARP: Cisco# show ipv6 route 2001:dead:5:7357::13 IPv6 Routing Table - 23 entries Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP U - Per-user Static route I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 O 2001:DEAD:5:7357::/64 [110/10] via FE80::214:22FF:FE73:44A3, GigabitEthernet2/1 I will do some more testing.
Re: OpenOSPF6d does not send LSAs for passive interfaces
On Mon, Jan 3, 2011 at 5:27 PM, Jan Johansson wrote: > If an CARP interface is in BACKUP state the route is still > advertised which leads to assymetric routing. Ok, the following should fix this. It's a little more involved; here's what's new: - Avoid sending LSAs if the link state is down (to avoid double-advertising CARP interfaces). OSPFd does this a little more elegantly using metrics[1], but I wasn't able to get that to work, perhaps I'm not understanding the protocol. Suggestions appreciated. - Don't send LSAs if the interface is down (ifconfig carp1 down), because that's silly - Make the OSPF engine update the RDE about interface changes even when the interface state does not change, so the RDE is informed when a passive interface's link state changes (so we can then make a decision using that data) - Resend intra-area LSAs in the RDE when interface flags change, not just interface state (avoids a race condition where LSAs get sent before the OSPF engine updates the RDE with new linkstate data) Cheers, Patrick [1] See ospfe.c:851 through ospfe.c:883 in ospfd. -- http://www.labyrinthdata.net.au - WA Backup, Web and VPS Hosting http://patrick.ld.net.au/ospf6d-fix-passive-interfaces-mk2.patch Index: interface.c === RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v retrieving revision 1.15 diff -u -p -r1.15 interface.c --- interface.c 20 Sep 2009 20:45:06 - 1.15 +++ interface.c 4 Jan 2011 08:44:10 - @@ -145,11 +145,15 @@ if_fsm(struct iface *iface, enum iface_e if (iface->state != old_state) { orig_rtr_lsa(iface); orig_link_lsa(iface); - - /* state change inform RDE */ - ospfe_imsg_compose_rde(IMSG_IFINFO, - iface->self->peerid, 0, iface, sizeof(struct iface)); } + + /* +* Send interface update to RDE regardless of whether state changes - a +* passive interface will remain in the DOWN state but may need to have +* prefix LSAs sent regardless. +*/ + ospfe_imsg_compose_rde(IMSG_IFINFO, + iface->self->peerid, 0, iface, sizeof(struct iface)); if (old_state & (IF_STA_MULTI | IF_STA_POINTTOPOINT) && (iface->state & (IF_STA_MULTI | IF_STA_POINTTOPOINT)) == 0) Index: rde.c === RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v retrieving revision 1.50 diff -u -p -r1.50 rde.c --- rde.c 22 Aug 2010 20:55:10 - 1.50 +++ rde.c 4 Jan 2011 08:44:11 - @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -587,11 +588,17 @@ rde_dispatch_imsg(int fd, short event, v iface = if_find(ifp->ifindex); if (iface == NULL) fatalx("interface lost in rde"); - iface->flags = ifp->flags; - iface->linkstate = ifp->linkstate; iface->nh_reachable = ifp->nh_reachable; - if (iface->state != ifp->state) { + + /* Resend LSAs if interface flags change */ + if ((iface->state != ifp->state) || + (iface->linkstate != ifp->linkstate) || + (iface->flags != ifp->flags)) { + iface->state = ifp->state; + iface->flags = ifp->flags; + iface->linkstate = ifp->linkstate; + area = area_find(rdeconf, iface->area_id); if (!area) fatalx("interface lost area"); @@ -1459,8 +1466,27 @@ orig_intra_lsa_rtr(struct area *area, st numprefix = 0; LIST_FOREACH(iface, &area->iface_list, entry) { - if (iface->state & IF_STA_DOWN) + /* +* do not send a LSA for interfaces that: +* - have a link state that is not up, or +* - are down (kernel flags), or +* - are in the down state, and are not [carp or marked as passive], or +* - are unknown and are carp +* +* This will not advertise backup carp interfaces (which have a link +* state of down). +*/ + if (!(LINK_STATE_IS_UP(iface->linkstate)) || + !(iface->flags & IFF_UP) || + ((iface->state & IF_STA_DOWN) && + !((iface->media_type == IFT_CARP) || + (iface->cflags & F_IFACE_PASSIVE))) || + ((iface->linkstate == LINK_STATE_UNKNOWN) && + (iface->media_type == IFT_CARP))) { + log_debug("orig_intra_lsa_rtr: area %s, interface %s: not including" + " in LSA", inet_ntoa(area->id), iface->name); continue; + } /* Broadcast links with adjacencies are handled * by orig_intra_lsa_net(), ignore. */
Re: OpenOSPF6d does not send LSAs for passive interfaces
Patrick Coleman wrote: > I've found that if an interface is declared passive (or is a > CARP interface) in ospf6d.conf, ospf6d will not send LSAs for > that interface, and any associated prefixes will not be > advertised. This is contrary to the behaviour in ospfd and what > I would expect. Hello! This partially fixes my problem as described in http://marc.info/?l=openbsd-misc&m=128931276307517&w=2 If an CARP interface is in BACKUP state the route is still advertised which leads to assymetric routing. Jan J
OpenOSPF6d does not send LSAs for passive interfaces
Hi, I've found that if an interface is declared passive (or is a CARP interface) in ospf6d.conf, ospf6d will not send LSAs for that interface, and any associated prefixes will not be advertised. This is contrary to the behaviour in ospfd and what I would expect. The problem appears to be that orig_intra_lsa_rtr in rde.c assumes that if an interface is in the down state we should not include that interface in intra-area LSAs, which is incorrect - a passive interface will be in the down state by definition and we still want to advertise the attached prefix. The patch below fixes the issue for me. I'd appreciate any comments, as I'd like to deploy this in production. Cheers, Patrick -- http://www.labyrinthdata.net.au - WA Backup, Web and VPS Hosting Also up at http://patrick.ld.net.au/ospf6d-fix-passive-interfaces.patch cvs server: Diffing . Index: rde.c === RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v retrieving revision 1.50 diff -u -p -r1.50 rde.c --- rde.c 22 Aug 2010 20:55:10 - 1.50 +++ rde.c 3 Jan 2011 02:23:23 - @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,9 @@ orig_intra_lsa_rtr(struct area *area, st numprefix = 0; LIST_FOREACH(iface, &area->iface_list, entry) { - if (iface->state & IF_STA_DOWN) + if ((iface->state & IF_STA_DOWN) && + !((iface->media_type == IFT_CARP) || + (iface->cflags & F_IFACE_PASSIVE))) continue; /* Broadcast links with adjacencies are handled