[Babel-users] no via line in zebra/quagga routes

Juliusz Chroboczek jch at pps.jussieu.fr
Thu Feb 9 09:09:05 UTC 2012


>> Okay, I'm starting to understand.  IPv6 works fine, it's only IPv4
>> that's broken.  (Why don't we all switch to IPv6 and be done with it?)

>> Apparently, either quagga doesn't like an IPv4 route to have both
>> a next-hop address and an ifindex, or we're doing something wrong.

> but nexthop+address nexthops are also supported in ZAPI,

I was unable to get it to work.  The attached patch makes babel/Quagga
work with IPv4, but obviously only if the interfaces' prefixes are
correct (i.e. not in a mesh network).

> ospfd should use a similar call for route management, it can be used
> as an example.

Perhaps I'm confused, but to me it looks like ospf_zebra_add sets only
one or the other (see ospf_zebra.c line 374).

-- Juliusz

diff --git a/babeld/kernel_zebra.c b/babeld/kernel_zebra.c
index f52122d..3e31ee9 100644
--- a/babeld/kernel_zebra.c
+++ b/babeld/kernel_zebra.c
@@ -167,7 +167,6 @@ kernel_route_add_v4(const unsigned char *pref, unsigned short plen,
                     const unsigned char *newgate, int newifindex,
                     unsigned int newmetric)
 {
-    unsigned int tmp_ifindex = ifindex; /* (for typing) */
     struct zapi_ipv4 api;               /* quagga's communication system */
     struct prefix_ipv4 quagga_prefix;   /* quagga's prefix */
     struct in_addr babel_prefix_addr;   /* babeld's prefix addr */
@@ -190,12 +189,17 @@ kernel_route_add_v4(const unsigned char *pref, unsigned short plen,
     api.flags = 0;
     api.message = 0;
     api.safi = SAFI_UNICAST;
+
+    /* Unlike the native Linux and BSD interfaces, Quagga doesn't like
+       there to be both and IPv4 nexthop and an ifindex.  Omit the
+       ifindex, and assume that the connected prefixes be set up
+       correctly. */
+
     SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
     api.nexthop_num = 1;
     api.nexthop = &nexthop_pointer;
-    SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX);
-    api.ifindex_num = 1;
-    api.ifindex = &tmp_ifindex;
+    api.ifindex_num = 0;
+
     SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
     api.metric = metric;
 
@@ -254,7 +258,6 @@ kernel_route_delete_v4(const unsigned char *pref, unsigned short plen,
                        const unsigned char *newgate, int newifindex,
                        unsigned int newmetric)
 {
-    unsigned int tmp_ifindex = ifindex; /* (for typing) */
     struct zapi_ipv4 api;               /* quagga's communication system */
     struct prefix_ipv4 quagga_prefix;   /* quagga's prefix */
     struct in_addr babel_prefix_addr;   /* babeld's prefix addr */
@@ -280,9 +283,7 @@ kernel_route_delete_v4(const unsigned char *pref, unsigned short plen,
     SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
     api.nexthop_num = 1;
     api.nexthop = &nexthop_pointer;
-    SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX);
-    api.ifindex_num = 1;
-    api.ifindex = &tmp_ifindex;
+    api.ifindex_num = 0;
     SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
     api.metric = metric;



More information about the Babel-users mailing list