File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1+ #ifndef LINUX_VERSION_CODE
2+ #include <linux/version.h>
3+ #endif
14#include <linux/module.h>
25#include <linux/kernel.h>
36#include <net/ip.h>
@@ -10,6 +13,14 @@ MODULE_AUTHOR("Semyon Verchenko");
1013MODULE_DESCRIPTION ("Netfilter module to set/reset DF flag" );
1114MODULE_LICENSE ("Dual BSD/GPL" );
1215
16+ /*
17+ * skb_make_writable was removed in this commit:
18+ * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=2cf6bffc49dae26edd12af6b57c8c780590380bf
19+ */
20+ #if (LINUX_VERSION_CODE < KERNEL_VERSION (5 ,3 ,0 ))
21+ #define skb_ensure_writable (skb , len ) (!skb_make_writable((skb), (len)))
22+ #endif
23+
1324static int df_tg_check (const struct xt_tgchk_param * param )
1425{
1526 return 0 ;
@@ -23,7 +34,7 @@ static unsigned int df_tg(struct sk_buff *skb, const struct xt_action_param *par
2334 __u16 old_frag_off , new_frag_off ;
2435
2536 /* make_writable might invoke copy-on-write, so fetch iph afterwards */
26- if (! skb_make_writable (skb , sizeof (struct iphdr ))){
37+ if (skb_ensure_writable (skb , sizeof (struct iphdr ))){
2738 printk (KERN_ERR "DF: Error making skb writable\n" );
2839 return NF_DROP ;
2940 }
You can’t perform that action at this time.
0 commit comments