char *source = NULL;
char *target;
- s = socket(PF_PACKET, SOCK_DGRAM, 0);
+ s = xsocket(PF_PACKET, SOCK_DGRAM, 0);
ifindex = errno;
// Drop suid root privileges
if (!(cfg&dad) || src.s_addr) {
struct sockaddr_in saddr;
- int probe_fd = socket(AF_INET, SOCK_DGRAM, 0); /* maybe use bb_xsocket? */
+ int probe_fd = xsocket(AF_INET, SOCK_DGRAM, 0);
- if (probe_fd < 0) {
- bb_error_msg_and_die("socket");
- }
if (device) {
if (setsockopt
(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device,
int fd;
strcpy(ifr.ifr_name, dev);
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
if (ioctl(fd, SIOCGIFINDEX, &ifr)) {
bb_perror_msg("ioctl");
return 0;
int fd;
strcpy(ifr.ifr_name, dev);
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
if (ioctl(fd, SIOCGIFHWADDR, &ifr)) {
bb_perror_msg("ioctl");
return -1;
int fd;
ifr.ifr_ifindex = idx;
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
if (ioctl(fd, SIOCGIFNAME, &ifr)) {
bb_perror_msg("ioctl");
return NULL;
strcpy(ifr.ifr_name, basedev);
ifr.ifr_ifru.ifru_data = (void*)p;
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
err = ioctl(fd, SIOCGETTUNNEL, &ifr);
if (err) {
bb_perror_msg("ioctl");
strcpy(ifr.ifr_name, basedev);
}
ifr.ifr_ifru.ifru_data = (void*)p;
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
err = ioctl(fd, cmd, &ifr);
if (err) {
bb_perror_msg("ioctl");
strcpy(ifr.ifr_name, basedev);
}
ifr.ifr_ifru.ifru_data = (void*)p;
- fd = socket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
err = ioctl(fd, SIOCDELTUNNEL, &ifr);
if (err) {
bb_perror_msg("ioctl");