Skip to content
Closed
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
12 changes: 6 additions & 6 deletions lib/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1,
{
int ret = 0;

if (next1->vrf_id < next2->vrf_id)
return -1;

if (next1->vrf_id > next2->vrf_id)
return 1;

if (next1->type < next2->type)
return -1;

Expand All @@ -120,6 +114,12 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1,
switch (next1->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV6:
if (next1->vrf_id < next2->vrf_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what if vrf is used not only with IPv4/IPv6 nexthop, but nexthop as interface?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If ifindex given, vrf is a redundant term, actually it is get from ifindex, further more interface may change vrf, then RTM_DELROUTE handling failed, netlink message doesn't contain nexthop vrf either.

return -1;

if (next1->vrf_id > next2->vrf_id)
return 1;

ret = _nexthop_gateway_cmp(next1, next2);
if (ret != 0)
return ret;
Expand Down
12 changes: 6 additions & 6 deletions lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,6 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1,
{
int ret = 0;

if (next1->vrf_id < next2->vrf_id)
return -1;

if (next1->vrf_id > next2->vrf_id)
return 1;

if (next1->type < next2->type)
return -1;

Expand All @@ -805,6 +799,12 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1,
switch (next1->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV6:
if (next1->vrf_id < next2->vrf_id)
return -1;

if (next1->vrf_id > next2->vrf_id)
return 1;

ret = nexthop_g_addr_cmp(next1->type, &next1->gate,
&next2->gate);
if (ret != 0)
Expand Down