Re: Questions about a weird router rate-limiting NDP
Roy Marples
Fri Apr 03 18:17:23 2020
On 03/04/2020 17:50, Alarig Le Lay wrote:
Hi,
I’m facing a router that isn’t very friendly with NDP:
Apr 3 18:12:55 core01-arendal dhcpcd[2833]: enp2s0: Router Advertisement from fe80::5e5e:abff:fe43:1ece
Apr 3 18:12:55 core01-arendal dhcpcd[2833]: enp2s0: adding default route via fe80::5e5e:abff:fe43:1ece
Apr 3 18:13:03 core01-arendal dhcpcd[2833]: enp2s0: fe80::5e5e:abff:fe43:1ece is unreachable
Apr 3 18:13:04 core01-arendal dhcpcd[2833]: enp2s0: soliciting an IPv6 router
Apr 3 18:13:16 core01-arendal dhcpcd[2833]: enp2s0: no IPv6 Routers available
Apr 3 18:13:20 core01-arendal dhcpcd[2833]: enp2s0: Router Advertisement from fe80::5e5e:abff:fe43:1ece
Apr 3 18:13:28 core01-arendal dhcpcd[2833]: enp2s0: fe80::5e5e:abff:fe43:1ece is unreachable
Apr 3 18:13:29 core01-arendal dhcpcd[2833]: enp2s0: soliciting an IPv6 router
and so on…
If fixed the issue with this command:
core01-arendal ~ # ip -6 neigh replace $(ip neigh show dev enp2s0 | awk '/router/ { print $1 }') dev enp2s0 lladdr $(ip neigh show dev enp2s0 | awk '/router/ { print $3 }')
It’s not a bug in dhcpcd, the NDP itself is dropped from the kernel.
So, my question is: Is it a good idea to put this command in a post-up
hook (and a similar one in post-down), or is there a better way?
Could be a dhcpcd bug!
Does this patch help?
Roy
diff --git a/src/if-linux.c b/src/if-linux.c
index fe39dcb6..6b81197c 100644
--- a/src/if-linux.c
+++ b/src/if-linux.c
@@ -811,7 +811,7 @@ link_neigh(struct dhcpcd_ctx *ctx, __unused struct interface *ifp,
struct rtattr *rta;
size_t len;
- if (nlm->nlmsg_type != RTM_NEWNEIGH && nlm->nlmsg_type != RTM_DELNEIGH)
+ if (nlm->nlmsg_type != RTM_NEWNEIGH)
return 0;
if (nlm->nlmsg_len < sizeof(*r))
return -1;
@@ -820,13 +820,11 @@ link_neigh(struct dhcpcd_ctx *ctx, __unused struct interface *ifp,
rta = RTM_RTA(r);
len = RTM_PAYLOAD(nlm);
if (r->ndm_family == AF_INET6) {
- bool reachable;
+ bool unreachable;
struct in6_addr addr6;
- reachable = (nlm->nlmsg_type == RTM_NEWNEIGH &&
- r->ndm_state &
- (NUD_REACHABLE | NUD_STALE | NUD_DELAY | NUD_PROBE |
- NUD_PERMANENT));
+ unreachable = (nlm->nlmsg_type == RTM_NEWNEIGH &&
+ r->ndm_state & NUD_FAILED);
memset(&addr6, 0, sizeof(addr6));
for (; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
switch (rta->rta_type) {
@@ -836,7 +834,7 @@ link_neigh(struct dhcpcd_ctx *ctx, __unused struct interface *ifp,
break;
}
}
- ipv6nd_neighbour(ctx, &addr6, reachable);
+ ipv6nd_neighbour(ctx, &addr6, !unreachable);
}
return 0;
Archive administrator: postmaster@marples.name