Phil Sutter | f7b49a3 | 2015-11-06 18:54:08 +0100 | [diff] [blame] | 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, |
Nicolas Dichtel | 9d0efc1 | 2012-12-12 09:09:23 -0800 | [diff] [blame] | 5 | struct nlmsghdr *n, void *arg); |
Phil Sutter | f7b49a3 | 2015-11-06 18:54:08 +0100 | [diff] [blame] | 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, |
Stephen Hemminger | 90353c3 | 2016-06-08 09:15:52 -0700 | [diff] [blame] | 11 | struct nlmsghdr *n, void *arg); |
Phil Sutter | f7b49a3 | 2015-11-06 18:54:08 +0100 | [diff] [blame] | 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); |
Anton Aksola | e29a8e0 | 2016-09-20 06:01:27 +0000 | [diff] [blame] | 34 | void netns_nsid_socket_init(void); |
Phil Sutter | f7b49a3 | 2015-11-06 18:54:08 +0100 | [diff] [blame] | 35 | int print_nsid(const struct sockaddr_nl *who, |
| 36 | struct nlmsghdr *n, void *arg); |
| 37 | int do_ipaddr(int argc, char **argv); |
| 38 | int do_ipaddrlabel(int argc, char **argv); |
| 39 | int do_iproute(int argc, char **argv); |
| 40 | int do_iprule(int argc, char **argv); |
| 41 | int do_ipneigh(int argc, char **argv); |
| 42 | int do_ipntable(int argc, char **argv); |
| 43 | int do_iptunnel(int argc, char **argv); |
| 44 | int do_ip6tunnel(int argc, char **argv); |
| 45 | int do_iptuntap(int argc, char **argv); |
| 46 | int do_iplink(int argc, char **argv); |
Sabrina Dubroca | b26fc59 | 2016-06-08 09:34:21 -0700 | [diff] [blame] | 47 | int do_ipmacsec(int argc, char **argv); |
Phil Sutter | f7b49a3 | 2015-11-06 18:54:08 +0100 | [diff] [blame] | 48 | int do_ipmonitor(int argc, char **argv); |
| 49 | int do_multiaddr(int argc, char **argv); |
| 50 | int do_multiroute(int argc, char **argv); |
| 51 | int do_multirule(int argc, char **argv); |
| 52 | int do_netns(int argc, char **argv); |
| 53 | int do_xfrm(int argc, char **argv); |
| 54 | int do_ipl2tp(int argc, char **argv); |
| 55 | int do_ipfou(int argc, char **argv); |
Tom Herbert | ec71cae | 2016-08-04 13:34:54 -0700 | [diff] [blame] | 56 | extern int do_ipila(int argc, char **argv); |
Phil Sutter | f7b49a3 | 2015-11-06 18:54:08 +0100 | [diff] [blame] | 57 | int do_tcp_metrics(int argc, char **argv); |
| 58 | int do_ipnetconf(int argc, char **argv); |
| 59 | int do_iptoken(int argc, char **argv); |
| 60 | int iplink_get(unsigned int flags, char *name, __u32 filt_mask); |
shemminger | 351efcd | 2005-09-01 19:21:50 +0000 | [diff] [blame] | 61 | |
Patrick McHardy | 34e9564 | 2006-08-11 00:14:51 +0200 | [diff] [blame] | 62 | static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb) |
| 63 | { |
| 64 | __u32 table = r->rtm_table; |
Stephen Hemminger | 90353c3 | 2016-06-08 09:15:52 -0700 | [diff] [blame] | 65 | |
Patrick McHardy | 34e9564 | 2006-08-11 00:14:51 +0200 | [diff] [blame] | 66 | if (tb[RTA_TABLE]) |
Stephen Hemminger | ff24746 | 2012-04-10 08:47:55 -0700 | [diff] [blame] | 67 | table = rta_getattr_u32(tb[RTA_TABLE]); |
Patrick McHardy | 34e9564 | 2006-08-11 00:14:51 +0200 | [diff] [blame] | 68 | return table; |
| 69 | } |
| 70 | |
shemminger | 351efcd | 2005-09-01 19:21:50 +0000 | [diff] [blame] | 71 | extern struct rtnl_handle rth; |
Masahide NAKAMURA | 141bb60 | 2006-11-24 12:27:01 +0900 | [diff] [blame] | 72 | |
Jiri Pirko | fbea611 | 2014-01-23 17:52:53 +0100 | [diff] [blame] | 73 | #include <stdbool.h> |
| 74 | |
Stephen Hemminger | 90353c3 | 2016-06-08 09:15:52 -0700 | [diff] [blame] | 75 | struct link_util { |
Patrick McHardy | 1d93483 | 2007-08-22 10:49:01 -0700 | [diff] [blame] | 76 | struct link_util *next; |
| 77 | const char *id; |
| 78 | int maxattr; |
| 79 | int (*parse_opt)(struct link_util *, int, char **, |
| 80 | struct nlmsghdr *); |
| 81 | void (*print_opt)(struct link_util *, FILE *, |
| 82 | struct rtattr *[]); |
| 83 | void (*print_xstats)(struct link_util *, FILE *, |
| 84 | struct rtattr *); |
vadimk | 561e650 | 2014-09-30 08:17:31 +0300 | [diff] [blame] | 85 | void (*print_help)(struct link_util *, int, char **, |
| 86 | FILE *); |
Patrick McHardy | 1d93483 | 2007-08-22 10:49:01 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | struct link_util *get_link_kind(const char *kind); |
| 90 | |
Nikolay Aleksandrov | 3069539 | 2016-02-16 16:08:51 +0100 | [diff] [blame] | 91 | void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len); |
| 92 | |
David Ahern | 9b76577 | 2016-06-29 11:27:01 -0700 | [diff] [blame] | 93 | __u32 ipvrf_get_table(const char *name); |
David Ahern | 7dc0e97 | 2016-06-29 11:26:57 -0700 | [diff] [blame] | 94 | bool name_is_vrf(const char *name); |
| 95 | |
Masahide NAKAMURA | 141bb60 | 2006-11-24 12:27:01 +0900 | [diff] [blame] | 96 | #ifndef INFINITY_LIFE_TIME |
| 97 | #define INFINITY_LIFE_TIME 0xFFFFFFFFU |
| 98 | #endif |
Daniel Borkmann | f8eb79a | 2016-03-24 16:49:55 +0100 | [diff] [blame] | 99 | |
| 100 | #ifndef LABEL_MAX_MASK |
| 101 | #define LABEL_MAX_MASK 0xFFFFFU |
| 102 | #endif |