Skip to content

Commit c37f741

Browse files
committed
ip6: insert route only when creating nexthop
When multiple packets arrive for the same on-link destination, only the first packet that creates the nexthop should attempt route insertion. Subsequent packets reuse the existing nexthop without trying to insert a duplicate route. This prevents EEXIST errors and packet drops during concurrent nexthop resolution. Signed-off-by: Anthony Harivel <aharivel@redhat.com>
1 parent 02969b8 commit c37f741

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

modules/ip6/control/nexthop.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ void nh6_unreachable_cb(struct rte_mbuf *m) {
5959
.ipv6 = *dst,
6060
}
6161
);
62+
// Create an associated /128 route so that next packets take it
63+
// in priority with a single route lookup.
64+
int ret = rib6_insert(
65+
nh->vrf_id,
66+
nh->iface_id,
67+
dst,
68+
RTE_IPV6_MAX_DEPTH,
69+
GR_NH_ORIGIN_INTERNAL,
70+
remote
71+
);
72+
if (ret < 0) {
73+
LOG(ERR, "failed to insert route: %s", strerror(errno));
74+
goto free;
75+
}
6276
}
6377

6478
if (remote == NULL) {
@@ -69,20 +83,6 @@ void nh6_unreachable_cb(struct rte_mbuf *m) {
6983
remote_l3 = nexthop_info_l3(remote);
7084
assert(remote->iface_id == nh->iface_id);
7185

72-
// Create an associated /128 route so that next packets take it
73-
// in priority with a single route lookup.
74-
int ret = rib6_insert(
75-
nh->vrf_id,
76-
nh->iface_id,
77-
dst,
78-
RTE_IPV6_MAX_DEPTH,
79-
GR_NH_ORIGIN_INTERNAL,
80-
remote
81-
);
82-
if (ret < 0) {
83-
LOG(ERR, "failed to insert route: %s", strerror(errno));
84-
goto free;
85-
}
8686
nh = remote;
8787
l3 = remote_l3;
8888
}

0 commit comments

Comments
 (0)