]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - ip/ip_common.h
rdma: Properly mark RDMAtool license
[mirror_iproute2.git] / ip / ip_common.h
index 4b8b0a71b87890123dcd5eea951cdbcbb3745c6b..d67575c63c24b93d268dea47c99fd467e3d7dd08 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #ifndef _IP_COMMON_H_
 #define _IP_COMMON_H_
 
@@ -26,19 +27,12 @@ struct link_filter {
 };
 
 int get_operstate(const char *name);
-int print_linkinfo(const struct sockaddr_nl *who,
-                  struct nlmsghdr *n, void *arg);
-int print_linkinfo_brief(const struct sockaddr_nl *who,
-                        struct nlmsghdr *n, void *arg,
-                        struct link_filter *filter);
-int print_addrinfo(const struct sockaddr_nl *who,
-                  struct nlmsghdr *n, void *arg);
-int print_addrlabel(const struct sockaddr_nl *who,
-                   struct nlmsghdr *n, void *arg);
-int print_neigh(const struct sockaddr_nl *who,
-               struct nlmsghdr *n, void *arg);
+int print_linkinfo(struct nlmsghdr *n, void *arg);
+int print_addrinfo(struct nlmsghdr *n, void *arg);
+int print_addrlabel(struct nlmsghdr *n, void *arg);
+int print_neigh(struct nlmsghdr *n, void *arg);
 int ipaddr_list_link(int argc, char **argv);
-void ipaddr_get_vf_rate(int, int *, int *, int);
+void ipaddr_get_vf_rate(int, int *, int *, const char *);
 void iplink_usage(void) __attribute__((noreturn));
 
 void iproute_reset_filter(int ifindex);
@@ -47,21 +41,18 @@ void ipaddr_reset_filter(int oneline, int ifindex);
 void ipneigh_reset_filter(int ifindex);
 void ipnetconf_reset_filter(int ifindex);
 
-int print_route(const struct sockaddr_nl *who,
-               struct nlmsghdr *n, void *arg);
-int print_mroute(const struct sockaddr_nl *who,
-                struct nlmsghdr *n, void *arg);
-int print_prefix(const struct sockaddr_nl *who,
-                struct nlmsghdr *n, void *arg);
-int print_rule(const struct sockaddr_nl *who,
-              struct nlmsghdr *n, void *arg);
-int print_netconf(const struct sockaddr_nl *who,
-                 struct rtnl_ctrl_data *ctrl,
+int print_route(struct nlmsghdr *n, void *arg);
+int print_mroute(struct nlmsghdr *n, void *arg);
+int print_prefix(struct nlmsghdr *n, void *arg);
+int print_rule(struct nlmsghdr *n, void *arg);
+int print_netconf(struct rtnl_ctrl_data *ctrl,
                  struct nlmsghdr *n, void *arg);
 void netns_map_init(void);
 void netns_nsid_socket_init(void);
-int print_nsid(const struct sockaddr_nl *who,
-              struct nlmsghdr *n, void *arg);
+int print_nsid(struct nlmsghdr *n, void *arg);
+char *get_name_from_nsid(int nsid);
+int get_netnsid_from_name(const char *name);
+int set_netnsid_from_name(const char *name, int nsid);
 int do_ipaddr(int argc, char **argv);
 int do_ipaddrlabel(int argc, char **argv);
 int do_iproute(int argc, char **argv);
@@ -81,7 +72,7 @@ int do_netns(int argc, char **argv);
 int do_xfrm(int argc, char **argv);
 int do_ipl2tp(int argc, char **argv);
 int do_ipfou(int argc, char **argv);
-extern int do_ipila(int argc, char **argv);
+int do_ipila(int argc, char **argv);
 int do_tcp_metrics(int argc, char **argv);
 int do_ipnetconf(int argc, char **argv);
 int do_iptoken(int argc, char **argv);
@@ -90,11 +81,10 @@ void vrf_reset(void);
 int netns_identify_pid(const char *pidstr, char *name, int len);
 int do_seg6(int argc, char **argv);
 
-int iplink_get(unsigned int flags, char *name, __u32 filt_mask);
+int iplink_get(char *name, __u32 filt_mask);
 int iplink_ifla_xstats(int argc, char **argv);
 
-int ip_linkaddr_list(int family, req_filter_fn_t filter_fn,
-                    struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo);
+int ip_link_list(req_filter_fn_t filter_fn, struct nlmsg_chain *linfo);
 void free_nlmsg_chain(struct nlmsg_chain *info);
 
 static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
@@ -108,6 +98,12 @@ static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb)
 
 extern struct rtnl_handle rth;
 
+struct iplink_req {
+       struct nlmsghdr         n;
+       struct ifinfomsg        i;
+       char                    buf[1024];
+};
+
 struct link_util {
        struct link_util        *next;
        const char              *id;
@@ -122,17 +118,28 @@ struct link_util {
                                              FILE *);
        int                     (*parse_ifla_xstats)(struct link_util *,
                                                     int, char **);
-       int                     (*print_ifla_xstats)(const struct sockaddr_nl *,
-                                                    struct nlmsghdr *, void *);
+       int                     (*print_ifla_xstats)(struct nlmsghdr *, void *);
 };
 
 struct link_util *get_link_kind(const char *kind);
 
+int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type);
+
+/* iplink_bridge.c */
 void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len);
 int bridge_parse_xstats(struct link_util *lu, int argc, char **argv);
-int bridge_print_xstats(const struct sockaddr_nl *who,
-                       struct nlmsghdr *n, void *arg);
+int bridge_print_xstats(struct nlmsghdr *n, void *arg);
+
+/* iproute_lwtunnel.c */
+int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp);
+void lwt_print_encap(FILE *fp, struct rtattr *encap_type, struct rtattr *encap);
+
+/* iplink_xdp.c */
+int xdp_parse(int *argc, char ***argv, struct iplink_req *req, const char *ifname,
+             bool generic, bool drv, bool offload);
+void xdp_dump(FILE *fp, struct rtattr *tb, bool link, bool details);
 
+/* iplink_vrf.c */
 __u32 ipvrf_get_table(const char *name);
 int name_is_vrf(const char *name);