summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/Kbuild5
-rw-r--r--networking/ip.c52
-rw-r--r--networking/ipaddr.c26
-rw-r--r--networking/iplink.c26
-rw-r--r--networking/iproute.c26
-rw-r--r--networking/iprule.c26
-rw-r--r--networking/iptunnel.c26
7 files changed, 51 insertions, 136 deletions
diff --git a/networking/Kbuild b/networking/Kbuild
index 68d3613..13b4452 100644
--- a/networking/Kbuild
+++ b/networking/Kbuild
@@ -19,11 +19,6 @@ lib-$(CONFIG_IFUPDOWN) += ifupdown.o
lib-$(CONFIG_INETD) += inetd.o
lib-$(CONFIG_IP) += ip.o
lib-$(CONFIG_IPCALC) += ipcalc.o
-lib-$(CONFIG_IPADDR) += ipaddr.o
-lib-$(CONFIG_IPLINK) += iplink.o
-lib-$(CONFIG_IPROUTE) += iproute.o
-lib-$(CONFIG_IPRULE) += iprule.o
-lib-$(CONFIG_IPTUNNEL) += iptunnel.o
lib-$(CONFIG_NAMEIF) += nameif.o
lib-$(CONFIG_NC) += nc.o
lib-$(CONFIG_NETSTAT) += netstat.o
diff --git a/networking/ip.c b/networking/ip.c
index dc9ca1f..dd1d863 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -22,6 +22,57 @@ static int ATTRIBUTE_NORETURN ip_print_help(int ATTRIBUTE_UNUSED ac, char ATTRIB
{
bb_show_usage();
}
+
+static int (*ip_func)(int argc, char **argv) = ip_print_help;
+
+static int ip_do(int argc, char **argv)
+{
+ ip_parse_common_args(&argc, &argv);
+ return ip_func(argc-1, argv+1);
+}
+
+#if ENABLE_FEATURE_IP_ADDRESS
+int ipaddr_main(int argc, char **argv);
+int ipaddr_main(int argc, char **argv)
+{
+ ip_func = do_ipaddr;
+ return ip_do(argc, argv);
+}
+#endif
+#if ENABLE_FEATURE_IP_LINK
+int iplink_main(int argc, char **argv);
+int iplink_main(int argc, char **argv)
+{
+ ip_func = do_iplink;
+ return ip_do(argc, argv);
+}
+#endif
+#if ENABLE_FEATURE_IP_ROUTE
+int iproute_main(int argc, char **argv);
+int iproute_main(int argc, char **argv)
+{
+ ip_func = do_iproute;
+ return ip_do(argc, argv);
+}
+#endif
+#if ENABLE_FEATURE_IP_RULE
+int iprule_main(int argc, char **argv);
+int iprule_main(int argc, char **argv)
+{
+ ip_func = do_iprule;
+ return ip_do(argc, argv);
+}
+#endif
+#if ENABLE_FEATURE_IP_TUNNEL
+int iptunnel_main(int argc, char **argv);
+int iptunnel_main(int argc, char **argv)
+{
+ ip_func = do_iptunnel;
+ return ip_do(argc, argv);
+}
+#endif
+
+
int ip_main(int argc, char **argv);
int ip_main(int argc, char **argv)
{
@@ -41,7 +92,6 @@ int ip_main(int argc, char **argv)
USE_FEATURE_IP_RULE(IP_rule,)
IP_none
};
- int (*ip_func)(int argc, char **argv) = ip_print_help;
ip_parse_common_args(&argc, &argv);
if (argc > 1) {
diff --git a/networking/ipaddr.c b/networking/ipaddr.c
deleted file mode 100644
index fb02137..0000000
--- a/networking/ipaddr.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * ip.c "ip" utility frontend.
- *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
- *
- * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *
- *
- * Changes:
- *
- * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
- */
-
-#include "libiproute/utils.h"
-#include "libiproute/ip_common.h"
-
-#include "busybox.h"
-
-int ipaddr_main(int argc, char **argv);
-int ipaddr_main(int argc, char **argv)
-{
- ip_parse_common_args(&argc, &argv);
-
- return do_ipaddr(argc-1, argv+1);
-}
diff --git a/networking/iplink.c b/networking/iplink.c
deleted file mode 100644
index 54087e9..0000000
--- a/networking/iplink.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * ip.c "ip" utility frontend.
- *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
- *
- * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *
- *
- * Changes:
- *
- * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
- */
-
-#include "libiproute/utils.h"
-#include "libiproute/ip_common.h"
-
-#include "busybox.h"
-
-int iplink_main(int argc, char **argv);
-int iplink_main(int argc, char **argv)
-{
- ip_parse_common_args(&argc, &argv);
-
- return do_iplink(argc-1, argv+1);
-}
diff --git a/networking/iproute.c b/networking/iproute.c
deleted file mode 100644
index 3d540b2..0000000
--- a/networking/iproute.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * ip.c "ip" utility frontend.
- *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
- *
- * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *
- *
- * Changes:
- *
- * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
- */
-
-#include "libiproute/utils.h"
-#include "libiproute/ip_common.h"
-
-#include "busybox.h"
-
-int iproute_main(int argc, char **argv);
-int iproute_main(int argc, char **argv)
-{
- ip_parse_common_args(&argc, &argv);
-
- return do_iproute(argc-1, argv+1);
-}
diff --git a/networking/iprule.c b/networking/iprule.c
deleted file mode 100644
index 9c1fb50..0000000
--- a/networking/iprule.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * ip.c "ip" utility frontend.
- *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
- *
- * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *
- *
- * Changes:
- *
- * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
- */
-
-#include "libiproute/utils.h"
-#include "libiproute/ip_common.h"
-
-#include "busybox.h"
-
-int iprule_main(int argc, char **argv);
-int iprule_main(int argc, char **argv)
-{
- ip_parse_common_args(&argc, &argv);
-
- return do_iprule(argc-1, argv+1);
-}
diff --git a/networking/iptunnel.c b/networking/iptunnel.c
deleted file mode 100644
index 8a65413..0000000
--- a/networking/iptunnel.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * ip.c "ip" utility frontend.
- *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
- *
- * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *
- *
- * Changes:
- *
- * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
- */
-
-#include "libiproute/utils.h"
-#include "libiproute/ip_common.h"
-
-#include "busybox.h"
-
-int iptunnel_main(int argc, char **argv);
-int iptunnel_main(int argc, char **argv)
-{
- ip_parse_common_args(&argc, &argv);
-
- return do_iptunnel(argc-1, argv+1);
-}