3 @@ -15,6 +15,13 @@ RTMONOBJ=rtmon.o
8 +ifeq ($(IP_CONFIG_TINY),y)
9 + STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
10 + CFLAGS += -DIPROUTE2_TINY
12 +STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
14 ALLOBJ=$(IPOBJ) $(RTMONOBJ)
15 SCRIPTS=ifcfg rtpr routel routef
17 @@ -44,7 +51,7 @@ else
20 static-syms.o: static-syms.h
21 -static-syms.h: $(wildcard *.c)
22 +static-syms.h: $(STATIC_SYM_SOURCES)
24 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
25 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
28 @@ -49,10 +49,16 @@ static void usage(void)
30 "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
31 " ip [ -force ] -batch filename\n"
32 +#ifndef IPROUTE2_TINY
33 "where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n"
34 " tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
35 " netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n"
38 +"where OBJECT := { link | address | route | rule | neigh | tunnel | maddress |\n"
39 +" mroute | mrule | monitor | netns | macsec | token | ila |\n"
42 " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
43 " -h[uman-readable] | -iec |\n"
44 " -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |\n"
45 @@ -74,32 +80,44 @@ static const struct cmd {
46 int (*func)(int argc, char **argv);
48 { "address", do_ipaddr },
49 +#ifndef IPROUTE2_TINY
50 { "addrlabel", do_ipaddrlabel },
52 { "maddress", do_multiaddr },
53 { "route", do_iproute },
54 { "rule", do_iprule },
55 { "neighbor", do_ipneigh },
56 { "neighbour", do_ipneigh },
57 +#ifndef IPROUTE2_TINY
58 { "ntable", do_ipntable },
59 { "ntbl", do_ipntable },
61 { "link", do_iplink },
62 +#ifndef IPROUTE2_TINY
63 { "l2tp", do_ipl2tp },
67 { "macsec", do_ipmacsec },
68 { "tunnel", do_iptunnel },
69 { "tunl", do_iptunnel },
70 +#ifndef IPROUTE2_TINY
71 { "tuntap", do_iptuntap },
72 { "tap", do_iptuntap },
73 { "token", do_iptoken },
74 { "tcpmetrics", do_tcp_metrics },
75 { "tcp_metrics", do_tcp_metrics },
77 { "monitor", do_ipmonitor },
78 +#ifndef IPROUTE2_TINY
81 { "mroute", do_multiroute },
82 { "mrule", do_multirule },
83 { "netns", do_netns },
84 +#ifndef IPROUTE2_TINY
85 { "netconf", do_ipnetconf },
92 @@ -817,6 +817,7 @@ const char *rt_addr_n2a_r(int af, int le
93 return inet_ntop(af, addr, buf, buflen);
95 return mpls_ntop(af, addr, buf, buflen);
96 +#ifndef IPROUTE2_TINY
98 return ipx_ntop(af, addr, buf, buflen);
100 @@ -826,6 +827,7 @@ const char *rt_addr_n2a_r(int af, int le
101 memcpy(dna.a_addr, addr, 2);
102 return dnet_ntop(af, &dna, buf, buflen);
106 return ll_addr_n2a(addr, len, ARPHRD_VOID, buf, buflen);
110 @@ -2,6 +2,10 @@ include ../config.mk
114 +ifeq ($(IP_CONFIG_TINY),y)
115 + CFLAGS += -DIPROUTE2_TINY
118 UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \
119 inet_proto.o namespace.o json_writer.o json_print.o \
120 names.o color.o bpf.o exec.o fs.o