ip.c 16 KB

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