ip.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  4. *
  5. * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
  6. *
  7. * Changes:
  8. * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
  9. * Bernhard Reutner-Fischer rewrote to use index_in_substr_array
  10. */
  11. //config:config IP
  12. //config: bool "ip (35 kb)"
  13. //config: default y
  14. //config: select PLATFORM_LINUX
  15. //config: help
  16. //config: The "ip" applet is a TCP/IP interface configuration and routing
  17. //config: utility.
  18. //config: Short forms (enabled below) are busybox-specific extensions.
  19. //config: The standard "ip" utility does not provide them. If you are
  20. //config: trying to be portable, it's better to use "ip CMD" forms.
  21. //config:
  22. //config:config IPADDR
  23. //config: bool "ipaddr (14 kb)"
  24. //config: default y
  25. //config: select FEATURE_IP_ADDRESS
  26. //config: select PLATFORM_LINUX
  27. //config: help
  28. //config: Short form of "ip addr"
  29. //config:
  30. //config:config IPLINK
  31. //config: bool "iplink (17 kb)"
  32. //config: default y
  33. //config: select FEATURE_IP_LINK
  34. //config: select PLATFORM_LINUX
  35. //config: help
  36. //config: Short form of "ip link"
  37. //config:
  38. //config:config IPROUTE
  39. //config: bool "iproute (15 kb)"
  40. //config: default y
  41. //config: select FEATURE_IP_ROUTE
  42. //config: select PLATFORM_LINUX
  43. //config: help
  44. //config: Short form of "ip route"
  45. //config:
  46. //config:config IPTUNNEL
  47. //config: bool "iptunnel (9.6 kb)"
  48. //config: default y
  49. //config: select FEATURE_IP_TUNNEL
  50. //config: select PLATFORM_LINUX
  51. //config: help
  52. //config: Short form of "ip tunnel"
  53. //config:
  54. //config:config IPRULE
  55. //config: bool "iprule (10 kb)"
  56. //config: default y
  57. //config: select FEATURE_IP_RULE
  58. //config: select PLATFORM_LINUX
  59. //config: help
  60. //config: Short form of "ip rule"
  61. //config:
  62. //config:config IPNEIGH
  63. //config: bool "ipneigh (8.3 kb)"
  64. //config: default y
  65. //config: select FEATURE_IP_NEIGH
  66. //config: select PLATFORM_LINUX
  67. //config: help
  68. //config: Short form of "ip neigh"
  69. //config:
  70. //config:config FEATURE_IP_ADDRESS
  71. //config: bool "ip address"
  72. //config: default y
  73. //config: depends on IP || IPADDR
  74. //config: help
  75. //config: Address manipulation support for the "ip" applet.
  76. //config:
  77. //config:config FEATURE_IP_LINK
  78. //config: bool "ip link"
  79. //config: default y
  80. //config: depends on IP || IPLINK
  81. //config: help
  82. //config: Configure network devices with "ip".
  83. //config:
  84. //config:config FEATURE_IP_ROUTE
  85. //config: bool "ip route"
  86. //config: default y
  87. //config: depends on IP || IPROUTE
  88. //config: help
  89. //config: Add support for routing table management to "ip".
  90. //config:
  91. //config:config FEATURE_IP_ROUTE_DIR
  92. //config: string "ip route configuration directory"
  93. //config: default "/etc/iproute2"
  94. //config: depends on FEATURE_IP_ROUTE
  95. //config: help
  96. //config: Location of the "ip" applet routing configuration.
  97. //config:
  98. //config:config FEATURE_IP_TUNNEL
  99. //config: bool "ip tunnel"
  100. //config: default y
  101. //config: depends on IP || IPTUNNEL
  102. //config: help
  103. //config: Add support for tunneling commands to "ip".
  104. //config:
  105. //config:config FEATURE_IP_RULE
  106. //config: bool "ip rule"
  107. //config: default y
  108. //config: depends on IP || IPRULE
  109. //config: help
  110. //config: Add support for rule commands to "ip".
  111. //config:
  112. //config:config FEATURE_IP_NEIGH
  113. //config: bool "ip neighbor"
  114. //config: default y
  115. //config: depends on IP || IPNEIGH
  116. //config: help
  117. //config: Add support for neighbor commands to "ip".
  118. //config:
  119. //config:config FEATURE_IP_RARE_PROTOCOLS
  120. //config: bool "Support displaying rarely used link types"
  121. //config: default n
  122. //config: depends on IP || IPADDR || IPLINK || IPROUTE || IPTUNNEL || IPRULE || IPNEIGH
  123. //config: help
  124. //config: If you are not going to use links of type "frad", "econet",
  125. //config: "bif" etc, you probably don't need to enable this.
  126. //config: Ethernet, wireless, infrared, ppp/slip, ip tunnelling
  127. //config: link types are supported without this option selected.
  128. //applet:IF_IP( APPLET_NOEXEC(ip , ip , BB_DIR_SBIN, BB_SUID_DROP, ip ))
  129. //applet:IF_IPADDR( APPLET_NOEXEC(ipaddr , ipaddr , BB_DIR_SBIN, BB_SUID_DROP, ipaddr ))
  130. //applet:IF_IPLINK( APPLET_NOEXEC(iplink , iplink , BB_DIR_SBIN, BB_SUID_DROP, iplink ))
  131. //applet:IF_IPROUTE( APPLET_NOEXEC(iproute , iproute , BB_DIR_SBIN, BB_SUID_DROP, iproute ))
  132. //applet:IF_IPRULE( APPLET_NOEXEC(iprule , iprule , BB_DIR_SBIN, BB_SUID_DROP, iprule ))
  133. //applet:IF_IPTUNNEL(APPLET_NOEXEC(iptunnel, iptunnel, BB_DIR_SBIN, BB_SUID_DROP, iptunnel))
  134. //applet:IF_IPNEIGH( APPLET_NOEXEC(ipneigh , ipneigh , BB_DIR_SBIN, BB_SUID_DROP, ipneigh ))
  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
  142. //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79
  143. //usage:#define ipaddr_trivial_usage
  144. //usage: "add|del IFADDR dev IFACE | show|flush [dev IFACE] [to PREFIX]"
  145. //usage:#define ipaddr_full_usage "\n\n"
  146. //usage: "ipaddr add|change|replace|delete dev IFACE IFADDR\n"
  147. //usage: " IFADDR := PREFIX | ADDR peer PREFIX [broadcast ADDR|+|-]\n"
  148. //usage: " [anycast ADDR] [label STRING] [scope SCOPE]\n"
  149. //usage: " PREFIX := ADDR[/MASK]\n"
  150. //usage: " SCOPE := [host|link|global|NUMBER]\n"
  151. //usage: "ipaddr show|flush [dev IFACE] [scope SCOPE] [to PREFIX] [label PATTERN]"
  152. //usage:
  153. //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79
  154. //usage:#define iplink_trivial_usage
  155. //usage: /*Usage:iplink*/"set IFACE [up|down] [arp on|off] [multicast on|off]\n"
  156. //usage: " [promisc on|off] [mtu NUM] [name NAME] [qlen NUM] [address MAC]\n"
  157. //usage: " [master IFACE | nomaster]"
  158. // * short help shows only "set" command, long help continues (with just one "\n")
  159. // * and shows all other commands:
  160. //usage:#define iplink_full_usage "\n"
  161. //usage: "iplink add [link IFACE] IFACE [address MAC] type TYPE [ARGS]\n"
  162. //usage: "iplink delete IFACE type TYPE [ARGS]\n"
  163. //usage: " TYPE ARGS := vlan VLANARGS | vrf table NUM\n"
  164. //usage: " VLANARGS := id VLANID [protocol 802.1q|802.1ad] [reorder_hdr on|off]\n"
  165. //usage: " [gvrp on|off] [mvrp on|off] [loose_binding on|off]\n"
  166. //usage: "iplink show [IFACE]"
  167. //upstream man ip-link:
  168. //=====================
  169. //ip link add [link DEV] [ name ] NAME
  170. // [ txqueuelen PACKETS ]
  171. // [ address LLADDR ]
  172. // [ broadcast LLADDR ]
  173. // [ mtu MTU ] [index IDX ]
  174. // [ numtxqueues QUEUE_COUNT ]
  175. // [ numrxqueues QUEUE_COUNT ]
  176. // type TYPE [ ARGS ]
  177. // ip link delete { DEVICE | dev DEVICE | group DEVGROUP } type TYPE [ ARGS ]
  178. // ip link set { DEVICE | dev DEVICE | group DEVGROUP } [ { up | down } ]
  179. // [ arp { on | off } ]
  180. // [ dynamic { on | off } ]
  181. // [ multicast { on | off } ]
  182. // [ allmulticast { on | off } ]
  183. // [ promisc { on | off } ]
  184. // [ trailers { on | off } ]
  185. // [ txqueuelen PACKETS ]
  186. // [ name NEWNAME ]
  187. // [ address LLADDR ]
  188. // [ broadcast LLADDR ]
  189. // [ mtu MTU ]
  190. // [ netns { PID | NAME } ]
  191. // [ link-netnsid ID ]
  192. // [ alias NAME ]
  193. // [ vf NUM [ mac LLADDR ]
  194. // [ vlan VLANID [ qos VLAN-QOS ] ]
  195. // [ rate TXRATE ]
  196. // [ spoofchk { on | off} ]
  197. // [ query_rss { on | off} ]
  198. // [ state { auto | enable | disable} ] ]
  199. // [ trust { on | off} ] ]
  200. // [ master DEVICE ]
  201. // [ nomaster ]
  202. // [ addrgenmode { eui64 | none | stable_secret | random } ]
  203. // [ protodown { on | off } ]
  204. // ip link show [ DEVICE | group GROUP ] [up] [master DEV] [type TYPE]
  205. // ip link help [ TYPE ]
  206. //TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |
  207. // bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |
  208. // gre | gretap | ip6gre | ip6gretap | vti | nlmon |
  209. // bond_slave | ipvlan | geneve | bridge_slave | vrf }
  210. //usage:
  211. //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79
  212. //usage:#define iproute_trivial_usage
  213. //usage: "list|flush|add|del|change|append|replace|test ROUTE"
  214. //usage:#define iproute_full_usage "\n\n"
  215. //usage: "iproute list|flush SELECTOR\n"
  216. //usage: " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n"
  217. //usage: " PREFIX := default|ADDR[/MASK]\n"
  218. //usage: "iproute get ADDR [from ADDR iif IFACE]\n"
  219. //usage: " [oif IFACE] [tos TOS]\n"
  220. //usage: "iproute add|del|change|append|replace|test ROUTE\n"
  221. //usage: " ROUTE := NODE_SPEC [INFO_SPEC]\n"
  222. //usage: " NODE_SPEC := PREFIX"IF_FEATURE_IP_RULE(" [table TABLE_ID]")" [proto RTPROTO] [scope SCOPE] [metric METRIC]\n"
  223. //usage: " INFO_SPEC := NH OPTIONS\n"
  224. //usage: " NH := [via [inet|inet6] ADDR] [dev IFACE] [src ADDR] [onlink]\n"
  225. //usage: " OPTIONS := [mtu [lock] NUM] [advmss [lock] NUM]"
  226. //upstream man ip-route:
  227. //======================
  228. //ip route { show | flush } SELECTOR
  229. //ip route save SELECTOR
  230. //ip route restore
  231. //ip route get ADDRESS [ from ADDRESS iif STRING ] [ oif STRING ] [ tos TOS ]
  232. //ip route { add | del | change | append | replace } ROUTE
  233. //SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ] [ table TABLE_ID ] [ proto RTPROTO ] [ type TYPE ] [ scope SCOPE ]
  234. //ROUTE := NODE_SPEC [ INFO_SPEC ]
  235. //NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ] [ table TABLE_ID ] [ proto RTPROTO ] [ scope SCOPE ] [ metric METRIC ]
  236. //INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ] ...
  237. //NH := [ encap ENCAP ] [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
  238. // ..............................................................^ I guess [src ADDRESS] should be here
  239. //FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
  240. //OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ] rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ] [ window NUMBER ] [ cwnd NUMBER ] [ ssthresh REALM ] [ realms REALM ]
  241. // [ rto_min TIME ] [ initcwnd NUMBER ] [ initrwnd NUMBER ] [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ] [ pref PREF ] [ expires TIME ]
  242. //TYPE := [ unicast | local | broadcast | multicast | throw | unreachable | prohibit | blackhole | nat ]
  243. //TABLE_ID := [ local | main | default | all | NUMBER ]
  244. //SCOPE := [ host | link | global | NUMBER ]
  245. //NHFLAGS := [ onlink | pervasive ]
  246. //RTPROTO := [ kernel | boot | static | NUMBER ]
  247. //FEATURES := [ ecn | ]
  248. //PREF := [ low | medium | high ]
  249. //ENCAP := [ MPLS | IP ]
  250. //ENCAP_MPLS := mpls [ LABEL ]
  251. //ENCAP_IP := ip id TUNNEL_ID dst REMOTE_IP [ tos TOS ] [ ttl TTL ]
  252. //usage:
  253. //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79
  254. //usage:#define iprule_trivial_usage
  255. //usage: "[list] | add|del SELECTOR ACTION"
  256. //usage:#define iprule_full_usage "\n\n"
  257. //usage: " SELECTOR := [from PREFIX] [to PREFIX] [tos TOS] [fwmark FWMARK]\n"
  258. //usage: " [dev IFACE] [pref NUMBER]\n"
  259. //usage: " ACTION := [table TABLE_ID] [nat ADDR]\n"
  260. //usage: " [prohibit|reject|unreachable]\n"
  261. //usage: " [realms [SRCREALM/]DSTREALM]\n"
  262. //usage: " TABLE_ID := [local|main|default|NUMBER]"
  263. //usage:
  264. //--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79
  265. //usage:#define iptunnel_trivial_usage
  266. //usage: "add|change|del|show [NAME]\n"
  267. //usage: " [mode ipip|gre|sit] [remote ADDR] [local ADDR] [ttl TTL]"
  268. //usage:#define iptunnel_full_usage "\n\n"
  269. //usage: "iptunnel add|change|del|show [NAME]\n"
  270. //usage: " [mode ipip|gre|sit] [remote ADDR] [local ADDR]\n"
  271. //usage: " [[i|o]seq] [[i|o]key KEY] [[i|o]csum]\n"
  272. //usage: " [ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]"
  273. //usage:
  274. //usage:#define ipneigh_trivial_usage
  275. //usage: "show|flush [to PREFIX] [dev DEV] [nud STATE]"
  276. //usage:#define ipneigh_full_usage ""
  277. //usage:
  278. //usage:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE
  279. //usage:# define IP_BAR_LINK "|"
  280. //usage:#else
  281. //usage:# define IP_BAR_LINK ""
  282. //usage:#endif
  283. //usage:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK
  284. //usage:# define IP_BAR_TUNNEL "|"
  285. //usage:#else
  286. //usage:# define IP_BAR_TUNNEL ""
  287. //usage:#endif
  288. //usage:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK || ENABLE_FEATURE_IP_TUNNEL
  289. //usage:# define IP_BAR_NEIGH "|"
  290. //usage:#else
  291. //usage:# define IP_BAR_NEIGH ""
  292. //usage:#endif
  293. //usage:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK || ENABLE_FEATURE_IP_TUNNEL || ENABLE_FEATURE_IP_NEIGH
  294. //usage:# define IP_BAR_RULE "|"
  295. //usage:#else
  296. //usage:# define IP_BAR_RULE ""
  297. //usage:#endif
  298. //usage:
  299. //usage:#define ip_trivial_usage
  300. //usage: "[OPTIONS] "
  301. //usage: IF_FEATURE_IP_ADDRESS("address")
  302. //usage: IF_FEATURE_IP_ROUTE( IF_FEATURE_IP_ADDRESS("|")"route")
  303. //usage: IF_FEATURE_IP_LINK( IP_BAR_LINK "link")
  304. //usage: IF_FEATURE_IP_TUNNEL( IP_BAR_TUNNEL"tunnel")
  305. //usage: IF_FEATURE_IP_NEIGH( IP_BAR_NEIGH "neigh")
  306. //usage: IF_FEATURE_IP_RULE( IP_BAR_RULE "rule")
  307. //usage: " [ARGS]"
  308. //usage:#define ip_full_usage "\n\n"
  309. //usage: "OPTIONS := -f[amily] inet|inet6|link | -o[neline]\n"
  310. //usage: IF_FEATURE_IP_ADDRESS("\n"
  311. //usage: "ip addr "ipaddr_trivial_usage)
  312. //usage: IF_FEATURE_IP_ROUTE("\n"
  313. //usage: "ip route "iproute_trivial_usage)
  314. //usage: IF_FEATURE_IP_LINK("\n"
  315. //usage: "ip link "iplink_trivial_usage)
  316. //usage: IF_FEATURE_IP_TUNNEL("\n"
  317. //usage: "ip tunnel "iptunnel_trivial_usage)
  318. //usage: IF_FEATURE_IP_NEIGH("\n"
  319. //usage: "ip neigh "ipneigh_trivial_usage)
  320. //usage: IF_FEATURE_IP_RULE("\n"
  321. //usage: "ip rule "iprule_trivial_usage)
  322. #include "libbb.h"
  323. #include "libiproute/utils.h"
  324. #include "libiproute/ip_common.h"
  325. typedef int FAST_FUNC (*ip_func_ptr_t)(char**);
  326. #if ENABLE_IPADDR \
  327. || ENABLE_IPLINK \
  328. || ENABLE_IPROUTE \
  329. || ENABLE_IPRULE \
  330. || ENABLE_IPTUNNEL \
  331. || ENABLE_IPNEIGH
  332. static int ip_do(ip_func_ptr_t ip_func, char **argv)
  333. {
  334. argv = ip_parse_common_args(argv + 1);
  335. return ip_func(argv);
  336. }
  337. #endif
  338. #if ENABLE_IPADDR
  339. int ipaddr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  340. int ipaddr_main(int argc UNUSED_PARAM, char **argv)
  341. {
  342. return ip_do(do_ipaddr, argv);
  343. }
  344. #endif
  345. #if ENABLE_IPLINK
  346. int iplink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  347. int iplink_main(int argc UNUSED_PARAM, char **argv)
  348. {
  349. return ip_do(do_iplink, argv);
  350. }
  351. #endif
  352. #if ENABLE_IPROUTE
  353. int iproute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  354. int iproute_main(int argc UNUSED_PARAM, char **argv)
  355. {
  356. return ip_do(do_iproute, argv);
  357. }
  358. #endif
  359. #if ENABLE_IPRULE
  360. int iprule_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  361. int iprule_main(int argc UNUSED_PARAM, char **argv)
  362. {
  363. return ip_do(do_iprule, argv);
  364. }
  365. #endif
  366. #if ENABLE_IPTUNNEL
  367. int iptunnel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  368. int iptunnel_main(int argc UNUSED_PARAM, char **argv)
  369. {
  370. return ip_do(do_iptunnel, argv);
  371. }
  372. #endif
  373. #if ENABLE_IPNEIGH
  374. int ipneigh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  375. int ipneigh_main(int argc UNUSED_PARAM, char **argv)
  376. {
  377. return ip_do(do_ipneigh, argv);
  378. }
  379. #endif
  380. #if ENABLE_IP
  381. static int FAST_FUNC ip_print_help(char **argv UNUSED_PARAM)
  382. {
  383. bb_show_usage();
  384. }
  385. int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  386. int ip_main(int argc UNUSED_PARAM, char **argv)
  387. {
  388. static const char keywords[] ALIGN1 = ""
  389. IF_FEATURE_IP_ADDRESS("address\0")
  390. IF_FEATURE_IP_ROUTE("route\0")
  391. IF_FEATURE_IP_ROUTE("r\0")
  392. IF_FEATURE_IP_LINK("link\0")
  393. IF_FEATURE_IP_TUNNEL("tunnel\0")
  394. IF_FEATURE_IP_TUNNEL("tunl\0")
  395. IF_FEATURE_IP_RULE("rule\0")
  396. IF_FEATURE_IP_NEIGH("neigh\0")
  397. ;
  398. static const ip_func_ptr_t ip_func_ptrs[] = {
  399. ip_print_help,
  400. IF_FEATURE_IP_ADDRESS(do_ipaddr,)
  401. IF_FEATURE_IP_ROUTE(do_iproute,)
  402. IF_FEATURE_IP_ROUTE(do_iproute,)
  403. IF_FEATURE_IP_LINK(do_iplink,)
  404. IF_FEATURE_IP_TUNNEL(do_iptunnel,)
  405. IF_FEATURE_IP_TUNNEL(do_iptunnel,)
  406. IF_FEATURE_IP_RULE(do_iprule,)
  407. IF_FEATURE_IP_NEIGH(do_ipneigh,)
  408. };
  409. ip_func_ptr_t ip_func;
  410. int key;
  411. argv = ip_parse_common_args(argv + 1);
  412. if (ARRAY_SIZE(ip_func_ptrs) > 1 && *argv)
  413. key = index_in_substrings(keywords, *argv++);
  414. else
  415. key = -1;
  416. ip_func = ip_func_ptrs[key + 1];
  417. return ip_func(argv);
  418. }
  419. #endif