]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: read and ignore srcdest routes on ZAPI
authorChristian Franke <chris@opensourcerouting.org>
Wed, 8 Jul 2015 17:48:51 +0000 (19:48 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Mon, 30 Jan 2017 12:47:04 +0000 (13:47 +0100)
Since zebra might be sending srcdest routes down to the various daemons,
they need to understand the presence of the field at the very least.
Sadly, that's also the best we can do at this point since none of the
protocols has support for handling srcdest routes.  The only consistent
thing to do is to ignore them throughout.

If an administrator wants to have the srcdest route as non-srcdest in a
protocol, setting a non-srcdest static route (possibly blackhole) is
probably the best way to go.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_zebra.c
bgpd/rfapi/vnc_zebra.c
ldpd/ldp_zebra.c
ospf6d/ospf6_zebra.c
ripngd/ripng_zebra.c

index 7c778122b9a96ca1fe814a8d9c39235b14158cb0..822f459c28f873c6ac8dd3cda6112e5e9a98c3de 100644 (file)
@@ -706,7 +706,7 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length,
   struct stream *s;
   struct zapi_ipv6 api;
   struct in6_addr nexthop;
-  struct prefix_ipv6 p;
+  struct prefix_ipv6 p, src_p;
   unsigned int ifindex;
   int i;
   struct bgp *bgp;
@@ -730,6 +730,18 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length,
   p.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc (s));
   stream_get (&p.prefix, s, PSIZE (p.prefixlen));
 
+  memset (&src_p, 0, sizeof (struct prefix_ipv6));
+  src_p.family = AF_INET6;
+  if (CHECK_FLAG (api.message, ZAPI_MESSAGE_SRCPFX))
+    {
+      src_p.prefixlen = stream_getc (s);
+      stream_get (&src_p.prefix, s, PSIZE (src_p.prefixlen));
+    }
+
+  if (src_p.prefixlen)
+    /* we completely ignore srcdest routes for now. */
+    return 0;
+
   /* Nexthop, ifindex, distance, metric. */
   if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP))
     {
index d659e964cdc83f65a0769b98e802b4897c874fc5..85baa13301ef05ca9e640870fce4afdbe2fa512f 100644 (file)
@@ -433,7 +433,7 @@ vnc_zebra_read_ipv6 (
   struct stream *s;
   struct zapi_ipv6 api;
   struct in6_addr nexthop;
-  struct prefix_ipv6 p;
+  struct prefix_ipv6 p, src_p;
 
   s = zclient->ibuf;
   memset (&nexthop, 0, sizeof (struct in6_addr));
@@ -449,6 +449,18 @@ vnc_zebra_read_ipv6 (
   p.prefixlen = stream_getc (s);
   stream_get (&p.prefix, s, PSIZE (p.prefixlen));
 
+  memset (&src_p, 0, sizeof (struct prefix_ipv6));
+  src_p.family = AF_INET6;
+  if (CHECK_FLAG (api.message, ZAPI_MESSAGE_SRCPFX))
+    {
+      src_p.prefixlen = stream_getc (s);
+      stream_get (&src_p.prefix, s, PSIZE (src_p.prefixlen));
+    }
+
+  if (src_p.prefixlen)
+    /* we completely ignore srcdest routes for now. */
+    return 0;
+
   /* Nexthop, ifindex, distance, metric. */
   if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP))
     {
index a233cb72e77779a080fa5732f815493e02b44593..8e7c6e27f91ba265f4413de15c284ad65a5c723d 100644 (file)
@@ -398,6 +398,17 @@ ldp_zebra_read_route(int command, struct zclient *zclient, zebra_size_t length,
            (kr.af == AF_INET6 && IN6_IS_SCOPE_EMBED(&kr.prefix.v6)))
                return (0);
 
+       if (kr.af == AF_INET6 &&
+           CHECK_FLAG(message_flags, ZAPI_MESSAGE_SRCPFX)) {
+               uint8_t src_prefixlen;
+
+               src_prefixlen = stream_getc(s);
+
+               /* we completely ignore srcdest routes for now. */
+               if (src_prefixlen)
+                       return (0);
+       }
+
        nhnum = stream_getc(s);
        nhmark = stream_get_getp(s);
        stream_set_getp(s, nhmark + nhnum * (nhlen + 5));
index c20311e92f117c6ee152fd3ad84cf72ed1b1fb0e..76bee9cf55eadc1f75adc90a2ce1264251f0d1fa 100644 (file)
@@ -217,7 +217,7 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient,
   struct stream *s;
   struct zapi_ipv6 api;
   unsigned long ifindex;
-  struct prefix_ipv6 p;
+  struct prefix_ipv6 p, src_p;
   struct in6_addr *nexthop;
 
   if (ospf6 == NULL)
@@ -240,6 +240,18 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient,
   p.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc (s));
   stream_get (&p.prefix, s, PSIZE (p.prefixlen));
 
+  memset (&src_p, 0, sizeof (struct prefix_ipv6));
+  src_p.family = AF_INET6;
+  if (CHECK_FLAG (api.message, ZAPI_MESSAGE_SRCPFX))
+    {
+      src_p.prefixlen = stream_getc (s);
+      stream_get (&src_p.prefix, s, PSIZE (src_p.prefixlen));
+    }
+
+  if (src_p.prefixlen)
+    /* we completely ignore srcdest routes for now. */
+    return 0;
+
   /* Nexthop, ifindex, distance, metric. */
   if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP))
     {
index 970aa14df6b5a8c9c280ee81a780d35ce22e8cec..964af81d1f20f6a7be109673893a7fbf850e4a2a 100644 (file)
@@ -140,7 +140,7 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient,
   struct zapi_ipv6 api;
   unsigned long ifindex;
   struct in6_addr nexthop;
-  struct prefix_ipv6 p;
+  struct prefix_ipv6 p, src_p;
 
   s = zclient->ibuf;
   ifindex = 0;
@@ -158,6 +158,18 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient,
   p.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc (s));
   stream_get (&p.prefix, s, PSIZE (p.prefixlen));
 
+  memset (&src_p, 0, sizeof (struct prefix_ipv6));
+  src_p.family = AF_INET6;
+  if (CHECK_FLAG (api.message, ZAPI_MESSAGE_SRCPFX))
+    {
+      src_p.prefixlen = stream_getc (s);
+      stream_get (&src_p.prefix, s, PSIZE (src_p.prefixlen));
+    }
+
+  if (src_p.prefixlen)
+    /* we completely ignore srcdest routes for now. */
+    return 0;
+
   /* Nexthop, ifindex, distance, metric. */
   if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP))
     {