|
| 1 | +From 2f0b5aef66316b47d2cc8ac18453600621a6a317 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Tyler Li < [email protected]> |
| 3 | +Date: Thu, 14 Nov 2019 23:46:52 -0800 |
| 4 | +Subject: [PATCH] nexthops compare vrf only if ip type |
| 5 | + |
| 6 | +--- |
| 7 | + lib/nexthop.c | 12 ++++++------ |
| 8 | + lib/zclient.c | 12 ++++++------ |
| 9 | + 2 files changed, 12 insertions(+), 12 deletions(-) |
| 10 | + |
| 11 | +diff --git a/lib/nexthop.c b/lib/nexthop.c |
| 12 | +index cf5bed3d6..7d9f646c9 100644 |
| 13 | +--- a/lib/nexthop.c |
| 14 | ++++ b/lib/nexthop.c |
| 15 | +@@ -105,12 +105,6 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1, |
| 16 | + { |
| 17 | + int ret = 0; |
| 18 | + |
| 19 | +- if (next1->vrf_id < next2->vrf_id) |
| 20 | +- return -1; |
| 21 | +- |
| 22 | +- if (next1->vrf_id > next2->vrf_id) |
| 23 | +- return 1; |
| 24 | +- |
| 25 | + if (next1->type < next2->type) |
| 26 | + return -1; |
| 27 | + |
| 28 | +@@ -120,6 +114,12 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1, |
| 29 | + switch (next1->type) { |
| 30 | + case NEXTHOP_TYPE_IPV4: |
| 31 | + case NEXTHOP_TYPE_IPV6: |
| 32 | ++ if (next1->vrf_id < next2->vrf_id) |
| 33 | ++ return -1; |
| 34 | ++ |
| 35 | ++ if (next1->vrf_id > next2->vrf_id) |
| 36 | ++ return 1; |
| 37 | ++ |
| 38 | + ret = _nexthop_gateway_cmp(next1, next2); |
| 39 | + if (ret != 0) |
| 40 | + return ret; |
| 41 | +diff --git a/lib/zclient.c b/lib/zclient.c |
| 42 | +index c739af043..0d37c46d1 100644 |
| 43 | +--- a/lib/zclient.c |
| 44 | ++++ b/lib/zclient.c |
| 45 | +@@ -783,12 +783,6 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1, |
| 46 | + { |
| 47 | + int ret = 0; |
| 48 | + |
| 49 | +- if (next1->vrf_id < next2->vrf_id) |
| 50 | +- return -1; |
| 51 | +- |
| 52 | +- if (next1->vrf_id > next2->vrf_id) |
| 53 | +- return 1; |
| 54 | +- |
| 55 | + if (next1->type < next2->type) |
| 56 | + return -1; |
| 57 | + |
| 58 | +@@ -798,6 +792,12 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1, |
| 59 | + switch (next1->type) { |
| 60 | + case NEXTHOP_TYPE_IPV4: |
| 61 | + case NEXTHOP_TYPE_IPV6: |
| 62 | ++ if (next1->vrf_id < next2->vrf_id) |
| 63 | ++ return -1; |
| 64 | ++ |
| 65 | ++ if (next1->vrf_id > next2->vrf_id) |
| 66 | ++ return 1; |
| 67 | ++ |
| 68 | + ret = nexthop_g_addr_cmp(next1->type, &next1->gate, |
| 69 | + &next2->gate); |
| 70 | + if (ret != 0) |
| 71 | +-- |
| 72 | +2.11.0 |
| 73 | + |
0 commit comments