PPPoE sometimes stuck at waiting interface address
Hiroki Takeuchi
Thu Jan 09 02:24:30 2020I am using ubuntu/debian variant of dhcpcd 7.1.0 patched with https://roy.marples.name/cgit/dhcpcd.git/commit/?h=dhcpcd-7&id=75f2832a88b8f5a3078179404b149b7cd9623dbf https://roy.marples.name/cgit/dhcpcd.git/commit/?h=dhcpcd-7&id=8d7414a6d80f54ca82887e3dbb05fed9b568a9a8 Most of the time, dhcpcd worked without issue and the route will be added successfully. However, sometimes the interface will be stuck at waiting for IP address, while the address is already added. I've managed to trace the problem down to the cause being dhcpcd process the netlink event first (link_addr function) and ignore the address which interface doesn't exist in ctx->ifaces, then only the link being added afterwards. Refer to the following syslog: Jan 8 13:56:32 QNE dhcpcd: NM dhcpcd callback by PREINIT for ppp-eno2 completed with rc: 0 Jan 8 13:56:32 QNE dhcpcd[9021]: ppp-eno2: IAID 00:00:00:eb Jan 8 13:56:32 QNE dhcpcd[9021]: ppp-eno2: waiting for 3rd party to configure IP address My thoughts of a possible simple fix for this is simply to let new interface discover it's addresses immediately. Refer to the attachment for my suggestion to patch the issue. Is there any better way or any other suggestions to handle this issue? Thanks!
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 8f2c38a..e6c57de 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -1031,7 +1031,6 @@ dhcpcd_handleinterface(void *arg, int action, const char *ifname)
if (ifp->hwlen != 0)
memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen);
} else {
- TAILQ_REMOVE(ifs, ifp, next);
TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
if (ifp->active) {
logdebugx("%s: interface added", ifp->name);
@@ -1047,6 +1046,9 @@ dhcpcd_handleinterface(void *arg, int action, const char *ifname)
dhcpcd_prestartinterface(iff);
}
+ if (iff == ifp)
+ TAILQ_REMOVE(ifs, ifp, next);
+
/* Free our discovered list */
while ((ifp = TAILQ_FIRST(ifs))) {
TAILQ_REMOVE(ifs, ifp, next);
Archive administrator: postmaster@marples.name