diff options
| author | Feng Lu <lu.feng@6wind.com> | 2015-05-22 11:40:05 +0200 |
|---|---|---|
| committer | Vipin Kumar <vipin@cumulusnetworks.com> | 2015-10-29 23:58:09 -0700 |
| commit | f91386cb7dcc3992d34e220c04f8f1def00105fd (patch) | |
| tree | d89a54b18d60c702dcaf543bee1262436ea2455a | |
| parent | 0032dd59cda8215e7ccf4297cd78ee6100de7499 (diff) | |
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
| -rw-r--r-- | zebra/zebra_routemap.c | 17 |
1 files changed, 13 insertions, 4 deletions
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) { |
