*: fix SO_BINDTODEVICE. Kernel wants at least IFNAMSIZ bytes there.

This commit is contained in:
Denis Vlasenko
2008-12-10 11:12:16 +00:00
parent 0d94820adf
commit e53738558f
5 changed files with 21 additions and 6 deletions

View File

@@ -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) {