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:
parent
b7795b6746
commit
cef9f220cd
@ -72,8 +72,7 @@ static ng_rcvdata_t ng_ipfw_rcvdata;
|
|||||||
static ng_disconnect_t ng_ipfw_disconnect;
|
static ng_disconnect_t ng_ipfw_disconnect;
|
||||||
|
|
||||||
static hook_p ng_ipfw_findhook1(node_p, u_int16_t );
|
static hook_p ng_ipfw_findhook1(node_p, u_int16_t );
|
||||||
static int ng_ipfw_input(struct mbuf **, int, struct ip_fw_args *,
|
static int ng_ipfw_input(struct mbuf **, struct ip_fw_args *, bool);
|
||||||
int);
|
|
||||||
|
|
||||||
/* We have only one node */
|
/* We have only one node */
|
||||||
static node_p fw_node;
|
static node_p fw_node;
|
||||||
@ -285,7 +284,7 @@ ng_ipfw_rcvdata(hook_p hook, item_p item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
struct mbuf *m;
|
||||||
hook_p hook;
|
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
|
* 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.
|
* a copy of a packet and forward it into netgraph without a tag.
|
||||||
*/
|
*/
|
||||||
if (tee == 0) {
|
if (tee == false) {
|
||||||
struct m_tag *tag;
|
struct m_tag *tag;
|
||||||
struct ipfw_rule_ref *r;
|
struct ipfw_rule_ref *r;
|
||||||
m = *m0;
|
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 = (struct ipfw_rule_ref *)(tag + 1);
|
||||||
*r = fwa->rule;
|
*r = fwa->rule;
|
||||||
r->info &= IPFW_ONEPASS; /* keep this info */
|
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);
|
m_tag_prepend(m, tag);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
@ -294,9 +294,7 @@ VNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr);
|
|||||||
/* Divert hooks. */
|
/* Divert hooks. */
|
||||||
extern void (*ip_divert_ptr)(struct mbuf *m, bool incoming);
|
extern void (*ip_divert_ptr)(struct mbuf *m, bool incoming);
|
||||||
/* ng_ipfw hooks -- XXX make it the same as divert and dummynet */
|
/* ng_ipfw hooks -- XXX make it the same as divert and dummynet */
|
||||||
extern int (*ng_ipfw_input_p)(struct mbuf **, int,
|
extern int (*ng_ipfw_input_p)(struct mbuf **, struct ip_fw_args *, bool);
|
||||||
struct ip_fw_args *, int);
|
|
||||||
|
|
||||||
extern int (*ip_dn_ctl_ptr)(struct sockopt *);
|
extern int (*ip_dn_ctl_ptr)(struct sockopt *);
|
||||||
extern int (*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);
|
extern int (*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
@ -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_ctl_ptr)(struct sockopt *);
|
||||||
int (*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);
|
int (*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);
|
||||||
void (*ip_divert_ptr)(struct mbuf *, bool);
|
void (*ip_divert_ptr)(struct mbuf *, bool);
|
||||||
int (*ng_ipfw_input_p)(struct mbuf **, int,
|
int (*ng_ipfw_input_p)(struct mbuf **, struct ip_fw_args *, bool);
|
||||||
struct ip_fw_args *, int);
|
|
||||||
|
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
/*
|
/*
|
||||||
|
@ -296,8 +296,7 @@ again:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MPASS(args.flags & IPFW_ARGS_REF);
|
MPASS(args.flags & IPFW_ARGS_REF);
|
||||||
(void )ng_ipfw_input_p(m0, dir, &args,
|
(void )ng_ipfw_input_p(m0, &args, ipfw == IP_FW_NGTEE);
|
||||||
(ipfw == IP_FW_NGTEE) ? 1 : 0);
|
|
||||||
if (ipfw == IP_FW_NGTEE) /* ignore errors for NGTEE */
|
if (ipfw == IP_FW_NGTEE) /* ignore errors for NGTEE */
|
||||||
goto again; /* continue with packet */
|
goto again; /* continue with packet */
|
||||||
ret = PFIL_CONSUMED;
|
ret = PFIL_CONSUMED;
|
||||||
@ -421,8 +420,7 @@ again:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MPASS(args.flags & IPFW_ARGS_REF);
|
MPASS(args.flags & IPFW_ARGS_REF);
|
||||||
(void )ng_ipfw_input_p(m0, (dir & PFIL_IN) ? DIR_IN : DIR_OUT,
|
(void )ng_ipfw_input_p(m0, &args, i == IP_FW_NGTEE);
|
||||||
&args, (i == IP_FW_NGTEE) ? 1 : 0);
|
|
||||||
if (i == IP_FW_NGTEE) /* ignore errors for NGTEE */
|
if (i == IP_FW_NGTEE) /* ignore errors for NGTEE */
|
||||||
goto again; /* continue with packet */
|
goto again; /* continue with packet */
|
||||||
ret = PFIL_CONSUMED;
|
ret = PFIL_CONSUMED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user