Author: glebius
Date: Thu Mar 14 22:23:09 2019
New Revision: 345161
URL: https://svnweb.freebsd.org/changeset/base/345161

Log:
  Make second argument of ip_divert(), that specifies packet direction a bool.
  This allows pf(4) to avoid including ipfw(4) private files.

Modified:
  head/sys/netinet/ip_divert.c
  head/sys/netinet/ip_var.h
  head/sys/netinet/raw_ip.c
  head/sys/netpfil/ipfw/ip_fw_pfil.c
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netinet/ip_divert.c
==============================================================================
--- head/sys/netinet/ip_divert.c        Thu Mar 14 22:20:48 2019        
(r345160)
+++ head/sys/netinet/ip_divert.c        Thu Mar 14 22:23:09 2019        
(r345161)
@@ -184,7 +184,7 @@ div_input(struct mbuf **mp, int *offp, int proto)
  * then pass them along with mbuf chain.
  */
 static void
-divert_packet(struct mbuf *m, int incoming)
+divert_packet(struct mbuf *m, bool incoming)
 {
        struct ip *ip;
        struct inpcb *inp;

Modified: head/sys/netinet/ip_var.h
==============================================================================
--- head/sys/netinet/ip_var.h   Thu Mar 14 22:20:48 2019        (r345160)
+++ head/sys/netinet/ip_var.h   Thu Mar 14 22:23:09 2019        (r345161)
@@ -292,7 +292,7 @@ VNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr);
 #define        V_ip_fw_ctl_ptr         VNET(ip_fw_ctl_ptr)
 
 /* Divert hooks. */
-extern void    (*ip_divert_ptr)(struct mbuf *m, int incoming);
+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);

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c   Thu Mar 14 22:20:48 2019        (r345160)
+++ head/sys/netinet/raw_ip.c   Thu Mar 14 22:23:09 2019        (r345161)
@@ -101,7 +101,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 *, int);
+void   (*ip_divert_ptr)(struct mbuf *, bool);
 int    (*ng_ipfw_input_p)(struct mbuf **, int,
                        struct ip_fw_args *, int);
 

Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_pfil.c  Thu Mar 14 22:20:48 2019        
(r345160)
+++ head/sys/netpfil/ipfw/ip_fw_pfil.c  Thu Mar 14 22:23:09 2019        
(r345161)
@@ -85,7 +85,7 @@ VNET_DEFINE_STATIC(int, fwlink_enable) = 0;
 int ipfw_chg_hook(SYSCTL_HANDLER_ARGS);
 
 /* Forward declarations. */
-static int ipfw_divert(struct mbuf **, int, struct ipfw_rule_ref *, int);
+static int ipfw_divert(struct mbuf **, bool, struct ipfw_rule_ref *, int);
 
 #ifdef SYSCTL_NODE
 
@@ -282,7 +282,7 @@ again:
                        break;
                }
                MPASS(args.flags & IPFW_ARGS_REF);
-               (void )ipfw_divert(m0, dir, &args.rule,
+               (void )ipfw_divert(m0, dir == DIR_IN, &args.rule,
                        (ipfw == IP_FW_TEE) ? 1 : 0);
                /* continue processing for the original packet (tee). */
                if (*m0)
@@ -443,7 +443,7 @@ again:
 
 /* do the divert, return 1 on error 0 on success */
 static int
-ipfw_divert(struct mbuf **m0, int incoming, struct ipfw_rule_ref *rule,
+ipfw_divert(struct mbuf **m0, bool incoming, struct ipfw_rule_ref *rule,
        int tee)
 {
        /*

Modified: head/sys/netpfil/pf/pf.c
==============================================================================
--- head/sys/netpfil/pf/pf.c    Thu Mar 14 22:20:48 2019        (r345160)
+++ head/sys/netpfil/pf/pf.c    Thu Mar 14 22:23:09 2019        (r345161)
@@ -91,8 +91,6 @@ __FBSDID("$FreeBSD$");
 #include <netinet/udp.h>
 #include <netinet/udp_var.h>
 
-#include <netpfil/ipfw/ip_fw_private.h> /* XXX: only for DIR_IN/DIR_OUT */
-
 #ifdef INET6
 #include <netinet/ip6.h>
 #include <netinet/icmp6.h>
@@ -6184,7 +6182,7 @@ done:
                                        m->m_flags &= ~M_FASTFWD_OURS;
                                }
                        }
-                       ip_divert_ptr(*m0, dir ==  PF_IN ? DIR_IN : DIR_OUT);
+                       ip_divert_ptr(*m0, dir == PF_IN);
                        *m0 = NULL;
 
                        return (action);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to