summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/ether-wake.c19
-rw-r--r--networking/fakeidentd.c18
-rw-r--r--networking/ftpgetput.c19
-rw-r--r--networking/hostname.c11
-rw-r--r--networking/ifconfig.c10
-rw-r--r--networking/ifupdown.c48
-rw-r--r--networking/inetd.c27
-rw-r--r--networking/nameif.c14
-rw-r--r--networking/nc.c8
-rw-r--r--networking/route.c30
-rw-r--r--networking/tftp.c16
-rw-r--r--networking/traceroute.c16
-rw-r--r--networking/udhcp/libbb_udhcp.h2
-rw-r--r--networking/udhcp/script.c12
-rw-r--r--networking/vconfig.c12
-rw-r--r--networking/wget.c15
16 files changed, 73 insertions, 204 deletions
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index 1803d22..75f065c 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -65,25 +65,10 @@
*/
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <features.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
-#include <netdb.h>
#include <netinet/ether.h>
-
-#ifdef __linux__
#include <linux/if.h>
-#endif
#include "busybox.h"
@@ -93,10 +78,10 @@
*/
#ifdef PF_PACKET
# define whereto_t sockaddr_ll
-# define make_socket() bb_xsocket(PF_PACKET, SOCK_RAW, 0)
+# define make_socket() xsocket(PF_PACKET, SOCK_RAW, 0)
#else
# define whereto_t sockaddr
-# define make_socket() bb_xsocket(AF_INET, SOCK_PACKET, SOCK_PACKET)
+# define make_socket() xsocket(AF_INET, SOCK_PACKET, SOCK_PACKET)
#endif
#ifdef DEBUG
diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c
index 9cdbc57..6ee7c32 100644
--- a/networking/fakeidentd.c
+++ b/networking/fakeidentd.c
@@ -10,19 +10,7 @@
*/
#include "busybox.h"
-
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/syslog.h>
-
-#include <pwd.h>
-
#include <sys/syslog.h>
-#include <time.h>
-#include <sys/socket.h>
-#include <errno.h>
#include <sys/uio.h>
@@ -97,7 +85,7 @@ static void inetbind(void)
else
port = se->s_port;
- s = bb_xsocket(AF_INET, SOCK_STREAM, 0);
+ s = xsocket(AF_INET, SOCK_STREAM, 0);
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
@@ -106,8 +94,8 @@ static void inetbind(void)
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
- bb_xbind(s, (struct sockaddr *)&addr, len);
- bb_xlisten(s, 5);
+ xbind(s, (struct sockaddr *)&addr, len);
+ xlisten(s, 5);
movefd(s, 0);
}
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 9f3c789..767ace9 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -13,19 +13,8 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <sys/ioctl.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/socket.h>
-
#include "busybox.h"
+#include <getopt.h>
typedef struct ftp_host_info_s {
char *user;
@@ -175,9 +164,9 @@ static int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
/* only make a local file if we know that one exists on the remote server */
if (fd_local == -1) {
if (do_continue) {
- fd_local = bb_xopen(local_path, O_APPEND | O_WRONLY);
+ fd_local = xopen(local_path, O_APPEND | O_WRONLY);
} else {
- fd_local = bb_xopen(local_path, O_CREAT | O_TRUNC | O_WRONLY);
+ fd_local = xopen(local_path, O_CREAT | O_TRUNC | O_WRONLY);
}
}
@@ -223,7 +212,7 @@ static int ftp_send(ftp_host_info_t *server, FILE *control_stream,
if ((local_path[0] == '-') && (local_path[1] == '\0')) {
fd_local = STDIN_FILENO;
} else {
- fd_local = bb_xopen(local_path, O_RDONLY);
+ fd_local = xopen(local_path, O_RDONLY);
fstat(fd_local, &sbuf);
sprintf(buf, "ALLO %lu", (unsigned long)sbuf.st_size);
diff --git a/networking/hostname.c b/networking/hostname.c
index ec4a0e8..03fd88e 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -13,15 +13,8 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <errno.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
#include "busybox.h"
+#include <getopt.h>
extern char *optarg; /* in unistd.h */
extern int optind, opterr, optopt; /* in unistd.h */
@@ -41,7 +34,7 @@ static void do_sethostname(char *s, int isfile)
bb_perror_msg_and_die("sethostname");
}
} else {
- f = bb_xfopen(s, "r");
+ f = xfopen(s, "r");
while (fgets(buf, 255, f) != NULL) {
if (buf[0] =='#') {
continue;
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 7b358c4..4d346c4 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -26,14 +26,6 @@
* IPV6 support added by Bart Visscher <magick@linux-fan.com>
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h> /* strcmp and friends */
-#include <ctype.h> /* isdigit and friends */
-#include <stddef.h> /* offsetof */
-#include <unistd.h>
-#include <netdb.h>
-#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
@@ -329,7 +321,7 @@ int ifconfig_main(int argc, char **argv)
}
/* Create a channel to the NET kernel. */
- sockfd = bb_xsocket(AF_INET, SOCK_DGRAM, 0);
+ sockfd = xsocket(AF_INET, SOCK_DGRAM, 0);
/* get interface name */
safe_strncpy(ifr.ifr_name, *argv, IFNAMSIZ);
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 8ee4883..6429c07 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -17,22 +17,10 @@
/* TODO: standardise execute() return codes to return 0 for success and 1 for failure */
-#include <sys/stat.h>
+#include "busybox.h"
#include <sys/utsname.h>
-#include <sys/wait.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
#include <fnmatch.h>
#include <getopt.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "busybox.h"
#define MAX_OPT_DEPTH 10
#define EUNBALBRACK 10001
@@ -628,7 +616,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
defn = xzalloc(sizeof(struct interfaces_file_t));
- f = bb_xfopen(filename, "r");
+ f = xfopen(filename, "r");
while ((buf = bb_get_chomped_line_from_file(f)) != NULL) {
char *buf_ptr = buf;
@@ -649,7 +637,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
currmap->match = xrealloc(currmap->match, sizeof(currmap->match) * currmap->max_matches);
}
- currmap->match[currmap->n_matches++] = bb_xstrdup(firstword);
+ currmap->match[currmap->n_matches++] = xstrdup(firstword);
}
currmap->max_mappings = 0;
currmap->n_mappings = 0;
@@ -701,7 +689,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
return NULL;
}
- currif->iface = bb_xstrdup(iface_name);
+ currif->iface = xstrdup(iface_name);
currif->address_family = get_address_family(addr_fams, address_family_name);
if (!currif->address_family) {
@@ -741,7 +729,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
}
/* Add the interface to the list */
- llist_add_to_end(&(defn->autointerfaces), bb_xstrdup(firstword));
+ llist_add_to_end(&(defn->autointerfaces), xstrdup(firstword));
debug_noise("\nauto %s\n", firstword);
}
currently_processing = NONE;
@@ -775,8 +763,8 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
opt = xrealloc(currif->option, sizeof(*opt) * currif->max_options);
currif->option = opt;
}
- currif->option[currif->n_options].name = bb_xstrdup(firstword);
- currif->option[currif->n_options].value = bb_xstrdup(buf_ptr);
+ currif->option[currif->n_options].name = xstrdup(firstword);
+ currif->option[currif->n_options].value = xstrdup(buf_ptr);
if (!currif->option[currif->n_options].name) {
perror(filename);
return NULL;
@@ -796,14 +784,14 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
bb_error_msg("duplicate script in mapping \"%s\"", buf);
return NULL;
} else {
- currmap->script = bb_xstrdup(next_word(&buf_ptr));
+ currmap->script = xstrdup(next_word(&buf_ptr));
}
} else if (strcmp(firstword, "map") == 0) {
if (currmap->max_mappings == currmap->n_mappings) {
currmap->max_mappings = currmap->max_mappings * 2 + 1;
currmap->mapping = xrealloc(currmap->mapping, sizeof(char *) * currmap->max_mappings);
}
- currmap->mapping[currmap->n_mappings] = bb_xstrdup(next_word(&buf_ptr));
+ currmap->mapping[currmap->n_mappings] = xstrdup(next_word(&buf_ptr));
currmap->n_mappings++;
} else {
bb_error_msg("misplaced option \"%s\"", buf);
@@ -833,7 +821,7 @@ static char *setlocalenv(char *format, const char *name, const char *value)
char *here;
char *there;
- result = bb_xasprintf(format, name, value);
+ result = xasprintf(format, name, value);
for (here = there = result; *there != '=' && *there; there++) {
if (*there == '-')
@@ -922,7 +910,7 @@ static int execute_all(struct interface_defn_t *ifd, const char *opt)
}
}
- buf = bb_xasprintf("run-parts /etc/network/if-%s.d", opt);
+ buf = xasprintf("run-parts /etc/network/if-%s.d", opt);
if (doit(buf) != 1) {
return 0;
}
@@ -1013,7 +1001,7 @@ static char *run_mapping(char *physical, struct mapping_defn_t * map)
int i, status;
pid_t pid;
- char *logical = bb_xstrdup(physical);
+ char *logical = xstrdup(physical);
/* Run the mapping script. */
pid = popen2(&in, &out, map->script, physical, NULL);
@@ -1158,7 +1146,7 @@ int ifupdown_main(int argc, char **argv)
/* iface_down */
const llist_t *list = state_list;
while (list) {
- llist_add_to_end(&target_list, bb_xstrdup(list->data));
+ llist_add_to_end(&target_list, xstrdup(list->data));
list = list->link;
}
target_list = defn->autointerfaces;
@@ -1178,15 +1166,15 @@ int ifupdown_main(int argc, char **argv)
int okay = 0;
int cmds_ret;
- iface = bb_xstrdup(target_list->data);
+ iface = xstrdup(target_list->data);
target_list = target_list->link;
pch = strchr(iface, '=');
if (pch) {
*pch = '\0';
- liface = bb_xstrdup(pch + 1);
+ liface = xstrdup(pch + 1);
} else {
- liface = bb_xstrdup(iface);
+ liface = xstrdup(iface);
}
if (!force) {
@@ -1263,7 +1251,7 @@ int ifupdown_main(int argc, char **argv)
llist_t *iface_state = find_iface_state(state_list, iface);
if (cmds == iface_up) {
- char *newiface = bb_xasprintf("%s=%s", iface, liface);
+ char *newiface = xasprintf("%s=%s", iface, liface);
if (iface_state == NULL) {
llist_add_to_end(&state_list, newiface);
} else {
@@ -1281,7 +1269,7 @@ int ifupdown_main(int argc, char **argv)
if (!no_act) {
FILE *state_fp = NULL;
- state_fp = bb_xfopen(statefile, "w");
+ state_fp = xfopen(statefile, "w");
while (state_list) {
if (state_list->data) {
fputs(state_list->data, state_fp);
diff --git a/networking/inetd.c b/networking/inetd.c
index 54294b6..49ca7a3 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -128,31 +128,8 @@
*
*/
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-
-
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <signal.h>
-#include <netdb.h>
-#include <syslog.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <time.h>
-
#include "busybox.h"
+#include <syslog.h>
//#define CONFIG_FEATURE_INETD_RPC
//#define CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO
@@ -1314,7 +1291,7 @@ inetd_main (int argc, char *argv[])
/* reexec for vfork() do continue parent */
vfork_daemon_rexec (0, 0, argc, argv, "-f");
#else
- bb_xdaemon (0, 0);
+ xdaemon (0, 0);
#endif
} else {
setsid ();
diff --git a/networking/nameif.c b/networking/nameif.c
index f13ef1b..501e244 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -10,13 +10,7 @@
*/
#include "busybox.h"
-
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
+#include <syslog.h>
#include <net/if.h>
#include <netinet/ether.h>
@@ -107,7 +101,7 @@ int nameif_main(int argc, char **argv)
if (strlen(*a) > IF_NAMESIZE)
serror("interface name `%s' too long", *a);
ch = xzalloc(sizeof(mactable_t));
- ch->ifname = bb_xstrdup(*a++);
+ ch->ifname = xstrdup(*a++);
ch->mac = cc_macaddr(*a++);
if (clist)
clist->prev = ch;
@@ -115,7 +109,7 @@ int nameif_main(int argc, char **argv)
clist = ch;
}
} else {
- ifh = bb_xfopen(fname, "r");
+ ifh = xfopen(fname, "r");
while ((line = bb_get_line_from_file(ifh)) != NULL) {
char *line_ptr;
@@ -128,7 +122,7 @@ int nameif_main(int argc, char **argv)
}
name_length = strcspn(line_ptr, " \t");
ch = xzalloc(sizeof(mactable_t));
- ch->ifname = bb_xstrndup(line_ptr, name_length);
+ ch->ifname = xstrndup(line_ptr, name_length);
if (name_length > IF_NAMESIZE)
serror("interface name `%s' too long", ch->ifname);
line_ptr += name_length;
diff --git a/networking/nc.c b/networking/nc.c
index 117bbe2..3f4149e 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -54,10 +54,10 @@ int nc_main(int argc, char **argv)
alarm(wsecs);
}
- if (infile) cfd = bb_xopen(infile, O_RDWR);
+ if (infile) cfd = xopen(infile, O_RDWR);
else {
opt = 1;
- sfd = bb_xsocket(AF_INET, SOCK_STREAM, 0);
+ sfd = xsocket(AF_INET, SOCK_STREAM, 0);
fcntl(sfd, F_SETFD, FD_CLOEXEC);
setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt));
address.sin_family = AF_INET;
@@ -67,13 +67,13 @@ int nc_main(int argc, char **argv)
if (lport != 0) {
address.sin_port = lport;
- bb_xbind(sfd, (struct sockaddr *) &address, sizeof(address));
+ xbind(sfd, (struct sockaddr *) &address, sizeof(address));
}
if (do_listen) {
socklen_t addrlen = sizeof(address);
- bb_xlisten(sfd, do_listen);
+ xlisten(sfd, do_listen);
// If we didn't specify a port number, query and print it to stderr.
diff --git a/networking/route.c b/networking/route.c
index d905786..5fd8886 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -26,20 +26,12 @@
* remove ridiculous amounts of bloat.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "busybox.h"
+#include "inet_common.h"
#include <getopt.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
#include <net/route.h>
#include <net/if.h>
-#include "busybox.h"
-#include "inet_common.h"
+
#ifndef RTF_UP
/* Keep this in sync with /usr/src/linux/include/linux/route.h */
@@ -166,8 +158,6 @@ static void INET_setroute(int action, char **args)
const char *netmask = NULL;
int skfd, isnet, xflag;
- assert((action == RTACTION_ADD) || (action == RTACTION_DEL));
-
/* Grab the -net or -host options. Remember they were transformed. */
xflag = kw_lookup(tbl_hash_net_host, &args);
@@ -335,7 +325,7 @@ static void INET_setroute(int action, char **args)
}
/* Create a socket to the INET kernel. */
- skfd = bb_xsocket(AF_INET, SOCK_DGRAM, 0);
+ skfd = xsocket(AF_INET, SOCK_DGRAM, 0);
if (ioctl(skfd, ((action==RTACTION_ADD) ? SIOCADDRT : SIOCDELRT), &rt)<0) {
bb_perror_msg_and_die("SIOC[ADD|DEL]RT");
@@ -353,9 +343,6 @@ static void INET6_setroute(int action, char **args)
int prefix_len, skfd;
const char *devname;
- assert((action == RTACTION_ADD) || (action == RTACTION_DEL));
-
- {
/* We know args isn't NULL from the check in route_main. */
const char *target = *args++;
@@ -374,7 +361,6 @@ static void INET6_setroute(int action, char **args)
bb_error_msg_and_die("resolving %s", target);
}
}
- }
/* Clean out the RTREQ structure. */
memset((char *) &rt, 0, sizeof(struct in6_rtmsg));
@@ -429,7 +415,7 @@ static void INET6_setroute(int action, char **args)
}
/* Create a socket to the INET6 kernel. */
- skfd = bb_xsocket(AF_INET6, SOCK_DGRAM, 0);
+ skfd = xsocket(AF_INET6, SOCK_DGRAM, 0);
rt.rtmsg_ifindex = 0;
@@ -503,7 +489,7 @@ void displayroutes(int noresolve, int netstatfmt)
struct sockaddr_in s_addr;
struct in_addr mask;
- FILE *fp = bb_xfopen("/proc/net/route", "r");
+ FILE *fp = xfopen("/proc/net/route", "r");
bb_printf("Kernel IP routing table\n"
"Destination Gateway Genmask"
@@ -573,7 +559,7 @@ static void INET6_displayroutes(int noresolve)
int iflags, metric, refcnt, use, prefix_len, slen;
struct sockaddr_in6 snaddr6;
- FILE *fp = bb_xfopen("/proc/net/ipv6_route", "r");
+ FILE *fp = xfopen("/proc/net/ipv6_route", "r");
bb_printf("Kernel IPv6 routing table\n%-44s%-40s"
"Flags Metric Ref Use Iface\n",
@@ -699,7 +685,7 @@ int route_main(int argc, char **argv)
#endif
displayroutes(noresolve, opt & ROUTE_OPT_e);
- bb_xferror_stdout();
+ xferror_stdout();
bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}
diff --git a/networking/tftp.c b/networking/tftp.c
index dfa599a..42fd9d2 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -19,18 +19,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
* ------------------------------------------------------------------------- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <fcntl.h>
-
#include "busybox.h"
@@ -159,7 +147,7 @@ static int tftp(const int cmd, const struct hostent *host,
char *buf=xmalloc(tftp_bufsize += 4);
if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
- /* need to unlink the localfile, so don't use bb_xsocket here. */
+ /* need to unlink the localfile, so don't use xsocket here. */
bb_perror_msg("socket");
return EXIT_FAILURE;
}
@@ -167,7 +155,7 @@ static int tftp(const int cmd, const struct hostent *host,
len = sizeof(sa);
memset(&sa, 0, len);
- bb_xbind(socketfd, (struct sockaddr *)&sa, len);
+ xbind(socketfd, (struct sockaddr *)&sa, len);
sa.sin_family = host->h_addrtype;
sa.sin_port = port;
diff --git a/networking/traceroute.c b/networking/traceroute.c
index c2084fc..4464903 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -357,7 +357,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp)
struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr;
struct IFADDRLIST *st_ifaddrlist;
- fd = bb_xsocket(AF_INET, SOCK_DGRAM, 0);
+ fd = xsocket(AF_INET, SOCK_DGRAM, 0);
ifc.ifc_len = sizeof(ibuf);
ifc.ifc_buf = (caddr_t)ibuf;
@@ -457,7 +457,7 @@ findsaddr(const struct sockaddr_in *to, struct sockaddr_in *from)
struct IFADDRLIST *al;
char buf[256], tdevice[256], device[256];
- f = bb_xfopen(route, "r");
+ f = xfopen(route, "r");
/* Find the appropriate interface */
n = 0;
@@ -875,7 +875,7 @@ gethostinfo(const char *host)
hi = xcalloc(1, sizeof(*hi));
addr = inet_addr(host);
if ((int32_t)addr != -1) {
- hi->name = bb_xstrdup(host);
+ hi->name = xstrdup(host);
hi->n = 1;
hi->addrs = xcalloc(1, sizeof(hi->addrs[0]));
hi->addrs[0] = addr;
@@ -885,7 +885,7 @@ gethostinfo(const char *host)
hp = xgethostbyname(host);
if (hp->h_addrtype != AF_INET || hp->h_length != 4)
bb_perror_msg_and_die("bad host %s", host);
- hi->name = bb_xstrdup(hp->h_name);
+ hi->name = xstrdup(hp->h_name);
for (n = 0, p = hp->h_addr_list; *p != NULL; ++n, ++p)
continue;
hi->n = n;
@@ -1081,11 +1081,11 @@ traceroute_main(int argc, char *argv[])
bb_perror_msg_and_die("unknown protocol %s", cp);
/* Insure the socket fds won't be 0, 1 or 2 */
- do n = bb_xopen(bb_dev_null, O_RDONLY); while (n < 2);
+ do n = xopen(bb_dev_null, O_RDONLY); while (n < 2);
if (n > 2)
close(n);
- s = bb_xsocket(AF_INET, SOCK_RAW, pe->p_proto);
+ s = xsocket(AF_INET, SOCK_RAW, pe->p_proto);
#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
if (op & USAGE_OP_DEBUG)
@@ -1096,7 +1096,7 @@ traceroute_main(int argc, char *argv[])
(void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on,
sizeof(on));
- sndsock = bb_xsocket(AF_INET, SOCK_RAW, IPPROTO_RAW);
+ sndsock = xsocket(AF_INET, SOCK_RAW, IPPROTO_RAW);
#ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE
#if defined(IP_OPTIONS)
@@ -1248,7 +1248,7 @@ traceroute_main(int argc, char *argv[])
outip->ip_src = from->sin_addr;
#ifndef IP_HDRINCL
- bb_xbind(sndsock, (struct sockaddr *)from, sizeof(*from));
+ xbind(sndsock, (struct sockaddr *)from, sizeof(*from));
#endif
fprintf(stderr, "traceroute to %s (%s)", hostname, inet_ntoa(to->sin_addr));
diff --git a/networking/udhcp/libbb_udhcp.h b/networking/udhcp/libbb_udhcp.h
index 3cf2d14..c21d3ba 100644
--- a/networking/udhcp/libbb_udhcp.h
+++ b/networking/udhcp/libbb_udhcp.h
@@ -20,8 +20,6 @@
#define COMBINED_BINARY
-#define xfopen bb_xfopen
-
void udhcp_background(const char *pidfile);
void udhcp_start_log_and_pid(const char *client_server, const char *pidfile);
void udhcp_logging(int level, const char *fmt, ...);
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 8c49334..5a4b33a 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -149,10 +149,10 @@ static char **fill_envp(struct dhcpMessage *packet)
envp = xzalloc(sizeof(char *) * (num_options + 5));
j = 0;
- envp[j++] = bb_xasprintf("interface=%s", client_config.interface);
- envp[j++] = bb_xasprintf("PATH=%s",
+ envp[j++] = xasprintf("interface=%s", client_config.interface);
+ envp[j++] = xasprintf("PATH=%s",
getenv("PATH") ? : "/bin:/usr/bin:/sbin:/usr/sbin");
- envp[j++] = bb_xasprintf("HOME=%s", getenv("HOME") ? : "/");
+ envp[j++] = xasprintf("HOME=%s", getenv("HOME") ? : "/");
if (packet == NULL) return envp;
@@ -170,7 +170,7 @@ static char **fill_envp(struct dhcpMessage *packet)
/* Fill in a subnet bits option for things like /24 */
if (dhcp_options[i].code == DHCP_SUBNET) {
memcpy(&subnet, temp, 4);
- envp[j++] = bb_xasprintf("mask=%d", mton(&subnet));
+ envp[j++] = xasprintf("mask=%d", mton(&subnet));
}
}
if (packet->siaddr) {
@@ -180,12 +180,12 @@ static char **fill_envp(struct dhcpMessage *packet)
if (!(over & FILE_FIELD) && packet->file[0]) {
/* watch out for invalid packets */
packet->file[sizeof(packet->file) - 1] = '\0';
- envp[j++] = bb_xasprintf("boot_file=%s", packet->file);
+ envp[j++] = xasprintf("boot_file=%s", packet->file);
}
if (!(over & SNAME_FIELD) && packet->sname[0]) {
/* watch out for invalid packets */
packet->sname[sizeof(packet->sname) - 1] = '\0';
- envp[j++] = bb_xasprintf("sname=%s", packet->sname);
+ envp[j++] = xasprintf("sname=%s", packet->sname);
}
return envp;
}
diff --git a/networking/vconfig.c b/networking/vconfig.c
index 6cbbb54..b90f410 100644
--- a/networking/vconfig.c
+++ b/networking/vconfig.c
@@ -9,14 +9,8 @@
/* BB_AUDIT SUSv3 N/A */
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <string.h>
-#include <limits.h>
#include "busybox.h"
+#include <net/if.h>
/* Stuff from linux/if_vlan.h, kernel version 2.4.23 */
enum vlan_ioctl_cmds {
@@ -124,7 +118,7 @@ int vconfig_main(int argc, char **argv)
/* Don't bother closing the filedes. It will be closed on cleanup. */
/* Will die if 802.1q is not present */
- bb_xopen3(conf_file_name, O_RDONLY, 0);
+ xopen3(conf_file_name, O_RDONLY, 0);
memset(&ifr, 0, sizeof(struct vlan_ioctl_args));
@@ -159,7 +153,7 @@ int vconfig_main(int argc, char **argv)
}
}
- fd = bb_xsocket(AF_INET, SOCK_STREAM, 0);
+ fd = xsocket(AF_INET, SOCK_STREAM, 0);
if (ioctl(fd, SIOCSIFVLAN, &ifr) < 0) {
bb_perror_msg_and_die("ioctl error for %s", *argv);
}
diff --git a/networking/wget.c b/networking/wget.c
index 6565bb1..1b7555a 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -7,9 +7,6 @@
*/
#include "busybox.h"
-#include <errno.h>
-#include <signal.h>
-#include <sys/ioctl.h>
#include <getopt.h>
@@ -221,7 +218,7 @@ int wget_main(int argc, char **argv)
if (use_proxy) {
proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy");
if (proxy && *proxy) {
- parse_url(bb_xstrdup(proxy), &server);
+ parse_url(xstrdup(proxy), &server);
} else {
use_proxy = 0;
}
@@ -263,7 +260,7 @@ int wget_main(int argc, char **argv)
output = stdout;
quiet_flag = TRUE;
} else {
- output = bb_xfopen(fname_out, (do_continue ? "a" : "w"));
+ output = xfopen(fname_out, (do_continue ? "a" : "w"));
}
/*
@@ -396,9 +393,9 @@ read_response:
}
if (strcasecmp(buf, "location") == 0) {
if (s[0] == '/')
- target.path = bb_xstrdup(s+1);
+ target.path = xstrdup(s+1);
else {
- parse_url(bb_xstrdup(s), &target);
+ parse_url(xstrdup(s), &target);
if (use_proxy == 0) {
server.host = target.host;
server.port = target.port;
@@ -419,7 +416,7 @@ read_response:
* FTP session
*/
if (! target.user)
- target.user = bb_xstrdup("anonymous:busybox@");
+ target.user = xstrdup("anonymous:busybox@");
sfp = open_socket(&s_in);
if (ftpcmd(NULL, NULL, sfp, buf) != 220)
@@ -556,7 +553,7 @@ void parse_url(char *url, struct host_info *h)
*sp++ = '\0';
h->path = sp;
} else
- h->path = bb_xstrdup("");
+ h->path = xstrdup("");
up = strrchr(h->host, '@');
if (up != NULL) {