[quagga-dev 9058] Re: Help with specifying both gateway and ifindex in IPv4

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Feb 13 12:17:34 GMT 2012


>
> >
> > >>
> > >> Is the limitation to either a nexthop or an ifindex in IPv4 by design?
> > >> Is it a bug?  If the latter, could somebody point me at the point in the
> > >> code where to fix it?
> >
> > > It is a case of no one have impl. yet. There is
> > > ZEBRA_NEXTHOP_IPV4_IFINDEX but the code that impl. is yet to be
> > > written. It is easy to impl. though, I did it for OSPF
> >
> > Is the code in RE-testing-0.99?
>
> No, it is not public as I haven't bothered to clean it up and submit it.

BTW, here is the zebra part, no idea if it still applies:

diff --git a/zebra/rib.h b/zebra/rib.h
index 3eacb31..82bb2d3 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -226,6 +226,10 @@ extern struct nexthop *nexthop_ifname_add (struct rib *, char *);
 extern struct nexthop *nexthop_blackhole_add (struct rib *);
 extern struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *,
 					 struct in_addr *);
+extern struct nexthop *nexthop_ipv4_ifindex_add (struct rib *,
+						 struct in_addr *,
+						 struct in_addr *,
+						 unsigned int);
 extern void rib_lookup_and_dump (struct prefix_ipv4 *);
 extern void rib_lookup_and_pushup (struct prefix_ipv4 *);
 extern void rib_dump (const char *, const struct prefix_ipv4 *, const struct rib *);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index aaa310d..52f57f3 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -254,7 +254,7 @@ nexthop_ipv4_add (struct rib *rib, struct in_addr *ipv4, struct in_addr *src)
   return nexthop;
 }

-static struct nexthop *
+struct nexthop *
 nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4,
                           struct in_addr *src, unsigned int ifindex)
 {
diff --git a/zebra/zserv.c b/zebra/zserv.c
index d54dece..35a5b1a 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -783,6 +783,11 @@ zread_ipv4_add (struct zserv *client, u_short length)
 	      nexthop.s_addr = stream_get_ipv4 (s);
 	      nexthop_ipv4_add (rib, &nexthop, NULL);
 	      break;
+	    case ZEBRA_NEXTHOP_IPV4_IFINDEX:
+	      nexthop.s_addr = stream_get_ipv4 (s);
+	      ifindex = stream_getl (s);
+	      nexthop_ipv4_ifindex_add (rib, &nexthop, NULL, ifindex);
+	      break;
 	    case ZEBRA_NEXTHOP_IPV6:
 	      stream_forward_getp (s, IPV6_MAX_BYTELEN);
 	      break;
@@ -857,6 +862,10 @@ zread_ipv4_delete (struct zserv *client, u_short length)
 	    case ZEBRA_NEXTHOP_IPV4:
 	      nexthop.s_addr = stream_get_ipv4 (s);
 	      break;
+	    case ZEBRA_NEXTHOP_IPV4_IFINDEX:
+	      nexthop.s_addr = stream_get_ipv4 (s);
+	      ifindex = stream_getl (s);
+	      break;
 	    case ZEBRA_NEXTHOP_IPV6:
 	      stream_forward_getp (s, IPV6_MAX_BYTELEN);
 	      break;




More information about the Quagga-dev mailing list