aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/arping.c3
-rw-r--r--networking/ping.c4
-rw-r--r--networking/udhcp/socket.c4
3 files changed, 5 insertions, 6 deletions
diff --git a/networking/arping.c b/networking/arping.c
index e7b842f5b..915af3261 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -331,8 +331,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
struct sockaddr_in saddr;
int probe_fd = xsocket(AF_INET, SOCK_DGRAM, 0);
- if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device) + 1) == -1)
- bb_perror_msg("cannot bind to device %s", device);
+ setsockopt_bindtodevice(probe_fd, device);
memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
if (src.s_addr) {
diff --git a/networking/ping.c b/networking/ping.c
index 01a9f9ac5..f2a612fde 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -572,7 +572,7 @@ static void ping4(len_and_sockaddr *lsa)
xbind(pingsock, &source_lsa->u.sa, source_lsa->len);
}
if (str_I)
- setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, str_I, strlen(str_I) + 1);
+ setsockopt_bindtodevice(pingsock, str_I);
/* enable broadcast pings */
setsockopt_broadcast(pingsock);
@@ -622,7 +622,7 @@ static void ping6(len_and_sockaddr *lsa)
if (source_lsa)
xbind(pingsock, &source_lsa->u.sa, source_lsa->len);
if (str_I)
- setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, str_I, strlen(str_I) + 1);
+ setsockopt_bindtodevice(pingsock, str_I);
#ifdef ICMP6_FILTER
{
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 857f0a4de..fdb558db4 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -98,8 +98,8 @@ int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
bb_perror_msg_and_die("SO_BROADCAST");
/* 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");
+ if (setsockopt_bindtodevice(fd, inf))
+ xfunc_die(); /* warning is already printed */
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;