Remove 'dir' argument in ng_ipfw_input, since ip_fw_args now has this info.

While here make 'tee' boolean.
This commit is contained in:
Gleb Smirnoff 2019-03-14 22:30:05 +00:00
parent b7795b6746
commit cef9f220cd
4 changed files with 9 additions and 14 deletions

View File

@ -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_args *fwa, int tee)
* 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_args *fwa, int tee)
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

View File

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

View File

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

View File

@ -296,8 +296,7 @@ ipfw_check_packet(struct mbuf **m0, struct ifnet *ifp, int flags,
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 @@ ipfw_check_frame(struct mbuf **m0, struct ifnet *ifp, int dir,
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;