Skip to content

Commit 8008427

Browse files
committed
Rework NF_HOOK call.
1 parent d667779 commit 8008427

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

compat.h

-9
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,4 @@ int in6_pton(const char *src, int srclen,
589589
# define vlan_tx_tag_present skb_vlan_tag_present
590590
#endif
591591

592-
/* NF_HOOK is 'define' in old code, but it's function in new code,
593-
* also, it's function in, supposedly older, kernel version of Centos 7.[01],
594-
* due to backporing. */
595-
#if defined(NF_HOOK) || (defined(RHEL_MAJOR) && RHEL_MAJOR == 7 && RHEL_MINOR < 2)
596-
# define NF_HOOK_COMPAT(a,b,c,d,e,f,g) NF_HOOK(a,b, d,e,f,g)
597-
#else /* new kernels */
598-
# define NF_HOOK_COMPAT NF_HOOK
599-
#endif
600-
601592
#endif /* COMPAT_NETFLOW_H */

ipt_NETFLOW.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -1219,11 +1219,14 @@ static int promisc4_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
12191219
memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
12201220
skb_orphan(skb);
12211221

1222-
return NF_HOOK_COMPAT(NFPROTO_IPV4, NF_INET_PRE_ROUTING,
1222+
return NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING,
12231223
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
12241224
dev_net(dev),
12251225
#endif
1226-
NULL, skb, dev, NULL, promisc_finish);
1226+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) || (defined(RHEL_MAJOR) && RHEL_MAJOR == 7 && RHEL_MINOR < 2)
1227+
NULL,
1228+
#endif
1229+
skb, dev, NULL, promisc_finish);
12271230
drop:
12281231
NETFLOW_STAT_INC(pkt_promisc_drop);
12291232
kfree_skb(skb);
@@ -1291,11 +1294,14 @@ static int promisc6_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
12911294
rcu_read_unlock();
12921295
skb_orphan(skb);
12931296

1294-
return NF_HOOK_COMPAT(NFPROTO_IPV6, NF_INET_PRE_ROUTING,
1297+
return NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING,
12951298
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
12961299
dev_net(dev),
12971300
#endif
1298-
NULL, skb, dev, NULL, promisc_finish);
1301+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) || (defined(RHEL_MAJOR) && RHEL_MAJOR == 7 && RHEL_MINOR < 2)
1302+
NULL,
1303+
#endif
1304+
skb, dev, NULL, promisc_finish);
12991305
drop:
13001306
rcu_read_unlock();
13011307
NETFLOW_STAT_INC(pkt_promisc_drop);

0 commit comments

Comments
 (0)