diff options
| author | Roy Marples <roy@marples.name> | 2008-11-17 22:50:37 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-11-17 22:50:37 +0000 |
| commit | 5f1643f5844b6cf6adba486c8712931b98533c74 (patch) | |
| tree | efc942fbcc0a4f2fcb695f09da3a46cb42a72900 /net.c | |
| parent | c989b02361577d2227094cd396c760c1df39e697 (diff) | |
| download | dhcpcd-5f1643f5844b6cf6adba486c8712931b98533c74.tar.xz | |
Fix working with linux aliased interfaces again.
Diffstat (limited to 'net.c')
| -rw-r--r-- | net.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -487,6 +487,7 @@ open_udp_socket(struct interface *iface) int n; #ifdef SO_BINDTODEVICE struct ifreq ifr; + char *p; #endif if ((s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) @@ -498,6 +499,10 @@ open_udp_socket(struct interface *iface) #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 |
