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_iptuntap(int argc, char **argv);
36 extern int do_iplink(int argc, char **argv);
37 extern int do_ipmonitor(int argc, char **argv);
38 extern int do_multiaddr(int argc, char **argv);
39 extern int do_multiroute(int argc, char **argv);
40 extern int do_multirule(int argc, char **argv);
41 extern int do_xfrm(int argc, char **argv);
42
rtm_get_table(struct rtmsg * r,struct rtattr ** tb)43 static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
44 {
45 __u32 table = r->rtm_table;
46 if (tb[RTA_TABLE])
47 table = *(__u32*) RTA_DATA(tb[RTA_TABLE]);
48 return table;
49 }
50
51 extern struct rtnl_handle rth;
52
53 struct link_util
54 {
55 struct link_util *next;
56 const char *id;
57 int maxattr;
58 int (*parse_opt)(struct link_util *, int, char **,
59 struct nlmsghdr *);
60 void (*print_opt)(struct link_util *, FILE *,
61 struct rtattr *[]);
62 void (*print_xstats)(struct link_util *, FILE *,
63 struct rtattr *);
64 };
65
66 struct link_util *get_link_kind(const char *kind);
67
68 #ifndef INFINITY_LIFE_TIME
69 #define INFINITY_LIFE_TIME 0xFFFFFFFFU
70 #endif
71