lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 31 Jan 2018 10:15:06 +0200
From:   Serhey Popovych <serhe.popovych@...il.com>
To:     netdev@...r.kernel.org
Subject: [PATCH iproute2-next 1/3] 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@...il.com>
---
 include/utils.h       |   10 ----------
 ip/ip_common.h        |   21 +++++++++++++++++++++
 ip/ipaddress.c        |    1 -
 ip/iplink.c           |    1 -
 ip/iplink_xdp.c       |    4 ++--
 ip/iproute.c          |    1 -
 ip/iproute_lwtunnel.c |    4 ++--
 ip/iproute_lwtunnel.h |    9 ---------
 ip/xdp.h              |   11 -----------
 9 files changed, 25 insertions(+), 37 deletions(-)
 delete mode 100644 ip/iproute_lwtunnel.h
 delete mode 100644 ip/xdp.h

diff --git a/include/utils.h b/include/utils.h
index 0394268..f81928a 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -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);
 
diff --git a/ip/ip_common.h b/ip/ip_common.h
index 3203f0c..35df364 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -109,6 +109,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;
@@ -129,11 +135,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);
 
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 051a05f..acb9936 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -34,7 +34,6 @@
 #include "utils.h"
 #include "ll_map.h"
 #include "ip_common.h"
-#include "xdp.h"
 #include "color.h"
 
 enum {
diff --git a/ip/iplink.c b/ip/iplink.c
index 230f4c5..6cbd04f 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -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
diff --git a/ip/iplink_xdp.c b/ip/iplink_xdp.c
index 6eeb820..8382635 100644
--- a/ip/iplink_xdp.c
+++ b/ip/iplink_xdp.c
@@ -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;
 
diff --git a/ip/iproute.c b/ip/iproute.c
index bf886fd..7616c0d 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -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
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index ffa897a..f7fbc62 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -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>
diff --git a/ip/iproute_lwtunnel.h b/ip/iproute_lwtunnel.h
deleted file mode 100644
index be003ce..0000000
--- a/ip/iproute_lwtunnel.h
+++ /dev/null
@@ -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
diff --git a/ip/xdp.h b/ip/xdp.h
deleted file mode 100644
index 7e10696..0000000
--- a/ip/xdp.h
+++ /dev/null
@@ -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__ */
-- 
1.7.10.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ