Skip to content

Commit

Permalink
Merge pull request luigirizzo#1 from tomerb/master
Browse files Browse the repository at this point in the history
adding support for linux 4.x kernels
  • Loading branch information
pmcgleenon committed May 6, 2016
2 parents 922efc7 + 0a74717 commit e875f6b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion kipfw/ipfw2_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,19 @@ call_ipfw(
#else
struct sk_buff *skb,
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
const struct net_device *in, const struct net_device *out,
int (*okfn)(struct sk_buff *))
#else
const struct nf_hook_state *state)
#endif
{
(void)hooknum; (void)skb; (void)in; (void)out; (void)okfn; /* UNUSED */
(void)hooknum; (void)skb; /* UNUSED */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
(void)in; (void)out; (void)okfn; /* UNUSED */
#else
(void)state; /* UNUSED */
#endif
return NF_QUEUE;
}

Expand Down Expand Up @@ -556,7 +565,11 @@ ipfw2_queue_handler(QH_ARGS)
m->m_skb = skb;
m->m_len = skb->len; /* len from ip header to end */
m->m_pkthdr.len = skb->len; /* total packet len */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
m->m_pkthdr.rcvif = info->indev;
#else
m->m_pkthdr.rcvif = info->state.in;
#endif
m->queue_entry = info;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) /* XXX was 2.6.0 */
m->m_data = (char *)skb->nh.iph;
Expand All @@ -565,11 +578,19 @@ ipfw2_queue_handler(QH_ARGS)
#endif

/* XXX add the interface */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
if (info->hook == IPFW_HOOK_IN) {
ret = ipfw_check_hook(NULL, &m, info->indev, PFIL_IN, NULL);
} else {
ret = ipfw_check_hook(NULL, &m, info->outdev, PFIL_OUT, NULL);
}
#else
if (info->state.hook == IPFW_HOOK_IN) {
ret = ipfw_check_hook(NULL, &m, info->state.in, PFIL_IN, NULL);
} else {
ret = ipfw_check_hook(NULL, &m, info->state.out, PFIL_OUT, NULL);
}
#endif

if (m != NULL) { /* Accept. reinject and free the mbuf */
REINJECT(info, NF_ACCEPT);
Expand Down

0 comments on commit e875f6b

Please sign in to comment.