]>
Commit | Line | Data |
---|---|---|
741dd5cd DA |
1 | struct link_filter { |
2 | int ifindex; | |
3 | int family; | |
4 | int oneline; | |
5 | int showqueue; | |
6 | inet_prefix pfx; | |
7 | int scope, scopemask; | |
8 | int flags, flagmask; | |
9 | int up; | |
10 | char *label; | |
11 | int flushed; | |
12 | char *flushb; | |
13 | int flushp; | |
14 | int flushe; | |
15 | int group; | |
16 | int master; | |
17 | char *kind; | |
18 | char *slave_kind; | |
19 | }; | |
20 | ||
f7b49a3f PS |
21 | int get_operstate(const char *name); |
22 | int print_linkinfo(const struct sockaddr_nl *who, | |
23 | struct nlmsghdr *n, void *arg); | |
24 | int print_linkinfo_brief(const struct sockaddr_nl *who, | |
63891c70 DA |
25 | struct nlmsghdr *n, void *arg, |
26 | struct link_filter *filter); | |
f7b49a3f PS |
27 | int print_addrinfo(const struct sockaddr_nl *who, |
28 | struct nlmsghdr *n, void *arg); | |
29 | int print_addrlabel(const struct sockaddr_nl *who, | |
30 | struct nlmsghdr *n, void *arg); | |
31 | int print_neigh(const struct sockaddr_nl *who, | |
90353c33 | 32 | struct nlmsghdr *n, void *arg); |
f7b49a3f | 33 | int ipaddr_list_link(int argc, char **argv); |
093b7646 | 34 | void ipaddr_get_vf_rate(int, int *, int *, int); |
f7b49a3f | 35 | void iplink_usage(void) __attribute__((noreturn)); |
093b7646 | 36 | |
f7b49a3f PS |
37 | void iproute_reset_filter(int ifindex); |
38 | void ipmroute_reset_filter(int ifindex); | |
39 | void ipaddr_reset_filter(int oneline, int ifindex); | |
40 | void ipneigh_reset_filter(int ifindex); | |
41 | void ipnetconf_reset_filter(int ifindex); | |
093b7646 | 42 | |
f7b49a3f PS |
43 | int print_route(const struct sockaddr_nl *who, |
44 | struct nlmsghdr *n, void *arg); | |
45 | int print_mroute(const struct sockaddr_nl *who, | |
46 | struct nlmsghdr *n, void *arg); | |
47 | int print_prefix(const struct sockaddr_nl *who, | |
48 | struct nlmsghdr *n, void *arg); | |
49 | int print_rule(const struct sockaddr_nl *who, | |
50 | struct nlmsghdr *n, void *arg); | |
51 | int print_netconf(const struct sockaddr_nl *who, | |
52 | struct rtnl_ctrl_data *ctrl, | |
53 | struct nlmsghdr *n, void *arg); | |
54 | void netns_map_init(void); | |
e29a8e05 | 55 | void netns_nsid_socket_init(void); |
f7b49a3f PS |
56 | int print_nsid(const struct sockaddr_nl *who, |
57 | struct nlmsghdr *n, void *arg); | |
58 | int do_ipaddr(int argc, char **argv); | |
59 | int do_ipaddrlabel(int argc, char **argv); | |
60 | int do_iproute(int argc, char **argv); | |
61 | int do_iprule(int argc, char **argv); | |
62 | int do_ipneigh(int argc, char **argv); | |
63 | int do_ipntable(int argc, char **argv); | |
64 | int do_iptunnel(int argc, char **argv); | |
65 | int do_ip6tunnel(int argc, char **argv); | |
66 | int do_iptuntap(int argc, char **argv); | |
67 | int do_iplink(int argc, char **argv); | |
b26fc590 | 68 | int do_ipmacsec(int argc, char **argv); |
f7b49a3f PS |
69 | int do_ipmonitor(int argc, char **argv); |
70 | int do_multiaddr(int argc, char **argv); | |
71 | int do_multiroute(int argc, char **argv); | |
72 | int do_multirule(int argc, char **argv); | |
73 | int do_netns(int argc, char **argv); | |
74 | int do_xfrm(int argc, char **argv); | |
75 | int do_ipl2tp(int argc, char **argv); | |
76 | int do_ipfou(int argc, char **argv); | |
ec71cae0 | 77 | extern int do_ipila(int argc, char **argv); |
f7b49a3f PS |
78 | int do_tcp_metrics(int argc, char **argv); |
79 | int do_ipnetconf(int argc, char **argv); | |
80 | int do_iptoken(int argc, char **argv); | |
1949f82c | 81 | int do_ipvrf(int argc, char **argv); |
ee9369a0 | 82 | void vrf_reset(void); |
9c49438a | 83 | int netns_identify_pid(const char *pidstr, char *name, int len); |
93863328 | 84 | int do_seg6(int argc, char **argv); |
1949f82c | 85 | |
f7b49a3f | 86 | int iplink_get(unsigned int flags, char *name, __u32 filt_mask); |
94f1a22a | 87 | int iplink_ifla_xstats(int argc, char **argv); |
351efcde | 88 | |
4ad87594 DA |
89 | int ip_linkaddr_list(int family, req_filter_fn_t filter_fn, |
90 | struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo); | |
91 | void free_nlmsg_chain(struct nlmsg_chain *info); | |
92 | ||
34e95647 PM |
93 | static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb) |
94 | { | |
95 | __u32 table = r->rtm_table; | |
90353c33 | 96 | |
34e95647 | 97 | if (tb[RTA_TABLE]) |
ff24746c | 98 | table = rta_getattr_u32(tb[RTA_TABLE]); |
34e95647 PM |
99 | return table; |
100 | } | |
101 | ||
351efcde | 102 | extern struct rtnl_handle rth; |
141bb606 | 103 | |
fbea6115 JP |
104 | #include <stdbool.h> |
105 | ||
90353c33 | 106 | struct link_util { |
1d934839 PM |
107 | struct link_util *next; |
108 | const char *id; | |
109 | int maxattr; | |
110 | int (*parse_opt)(struct link_util *, int, char **, | |
111 | struct nlmsghdr *); | |
112 | void (*print_opt)(struct link_util *, FILE *, | |
113 | struct rtattr *[]); | |
114 | void (*print_xstats)(struct link_util *, FILE *, | |
94f1a22a | 115 | struct rtattr *); |
561e650e | 116 | void (*print_help)(struct link_util *, int, char **, |
94f1a22a NA |
117 | FILE *); |
118 | int (*parse_ifla_xstats)(struct link_util *, | |
119 | int, char **); | |
120 | int (*print_ifla_xstats)(const struct sockaddr_nl *, | |
121 | struct nlmsghdr *, void *); | |
1d934839 PM |
122 | }; |
123 | ||
124 | struct link_util *get_link_kind(const char *kind); | |
125 | ||
3069539f | 126 | void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len); |
217264a0 NA |
127 | int bridge_parse_xstats(struct link_util *lu, int argc, char **argv); |
128 | int bridge_print_xstats(const struct sockaddr_nl *who, | |
129 | struct nlmsghdr *n, void *arg); | |
3069539f | 130 | |
9b765770 | 131 | __u32 ipvrf_get_table(const char *name); |
2330490f | 132 | int name_is_vrf(const char *name); |
7dc0e974 | 133 | |
141bb606 MN |
134 | #ifndef INFINITY_LIFE_TIME |
135 | #define INFINITY_LIFE_TIME 0xFFFFFFFFU | |
136 | #endif | |
f8eb79a6 DB |
137 | |
138 | #ifndef LABEL_MAX_MASK | |
139 | #define LABEL_MAX_MASK 0xFFFFFU | |
140 | #endif | |
837552b4 RS |
141 | |
142 | void print_num(FILE *fp, unsigned int width, uint64_t count); |