]>
git.proxmox.com Git - mirror_iproute2.git/blob - bridge/bridge.c
2 * Get/set/delete bridge with netlink
4 * Authors: Stephen Hemminger <shemminger@vyatta.com>
10 #include <sys/socket.h>
15 #include "br_common.h"
17 struct rtnl_handle rth
= { .fd
= -1 };
23 static void usage(void) __attribute__((noreturn
));
25 static void usage(void)
28 "Usage: br [ OPTIONS ] OBJECT { COMMAND | help }\n"
29 "where OBJECT := { fdb | monitor }\n"
30 " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails]\n" );
34 static int do_help(int argc
, char **argv
)
40 static const struct cmd
{
42 int (*func
)(int argc
, char **argv
);
45 { "monitor", do_monitor
},
50 static int do_cmd(const char *argv0
, int argc
, char **argv
)
54 for (c
= cmds
; c
->cmd
; ++c
) {
55 if (matches(argv0
, c
->cmd
) == 0)
56 return c
->func(argc
-1, argv
+1);
59 fprintf(stderr
, "Object \"%s\" is unknown, try \"br help\".\n", argv0
);
64 main(int argc
, char **argv
)
68 if (strcmp(opt
,"--") == 0) {
77 if (matches(opt
, "-help") == 0) {
79 } else if (matches(opt
, "-Version") == 0) {
80 printf("br utility, 0.0\n");
82 } else if (matches(opt
, "-stats") == 0 ||
83 matches(opt
, "-statistics") == 0) {
85 } else if (matches(opt
, "-details") == 0) {
87 } else if (matches(opt
, "-timestamp") == 0) {
90 fprintf(stderr
, "Option \"%s\" is unknown, try \"br -help\".\n", opt
);
96 if (rtnl_open(&rth
, 0) < 0)
100 return do_cmd(argv
[1], argc
-1, argv
+1);