]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
configure.ac: Build on kernels without skb->vlan_proto correctly
authorSerhey Popovych <serhe.popovych@gmail.com>
Fri, 29 Nov 2019 09:21:29 +0000 (11:21 +0200)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Mon, 9 Dec 2019 10:02:27 +0000 (11:02 +0100)
Support for EtherType other than ETH_P_8021Q for VLAN header introduced
with commit 86a9bad3ab6b ("net: vlan: add protocol argument to packet
tagging functions") in upstream kernel since v3.10.

To support build on older kernels check for ->vlan_proto presence in
@struct sk_buff and return htons(ETH_P_8021Q) when it is missing.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in

index ced28805a227c926d7a361d0c2f8fb3d471fa2f8..8fe1890300cf2f94d2965d21655aa5b7beebf3d5 100644 (file)
@@ -535,6 +535,17 @@ if test -f $ksourcedir/include/net/pkt_sched.h && \
 else
        AC_MSG_RESULT(no)
        AC_SUBST(HAVE_TC_SKB_PROTOCOL, undef)
+
+       AC_MSG_CHECKING([kernel source for vlan_proto in struct sk_buff])
+       if test -f $ksourcedir/include/linux/skbuff.h && \
+          $AWK '/^struct sk_buff {/,/^};$/' $ksourcedir/include/linux/skbuff.h | \
+          $GREP -q 'vlan_proto'; then
+               AC_MSG_RESULT(yes)
+               AC_SUBST(HAVE_VLAN_PROTO_IN_SK_BUFF, define)
+       else
+               AC_MSG_RESULT(no)
+               AC_SUBST(HAVE_VLAN_PROTO_IN_SK_BUFF, undef)
+       fi
 fi
 
 AC_MSG_CHECKING([kernel source for struct net in struct xt_action_param])
index f4d7acc79bad04d62e8e9bc824564e0364c42780..38f4179acb57cc18af9d64cb4d760ebb21333cde 100644 (file)
@@ -338,7 +338,11 @@ static inline int nla_put_in6_addr(struct sk_buff *skb, int attrtype,
 static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
 {
        if (vlan_tx_tag_present(skb))
+#ifdef HAVE_VLAN_PROTO_IN_SK_BUFF
                return skb->vlan_proto;
+#else
+               return htons(ETH_P_8021Q);
+#endif
        return skb->protocol;
 }
 #endif