summaryrefslogtreecommitdiff
path: root/networking/route.c
diff options
context:
space:
mode:
authorRob Landley2006-08-03 15:41:12 +0000
committerRob Landley2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /networking/route.c
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.zip
busybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'networking/route.c')
-rw-r--r--networking/route.c30
1 files changed, 8 insertions, 22 deletions
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);
}