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

Fix nhg extraspace #31

Merged
merged 2 commits into from
Mar 21, 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
6 changes: 4 additions & 2 deletions lib/nexthop_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh)
char buf[100];
struct vrf *vrf;

vty_out(vty, " nexthop ");
vty_out(vty, "nexthop ");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the display of:
nexthop-group in a show run.


switch (nh->type) {
case NEXTHOP_TYPE_IFINDEX:
Expand Down Expand Up @@ -361,8 +361,10 @@ static int nexthop_group_write(struct vty *vty)
RB_FOREACH (nhgc, nhgc_entry_head, &nhgc_entries) {
vty_out(vty, "nexthop-group %s\n", nhgc->name);

for (nh = nhgc->nhg.nexthop; nh; nh = nh->next)
for (nh = nhgc->nhg.nexthop; nh; nh = nh->next) {
vty_out(vty, " ");
nexthop_group_write_nexthop(vty, nh);
}

vty_out(vty, "!\n");
}
Expand Down
2 changes: 1 addition & 1 deletion pbrd/pbr_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ static void pbr_nht_show_nhg_nexthops(struct hash_backet *b, void *data)
struct pbr_nexthop_cache *pnhc = b->data;
struct vty *vty = data;

vty_out(vty, "\tValid: %d", pnhc->valid);
vty_out(vty, "\tValid: %d ", pnhc->valid);
nexthop_group_write_nexthop(vty, pnhc->nexthop);
}

Expand Down
7 changes: 3 additions & 4 deletions pbrd/pbr_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,7 @@ static int pbr_vty_map_config_write_sequence(struct vty *vty,
{
char buff[PREFIX_STRLEN];

vty_out(vty, "pbr-map %s seq %u\n",
pbrm->name, pbrms->seqno);
vty_frame(vty, "pbr-map %s seq %u\n", pbrm->name, pbrms->seqno);

if (pbrms->src)
vty_out(vty, " match src-ip %s\n",
Expand All @@ -559,11 +558,11 @@ static int pbr_vty_map_config_write_sequence(struct vty *vty,
vty_out(vty, " set nexthop-group %s\n", pbrms->nhgrp_name);

if (pbrms->nhg) {
vty_out(vty, " set");
vty_out(vty, " set ");
nexthop_group_write_nexthop(vty, pbrms->nhg->nexthop);
}

vty_out(vty, "!\n");
vty_endframe(vty, "!\n");
return 1;
}

Expand Down