/* If we haven't specified a ClientID and our hardware address
* length is greater than DHCP_CHADDR_LEN then we enforce a ClientID
* of the hardware address family and the hardware address. */
- if (!(ifo->options & DHCPCD_CLIENTID) && iface->hwlen > DHCP_CHADDR_LEN)
+ if (iface->hwlen > DHCP_CHADDR_LEN)
ifo->options |= DHCPCD_CLIENTID;
free(iface->clientid);
discover_interfaces(int argc, char * const *argv)
{
FILE *f;
- char *p;
+ char ifn[IF_NAMESIZE];
+ char *p, *c;
size_t ln = 0, n;
int i;
struct interface *ifs = NULL, *ifp, *ifl;
if (ifp)
continue;
if (argc > 0) {
- for (i = 0; i < argc; i++)
- if (strcmp(argv[i], p) == 0)
+ for (i = 0; i < argc; i++) {
+ /* Check the real interface name */
+ strlcpy(ifn, argv[i], sizeof(ifn));
+ c = strchr(ifn, ':');
+ if (c)
+ *c = '\0';
+ if (strcmp(ifn, p) == 0)
break;
+ }
if (i == argc)
continue;
+ p = argv[i];
} else {
for (i = 0; i < ifdc; i++)
if (!fnmatch(ifdv[i], p, 0))
int n;
#ifdef SO_BINDTODEVICE
struct ifreq ifr;
+ char *p;
#endif
if ((s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
#ifdef SO_BINDTODEVICE
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name));
+ /* We can only bind to the real device */
+ p = strchr(ifr.ifr_name, ':');
+ if (p)
+ *p = '\0';
if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) == -1)
goto eexit;
#endif