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