[quagga-dev 1412] Re: Dynamic Reconfiguration of Quagga (OSPF)
paul at clubi.ie
Sat Aug 14 06:27:15 BST 2004
On Sat, 14 Aug 2004, Matt Brown wrote:
> So how hard of a problem is this to solve?
I'm just looking at it now.
> Does quagga get enough information from the kernel to detect that
> the interfaces name has changed and react appropriately?
Well, the information is there but, annoyingly, the name change is
implied. Nice thing about rtnetlink was, I thought, that everything
was explicit, no hidden rules to have to worry about or bite you in
the rear-end. But apparently not so.. rtnetlink hack #1.
> The thing that confuses me in the output after PCMCIA has been
> restarted (show below) is that quagga thinks OSPF is enabled but
> not running on eth0, and that it is not even enabled on shr-uni. If
> you look at the ospfd configuration file found at
> you will see that there is a stanza for shr-uni but not for eth0.
> So if quagga was going to get confused I would have thought it
> would be have been the opposite way around.
Ah well, no, it does make sense. Before the restart, everything is
fine. Upon the restart, we get eth0, create ifp, we get the shr-uni
newlink and create the ifp for that. When we get the newlink/link-up
message we lookup by name and get shr-uni and set it up, when we get
the newaddr message we lookup by index, get eth0 and add the address
there. so you get eth0, down with address and shr-uni, up but no
address. The OSPF enabling is done by searching for addresses, so we
enable eth0 (but its down).
> Thanks very much for all your help so far in debugging this problem.
Try the attached patch against 0.96.5. It's a quick hack, only
compile tested and I'm tired so it probably wont work.. but if it
runs i'd be interested in same kernel<->zebra and zebra<->ospfd debug
output as well as zebra and ospfd interface command output
before/after each state change for the restart and rename case.
1. for real fix, i'll make rename explicit in the Zserv protocol.
Paul Jakma paul at clubi.ie paul at jakma.org Key ID: 64A2FF6A
A free society is one where it is safe to be unpopular.
-- Adlai Stevenson
-------------- next part --------------
RCS file: /var/cvsroot/quagga/zebra/rt_netlink.c,v
retrieving revision 1.20
diff -u -r1.20 rt_netlink.c
--- zebra/rt_netlink.c 6 Aug 2004 08:41:56 -0000 1.20
+++ zebra/rt_netlink.c 14 Aug 2004 05:23:37 -0000
@@ -899,13 +899,17 @@
/* Add interface. */
if (h->nlmsg_type == RTM_NEWLINK)
- ifp = if_lookup_by_name (name);
- if (ifp == NULL || !CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
+ ifp = if_lookup_by_index (ifi->ifi_index);
+ if (ifp == NULL || !CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)
+ || (strncmp (ifp->name, name, IFNAMSIZ) != 0))
if (ifp == NULL)
ifp = if_get_by_name (name);
+ strncpy (ifp->name, name, IFNAMSIZ);
+ ifp->name[INTERFACE_NAMSIZ] = '\0';
ifp->ifindex = ifi->ifi_index;
ifp->flags = ifi->ifi_flags & 0x0000fffff;
ifp->mtu6 = ifp->mtu = *(int *) RTA_DATA (tb[IFLA_MTU]);
RCS file: /var/cvsroot/quagga/lib/zclient.c,v
retrieving revision 1.10
diff -u -r1.10 zclient.c
--- lib/zclient.c 11 Jun 2004 11:27:03 -0000 1.10
+++ lib/zclient.c 14 Aug 2004 05:23:38 -0000
@@ -513,20 +513,31 @@
struct interface *ifp;
+ int ifindex;
/* Read interface name. */
stream_get (ifname_tmp, s, INTERFACE_NAMSIZ);
- /* Lookup this by interface name. */
- ifp = if_lookup_by_name (ifname_tmp);
+ /* Read interface's index. */
+ ifindex = stream_getl (s);
+ /* Lookup this by interface index. */
+ ifp = if_lookup_by_index (ifindex);
/* If such interface does not exist, make new one. */
if (! ifp)
ifp = if_create (ifname_tmp, INTERFACE_NAMSIZ);
- /* Read interface's index. */
- ifp->ifindex = stream_getl (s);
+ if (strncmp (ifp->name, ifname_tmp, INTERFACE_NAMSIZ) != 0)
+ /* interface name update */
+ strncpy (ifp->name, ifname_tmp, IFNAMSIZ);
+ ifp->name[INTERFACE_NAMSIZ] = '\0';
+ /* update ifindex */
+ ifp->ifindex = ifindex;
/* Read interface's value. */
ifp->status = stream_getc (s);
ifp->flags = stream_getl (s);
More information about the Quagga-dev