ip: Consolidate ip, xdp and lwtunnel parse/dump prototypes in ip_common.h

Having iplink_parse() and @struct iplink_req in include/utils.h does not
reflect it's IP nature: move to ip/ip_common.h.

Move contents of ip/iplink_xdp.h and ip/iproute_lwtunnel.h to
ip/ip_common.h since they are small (i.e. only two function prototypes):
ip/iplink_bridge.c and ip/iplink_vrf.c prototypes already there.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Serhey Popovych 2018-01-31 10:15:06 +02:00 committed by David Ahern
parent 2cd0578fcb
commit f7af0dc580
9 changed files with 25 additions and 37 deletions

View File

@ -272,16 +272,6 @@ extern int cmdlineno;
ssize_t getcmdline(char **line, size_t *len, FILE *in);
int makeargs(char *line, char *argv[], int maxargs);
struct iplink_req {
struct nlmsghdr n;
struct ifinfomsg i;
char buf[1024];
};
int iplink_parse(int argc, char **argv, struct iplink_req *req,
char **name, char **type, char **link, char **dev,
int *group, int *index);
int do_each_netns(int (*func)(char *nsname, void *arg), void *arg,
bool show_label);

View File

@ -108,6 +108,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;
@ -128,11 +134,26 @@ struct link_util {
struct link_util *get_link_kind(const char *kind);
int iplink_parse(int argc, char **argv, struct iplink_req *req,
char **name, char **type, char **link, char **dev,
int *group, int *index);
/* 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);
/* 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, __u32 ifindex,
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);

View File

@ -34,7 +34,6 @@
#include "utils.h"
#include "ll_map.h"
#include "ip_common.h"
#include "xdp.h"
#include "color.h"
enum {

View File

@ -31,7 +31,6 @@
#include "rt_names.h"
#include "utils.h"
#include "ip_common.h"
#include "xdp.h"
#include "namespace.h"
#define IPLINK_IOCTL_COMPAT 1

View File

@ -14,9 +14,9 @@
#include <linux/bpf.h>
#include "json_print.h"
#include "xdp.h"
#include "bpf_util.h"
#include "utils.h"
#include "ip_common.h"
extern int force;

View File

@ -28,7 +28,6 @@
#include "rt_names.h"
#include "utils.h"
#include "ip_common.h"
#include "iproute_lwtunnel.h"
#ifndef RTAX_RTTVAR
#define RTAX_RTTVAR RTAX_HOPS

View File

@ -22,9 +22,9 @@
#include <errno.h>
#include "rt_names.h"
#include "utils.h"
#include "iproute_lwtunnel.h"
#include "bpf_util.h"
#include "utils.h"
#include "ip_common.h"
#include "ila_common.h"
#include <linux/seg6.h>

View File

@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LWTUNNEL_H__
#define __LETUNNEL_H__ 1
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);
#endif

View File

@ -1,11 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __XDP__
#define __XDP__
#include "utils.h"
int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
bool generic, bool drv, bool offload);
void xdp_dump(FILE *fp, struct rtattr *tb, bool link, bool details);
#endif /* __XDP__ */