diff options
| author | Russ White <russ@riw.us> | 2017-09-13 16:18:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-13 16:18:41 -0400 |
| commit | dcc4574ae63716e15c5a6df7f76a3e01eea70afe (patch) | |
| tree | 3b193c225a6e61e7ac6472225c33b37b3a56354b /zebra/zebra_rib.c | |
| parent | 7577536c5c2dfb78f7af01cdb6d980023efccb18 (diff) | |
| parent | 14a481d9165c6abf5167bc4636ce49aec7cede13 (diff) | |
Merge pull request #1163 from donaldsharp/deduplicate_nexthops
zebra: deduplicate nexthops
Diffstat (limited to 'zebra/zebra_rib.c')
| -rw-r--r-- | zebra/zebra_rib.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 376425329b..d04b64b19c 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1000,8 +1000,24 @@ int rib_install_kernel(struct route_node *rn, struct route_entry *re, for (ALL_NEXTHOPS(re->nexthop, nexthop)) SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB); return ret; + } else { + struct nexthop *prev; + + for (ALL_NEXTHOPS(re->nexthop, nexthop)) { + UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_DUPLICATE); + for (ALL_NEXTHOPS(re->nexthop, prev)) { + if (prev == nexthop) + break; + if (nexthop_same_firsthop (nexthop, prev)) + { + SET_FLAG (nexthop->flags, NEXTHOP_FLAG_DUPLICATE); + break; + } + } + } } + /* * Make sure we update the FPM any time we send new information to * the kernel. |
