iproute2: bump to 4.13
[openwrt/openwrt.git] / package / network / utils / iproute2 / patches / 300-ip_tiny.patch
1 --- a/ip/Makefile
2 +++ b/ip/Makefile
3 @@ -28,6 +28,13 @@ ifeq ($(HAVE_MNL),y)
4 LDLIBS += $(shell $(PKG_CONFIG) libmnl --libs)
5 endif
6
7 +STATIC_SYM_FILTER:=
8 +ifeq ($(IP_CONFIG_TINY),y)
9 + STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
10 + CFLAGS += -DIPROUTE2_TINY
11 +endif
12 +STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
13 +
14 ALLOBJ=$(IPOBJ) $(RTMONOBJ)
15 SCRIPTS=ifcfg rtpr routel routef
16 TARGETS=ip rtmon
17 @@ -57,7 +64,7 @@ else
18
19 ip: static-syms.o
20 static-syms.o: static-syms.h
21 -static-syms.h: $(wildcard *.c)
22 +static-syms.h: $(STATIC_SYM_SOURCES)
23 files="$^" ; \
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 ; \
26 --- a/ip/ip.c
27 +++ b/ip/ip.c
28 @@ -74,32 +74,44 @@ static const struct cmd {
29 int (*func)(int argc, char **argv);
30 } cmds[] = {
31 { "address", do_ipaddr },
32 +#ifndef IPROUTE2_TINY
33 { "addrlabel", do_ipaddrlabel },
34 +#endif
35 { "maddress", do_multiaddr },
36 { "route", do_iproute },
37 { "rule", do_iprule },
38 { "neighbor", do_ipneigh },
39 { "neighbour", do_ipneigh },
40 +#ifndef IPROUTE2_TINY
41 { "ntable", do_ipntable },
42 { "ntbl", do_ipntable },
43 +#endif
44 { "link", do_iplink },
45 +#ifndef IPROUTE2_TINY
46 { "l2tp", do_ipl2tp },
47 { "fou", do_ipfou },
48 +#endif
49 { "ila", do_ipila },
50 { "macsec", do_ipmacsec },
51 { "tunnel", do_iptunnel },
52 { "tunl", do_iptunnel },
53 +#ifndef IPROUTE2_TINY
54 { "tuntap", do_iptuntap },
55 { "tap", do_iptuntap },
56 { "token", do_iptoken },
57 { "tcpmetrics", do_tcp_metrics },
58 { "tcp_metrics", do_tcp_metrics },
59 +#endif
60 { "monitor", do_ipmonitor },
61 +#ifndef IPROUTE2_TINY
62 { "xfrm", do_xfrm },
63 +#endif
64 { "mroute", do_multiroute },
65 { "mrule", do_multirule },
66 { "netns", do_netns },
67 +#ifndef IPROUTE2_TINY
68 { "netconf", do_ipnetconf },
69 +#endif
70 { "vrf", do_ipvrf},
71 { "sr", do_seg6 },
72 { "help", do_help },
73 --- a/lib/utils.c
74 +++ b/lib/utils.c
75 @@ -787,6 +787,7 @@ const char *rt_addr_n2a_r(int af, int le
76 return inet_ntop(af, addr, buf, buflen);
77 case AF_MPLS:
78 return mpls_ntop(af, addr, buf, buflen);
79 +#ifndef IPROUTE2_TINY
80 case AF_IPX:
81 return ipx_ntop(af, addr, buf, buflen);
82 case AF_DECnet:
83 @@ -796,6 +797,7 @@ const char *rt_addr_n2a_r(int af, int le
84 memcpy(dna.a_addr, addr, 2);
85 return dnet_ntop(af, &dna, buf, buflen);
86 }
87 +#endif
88 case AF_PACKET:
89 return ll_addr_n2a(addr, len, ARPHRD_VOID, buf, buflen);
90 default:
91 --- a/lib/Makefile
92 +++ b/lib/Makefile
93 @@ -12,6 +12,10 @@ ifeq ($(HAVE_MNL),y)
94 CFLAGS += -DHAVE_LIBMNL $(shell $(PKG_CONFIG) libmnl --cflags)
95 endif
96
97 +ifeq ($(IP_CONFIG_TINY),y)
98 + CFLAGS += -DIPROUTE2_TINY
99 +endif
100 +
101 CFLAGS += $(FPIC)
102
103 UTILOBJ = utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o \