aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/socket.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-06-10 17:22:49 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-06-10 17:22:49 +0000
commit24833430bc2dbea733c3b0b9ea6c6b976f95474a (patch)
tree805a4197b8a0d36eaa6880dfc23d8c2539359fe9 /networking/udhcp/socket.c
parent6c43f743a3f607f91ee22a53db880fce2df645f0 (diff)
downloadbusybox-24833430bc2dbea733c3b0b9ea6c6b976f95474a.tar.gz
Vodz, last_patch_88
Diffstat (limited to 'networking/udhcp/socket.c')
-rw-r--r--networking/udhcp/socket.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 3a2261561..a51a74369 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -41,7 +41,7 @@
#include <linux/if_ether.h>
#endif
-#include "debug.h"
+#include "common.h"
int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp)
{
@@ -60,8 +60,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char
*addr = our_ip->sin_addr.s_addr;
DEBUG(LOG_INFO, "%s (our ip) = %s", ifr.ifr_name, inet_ntoa(our_ip->sin_addr));
} else {
- LOG(LOG_ERR, "SIOCGIFADDR failed, is the interface up and configured?: %s",
- strerror(errno));
+ LOG(LOG_ERR, "SIOCGIFADDR failed, is the interface up and configured?: %m");
return -1;
}
}
@@ -70,7 +69,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char
DEBUG(LOG_INFO, "adapter index %d", ifr.ifr_ifindex);
*ifindex = ifr.ifr_ifindex;
} else {
- LOG(LOG_ERR, "SIOCGIFINDEX failed!: %s", strerror(errno));
+ LOG(LOG_ERR, "SIOCGIFINDEX failed!: %m");
return -1;
}
if (ioctl(fd, SIOCGIFHWADDR, &ifr) == 0) {
@@ -78,11 +77,11 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char
DEBUG(LOG_INFO, "adapter hardware address %02x:%02x:%02x:%02x:%02x:%02x",
arp[0], arp[1], arp[2], arp[3], arp[4], arp[5]);
} else {
- LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %s", strerror(errno));
+ LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %m");
return -1;
}
} else {
- LOG(LOG_ERR, "socket failed!: %s", strerror(errno));
+ LOG(LOG_ERR, "socket failed!: %m");
return -1;
}
close(fd);
@@ -99,7 +98,7 @@ int listen_socket(unsigned int ip, int port, char *inf)
DEBUG(LOG_INFO, "Opening listen socket on 0x%08x:%d %s\n", ip, port, inf);
if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno));
+ DEBUG(LOG_ERR, "socket call failed: %m");
return -1;
}
@@ -139,7 +138,7 @@ int raw_socket(int ifindex)
DEBUG(LOG_INFO, "Opening raw socket on ifindex %d\n", ifindex);
if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
- DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno));
+ DEBUG(LOG_ERR, "socket call failed: %m");
return -1;
}
@@ -147,11 +146,10 @@ int raw_socket(int ifindex)
sock.sll_protocol = htons(ETH_P_IP);
sock.sll_ifindex = ifindex;
if (bind(fd, (struct sockaddr *) &sock, sizeof(sock)) < 0) {
- DEBUG(LOG_ERR, "bind call failed: %s", strerror(errno));
+ DEBUG(LOG_ERR, "bind call failed: %m");
close(fd);
return -1;
}
return fd;
}
-