1 int get_operstate(const char *name);
2 int print_linkinfo(const struct sockaddr_nl *who,
3 struct nlmsghdr *n, void *arg);
4 int print_linkinfo_brief(const struct sockaddr_nl *who,
5 struct nlmsghdr *n, void *arg);
6 int print_addrinfo(const struct sockaddr_nl *who,
7 struct nlmsghdr *n, void *arg);
8 int print_addrlabel(const struct sockaddr_nl *who,
9 struct nlmsghdr *n, void *arg);
10 int print_neigh(const struct sockaddr_nl *who,
11 struct nlmsghdr *n, void *arg);
12 int ipaddr_list_link(int argc, char **argv);
13 void ipaddr_get_vf_rate(int, int *, int *, int);
14 void iplink_usage(void) __attribute__((noreturn));
15
16 void iproute_reset_filter(int ifindex);
17 void ipmroute_reset_filter(int ifindex);
18 void ipaddr_reset_filter(int oneline, int ifindex);
19 void ipneigh_reset_filter(int ifindex);
20 void ipnetconf_reset_filter(int ifindex);
21
22 int print_route(const struct sockaddr_nl *who,
23 struct nlmsghdr *n, void *arg);
24 int print_mroute(const struct sockaddr_nl *who,
25 struct nlmsghdr *n, void *arg);
26 int print_prefix(const struct sockaddr_nl *who,
27 struct nlmsghdr *n, void *arg);
28 int print_rule(const struct sockaddr_nl *who,
29 struct nlmsghdr *n, void *arg);
30 int print_netconf(const struct sockaddr_nl *who,
31 struct rtnl_ctrl_data *ctrl,
32 struct nlmsghdr *n, void *arg);
33 void netns_map_init(void);
34 int print_nsid(const struct sockaddr_nl *who,
35 struct nlmsghdr *n, void *arg);
36 int do_ipaddr(int argc, char **argv);
37 int do_ipaddrlabel(int argc, char **argv);
38 int do_iproute(int argc, char **argv);
39 int do_iprule(int argc, char **argv);
40 int do_ipneigh(int argc, char **argv);
41 int do_ipntable(int argc, char **argv);
42 int do_iptunnel(int argc, char **argv);
43 int do_ip6tunnel(int argc, char **argv);
44 int do_iptuntap(int argc, char **argv);
45 int do_iplink(int argc, char **argv);
46 int do_ipmonitor(int argc, char **argv);
47 int do_multiaddr(int argc, char **argv);
48 int do_multiroute(int argc, char **argv);
49 int do_multirule(int argc, char **argv);
50 int do_netns(int argc, char **argv);
51 int do_xfrm(int argc, char **argv);
52 int do_ipl2tp(int argc, char **argv);
53 int do_ipfou(int argc, char **argv);
54 int do_tcp_metrics(int argc, char **argv);
55 int do_ipnetconf(int argc, char **argv);
56 int do_iptoken(int argc, char **argv);
57 int iplink_get(unsigned int flags, char *name, __u32 filt_mask);
58
rtm_get_table(struct rtmsg * r,struct rtattr ** tb)59 static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
60 {
61 __u32 table = r->rtm_table;
62 if (tb[RTA_TABLE])
63 table = rta_getattr_u32(tb[RTA_TABLE]);
64 return table;
65 }
66
67 extern struct rtnl_handle rth;
68
69 #include <stdbool.h>
70
71 struct link_util
72 {
73 struct link_util *next;
74 const char *id;
75 int maxattr;
76 int (*parse_opt)(struct link_util *, int, char **,
77 struct nlmsghdr *);
78 void (*print_opt)(struct link_util *, FILE *,
79 struct rtattr *[]);
80 void (*print_xstats)(struct link_util *, FILE *,
81 struct rtattr *);
82 void (*print_help)(struct link_util *, int, char **,
83 FILE *);
84 bool slave;
85 };
86
87 struct link_util *get_link_kind(const char *kind);
88 struct link_util *get_link_slave_kind(const char *slave_kind);
89
90 #ifndef INFINITY_LIFE_TIME
91 #define INFINITY_LIFE_TIME 0xFFFFFFFFU
92 #endif
93