Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pbrd: show pbr-policy on ints before map created #10

Merged
merged 1 commit into from
Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions pbrd/pbr_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,12 @@ void pbr_map_add_interface(struct pbr_map *pbrm, struct interface *ifp_add)
pbr_event_enqueue(pbre);
}

void pbr_map_write_interfaces(struct vty *vty, struct interface *ifp_find)
void pbr_map_write_interfaces(struct vty *vty, struct interface *ifp)
{
struct pbr_map *pbrm;
struct listnode *node;
struct interface *ifp;
struct pbr_interface *pbr_ifp = ifp->info;

RB_FOREACH (pbrm, pbr_map_entry_head, &pbr_maps) {
for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, node, ifp)) {
if (ifp == ifp_find) {
vty_out(vty, " pbr-policy %s\n", pbrm->name);
break;
}
}
}
if (!(strcmp(pbr_ifp->mapname, "") == 0))
vty_out(vty, " pbr-policy %s\n", pbr_ifp->mapname);
}

struct pbr_map *pbrm_find(const char *name)
Expand Down
26 changes: 19 additions & 7 deletions pbrd/pbr_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,28 @@ DEFPY (show_pbr_interface,
"PBR Interface Name\n"
JSON_STR)
{
struct pbr_map *pbrm;
struct listnode *node;
struct interface *ifp;
struct vrf *vrf;
struct pbr_interface *pbr_ifp;

RB_FOREACH (pbrm, pbr_map_entry_head, &pbr_maps) {
for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, node, ifp)) {
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
FOR_ALL_INTERFACES(vrf, ifp) {
if (!name || (strcmp(ifp->name, name) == 0)) {
vty_out(vty, " %s(%d) with pbr-policy %s\n",
ifp->name, ifp->ifindex, pbrm->name);
break;
pbr_ifp = ifp->info;

if (!(strcmp(pbr_ifp->mapname, "") == 0)) {
struct pbr_map *pbrm;

pbrm = pbrm_find(pbr_ifp->mapname);
vty_out(vty,
" %s(%d) with pbr-policy %s",
ifp->name, ifp->ifindex,
pbr_ifp->mapname);
if (!pbrm)
vty_out(vty,
" (map doesn't exist)");
vty_out(vty, "\n");
}
}
}
}
Expand Down