nh: cleanup on interface deletion #240
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When an interface is removed, associated next hop remains with an unknown interface id:
grout# show ip6 nexthop
VRF IP MAC IFACE QUEUE AGE STATE
0 fe80::d2f0:cff:feba:a411 d2:f0:0c:ba:a4:11 gmztio1 0 - reachable static local link
0 fe80::d2f0:cff:feba:a412 d2:f0:0c:ba:a4:12 gmztio2 0 - reachable static local link
0 fd00:ba4:1::1 d2:f0:0c:ba:a4:11 gmztio1 0 - reachable static local link
0 fd00:ba4:2::1 d2:f0:0c:ba:a4:12 gmztio2 0 - reachable static local link
0 fe80::d0ad:caff:feca:a401 d2:ad:ca:ca:a4:01 gmztio1 0 3 reachable
0 fe80::d0ad:caff:feca:a401 d2:ad:ca:ca:a4:01 gmztio2 0 3 reachable
--> remove interfaces gmztio1 and gmztio2
grout# show ip6 nexthop
VRF IP MAC IFACE QUEUE AGE STATE
0 fe80::d0ad:caff:feca:a401 d2:ad:ca:ca:a4:01 1 0 6 reachable
0 fe80::d0ad:caff:feca:a401 d2:ad:ca:ca:a4:01 3 0 6 reachable
0 fd00:ba4:1::2 d2:ad:ca:ca:a4:01 1 0 2 reachable
0 fd00:ba4:2::2 d2:ad:ca:ca:a4:01 3 0 2 reachable
Then, when an other interface is added, we may abort in modules/ip6/control/nexthop.c:58
if (remote->iface_id != nh->iface_id)
ABORT(IP6_F " nexthop lookup gives wrong interface", &ip);
This can be reproduced by running the test smoke/ip6_forward_test.sh several times on the same grout instance.
To avoid this situation, cleanup the nexthops associated to the interface on removal.