]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: lookup the address in all VRFs when set the route-map rule "set src"
authorFeng Lu <lu.feng@6wind.com>
Fri, 22 May 2015 09:40:05 +0000 (11:40 +0200)
committerVipin Kumar <vipin@cumulusnetworks.com>
Fri, 30 Oct 2015 06:58:09 +0000 (23:58 -0700)
When configuring the route-map rule "set src A.B.C.D", it checked
whether the source address exists on some interface.

Now it checks the source address throughout all VRFs.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Conflicts:
zebra/zebra_routemap.c

Conflicts:
zebra/zebra_routemap.c

zebra/zebra_routemap.c

index a8e87dd09c4c5f88f6ec0c4fa273940f9df85b98..64d6fda24d3af7a3462a23d8c2d883e621e4508b 100644 (file)
@@ -659,6 +659,7 @@ DEFUN (set_src,
   struct interface *pif = NULL;
   int family;
   struct prefix p;
+  vrf_iter_t iter;
 
   if (inet_pton(AF_INET, argv[0], &src.ipv4) != 1)
     {
@@ -685,10 +686,18 @@ DEFUN (set_src,
          return CMD_WARNING;
     }
 
-  if (family == AF_INET)
-    pif = if_lookup_exact_address ((void *)&src.ipv4, AF_INET);
-  else if (family == AF_INET6)
-    pif = if_lookup_exact_address ((void *)&src.ipv6, AF_INET6);
+  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
+    {
+      if (family == AF_INET)
+        pif = if_lookup_exact_address_vrf ((void *)&src.ipv4, AF_INET,
+                                           vrf_iter2id (iter));
+      else if (family == AF_INET6)
+        pif = if_lookup_exact_address_vrf ((void *)&src.ipv6, AF_INET6,
+                                           vrf_iter2id (iter));
+
+      if (pif != NULL)
+        break;
+    }
 
   if (!pif)
     {