summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuliusz Chroboczek <jch@pps.jussieu.fr>2012-02-09 12:29:10 +0100
committerPaul Jakma <paul@quagga.net>2012-03-25 17:06:53 +0100
commitb6475ecb14abab936919894050f9ca47415d0f48 (patch)
tree2db873dd6edb2e68ef2c0e37d44acf0ea9068521
parent53b21956f650df86a76b7a7047cfa85114c99dcc (diff)
babeld: Don't use an ifindex when installing IPv4 routes.
Stand-alone babeld installs routes using both a next-hop gateway and an interface index. Unfortunately, this doesn't work for IPv4 under Quagga. We now ignore the ifindex when installing IPv4 routes, which makes Babel work for IPv4 in prefix-based networks. Of course this breaks IPv4 mesh networks, unless you play some tricks with your interfaces' netmasks.
-rw-r--r--babeld/kernel_zebra.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/babeld/kernel_zebra.c b/babeld/kernel_zebra.c
index f23403ec..1df4217f 100644
--- a/babeld/kernel_zebra.c
+++ b/babeld/kernel_zebra.c
@@ -157,7 +157,6 @@ static int
kernel_route_add_v4(const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex, unsigned int metric)
{
- 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 */
@@ -180,12 +179,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;
@@ -240,7 +244,6 @@ kernel_route_delete_v4(const unsigned char *pref, unsigned short plen,
const unsigned char *gate, int ifindex,
unsigned int metric)
{
- 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 */
@@ -266,9 +269,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;