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