2013-12-17 15:59:29 +00:00
|
|
|
--- a/ip/Makefile
|
|
|
|
+++ b/ip/Makefile
|
2015-01-17 10:58:22 +00:00
|
|
|
@@ -16,6 +16,13 @@ ifeq ($(IP_CONFIG_SETNS),y)
|
2013-12-17 15:59:29 +00:00
|
|
|
CFLAGS += -DHAVE_SETNS
|
|
|
|
endif
|
|
|
|
|
|
|
|
+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)
|
|
|
|
SCRIPTS=ifcfg rtpr routel routef
|
|
|
|
TARGETS=ip rtmon
|
2015-01-17 10:58:22 +00:00
|
|
|
@@ -43,7 +50,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
|
2015-02-17 14:14:39 +00:00
|
|
|
@@ -71,30 +71,42 @@ 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 },
|
2015-01-17 10:58:22 +00:00
|
|
|
{ "fou", do_ipfou },
|
2013-12-17 15:59:29 +00:00
|
|
|
+#endif
|
|
|
|
{ "tunnel", do_iptunnel },
|
|
|
|
{ "tunl", do_iptunnel },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "tuntap", do_iptuntap },
|
|
|
|
{ "tap", do_iptuntap },
|
|
|
|
{ "token", do_iptoken },
|
|
|
|
{ "tcpmetrics", do_tcp_metrics },
|
|
|
|
{ "tcp_metrics",do_tcp_metrics },
|
|
|
|
+#endif
|
|
|
|
{ "monitor", do_ipmonitor },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "xfrm", do_xfrm },
|
|
|
|
+#endif
|
|
|
|
{ "mroute", do_multiroute },
|
|
|
|
{ "mrule", do_multirule },
|
|
|
|
{ "netns", do_netns },
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
{ "netconf", do_ipnetconf },
|
|
|
|
+#endif
|
|
|
|
{ "help", do_help },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
--- a/lib/utils.c
|
|
|
|
+++ b/lib/utils.c
|
2015-02-17 14:14:39 +00:00
|
|
|
@@ -630,6 +630,7 @@ const char *rt_addr_n2a(int af, const vo
|
2013-12-17 15:59:29 +00:00
|
|
|
case AF_INET:
|
|
|
|
case AF_INET6:
|
|
|
|
return inet_ntop(af, addr, buf, buflen);
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
case AF_IPX:
|
|
|
|
return ipx_ntop(af, addr, buf, buflen);
|
|
|
|
case AF_DECnet:
|
2015-02-17 14:14:39 +00:00
|
|
|
@@ -638,6 +639,7 @@ const char *rt_addr_n2a(int af, const vo
|
2013-12-17 15:59:29 +00:00
|
|
|
memcpy(dna.a_addr, addr, 2);
|
|
|
|
return dnet_ntop(af, &dna, buf, buflen);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
default:
|
|
|
|
return "???";
|
|
|
|
}
|
2015-02-17 14:14:39 +00:00
|
|
|
@@ -713,6 +715,7 @@ const char *format_host(int af, int len,
|
2013-12-17 15:59:29 +00:00
|
|
|
case AF_INET6:
|
|
|
|
len = 16;
|
|
|
|
break;
|
|
|
|
+#ifndef IPROUTE2_TINY
|
|
|
|
case AF_IPX:
|
|
|
|
len = 10;
|
|
|
|
break;
|
2015-02-17 14:14:39 +00:00
|
|
|
@@ -723,6 +726,7 @@ const char *format_host(int af, int len,
|
2013-12-17 15:59:29 +00:00
|
|
|
len = 2;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
+#endif
|
|
|
|
default: ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--- a/lib/Makefile
|
|
|
|
+++ b/lib/Makefile
|
2015-02-17 14:14:39 +00:00
|
|
|
@@ -4,6 +4,10 @@ ifeq ($(IP_CONFIG_SETNS),y)
|
|
|
|
CFLAGS += -DHAVE_SETNS
|
|
|
|
endif
|
2013-12-17 15:59:29 +00:00
|
|
|
|
|
|
|
+ifeq ($(IP_CONFIG_TINY),y)
|
|
|
|
+ CFLAGS += -DIPROUTE2_TINY
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
CFLAGS += $(FPIC)
|
|
|
|
|
2015-02-17 14:14:39 +00:00
|
|
|
UTILOBJ=utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o inet_proto.o namespace.o
|