2013-12-17 15:59:29 +00:00
|
|
|
--- a/ip/Makefile
|
|
|
|
+++ b/ip/Makefile
|
2022-08-06 07:41:38 +00:00
|
|
|
@@ -19,6 +19,13 @@ RTMONOBJ=rtmon.o
|
2017-11-28 07:15:50 +00:00
|
|
|
|
|
|
|
include ../config.mk
|
2013-12-17 15:59:29 +00:00
|
|
|
|
|
|
|
+STATIC_SYM_FILTER:=
|
|
|
|
+ifeq ($(IP_CONFIG_TINY),y)
|
|
|
|
+ STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
|
|
|
|
+ CFLAGS += -DIPROUTE2_TINY
|
|
|
|
+endif
|
|
|
|
+STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
|
|
|
|
+
|
|
|
|
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
|
2022-08-05 10:11:28 +00:00
|
|
|
SCRIPTS=routel
|
2013-12-17 15:59:29 +00:00
|
|
|
TARGETS=ip rtmon
|
2022-08-06 07:41:38 +00:00
|
|
|
@@ -48,7 +55,7 @@ else
|
2013-12-17 15:59:29 +00:00
|
|
|
|
|
|
|
ip: static-syms.o
|
|
|
|
static-syms.o: static-syms.h
|
|
|
|
-static-syms.h: $(wildcard *.c)
|
|
|
|
+static-syms.h: $(STATIC_SYM_SOURCES)
|
|
|
|
files="$^" ; \
|
|
|
|
for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
|
|
|
|
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
|
|
|
--- a/ip/ip.c
|
|
|
|
+++ b/ip/ip.c
|
2021-07-27 18:13:40 +00:00
|
|
|
@@ -64,11 +64,17 @@ static void usage(void)
|
2017-12-06 21:14:09 +00:00
|
|
|
fprintf(stderr,
|
2019-09-26 00:13:14 +00:00
|
|
|
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
|
|
|
" ip [ -force ] -batch filename\n"
|
2017-12-06 21:14:09 +00:00
|
|
|
+#ifndef IPROUTE2_TINY
|
2022-08-05 10:11:28 +00:00
|
|
|
"where OBJECT := { address | addrlabel | amt | fou | help | ila | ioam | l2tp |\n"
|
|
|
|
" link | macsec | maddress | monitor | mptcp | mroute | mrule |\n"
|
2021-09-11 19:17:39 +00:00
|
|
|
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
|
|
|
|
" ntbl | route | rule | sr | tap | tcpmetrics |\n"
|
|
|
|
" token | tunnel | tuntap | vrf | xfrm }\n"
|
2017-12-06 21:14:09 +00:00
|
|
|
+#else
|
2022-08-06 21:35:12 +00:00
|
|
|
+ "where OBJECT := { address | link | maddress | monitor |\n"
|
|
|
|
+ " neighbor | neighbour | netns | route |\n"
|
|
|
|
+ " rule | token | tunnel }\n"
|
2017-12-06 21:14:09 +00:00
|
|
|
+#endif
|
2019-09-26 00:13:14 +00:00
|
|
|
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
|
|
|
|
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
|
|
|
|
" -f[amily] { inet | inet6 | mpls | bridge | link } |\n"
|
2022-08-06 21:35:12 +00:00
|
|
|
@@ -91,37 +97,49 @@ static const struct cmd {
|
2013-12-17 15:59:29 +00:00
|
|
|
int (*func)(int argc, char **argv);
|
|
|
|
} cmds[] = {
|
2014-06-17 12:43:30 +00:00
|
|
|
{ "address", do_ipaddr },
|
2013-12-17 15:59:29 +00:00
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "addrlabel", do_ipaddrlabel },
|
|
|
|
+#endif
|
|
|
|
{ "maddress", do_multiaddr },
|
|
|
|
{ "route", do_iproute },
|
|
|
|
{ "rule", do_iprule },
|
|
|
|
{ "neighbor", do_ipneigh },
|
|
|
|
{ "neighbour", do_ipneigh },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "ntable", do_ipntable },
|
|
|
|
{ "ntbl", do_ipntable },
|
|
|
|
+#endif
|
|
|
|
{ "link", do_iplink },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "l2tp", do_ipl2tp },
|
2016-01-03 20:56:45 +00:00
|
|
|
{ "fou", do_ipfou },
|
2017-03-20 21:53:46 +00:00
|
|
|
{ "ila", do_ipila },
|
|
|
|
{ "macsec", do_ipmacsec },
|
2022-08-06 21:35:12 +00:00
|
|
|
+#endif
|
2013-12-17 15:59:29 +00:00
|
|
|
{ "tunnel", do_iptunnel },
|
|
|
|
{ "tunl", do_iptunnel },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "tuntap", do_iptuntap },
|
|
|
|
{ "tap", do_iptuntap },
|
|
|
|
{ "token", do_iptoken },
|
|
|
|
{ "tcpmetrics", do_tcp_metrics },
|
2016-01-03 20:56:45 +00:00
|
|
|
{ "tcp_metrics", do_tcp_metrics },
|
2013-12-17 15:59:29 +00:00
|
|
|
+#endif
|
|
|
|
{ "monitor", do_ipmonitor },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "xfrm", do_xfrm },
|
|
|
|
{ "mroute", do_multiroute },
|
|
|
|
{ "mrule", do_multirule },
|
2022-08-06 21:35:12 +00:00
|
|
|
+#endif
|
2013-12-17 15:59:29 +00:00
|
|
|
{ "netns", do_netns },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "netconf", do_ipnetconf },
|
2017-03-20 21:53:46 +00:00
|
|
|
{ "vrf", do_ipvrf},
|
2017-10-01 19:46:27 +00:00
|
|
|
{ "sr", do_seg6 },
|
2019-09-26 00:13:14 +00:00
|
|
|
{ "nexthop", do_ipnh },
|
2020-08-24 09:47:25 +00:00
|
|
|
{ "mptcp", do_mptcp },
|
2021-11-07 23:32:18 +00:00
|
|
|
{ "ioam", do_ioam6 },
|
2019-09-26 00:13:14 +00:00
|
|
|
+#endif
|
2013-12-17 15:59:29 +00:00
|
|
|
{ "help", do_help },
|
2022-08-06 07:41:38 +00:00
|
|
|
{ "stats", do_ipstats },
|
2019-09-26 00:13:14 +00:00
|
|
|
{ 0 }
|
2013-12-17 15:59:29 +00:00
|
|
|
--- a/lib/Makefile
|
|
|
|
+++ b/lib/Makefile
|
2018-02-15 21:12:03 +00:00
|
|
|
@@ -3,6 +3,10 @@ include ../config.mk
|
2017-11-28 07:15:50 +00:00
|
|
|
|
|
|
|
CFLAGS += $(FPIC)
|
2013-12-17 15:59:29 +00:00
|
|
|
|
|
|
|
+ifeq ($(IP_CONFIG_TINY),y)
|
|
|
|
+ CFLAGS += -DIPROUTE2_TINY
|
|
|
|
+endif
|
|
|
|
+
|
2021-02-20 16:56:20 +00:00
|
|
|
UTILOBJ = utils.o utils_math.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \
|
|
|
|
inet_proto.o namespace.o json_writer.o json_print.o json_print_math.o \
|
|
|
|
names.o color.o bpf_legacy.o bpf_glue.o exec.o fs.o cg_map.o
|