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

lib: nexthops compare vrf only if ip type #5368

Closed
wants to merge 1 commit into from
Closed
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
@@ -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;

@@ -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
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
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;
12 changes: 6 additions & 6 deletions lib/zclient.c
Original file line number Diff line number Diff line change
@@ -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;

@@ -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)