Re: meaning of an error message related to DHCPv6
Roy Marples
Tue May 20 09:26:21 2014
Hi Peter
On 19/05/2014 19:04, Peter Mattern wrote:
Hello.
I'm just trying to debug the message
dhcpcd[<PID>]: dhcp6_start: <interface>: Protocol not
available
that appears if a Cubietruck running Arch Linux tries to connect to an
IPv6-enabled router, right after receiving Router Advertisements.
Obviously the problem behind the message must be related to DHCPv6.
But neither dhcpcd nor the upstream router are at fault imo as the
message can't be seen if other devices running Arch Linux i686 or
x86-64 connect to the same router. Moreover, it makes no difference
whether the connection is established via WLAN or Ethernet. I also
tried to find differences in the packages installed and Kernel config
files used in the different flavours of Arch Linux but without
success.
So I would like to ask whether You could give me a hint at the exact
meaning of the said message.
After looking at this report, I checked the code and made the following
change:
http://roy.marples.name/projects/dhcpcd/info/ea6ed21cdb
Sockets would be opened with PF_*, not AF_*.
Now, on supported OS's, AF_INET6 will always be equal to PF_INET6 so
this shouldn't make any difference but it's the more correct thing to
do.
Anyway, one of the below calls would be failing:
ctx->dhcp_fd = socket(PF_INET6,
SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
IPPROTO_UDP);
if (setsockopt(ctx->dhcp_fd, SOL_SOCKET, SO_REUSEADDR,
&n, sizeof(n)) == -1)
goto errexit;
if (setsockopt(ctx->dhcp_fd, SOL_SOCKET, SO_BROADCAST,
&n, sizeof(n)) == -1)
goto errexit;
#ifdef SO_REUSEPORT
if (setsockopt(ctx->dhcp_fd, SOL_SOCKET, SO_REUSEPORT,
&n, sizeof(n)) == -1)
goto errexit;
#endif
The chances are it is the first one.
You can do test this by adding debug lines such as `printf("0\n");` to
the code and watching what gets printed before the error.
I've attached a patch to the latest head to demonstrate this.
Let me know if I can help more.
Roy
Index: dhcp6.c
==================================================================
--- dhcp6.c
+++ dhcp6.c
@@ -2494,10 +2494,11 @@
sa.sin6_port = htons(DHCP6_CLIENT_PORT);
#ifdef BSD
sa.sin6_len = sizeof(sa);
#endif
+ printf("d6_open 0\n");
ctx = dctx->ipv6;
#ifdef SOCK_CLOEXEC
ctx->dhcp_fd = socket(PF_INET6,
SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
IPPROTO_UDP);
@@ -2520,30 +2521,35 @@
ctx->dhcp_fd = -1;
return -1;
}
#endif
+ printf("d6_open 1\n");
n = 1;
if (setsockopt(ctx->dhcp_fd, SOL_SOCKET, SO_REUSEADDR,
&n, sizeof(n)) == -1)
goto errexit;
+ printf("d6_open 2\n");
n = 1;
if (setsockopt(ctx->dhcp_fd, SOL_SOCKET, SO_BROADCAST,
&n, sizeof(n)) == -1)
goto errexit;
+ printf("d6_open 3\n");
#ifdef SO_REUSEPORT
n = 1;
if (setsockopt(ctx->dhcp_fd, SOL_SOCKET, SO_REUSEPORT,
&n, sizeof(n)) == -1)
goto errexit;
#endif
+ printf("d6_open 5\n");
if (bind(ctx->dhcp_fd, (struct sockaddr *)&sa, sizeof(sa)) == -1)
goto errexit;
+ printf("d6_open 6\n");
n = 1;
if (setsockopt(ctx->dhcp_fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&n, sizeof(n)) == -1)
goto errexit;
Archive administrator: postmaster@marples.name