diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/Config.src | 2 | ||||
-rw-r--r-- | networking/ifupdown.c | 36 | ||||
-rw-r--r-- | networking/ip.c | 162 | ||||
-rw-r--r-- | networking/libiproute/Kbuild.src | 3 | ||||
-rw-r--r-- | networking/libiproute/iproute.c | 24 | ||||
-rw-r--r-- | networking/libiproute/iprule.c | 11 | ||||
-rw-r--r-- | networking/tcpudp.c | 6 | ||||
-rw-r--r-- | networking/udhcp/Config.src | 2 | ||||
-rw-r--r-- | networking/udhcp/Kbuild.src | 2 |
9 files changed, 129 insertions, 119 deletions
diff --git a/networking/Config.src b/networking/Config.src index 527bdd15d..0adb1e2f9 100644 --- a/networking/Config.src +++ b/networking/Config.src | |||
@@ -53,7 +53,7 @@ source networking/udhcp/Config.in | |||
53 | config IFUPDOWN_UDHCPC_CMD_OPTIONS | 53 | config IFUPDOWN_UDHCPC_CMD_OPTIONS |
54 | string "ifup udhcpc command line options" | 54 | string "ifup udhcpc command line options" |
55 | default "-R -n" | 55 | default "-R -n" |
56 | depends on IFUPDOWN && UDHCPC | 56 | depends on IFUP || IFDOWN |
57 | help | 57 | help |
58 | Command line options to pass to udhcpc from ifup. | 58 | Command line options to pass to udhcpc from ifup. |
59 | Intended to alter options not available in /etc/network/interfaces. | 59 | Intended to alter options not available in /etc/network/interfaces. |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 7ac517afd..1806a6ccc 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -51,41 +51,19 @@ | |||
51 | //config: This config option defines location of ifstate. | 51 | //config: This config option defines location of ifstate. |
52 | //config: | 52 | //config: |
53 | //config:config FEATURE_IFUPDOWN_IP | 53 | //config:config FEATURE_IFUPDOWN_IP |
54 | //config: bool "Use ip applet" | 54 | //config: bool "Use ip tool (else ifconfig/route is used)" |
55 | //config: default y | 55 | //config: default y |
56 | //config: depends on IFUP || IFDOWN | 56 | //config: depends on IFUP || IFDOWN |
57 | //config: help | 57 | //config: help |
58 | //config: Use the iproute "ip" command to implement "ifup" and "ifdown", rather | 58 | //config: Use the iproute "ip" command to implement "ifup" and "ifdown", rather |
59 | //config: than the default of using the older 'ifconfig' and 'route' utilities. | 59 | //config: than the default of using the older "ifconfig" and "route" utilities. |
60 | //config: | 60 | //config: |
61 | //config:config FEATURE_IFUPDOWN_IP_BUILTIN | 61 | //config: If Y: you must install either the full-blown iproute2 package |
62 | //config: bool "Use busybox ip applet" | 62 | //config: or enable "ip" applet in Busybox, or the "ifup" and "ifdown" applets |
63 | //config: default y | 63 | //config: will not work. |
64 | //config: depends on FEATURE_IFUPDOWN_IP | ||
65 | //config: select PLATFORM_LINUX | ||
66 | //config: select IP | ||
67 | //config: select FEATURE_IP_ADDRESS | ||
68 | //config: select FEATURE_IP_LINK | ||
69 | //config: select FEATURE_IP_ROUTE | ||
70 | //config: help | ||
71 | //config: Use the busybox iproute "ip" applet to implement "ifupdown". | ||
72 | //config: | ||
73 | //config: If left disabled, you must install the full-blown iproute2 | ||
74 | //config: utility or the "ifup" and "ifdown" applets will not work. | ||
75 | //config: | ||
76 | //config:config FEATURE_IFUPDOWN_IFCONFIG_BUILTIN | ||
77 | //config: bool "Use busybox ifconfig and route applets" | ||
78 | //config: default n | ||
79 | //config: depends on (IFUP || IFDOWN) && !FEATURE_IFUPDOWN_IP | ||
80 | //config: select IFCONFIG | ||
81 | //config: select ROUTE | ||
82 | //config: help | ||
83 | //config: Use the busybox iproute "ifconfig" and "route" applets to | ||
84 | //config: implement the "ifup" and "ifdown" utilities. | ||
85 | //config: | 64 | //config: |
86 | //config: If left disabled, you must install the full-blown ifconfig | 65 | //config: If N: you must install either the full-blown ifconfig and route |
87 | //config: and route utilities, or the "ifup" and "ifdown" applets will not | 66 | //config: utilities, or enable these applets in Busybox. |
88 | //config: work. | ||
89 | //config: | 67 | //config: |
90 | //config:config FEATURE_IFUPDOWN_IPV4 | 68 | //config:config FEATURE_IFUPDOWN_IPV4 |
91 | //config: bool "Support for IPv4" | 69 | //config: bool "Support for IPv4" |
diff --git a/networking/ip.c b/networking/ip.c index c3607b74f..939721e46 100644 --- a/networking/ip.c +++ b/networking/ip.c | |||
@@ -17,24 +17,72 @@ | |||
17 | //config: utility. You generally don't need "ip" to use busybox with | 17 | //config: utility. You generally don't need "ip" to use busybox with |
18 | //config: TCP/IP. | 18 | //config: TCP/IP. |
19 | //config: | 19 | //config: |
20 | //config:config IPADDR | ||
21 | //config: bool "ipaddr" | ||
22 | //config: default y | ||
23 | //config: select FEATURE_IP_ADDRESS | ||
24 | //config: select PLATFORM_LINUX | ||
25 | //config: help | ||
26 | //config: Support short form of ip addr: ipaddr | ||
27 | //config: | ||
28 | //config:config IPLINK | ||
29 | //config: bool "iplink" | ||
30 | //config: default y | ||
31 | //config: select FEATURE_IP_LINK | ||
32 | //config: select PLATFORM_LINUX | ||
33 | //config: help | ||
34 | //config: Support short form of ip link: iplink | ||
35 | //config: | ||
36 | //config:config IPROUTE | ||
37 | //config: bool "iproute" | ||
38 | //config: default y | ||
39 | //config: select FEATURE_IP_ROUTE | ||
40 | //config: select PLATFORM_LINUX | ||
41 | //config: help | ||
42 | //config: Support short form of ip route: iproute | ||
43 | //config: | ||
44 | //config:config IPTUNNEL | ||
45 | //config: bool "iptunnel" | ||
46 | //config: default y | ||
47 | //config: select FEATURE_IP_TUNNEL | ||
48 | //config: select PLATFORM_LINUX | ||
49 | //config: help | ||
50 | //config: Support short form of ip tunnel: iptunnel | ||
51 | //config: | ||
52 | //config:config IPRULE | ||
53 | //config: bool "iprule" | ||
54 | //config: default y | ||
55 | //config: select FEATURE_IP_RULE | ||
56 | //config: select PLATFORM_LINUX | ||
57 | //config: help | ||
58 | //config: Support short form of ip rule: iprule | ||
59 | //config: | ||
60 | //config:config IPNEIGH | ||
61 | //config: bool "ipneigh" | ||
62 | //config: default y | ||
63 | //config: select FEATURE_IP_NEIGH | ||
64 | //config: select PLATFORM_LINUX | ||
65 | //config: help | ||
66 | //config: Support short form of ip neigh: ipneigh | ||
67 | //config: | ||
20 | //config:config FEATURE_IP_ADDRESS | 68 | //config:config FEATURE_IP_ADDRESS |
21 | //config: bool "ip address" | 69 | //config: bool "ip address" |
22 | //config: default y | 70 | //config: default y |
23 | //config: depends on IP | 71 | //config: depends on IP || IPADDR |
24 | //config: help | 72 | //config: help |
25 | //config: Address manipulation support for the "ip" applet. | 73 | //config: Address manipulation support for the "ip" applet. |
26 | //config: | 74 | //config: |
27 | //config:config FEATURE_IP_LINK | 75 | //config:config FEATURE_IP_LINK |
28 | //config: bool "ip link" | 76 | //config: bool "ip link" |
29 | //config: default y | 77 | //config: default y |
30 | //config: depends on IP | 78 | //config: depends on IP || IPLINK |
31 | //config: help | 79 | //config: help |
32 | //config: Configure network devices with "ip". | 80 | //config: Configure network devices with "ip". |
33 | //config: | 81 | //config: |
34 | //config:config FEATURE_IP_ROUTE | 82 | //config:config FEATURE_IP_ROUTE |
35 | //config: bool "ip route" | 83 | //config: bool "ip route" |
36 | //config: default y | 84 | //config: default y |
37 | //config: depends on IP | 85 | //config: depends on IP || IPROUTE |
38 | //config: help | 86 | //config: help |
39 | //config: Add support for routing table management to "ip". | 87 | //config: Add support for routing table management to "ip". |
40 | //config: | 88 | //config: |
@@ -48,83 +96,35 @@ | |||
48 | //config:config FEATURE_IP_TUNNEL | 96 | //config:config FEATURE_IP_TUNNEL |
49 | //config: bool "ip tunnel" | 97 | //config: bool "ip tunnel" |
50 | //config: default y | 98 | //config: default y |
51 | //config: depends on IP | 99 | //config: depends on IP || IPTUNNEL |
52 | //config: help | 100 | //config: help |
53 | //config: Add support for tunneling commands to "ip". | 101 | //config: Add support for tunneling commands to "ip". |
54 | //config: | 102 | //config: |
55 | //config:config FEATURE_IP_RULE | 103 | //config:config FEATURE_IP_RULE |
56 | //config: bool "ip rule" | 104 | //config: bool "ip rule" |
57 | //config: default y | 105 | //config: default y |
58 | //config: depends on IP | 106 | //config: depends on IP || IPRULE |
59 | //config: help | 107 | //config: help |
60 | //config: Add support for rule commands to "ip". | 108 | //config: Add support for rule commands to "ip". |
61 | //config: | 109 | //config: |
62 | //config:config FEATURE_IP_NEIGH | 110 | //config:config FEATURE_IP_NEIGH |
63 | //config: bool "ip neighbor" | 111 | //config: bool "ip neighbor" |
64 | //config: default y | 112 | //config: default y |
65 | //config: depends on IP | 113 | //config: depends on IP || IPNEIGH |
66 | //config: help | 114 | //config: help |
67 | //config: Add support for neighbor commands to "ip". | 115 | //config: Add support for neighbor commands to "ip". |
68 | //config: | 116 | //config: |
69 | //config:config FEATURE_IP_SHORT_FORMS | ||
70 | //config: bool "Support short forms of ip commands" | ||
71 | //config: default y | ||
72 | //config: depends on IP | ||
73 | //config: help | ||
74 | //config: Also support short-form of ip <OBJECT> commands: | ||
75 | //config: ip addr -> ipaddr | ||
76 | //config: ip link -> iplink | ||
77 | //config: ip route -> iproute | ||
78 | //config: ip tunnel -> iptunnel | ||
79 | //config: ip rule -> iprule | ||
80 | //config: ip neigh -> ipneigh | ||
81 | //config: | ||
82 | //config: Say N unless you desparately need the short form of the ip | ||
83 | //config: object commands. | ||
84 | //config: | ||
85 | //config:config FEATURE_IP_RARE_PROTOCOLS | 117 | //config:config FEATURE_IP_RARE_PROTOCOLS |
86 | //config: bool "Support displaying rarely used link types" | 118 | //config: bool "Support displaying rarely used link types" |
87 | //config: default n | 119 | //config: default n |
88 | //config: depends on IP | 120 | //config: depends on IP || IPADDR || IPLINK || IPROUTE || IPTUNNEL || IPRULE || IPNEIGH |
89 | //config: help | 121 | //config: help |
90 | //config: If you are not going to use links of type "frad", "econet", | 122 | //config: If you are not going to use links of type "frad", "econet", |
91 | //config: "bif" etc, you probably don't need to enable this. | 123 | //config: "bif" etc, you probably don't need to enable this. |
92 | //config: Ethernet, wireless, infrared, ppp/slip, ip tunnelling | 124 | //config: Ethernet, wireless, infrared, ppp/slip, ip tunnelling |
93 | //config: link types are supported without this option selected. | 125 | //config: link types are supported without this option selected. |
94 | //config: | ||
95 | //config:config IPADDR | ||
96 | //config: bool | ||
97 | //config: default y | ||
98 | //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ADDRESS | ||
99 | //config: | ||
100 | //config:config IPLINK | ||
101 | //config: bool | ||
102 | //config: default y | ||
103 | //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_LINK | ||
104 | //config: | ||
105 | //config:config IPROUTE | ||
106 | //config: bool | ||
107 | //config: default y | ||
108 | //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ROUTE | ||
109 | //config: | ||
110 | //config:config IPTUNNEL | ||
111 | //config: bool | ||
112 | //config: default y | ||
113 | //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_TUNNEL | ||
114 | //config: | ||
115 | //config:config IPRULE | ||
116 | //config: bool | ||
117 | //config: default y | ||
118 | //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_RULE | ||
119 | //config: | ||
120 | //config:config IPNEIGH | ||
121 | //config: bool | ||
122 | //config: default y | ||
123 | //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_NEIGH | ||
124 | 126 | ||
125 | //applet:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK || ENABLE_FEATURE_IP_TUNNEL || ENABLE_FEATURE_IP_RULE || ENABLE_FEATURE_IP_NEIGH | ||
126 | //applet:IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP)) | 127 | //applet:IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP)) |
127 | //applet:#endif | ||
128 | //applet:IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP)) | 128 | //applet:IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP)) |
129 | //applet:IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP)) | 129 | //applet:IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP)) |
130 | //applet:IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP)) | 130 | //applet:IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP)) |
@@ -133,6 +133,12 @@ | |||
133 | //applet:IF_IPNEIGH(APPLET(ipneigh, BB_DIR_SBIN, BB_SUID_DROP)) | 133 | //applet:IF_IPNEIGH(APPLET(ipneigh, BB_DIR_SBIN, BB_SUID_DROP)) |
134 | 134 | ||
135 | //kbuild:lib-$(CONFIG_IP) += ip.o | 135 | //kbuild:lib-$(CONFIG_IP) += ip.o |
136 | //kbuild:lib-$(CONFIG_IPADDR) += ip.o | ||
137 | //kbuild:lib-$(CONFIG_IPLINK) += ip.o | ||
138 | //kbuild:lib-$(CONFIG_IPROUTE) += ip.o | ||
139 | //kbuild:lib-$(CONFIG_IPRULE) += ip.o | ||
140 | //kbuild:lib-$(CONFIG_IPTUNNEL) += ip.o | ||
141 | //kbuild:lib-$(CONFIG_IPNEIGH) += ip.o | ||
136 | 142 | ||
137 | /* would need to make the " | " optional depending on more than one selected: */ | 143 | /* would need to make the " | " optional depending on more than one selected: */ |
138 | //usage:#define ip_trivial_usage | 144 | //usage:#define ip_trivial_usage |
@@ -218,62 +224,57 @@ | |||
218 | #include "libiproute/utils.h" | 224 | #include "libiproute/utils.h" |
219 | #include "libiproute/ip_common.h" | 225 | #include "libiproute/ip_common.h" |
220 | 226 | ||
221 | #if ENABLE_FEATURE_IP_ADDRESS \ | ||
222 | || ENABLE_FEATURE_IP_ROUTE \ | ||
223 | || ENABLE_FEATURE_IP_LINK \ | ||
224 | || ENABLE_FEATURE_IP_TUNNEL \ | ||
225 | || ENABLE_FEATURE_IP_RULE \ | ||
226 | || ENABLE_FEATURE_IP_NEIGH | ||
227 | |||
228 | static int FAST_FUNC ip_print_help(char **argv UNUSED_PARAM) | ||
229 | { | ||
230 | bb_show_usage(); | ||
231 | } | ||
232 | |||
233 | typedef int FAST_FUNC (*ip_func_ptr_t)(char**); | 227 | typedef int FAST_FUNC (*ip_func_ptr_t)(char**); |
234 | 228 | ||
229 | #if ENABLE_IPADDR \ | ||
230 | || ENABLE_IPLINK \ | ||
231 | || ENABLE_IPROUTE \ | ||
232 | || ENABLE_IPRULE \ | ||
233 | || ENABLE_IPTUNNEL \ | ||
234 | || ENABLE_IPNEIGH | ||
235 | static int ip_do(ip_func_ptr_t ip_func, char **argv) | 235 | static int ip_do(ip_func_ptr_t ip_func, char **argv) |
236 | { | 236 | { |
237 | argv = ip_parse_common_args(argv + 1); | 237 | argv = ip_parse_common_args(argv + 1); |
238 | return ip_func(argv); | 238 | return ip_func(argv); |
239 | } | 239 | } |
240 | #endif | ||
240 | 241 | ||
241 | #if ENABLE_FEATURE_IP_ADDRESS | 242 | #if ENABLE_IPADDR |
242 | int ipaddr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 243 | int ipaddr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
243 | int ipaddr_main(int argc UNUSED_PARAM, char **argv) | 244 | int ipaddr_main(int argc UNUSED_PARAM, char **argv) |
244 | { | 245 | { |
245 | return ip_do(do_ipaddr, argv); | 246 | return ip_do(do_ipaddr, argv); |
246 | } | 247 | } |
247 | #endif | 248 | #endif |
248 | #if ENABLE_FEATURE_IP_LINK | 249 | #if ENABLE_IPLINK |
249 | int iplink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 250 | int iplink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
250 | int iplink_main(int argc UNUSED_PARAM, char **argv) | 251 | int iplink_main(int argc UNUSED_PARAM, char **argv) |
251 | { | 252 | { |
252 | return ip_do(do_iplink, argv); | 253 | return ip_do(do_iplink, argv); |
253 | } | 254 | } |
254 | #endif | 255 | #endif |
255 | #if ENABLE_FEATURE_IP_ROUTE | 256 | #if ENABLE_IPROUTE |
256 | int iproute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 257 | int iproute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
257 | int iproute_main(int argc UNUSED_PARAM, char **argv) | 258 | int iproute_main(int argc UNUSED_PARAM, char **argv) |
258 | { | 259 | { |
259 | return ip_do(do_iproute, argv); | 260 | return ip_do(do_iproute, argv); |
260 | } | 261 | } |
261 | #endif | 262 | #endif |
262 | #if ENABLE_FEATURE_IP_RULE | 263 | #if ENABLE_IPRULE |
263 | int iprule_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 264 | int iprule_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
264 | int iprule_main(int argc UNUSED_PARAM, char **argv) | 265 | int iprule_main(int argc UNUSED_PARAM, char **argv) |
265 | { | 266 | { |
266 | return ip_do(do_iprule, argv); | 267 | return ip_do(do_iprule, argv); |
267 | } | 268 | } |
268 | #endif | 269 | #endif |
269 | #if ENABLE_FEATURE_IP_TUNNEL | 270 | #if ENABLE_IPTUNNEL |
270 | int iptunnel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 271 | int iptunnel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
271 | int iptunnel_main(int argc UNUSED_PARAM, char **argv) | 272 | int iptunnel_main(int argc UNUSED_PARAM, char **argv) |
272 | { | 273 | { |
273 | return ip_do(do_iptunnel, argv); | 274 | return ip_do(do_iptunnel, argv); |
274 | } | 275 | } |
275 | #endif | 276 | #endif |
276 | #if ENABLE_FEATURE_IP_NEIGH | 277 | #if ENABLE_IPNEIGH |
277 | int ipneigh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 278 | int ipneigh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
278 | int ipneigh_main(int argc UNUSED_PARAM, char **argv) | 279 | int ipneigh_main(int argc UNUSED_PARAM, char **argv) |
279 | { | 280 | { |
@@ -281,11 +282,16 @@ int ipneigh_main(int argc UNUSED_PARAM, char **argv) | |||
281 | } | 282 | } |
282 | #endif | 283 | #endif |
283 | 284 | ||
285 | #if ENABLE_IP | ||
286 | static int FAST_FUNC ip_print_help(char **argv UNUSED_PARAM) | ||
287 | { | ||
288 | bb_show_usage(); | ||
289 | } | ||
284 | 290 | ||
285 | int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 291 | int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
286 | int ip_main(int argc UNUSED_PARAM, char **argv) | 292 | int ip_main(int argc UNUSED_PARAM, char **argv) |
287 | { | 293 | { |
288 | static const char keywords[] ALIGN1 = | 294 | static const char keywords[] ALIGN1 = "" |
289 | IF_FEATURE_IP_ADDRESS("address\0") | 295 | IF_FEATURE_IP_ADDRESS("address\0") |
290 | IF_FEATURE_IP_ROUTE("route\0") | 296 | IF_FEATURE_IP_ROUTE("route\0") |
291 | IF_FEATURE_IP_ROUTE("r\0") | 297 | IF_FEATURE_IP_ROUTE("r\0") |
@@ -310,10 +316,12 @@ int ip_main(int argc UNUSED_PARAM, char **argv) | |||
310 | int key; | 316 | int key; |
311 | 317 | ||
312 | argv = ip_parse_common_args(argv + 1); | 318 | argv = ip_parse_common_args(argv + 1); |
313 | key = *argv ? index_in_substrings(keywords, *argv++) : -1; | 319 | if (ARRAY_SIZE(ip_func_ptrs) > 1 && *argv) |
320 | key = index_in_substrings(keywords, *argv++); | ||
321 | else | ||
322 | key = -1; | ||
314 | ip_func = ip_func_ptrs[key + 1]; | 323 | ip_func = ip_func_ptrs[key + 1]; |
315 | 324 | ||
316 | return ip_func(argv); | 325 | return ip_func(argv); |
317 | } | 326 | } |
318 | 327 | #endif | |
319 | #endif /* any of ENABLE_FEATURE_IP_xxx is 1 */ | ||
diff --git a/networking/libiproute/Kbuild.src b/networking/libiproute/Kbuild.src index c20e2fee8..056a58540 100644 --- a/networking/libiproute/Kbuild.src +++ b/networking/libiproute/Kbuild.src | |||
@@ -62,13 +62,16 @@ lib-$(CONFIG_FEATURE_IP_TUNNEL) += \ | |||
62 | lib-$(CONFIG_FEATURE_IP_RULE) += \ | 62 | lib-$(CONFIG_FEATURE_IP_RULE) += \ |
63 | ip_parse_common_args.o \ | 63 | ip_parse_common_args.o \ |
64 | iprule.o \ | 64 | iprule.o \ |
65 | libnetlink.o \ | ||
65 | rt_names.o \ | 66 | rt_names.o \ |
67 | rtm_map.o \ | ||
66 | utils.o | 68 | utils.o |
67 | 69 | ||
68 | lib-$(CONFIG_FEATURE_IP_NEIGH) += \ | 70 | lib-$(CONFIG_FEATURE_IP_NEIGH) += \ |
69 | ip_parse_common_args.o \ | 71 | ip_parse_common_args.o \ |
70 | ipneigh.o \ | 72 | ipneigh.o \ |
71 | libnetlink.o \ | 73 | libnetlink.o \ |
74 | ll_addr.o \ | ||
72 | ll_map.o \ | 75 | ll_map.o \ |
73 | rt_names.o \ | 76 | rt_names.o \ |
74 | utils.o | 77 | utils.o |
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 48dc6e3d9..0f2b89682 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -66,6 +66,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
66 | inet_prefix dst; | 66 | inet_prefix dst; |
67 | inet_prefix src; | 67 | inet_prefix src; |
68 | int host_len = -1; | 68 | int host_len = -1; |
69 | uint32_t tid; | ||
69 | 70 | ||
70 | if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) { | 71 | if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) { |
71 | fprintf(stderr, "Not a route: %08x %08x %08x\n", | 72 | fprintf(stderr, "Not a route: %08x %08x %08x\n", |
@@ -78,6 +79,14 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
78 | if (len < 0) | 79 | if (len < 0) |
79 | bb_error_msg_and_die("wrong nlmsg len %d", len); | 80 | bb_error_msg_and_die("wrong nlmsg len %d", len); |
80 | 81 | ||
82 | memset(tb, 0, sizeof(tb)); | ||
83 | parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); | ||
84 | |||
85 | if (tb[RTA_TABLE]) | ||
86 | tid = *(uint32_t *)RTA_DATA(tb[RTA_TABLE]); | ||
87 | else | ||
88 | tid = r->rtm_table; | ||
89 | |||
81 | if (r->rtm_family == AF_INET6) | 90 | if (r->rtm_family == AF_INET6) |
82 | host_len = 128; | 91 | host_len = 128; |
83 | else if (r->rtm_family == AF_INET) | 92 | else if (r->rtm_family == AF_INET) |
@@ -107,7 +116,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
107 | } | 116 | } |
108 | } | 117 | } |
109 | } else { | 118 | } else { |
110 | if (G_filter.tb > 0 && G_filter.tb != r->rtm_table) { | 119 | if (G_filter.tb > 0 && G_filter.tb != tid) { |
111 | return 0; | 120 | return 0; |
112 | } | 121 | } |
113 | } | 122 | } |
@@ -136,10 +145,8 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
136 | return 0; | 145 | return 0; |
137 | } | 146 | } |
138 | 147 | ||
139 | memset(tb, 0, sizeof(tb)); | ||
140 | memset(&src, 0, sizeof(src)); | 148 | memset(&src, 0, sizeof(src)); |
141 | memset(&dst, 0, sizeof(dst)); | 149 | memset(&dst, 0, sizeof(dst)); |
142 | parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); | ||
143 | 150 | ||
144 | if (tb[RTA_SRC]) { | 151 | if (tb[RTA_SRC]) { |
145 | src.bitlen = r->rtm_src_len; | 152 | src.bitlen = r->rtm_src_len; |
@@ -258,6 +265,10 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, | |||
258 | if (tb[RTA_OIF]) { | 265 | if (tb[RTA_OIF]) { |
259 | printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); | 266 | printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); |
260 | } | 267 | } |
268 | #if ENABLE_FEATURE_IP_RULE | ||
269 | if (tid && tid != RT_TABLE_MAIN && !G_filter.tb) | ||
270 | printf("table %s ", rtnl_rttable_n2a(tid)); | ||
271 | #endif | ||
261 | 272 | ||
262 | /* Todo: parse & show "proto kernel", "scope link" here */ | 273 | /* Todo: parse & show "proto kernel", "scope link" here */ |
263 | 274 | ||
@@ -419,7 +430,12 @@ IF_FEATURE_IP_RULE(ARG_table,) | |||
419 | NEXT_ARG(); | 430 | NEXT_ARG(); |
420 | if (rtnl_rttable_a2n(&tid, *argv)) | 431 | if (rtnl_rttable_a2n(&tid, *argv)) |
421 | invarg_1_to_2(*argv, "table"); | 432 | invarg_1_to_2(*argv, "table"); |
422 | req.r.rtm_table = tid; | 433 | if (tid < 256) |
434 | req.r.rtm_table = tid; | ||
435 | else { | ||
436 | req.r.rtm_table = RT_TABLE_UNSPEC; | ||
437 | addattr32(&req.n, sizeof(req), RTA_TABLE, tid); | ||
438 | } | ||
423 | #endif | 439 | #endif |
424 | } else if (arg == ARG_dev || arg == ARG_oif) { | 440 | } else if (arg == ARG_dev || arg == ARG_oif) { |
425 | NEXT_ARG(); | 441 | NEXT_ARG(); |
diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index c486834b0..8f3f86286 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c | |||
@@ -114,7 +114,9 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, | |||
114 | printf("iif %s ", (char*)RTA_DATA(tb[RTA_IIF])); | 114 | printf("iif %s ", (char*)RTA_DATA(tb[RTA_IIF])); |
115 | } | 115 | } |
116 | 116 | ||
117 | if (r->rtm_table) | 117 | if (tb[RTA_TABLE]) |
118 | printf("lookup %s ", rtnl_rttable_n2a(*(uint32_t*)RTA_DATA(tb[RTA_TABLE]))); | ||
119 | else if (r->rtm_table) | ||
118 | printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table)); | 120 | printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table)); |
119 | 121 | ||
120 | if (tb[RTA_FLOW]) { | 122 | if (tb[RTA_FLOW]) { |
@@ -256,7 +258,12 @@ static int iprule_modify(int cmd, char **argv) | |||
256 | NEXT_ARG(); | 258 | NEXT_ARG(); |
257 | if (rtnl_rttable_a2n(&tid, *argv)) | 259 | if (rtnl_rttable_a2n(&tid, *argv)) |
258 | invarg_1_to_2(*argv, "table ID"); | 260 | invarg_1_to_2(*argv, "table ID"); |
259 | req.r.rtm_table = tid; | 261 | if (tid < 256) |
262 | req.r.rtm_table = tid; | ||
263 | else { | ||
264 | req.r.rtm_table = RT_TABLE_UNSPEC; | ||
265 | addattr32(&req.n, sizeof(req), RTA_TABLE, tid); | ||
266 | } | ||
260 | table_ok = 1; | 267 | table_ok = 1; |
261 | } else if (key == ARG_dev || | 268 | } else if (key == ARG_dev || |
262 | key == ARG_iif | 269 | key == ARG_iif |
diff --git a/networking/tcpudp.c b/networking/tcpudp.c index 94c89b9ef..3a6c68646 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c | |||
@@ -107,10 +107,10 @@ | |||
107 | #include "libbb.h" | 107 | #include "libbb.h" |
108 | #include "common_bufsiz.h" | 108 | #include "common_bufsiz.h" |
109 | 109 | ||
110 | /* Wants <limits.h> etc, thus included after libbb.h: */ | ||
111 | #ifdef __linux__ | 110 | #ifdef __linux__ |
112 | #include <linux/types.h> /* for __be32 etc */ | 111 | /* from linux/netfilter_ipv4.h: */ |
113 | #include <linux/netfilter_ipv4.h> | 112 | # undef SO_ORIGINAL_DST |
113 | # define SO_ORIGINAL_DST 80 | ||
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | // TODO: move into this file: | 116 | // TODO: move into this file: |
diff --git a/networking/udhcp/Config.src b/networking/udhcp/Config.src index c34c8d6f0..90fb313b5 100644 --- a/networking/udhcp/Config.src +++ b/networking/udhcp/Config.src | |||
@@ -16,7 +16,6 @@ config UDHCPD | |||
16 | config DHCPRELAY | 16 | config DHCPRELAY |
17 | bool "dhcprelay" | 17 | bool "dhcprelay" |
18 | default y | 18 | default y |
19 | depends on UDHCPD | ||
20 | help | 19 | help |
21 | dhcprelay listens for dhcp requests on one or more interfaces | 20 | dhcprelay listens for dhcp requests on one or more interfaces |
22 | and forwards these requests to a different interface or dhcp | 21 | and forwards these requests to a different interface or dhcp |
@@ -25,7 +24,6 @@ config DHCPRELAY | |||
25 | config DUMPLEASES | 24 | config DUMPLEASES |
26 | bool "Lease display utility (dumpleases)" | 25 | bool "Lease display utility (dumpleases)" |
27 | default y | 26 | default y |
28 | depends on UDHCPD | ||
29 | help | 27 | help |
30 | dumpleases displays the leases written out by the udhcpd server. | 28 | dumpleases displays the leases written out by the udhcpd server. |
31 | Lease times are stored in the file by time remaining in lease, or | 29 | Lease times are stored in the file by time remaining in lease, or |
diff --git a/networking/udhcp/Kbuild.src b/networking/udhcp/Kbuild.src index 5ea77df06..fcb725fbc 100644 --- a/networking/udhcp/Kbuild.src +++ b/networking/udhcp/Kbuild.src | |||
@@ -15,7 +15,7 @@ lib-$(CONFIG_UDHCPD) += common.o packet.o signalpipe.o socket.o | |||
15 | lib-$(CONFIG_UDHCPC) += dhcpc.o | 15 | lib-$(CONFIG_UDHCPC) += dhcpc.o |
16 | lib-$(CONFIG_UDHCPD) += dhcpd.o arpping.o | 16 | lib-$(CONFIG_UDHCPD) += dhcpd.o arpping.o |
17 | lib-$(CONFIG_DUMPLEASES) += dumpleases.o | 17 | lib-$(CONFIG_DUMPLEASES) += dumpleases.o |
18 | lib-$(CONFIG_DHCPRELAY) += dhcprelay.o | 18 | lib-$(CONFIG_DHCPRELAY) += dhcprelay.o common.o socket.o packet.o |
19 | 19 | ||
20 | lib-$(CONFIG_FEATURE_UDHCPC_ARPING) += arpping.o | 20 | lib-$(CONFIG_FEATURE_UDHCPC_ARPING) += arpping.o |
21 | lib-$(CONFIG_FEATURE_UDHCP_RFC3397) += domain_codec.o | 21 | lib-$(CONFIG_FEATURE_UDHCP_RFC3397) += domain_codec.o |