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 <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
This commit is contained in:
Feng Lu 2015-05-22 11:40:05 +02:00 committed by Vipin Kumar
parent 0032dd59cd
commit f91386cb7d

View 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)
{