diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-27 12:56:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-27 12:56:58 +0000 |
commit | 7ff85c53f17cbd6e3696ece978910f33f74901fe (patch) | |
tree | 15c14405bd29f8bcede85087bd481d21dd22b4e9 /networking | |
parent | de5f645dff4848e30a2bf564713088c2425ce9e2 (diff) | |
download | busybox-w32-7ff85c53f17cbd6e3696ece978910f33f74901fe.tar.gz busybox-w32-7ff85c53f17cbd6e3696ece978910f33f74901fe.tar.bz2 busybox-w32-7ff85c53f17cbd6e3696ece978910f33f74901fe.zip |
udhcp: simplify SO_BINDTODEVICE call
Diffstat (limited to 'networking')
-rw-r--r-- | networking/udhcp/common.h | 2 | ||||
-rw-r--r-- | networking/udhcp/socket.c | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index 66a0b0d8b..de4a8c75a 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h | |||
@@ -91,8 +91,8 @@ void udhcp_run_script(struct dhcpMessage *packet, const char *name) FAST_FUNC; | |||
91 | void udhcp_sp_setup(void) FAST_FUNC; | 91 | void udhcp_sp_setup(void) FAST_FUNC; |
92 | int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC; | 92 | int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC; |
93 | int udhcp_sp_read(const fd_set *rfds) FAST_FUNC; | 93 | int udhcp_sp_read(const fd_set *rfds) FAST_FUNC; |
94 | int udhcp_raw_socket(int ifindex) FAST_FUNC; | ||
95 | int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) FAST_FUNC; | 94 | int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) FAST_FUNC; |
95 | int udhcp_raw_socket(int ifindex) FAST_FUNC; | ||
96 | int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC; | 96 | int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC; |
97 | /* Returns 1 if no reply received */ | 97 | /* Returns 1 if no reply received */ |
98 | int arpping(uint32_t test_ip, uint32_t from_ip, uint8_t *from_mac, const char *interface) FAST_FUNC; | 98 | int arpping(uint32_t test_ip, uint32_t from_ip, uint8_t *from_mac, const char *interface) FAST_FUNC; |
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index 2d272510d..ea0a2c3a8 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 | |||
88 | int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) | 88 | int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) |
89 | { | 89 | { |
90 | int fd; | 90 | int fd; |
91 | struct ifreq interface; | ||
92 | struct sockaddr_in addr; | 91 | struct sockaddr_in addr; |
93 | 92 | ||
94 | DEBUG("Opening listen socket on *:%d %s", port, inf); | 93 | 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) | |||
98 | if (setsockopt_broadcast(fd) == -1) | 97 | if (setsockopt_broadcast(fd) == -1) |
99 | bb_perror_msg_and_die("SO_BROADCAST"); | 98 | bb_perror_msg_and_die("SO_BROADCAST"); |
100 | 99 | ||
101 | strncpy(interface.ifr_name, inf, IFNAMSIZ); | 100 | /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */ |
102 | if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &interface, sizeof(interface)) == -1) | 101 | if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &inf, strlen(inf) + 1) == -1) |
103 | bb_perror_msg_and_die("SO_BINDTODEVICE"); | 102 | bb_perror_msg_and_die("SO_BINDTODEVICE"); |
104 | 103 | ||
105 | memset(&addr, 0, sizeof(addr)); | 104 | memset(&addr, 0, sizeof(addr)); |