Make second argument of ip_divert(), that specifies packet direction a bool.

This allows pf(4) to avoid including ipfw(4) private files.
This commit is contained in:
Gleb Smirnoff 2019-03-14 22:23:09 +00:00
parent 2d0232783c
commit 1830dae3d3
5 changed files with 7 additions and 9 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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)
{
/*

View file

@ -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);