Implement optional syslog logging using ordinary
[oweals/busybox.git] / networking / udhcp / clientsocket.c
index 7c1b6e87cce31e5e611c620e610550084b31f77d..982aca1bb6a824231c547abf3e4ab4eb699b73e7 100644 (file)
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 /*
  * clientsocket.c -- DHCP client socket creation
  *
@@ -25,7 +26,7 @@
 #include <unistd.h>
 #include <netinet/in.h>
 #include <features.h>
-#if __GLIBC__ >=2 && __GLIBC_MINOR >= 1
+#if (__GLIBC__ >= 2 && __GLIBC_MINOR >= 1) || defined _NEWLIB_VERSION
 #include <netpacket/packet.h>
 #include <net/ethernet.h>
 #else
@@ -43,9 +44,9 @@ int raw_socket(int ifindex)
        int fd;
        struct sockaddr_ll sock;
 
-       DEBUG(LOG_INFO, "Opening raw socket on ifindex %d", ifindex);
+       DEBUG("Opening raw socket on ifindex %d", ifindex);
        if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
-               DEBUG(LOG_ERR, "socket call failed: %m");
+               bb_perror_msg("socket");
                return -1;
        }
 
@@ -53,7 +54,7 @@ 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: %m");
+               bb_perror_msg("bind:");
                close(fd);
                return -1;
        }