Skip to content

Commit

Permalink
zebra: mpls entry interface lookup adaptation for vrf backend
Browse files Browse the repository at this point in the history
The search algorithm for interface based on ifindex only is adapted to
vrf netns based too. Only the default netns will be used to search the
interface index.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Jul 10, 2018
1 parent 06432d4 commit 86f07f4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions zebra/zebra_mpls.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include "zebra/rib.h"
#include "zebra/rt.h"
#include "zebra/interface.h"
#include "zebra/zserv.h"
#include "zebra/redistribute.h"
#include "zebra/debug.h"
Expand Down Expand Up @@ -704,6 +705,7 @@ static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe)
{
struct nexthop *nexthop;
struct interface *ifp;
struct zebra_ns *zns;

nexthop = nhlfe->nexthop;
if (!nexthop) // unexpected
Expand All @@ -721,7 +723,8 @@ static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe)
* which will not be in the default
* VRF. So let's look in all of them
*/
ifp = if_lookup_by_index(nexthop->ifindex, VRF_UNKNOWN);
zns = zebra_ns_lookup(NS_DEFAULT);
ifp = if_lookup_by_index_per_ns(zns, nexthop->ifindex);
if (ifp && if_is_operative(ifp))
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
Expand Down Expand Up @@ -2752,10 +2755,13 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf,

switch (nexthop->type) {
case NEXTHOP_TYPE_IFINDEX: {
struct zebra_ns *zns;
struct interface *ifp;

ifp = if_lookup_by_index(
nexthop->ifindex, VRF_UNKNOWN);
zns = zebra_ns_lookup(NS_DEFAULT);
ifp = if_lookup_by_index_per_ns(
zns,
nexthop->ifindex);
vty_out(vty, "%15s", ifp->name);
break;
}
Expand Down

0 comments on commit 86f07f4

Please sign in to comment.