svn commit: r345163 - in head/sys: netgraph netinet netpfil/ipfw

Gleb Smirnoff glebius at FreeBSD.org
Thu Mar 14 22:30:07 UTC 2019


Author: glebius
Date: Thu Mar 14 22:30:05 2019
New Revision: 345163
URL: https://svnweb.freebsd.org/changeset/base/345163

Log:
  Remove 'dir' argument in ng_ipfw_input, since ip_fw_args now has this info.
  While here make 'tee' boolean.

Modified:
  head/sys/netgraph/ng_ipfw.c
  head/sys/netinet/ip_var.h
  head/sys/netinet/raw_ip.c
  head/sys/netpfil/ipfw/ip_fw_pfil.c

Modified: head/sys/netgraph/ng_ipfw.c
==============================================================================
--- head/sys/netgraph/ng_ipfw.c	Thu Mar 14 22:28:50 2019	(r345162)
+++ head/sys/netgraph/ng_ipfw.c	Thu Mar 14 22:30:05 2019	(r345163)
@@ -72,8 +72,7 @@ static ng_rcvdata_t	ng_ipfw_rcvdata;
 static ng_disconnect_t	ng_ipfw_disconnect;
 
 static hook_p		ng_ipfw_findhook1(node_p, u_int16_t );
-static int		ng_ipfw_input(struct mbuf **, int, struct ip_fw_args *,
-			    int);
+static int	ng_ipfw_input(struct mbuf **, struct ip_fw_args *, bool);
 
 /* We have only one node */
 static node_p	fw_node;
@@ -285,7 +284,7 @@ ng_ipfw_rcvdata(hook_p hook, item_p item)
 }
 
 static int
-ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee)
+ng_ipfw_input(struct mbuf **m0, struct ip_fw_args *fwa, bool tee)
 {
 	struct mbuf *m;
 	hook_p	hook;
@@ -303,7 +302,7 @@ ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_
 	 * important to return packet back to IP stack. In tee mode we make
 	 * a copy of a packet and forward it into netgraph without a tag.
 	 */
-	if (tee == 0) {
+	if (tee == false) {
 		struct m_tag *tag;
 		struct ipfw_rule_ref *r;
 		m = *m0;
@@ -318,7 +317,8 @@ ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_
 		r = (struct ipfw_rule_ref *)(tag + 1);
 		*r = fwa->rule;
 		r->info &= IPFW_ONEPASS;  /* keep this info */
-		r->info |= dir ? IPFW_INFO_IN : IPFW_INFO_OUT;
+		r->info |= (fwa->flags & IPFW_ARGS_IN) ?
+		    IPFW_INFO_IN : IPFW_INFO_OUT;
 		m_tag_prepend(m, tag);
 
 	} else

Modified: head/sys/netinet/ip_var.h
==============================================================================
--- head/sys/netinet/ip_var.h	Thu Mar 14 22:28:50 2019	(r345162)
+++ head/sys/netinet/ip_var.h	Thu Mar 14 22:30:05 2019	(r345163)
@@ -294,9 +294,7 @@ VNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr);
 /* Divert hooks. */
 extern void	(*ip_divert_ptr)(struct mbuf *m, bool incoming);
 /* ng_ipfw hooks -- XXX make it the same as divert and dummynet */
-extern int	(*ng_ipfw_input_p)(struct mbuf **, int,
-			struct ip_fw_args *, int);
-
+extern int	(*ng_ipfw_input_p)(struct mbuf **, struct ip_fw_args *, bool);
 extern int	(*ip_dn_ctl_ptr)(struct sockopt *);
 extern int	(*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);
 #endif /* _KERNEL */

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c	Thu Mar 14 22:28:50 2019	(r345162)
+++ head/sys/netinet/raw_ip.c	Thu Mar 14 22:30:05 2019	(r345163)
@@ -102,8 +102,7 @@ VNET_DEFINE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr) = NULL;
 int	(*ip_dn_ctl_ptr)(struct sockopt *);
 int	(*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);
 void	(*ip_divert_ptr)(struct mbuf *, bool);
-int	(*ng_ipfw_input_p)(struct mbuf **, int,
-			struct ip_fw_args *, int);
+int	(*ng_ipfw_input_p)(struct mbuf **, struct ip_fw_args *, bool);
 
 #ifdef INET
 /*

Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_pfil.c	Thu Mar 14 22:28:50 2019	(r345162)
+++ head/sys/netpfil/ipfw/ip_fw_pfil.c	Thu Mar 14 22:30:05 2019	(r345163)
@@ -296,8 +296,7 @@ again:
 			break;
 		}
 		MPASS(args.flags & IPFW_ARGS_REF);
-		(void )ng_ipfw_input_p(m0, dir, &args,
-			(ipfw == IP_FW_NGTEE) ? 1 : 0);
+		(void )ng_ipfw_input_p(m0, &args, ipfw == IP_FW_NGTEE);
 		if (ipfw == IP_FW_NGTEE) /* ignore errors for NGTEE */
 			goto again;	/* continue with packet */
 		ret = PFIL_CONSUMED;
@@ -421,8 +420,7 @@ again:
 			break;
 		}
 		MPASS(args.flags & IPFW_ARGS_REF);
-		(void )ng_ipfw_input_p(m0, (dir & PFIL_IN) ? DIR_IN : DIR_OUT,
-			&args, (i == IP_FW_NGTEE) ? 1 : 0);
+		(void )ng_ipfw_input_p(m0, &args, i == IP_FW_NGTEE);
 		if (i == IP_FW_NGTEE) /* ignore errors for NGTEE */
 			goto again;	/* continue with packet */
 		ret = PFIL_CONSUMED;


More information about the svn-src-all mailing list