iproute2: bump version from v3.18.0 to v3.19.0
[openwrt/staging/mkresin.git] / package / network / utils / iproute2 / patches / 300-ip_tiny.patch
1 --- a/ip/Makefile
2 +++ b/ip/Makefile
3 @@ -16,6 +16,13 @@ ifeq ($(IP_CONFIG_SETNS),y)
4 CFLAGS += -DHAVE_SETNS
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 @@ -43,7 +50,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 @@ -71,30 +71,42 @@ 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 { "tunnel", do_iptunnel },
50 { "tunl", do_iptunnel },
51 +#ifndef IPROUTE2_TINY
52 { "tuntap", do_iptuntap },
53 { "tap", do_iptuntap },
54 { "token", do_iptoken },
55 { "tcpmetrics", do_tcp_metrics },
56 { "tcp_metrics",do_tcp_metrics },
57 +#endif
58 { "monitor", do_ipmonitor },
59 +#ifndef IPROUTE2_TINY
60 { "xfrm", do_xfrm },
61 +#endif
62 { "mroute", do_multiroute },
63 { "mrule", do_multirule },
64 { "netns", do_netns },
65 +#ifndef IPROUTE2_TINY
66 { "netconf", do_ipnetconf },
67 +#endif
68 { "help", do_help },
69 { 0 }
70 };
71 --- a/lib/utils.c
72 +++ b/lib/utils.c
73 @@ -630,6 +630,7 @@ const char *rt_addr_n2a(int af, const vo
74 case AF_INET:
75 case AF_INET6:
76 return inet_ntop(af, addr, buf, buflen);
77 +#ifndef IPROUTE2_TINY
78 case AF_IPX:
79 return ipx_ntop(af, addr, buf, buflen);
80 case AF_DECnet:
81 @@ -638,6 +639,7 @@ const char *rt_addr_n2a(int af, const vo
82 memcpy(dna.a_addr, addr, 2);
83 return dnet_ntop(af, &dna, buf, buflen);
84 }
85 +#endif
86 default:
87 return "???";
88 }
89 @@ -713,6 +715,7 @@ const char *format_host(int af, int len,
90 case AF_INET6:
91 len = 16;
92 break;
93 +#ifndef IPROUTE2_TINY
94 case AF_IPX:
95 len = 10;
96 break;
97 @@ -723,6 +726,7 @@ const char *format_host(int af, int len,
98 len = 2;
99 break;
100 #endif
101 +#endif
102 default: ;
103 }
104 }
105 --- a/lib/Makefile
106 +++ b/lib/Makefile
107 @@ -4,6 +4,10 @@ ifeq ($(IP_CONFIG_SETNS),y)
108 CFLAGS += -DHAVE_SETNS
109 endif
110
111 +ifeq ($(IP_CONFIG_TINY),y)
112 + CFLAGS += -DIPROUTE2_TINY
113 +endif
114 +
115 CFLAGS += $(FPIC)
116
117 UTILOBJ=utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o inet_proto.o namespace.o