From: Roy Marples Date: Sun, 26 Jan 2020 16:44:40 +0000 (+0000) Subject: DHCP: redirect message to other interfaces if received for inactive X-Git-Tag: v9.0.0~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b09dc6be47b0e9fe0bdf181e8b0f180a14ea6c80;p=thirdparty%2Fdhcpcd.git DHCP: redirect message to other interfaces if received for inactive This is unlikely but possible if you have a manual subnet route via another interface you normally receive a DHCP address inside this subnet. Saves spamming the log that we received for an inactive interface as well. --- diff --git a/src/dhcp.c b/src/dhcp.c index 1ae1a5a2..d53bf7ba 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -2898,6 +2898,8 @@ dhcp_redirect_dhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len, xid = ntohl(bootp->xid); TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) { + if (ifn == ifp) + continue; state = D_CSTATE(ifn); if (state == NULL || state->state == DHS_NONE) continue; @@ -3548,8 +3550,9 @@ dhcp_recvmsg(struct dhcpcd_ctx *ctx, struct msghdr *msg) } state = D_CSTATE(ifp); if (state == NULL) { - logdebugx("%s: received BOOTP for inactive interface", - ifp->name); + /* Try re-directing it to another interface. */ + dhcp_redirect_dhcp(ifp, (struct bootp *)iov->iov_base, + iov->iov_len, &from->sin_addr); return; }