~ubuntu-branches/ubuntu/karmic/iproute/karmic

« back to all changes in this revision

Viewing changes to ip/ip.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabio M. Di Nitto
  • Date: 2006-11-14 15:18:53 UTC
  • mto: (3.1.1 etch) (1.1.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20061114151853-4pojonfwjxhzx7z9
Tags: upstream-20061002
ImportĀ upstreamĀ versionĀ 20061002

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
char * _SL_ = NULL;
37
37
char *batch_file = NULL;
38
38
int force = 0;
39
 
struct rtnl_handle rth;
 
39
struct rtnl_handle rth = { .fd = -1 };
40
40
 
41
41
static void usage(void) __attribute__((noreturn));
42
42
 
45
45
        fprintf(stderr,
46
46
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
47
47
"       ip [ -force ] [-batch filename\n"
48
 
"where  OBJECT := { link | addr | route | rule | neigh | tunnel |\n"
 
48
"where  OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n"
49
49
"                   maddr | mroute | monitor | xfrm }\n"
50
50
"       OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] |\n"
51
51
"                    -f[amily] { inet | inet6 | ipx | dnet | link } |\n"
62
62
        const char *cmd;
63
63
        int (*func)(int argc, char **argv);
64
64
} cmds[] = {
65
 
        { "addr",       do_ipaddr },
66
 
        { "maddr",      do_multiaddr },
 
65
        { "address",    do_ipaddr },
 
66
        { "maddress",   do_multiaddr },
67
67
        { "route",      do_iproute },
68
68
        { "rule",       do_iprule },
69
 
        { "neigh",      do_ipneigh },
 
69
        { "neighbor",   do_ipneigh },
 
70
        { "neighbour",  do_ipneigh },
 
71
        { "ntable",     do_ipntable },
 
72
        { "ntbl",       do_ipntable },
70
73
        { "link",       do_iplink },
71
74
        { "tunnel",     do_iptunnel },
 
75
        { "tunl",       do_iptunnel },
72
76
        { "monitor",    do_ipmonitor },
73
77
        { "xfrm",       do_xfrm },
74
78
        { "mroute",     do_multiroute },
80
84
{
81
85
        const struct cmd *c;
82
86
 
83
 
        for (c = cmds; c->cmd; ++c)
84
 
                if (strcmp(c->cmd, argv0) == 0)
 
87
        for (c = cmds; c->cmd; ++c) {
 
88
                if (matches(argv0, c->cmd) == 0)
85
89
                        return c->func(argc-1, argv+1);
 
90
        }
86
91
 
87
92
        fprintf(stderr, "Object \"%s\" is unknown, try \"ip help\".\n", argv0);
88
 
        exit(-1);
 
93
        return -1;
89
94
}
90
95
 
91
96
static int batch(const char *name)