contrib/dhcpcd/src/dhcp.c
/* If we're sharing the same IP address with another interface on the
 * same network, we may receive the DHCP reply on the wrong interface.
 * Try and re-direct it here. */
If we're sharing the same IP address with another interface on the
same network, we may receive the DHCP reply on the wrong interface.
Try and re-direct it here.
If we ' re sharing the same IP address with another interface on the same network we may receive the DHCP reply on the wrong interface . Try and re - direct it here .
static void
dhcp_redirect_dhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len,
    const struct in_addr *from)
{
	struct interface *ifn;
	const struct dhcp_state *state;
	uint32_t xid;
	xid = ntohl(bootp->xid);
	TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
		state = D_CSTATE(ifn);
		if (state == NULL || state->state == DHS_NONE)
			continue;
		if (state->xid != xid)
			continue;
		if (ifn->hwlen <= sizeof(bootp->chaddr) &&
		    memcmp(bootp->chaddr, ifn->hwaddr, ifn->hwlen))
			continue;
		logdebugx("%s: redirecting DHCP message to %s",
		    ifp->name, ifn->name);
		dhcp_handledhcp(ifn, bootp, bootp_len, from);
	}
}
static void dhcp_redirect_dhcp ( struct interface * ifp , struct bootp * bootp , size_t bootp_len , const struct in_addr * from ) { struct interface * ifn ; const struct dhcp_state * state ; uint32_t xid ; xid = ntohl ( bootp -> xid ) ; TAILQ_FOREACH ( ifn , ifp -> ctx -> ifaces , next ) { state = D_CSTATE ( ifn ) ; if ( state == NULL || state -> state == DHS_NONE ) continue ; if ( state -> xid != xid ) continue ; if ( ifn -> hwlen <= sizeof ( bootp -> chaddr ) && memcmp ( bootp -> chaddr , ifn -> hwaddr , ifn -> hwlen ) ) continue ; logdebugx ( " " , ifp -> name , ifn -> name ) ; dhcp_handledhcp ( ifn , bootp , bootp_len , from ) ; } }
If we're sharing the same IP address with another interface on the
 same network, we may receive the DHCP reply on the wrong interface.
If we ' re sharing the same IP address with another interface on the same network we may receive the DHCP reply on the wrong interface .