--- iputils-s20121112/ping.c.orig 2012-11-13 12:54:16.000000000 +0100 +++ iputils-s20121112/ping.c 2012-11-13 12:59:42.800466410 +0100 @@ -314,9 +314,16 @@ main(int argc, char **argv) } if (device) { struct ifreq ifr; + int rc; + memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, device, IFNAMSIZ-1); - if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1) { + + enable_capability_raw(); + rc = setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1); + disable_capability_raw(); + + if (rc == -1) { if (IN_MULTICAST(ntohl(dst.sin_addr.s_addr))) { struct ip_mreqn imr; if (ioctl(probe_fd, SIOCGIFINDEX, &ifr) < 0) {