1 /* vi: set sw=4 ts=4: */
3 * ip.c "ip" utility frontend.
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
13 * Bernhard Fischer rewrote to use index_in_substr_array
18 #include "libiproute/utils.h"
19 #include "libiproute/ip_common.h"
21 static int ATTRIBUTE_NORETURN ip_print_help(int ATTRIBUTE_UNUSED ac, char ATTRIBUTE_UNUSED **av)
25 int ip_main(int argc, char **argv);
26 int ip_main(int argc, char **argv)
28 const char * const keywords[] = {
29 USE_FEATURE_IP_ADDRESS("address",)
30 USE_FEATURE_IP_ROUTE("route",)
31 USE_FEATURE_IP_LINK("link",)
32 USE_FEATURE_IP_TUNNEL("tunnel", "tunl",)
33 USE_FEATURE_IP_RULE("rule",)
37 USE_FEATURE_IP_ADDRESS(IP_addr,)
38 USE_FEATURE_IP_ROUTE(IP_route,)
39 USE_FEATURE_IP_LINK(IP_link,)
40 USE_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,)
41 USE_FEATURE_IP_RULE(IP_rule,)
44 int (*ip_func)(int argc, char **argv) = ip_print_help;
46 ip_parse_common_args(&argc, &argv);
48 int key = index_in_substr_array(keywords, argv[1]);
51 #if ENABLE_FEATURE_IP_ADDRESS
55 #if ENABLE_FEATURE_IP_ROUTE
59 #if ENABLE_FEATURE_IP_LINK
63 #if ENABLE_FEATURE_IP_TUNNEL
64 if (key == IP_tunnel || key == IP_tunl)
65 ip_func = do_iptunnel;
67 #if ENABLE_FEATURE_IP_RULE
72 return (ip_func(argc, argv));