summaryrefslogtreecommitdiff
path: root/networking/udhcp/socket.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-10-27 12:56:58 +0000
committerDenis Vlasenko2008-10-27 12:56:58 +0000
commit7ff85c53f17cbd6e3696ece978910f33f74901fe (patch)
tree15c14405bd29f8bcede85087bd481d21dd22b4e9 /networking/udhcp/socket.c
parentde5f645dff4848e30a2bf564713088c2425ce9e2 (diff)
downloadbusybox-7ff85c53f17cbd6e3696ece978910f33f74901fe.zip
busybox-7ff85c53f17cbd6e3696ece978910f33f74901fe.tar.gz
udhcp: simplify SO_BINDTODEVICE call
Diffstat (limited to 'networking/udhcp/socket.c')
-rw-r--r--networking/udhcp/socket.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 2d27251..ea0a2c3 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -88,7 +88,6 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t
int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
{
int fd;
- struct ifreq interface;
struct sockaddr_in addr;
DEBUG("Opening listen socket on *:%d %s", port, inf);
@@ -98,8 +97,8 @@ int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
if (setsockopt_broadcast(fd) == -1)
bb_perror_msg_and_die("SO_BROADCAST");
- strncpy(interface.ifr_name, inf, IFNAMSIZ);
- if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &interface, sizeof(interface)) == -1)
+ /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */
+ if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &inf, strlen(inf) + 1) == -1)
bb_perror_msg_and_die("SO_BINDTODEVICE");
memset(&addr, 0, sizeof(addr));