]> git.proxmox.com Git - mirror_frr.git/commitdiff
ripngd: add support for route tags
authorChristian Franke <chris@opensourcerouting.org>
Sat, 1 Oct 2016 20:35:32 +0000 (22:35 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 8 Oct 2016 01:05:06 +0000 (21:05 -0400)
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
ripngd/ripng_interface.c
ripngd/ripng_zebra.c
ripngd/ripngd.c
ripngd/ripngd.h

index 0061c0e803ba9a6f0ed0d17c1419c6164833335f..c4dec7e7b1ae2da37ee15f5f31539b253415743c 100644 (file)
@@ -383,7 +383,7 @@ ripng_apply_address_add (struct connected *ifc) {
   if ((ripng_enable_if_lookup(ifc->ifp->name) >= 0) ||
       (ripng_enable_network_lookup2(ifc) >= 0))
     ripng_redistribute_add(ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
-                           &address, ifc->ifp->ifindex, NULL);
+                           &address, ifc->ifp->ifindex, NULL, 0);
 
 }
 
@@ -704,13 +704,13 @@ ripng_connect_set (struct interface *ifp, int set)
         if ((ripng_enable_if_lookup(connected->ifp->name) >= 0) ||
             (ripng_enable_network_lookup2(connected) >= 0))
           ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
-                                  &address, connected->ifp->ifindex, NULL);
+                                  &address, connected->ifp->ifindex, NULL, 0);
       } else {
         ripng_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
                                    &address, connected->ifp->ifindex);
         if (ripng_redistribute_check (ZEBRA_ROUTE_CONNECT))
           ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_REDISTRIBUTE,
-                                  &address, connected->ifp->ifindex, NULL);
+                                  &address, connected->ifp->ifindex, NULL, 0);
       }
     }
 }
index c4ed0c52c62889eed70ec25c54a7895b04b524ff..d05b5dbad8b28d6e176bfd32001fe810429228b1 100644 (file)
@@ -92,6 +92,12 @@ ripng_zebra_ipv6_send (struct route_node *rp, u_char cmd)
       SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
       api.metric = rinfo->metric;
 
+      if (rinfo->tag)
+        {
+          SET_FLAG (api.message, ZAPI_MESSAGE_TAG);
+          api.tag = rinfo->tag;
+        }
+
       zapi_ipv6_route (cmd, zclient,
                        (struct prefix_ipv6 *)&rp->p, &api);
 
@@ -172,8 +178,13 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient,
   else
     api.metric = 0;
 
+  if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
+    api.tag = stream_getl (s);
+  else
+    api.tag = 0;
+
   if (command == ZEBRA_REDISTRIBUTE_IPV6_ADD)
-    ripng_redistribute_add (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex, &nexthop);
+    ripng_redistribute_add (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex, &nexthop, api.tag);
   else
     ripng_redistribute_delete (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex);
 
index 0c9606e69cc0ef71981b73db9c55fe101fff6f47..e8aad7774a16718db5931f4bc0e4b04a3f24c670 100644 (file)
@@ -907,7 +907,8 @@ ripng_route_process (struct rte *rte, struct sockaddr_in6 *from,
 /* Add redistributed route to RIPng table. */
 void
 ripng_redistribute_add (int type, int sub_type, struct prefix_ipv6 *p, 
-                       ifindex_t ifindex, struct in6_addr *nexthop)
+                       ifindex_t ifindex, struct in6_addr *nexthop,
+                       route_tag_t tag)
 {
   struct route_node *rp;
   struct ripng_info *rinfo = NULL, newinfo;
@@ -926,6 +927,8 @@ ripng_redistribute_add (int type, int sub_type, struct prefix_ipv6 *p,
   newinfo.sub_type = sub_type;
   newinfo.ifindex = ifindex;
   newinfo.metric = 1;
+  if (tag <= UINT16_MAX) /* RIPng only supports 16 bit tags */
+    newinfo.tag = tag;
   newinfo.rp = rp;
   if (nexthop && IN6_IS_ADDR_LINKLOCAL(nexthop))
     newinfo.nexthop = *nexthop;
@@ -2216,7 +2219,7 @@ DEFUN (ripng_route,
     }
   rp->info = (void *)1;
 
-  ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_STATIC, &p, 0, NULL);
+  ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_STATIC, &p, 0, NULL, 0);
 
   return CMD_SUCCESS;
 }
@@ -2553,7 +2556,7 @@ DEFUN (ripng_default_information_originate,
     ripng->default_information = 1;
 
     str2prefix_ipv6 ("::/0", &p);
-    ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_DEFAULT, &p, 0, NULL);
+    ripng_redistribute_add (ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_DEFAULT, &p, 0, NULL, 0);
   }
 
   return CMD_SUCCESS;
index c4b34b348cf68f1d317e3238644ccb966fd3f67f..e340eeecc2e7c45684cc0edebbea7904ea317b50 100644 (file)
@@ -383,7 +383,7 @@ extern void ripng_info_free (struct ripng_info *rinfo);
 extern void ripng_event (enum ripng_event, int);
 extern int ripng_request (struct interface *ifp);
 extern void ripng_redistribute_add (int, int, struct prefix_ipv6 *,
-                                    ifindex_t, struct in6_addr *);
+                                    ifindex_t, struct in6_addr *, route_tag_t);
 extern void ripng_redistribute_delete (int, int, struct prefix_ipv6 *,
                                        ifindex_t);
 extern void ripng_redistribute_withdraw (int type);