Skip to content

Commit f67009e

Browse files
ip6: fix ip6 address deletion
We couldn't add a previously added IPv6 on an interface, either through the command line, or for link local ip when we add/delete/add an interface. In rib6_cleanup, call rib6_delete with the prefixlen instead of the max prefix. Add these checks in the existing test. Signed-off-by: Christophe Fontaine <[email protected]>
1 parent 50aec94 commit f67009e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

modules/ip6/control/address.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,13 @@ static struct api_out addr6_del(const void *request, void ** /*response*/) {
213213
struct rte_ipv6_addr solicited_node;
214214
struct nexthop *nh = NULL;
215215
struct hoplist *addrs;
216+
struct iface *iface;
216217
unsigned i = 0;
217218

219+
iface = iface_from_id(req->addr.iface_id);
220+
if (iface == NULL)
221+
return api_out(errno, 0);
222+
218223
if ((addrs = addr6_get_all(req->addr.iface_id)) == NULL)
219224
return api_out(errno, 0);
220225

@@ -299,7 +304,7 @@ static const struct rte_ipv6_addr well_known_mcast_addrs[] = {
299304
RTE_IPV6_ADDR_ALLROUTERS_SITE_LOCAL,
300305
};
301306

302-
static void ip6_iface_event_handler(uint32_t event, const void *obj) {
307+
static void ip6_iface_event_handler(iface_event_t event, const void *obj) {
303308
struct rte_ipv6_addr link_local, solicited_node;
304309
const struct iface *iface = obj;
305310
struct rte_ether_addr mac;

modules/ip6/control/route.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void rib6_cleanup(struct nexthop *nh) {
393393
struct rte_rib6 *rib;
394394
uintptr_t nh_id;
395395

396-
rib6_delete(nh->vrf_id, nh->iface_id, &nh->ipv6, RTE_IPV6_MAX_DEPTH);
396+
rib6_delete(nh->vrf_id, nh->iface_id, &nh->ipv6, nh->prefixlen);
397397
local_ip = nh->ipv6;
398398
local_depth = nh->prefixlen;
399399

smoke/ip6_add_del_test.sh

+4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66

77
p0=${run_id}0
88

9+
grcli add interface port $p0 devargs net_tap0,iface=$p0 mac f0:0d:ac:dc:00:00
10+
grcli del interface $p0
911
grcli add interface port $p0 devargs net_tap0,iface=$p0 mac f0:0d:ac:dc:00:00
1012

1113
grcli add ip6 address 2001::1/64 iface $p0
1214
grcli show ip6 address
1315
grcli del ip6 address 2001::1/64 iface $p0
1416
grcli show ip6 address
17+
grcli add ip6 address 2001::1/64 iface $p0
18+
grcli show ip6 address

0 commit comments

Comments
 (0)