From: Feng Lu Date: Fri, 22 May 2015 09:40:05 +0000 (+0200) Subject: zebra: lookup the address in all VRFs when set the route-map rule "set src" X-Git-Tag: frr-2.0-rc1~1213^2~9 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f91386cb7dcc3992d34e220c04f8f1def00105fd;p=matthieu%2Ffrr.git zebra: lookup the address in all VRFs when set the route-map rule "set src" 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 Reviewed-by: Alain Ritoux Signed-off-by: Nicolas Dichtel Acked-by: Vincent JARDIN Signed-off-by: David Lamparter Conflicts: zebra/zebra_routemap.c Conflicts: zebra/zebra_routemap.c --- diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index a8e87dd09c..64d6fda24d 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -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) {