1 extern int print_linkinfo(const struct sockaddr_nl *who,
2 struct nlmsghdr *n,
3 void *arg);
4 extern int print_addrinfo(const struct sockaddr_nl *who,
5 struct nlmsghdr *n,
6 void *arg);
7 extern int print_addrlabel(const struct sockaddr_nl *who,
8 struct nlmsghdr *n, void *arg);
9 extern int print_neigh(const struct sockaddr_nl *who,
10 struct nlmsghdr *n, void *arg);
11 extern int print_ntable(const struct sockaddr_nl *who,
12 struct nlmsghdr *n, void *arg);
13 extern int ipaddr_list(int argc, char **argv);
14 extern int ipaddr_list_link(int argc, char **argv);
15 extern int iproute_monitor(int argc, char **argv);
16 extern void iplink_usage(void) __attribute__((noreturn));
17 extern void iproute_reset_filter(void);
18 extern void ipaddr_reset_filter(int);
19 extern void ipneigh_reset_filter(void);
20 extern void ipntable_reset_filter(void);
21 extern int print_route(const struct sockaddr_nl *who,
22 struct nlmsghdr *n, void *arg);
23 extern int print_prefix(const struct sockaddr_nl *who,
24 struct nlmsghdr *n, void *arg);
25 extern int print_rule(const struct sockaddr_nl *who,
26 struct nlmsghdr *n, void *arg);
27 extern int do_ipaddr(int argc, char **argv);
28 extern int do_ipaddrlabel(int argc, char **argv);
29 extern int do_iproute(int argc, char **argv);
30 extern int do_iprule(int argc, char **argv);
31 extern int do_ipneigh(int argc, char **argv);
32 extern int do_ipntable(int argc, char **argv);
33 extern int do_iptunnel(int argc, char **argv);
34 extern int do_ip6tunnel(int argc, char **argv);
35 extern int do_iplink(int argc, char **argv);
36 extern int do_ipmonitor(int argc, char **argv);
37 extern int do_multiaddr(int argc, char **argv);
38 extern int do_multiroute(int argc, char **argv);
39 extern int do_xfrm(int argc, char **argv);
40
rtm_get_table(struct rtmsg * r,struct rtattr ** tb)41 static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
42 {
43 __u32 table = r->rtm_table;
44 if (tb[RTA_TABLE])
45 table = *(__u32*) RTA_DATA(tb[RTA_TABLE]);
46 return table;
47 }
48
49 extern struct rtnl_handle rth;
50
51 struct link_util
52 {
53 struct link_util *next;
54 const char *id;
55 int maxattr;
56 int (*parse_opt)(struct link_util *, int, char **,
57 struct nlmsghdr *);
58 void (*print_opt)(struct link_util *, FILE *,
59 struct rtattr *[]);
60 void (*print_xstats)(struct link_util *, FILE *,
61 struct rtattr *);
62 };
63
64 struct link_util *get_link_kind(const char *kind);
65
66 #ifndef INFINITY_LIFE_TIME
67 #define INFINITY_LIFE_TIME 0xFFFFFFFFU
68 #endif
69