From: Ben Hutchings Date: Thu, 16 Nov 2017 21:00:59 +0000 (+0000) Subject: netfilter: nat: Avoid ABI change in 4.9.63 X-Git-Tag: archive/raspbian/4.9.80-2+rpi1~8^2~12 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=90421b48e407e49cbbc5dc7b3ee203ade441eb88;p=linux-4.9.git netfilter: nat: Avoid ABI change in 4.9.63 Commit e1bf1687740c ("netfilter: nat: Revert "netfilter: nat: convert nat bysrc hash to rhashtable") changed the type of nf_conn::nat_bysource. Thankfully the two types are the same size, and nothing outside of nf_nat_core touches this field directly. Hide the change from genksyms but add compile-time assertions to make sure that this isn't an ABI change. Gbp-Pq: Topic debian Gbp-Pq: Name netfilter-nat-avoid-abi-change-in-4.9.63.patch --- diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 9ae819e27940..f6bc7ed1b56c 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -100,7 +101,11 @@ struct nf_conn { possible_net_t ct_net; #if IS_ENABLED(CONFIG_NF_NAT) +#ifndef __GENKSYMS__ struct hlist_node nat_bysource; +#else + struct rhlist_head nat_bysource; +#endif #endif /* all members below initialized via memset */ u8 __nfct_init_offset[0]; diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index 02515f7ed4cc..c327a431a6f3 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h @@ -1,5 +1,6 @@ #ifndef _NF_NAT_H #define _NF_NAT_H +#include #include #include #include diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index 624d6e4dcd5c..c07897e2f0d6 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c @@ -811,6 +811,11 @@ static int __init nf_nat_init(void) { int ret; + /* bwh: Assert that nat_bysource hasn't changed size or alignment */ + BUILD_BUG_ON(sizeof(struct hlist_node) != sizeof(struct rhlist_head)); + BUILD_BUG_ON(__alignof__(struct hlist_node) != + __alignof__(struct rhlist_head)); + /* Leave them the same for the moment. */ nf_nat_htable_size = nf_conntrack_htable_size;