summaryrefslogtreecommitdiffstats
path: root/kernel/include
diff options
context:
space:
mode:
authorNeutron Soutmun <neo.neutron@gmail.com>2016-06-23 17:22:11 +0700
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2016-06-28 10:19:35 +0200
commitcaaa867cc7941814216950406c34ef27f73eca54 (patch)
treee280bc8d74b3b56a0a6daf2024c14722952c67ea /kernel/include
parentb20bcc4dff2156ef7b6878a65c3cc9f9ca7331ab (diff)
ipset: Backports for the nla_put_net64() API changes
* Backports the patch "libnl: nla_put_net64():align on a 64-bit area" [1] by Nicolas Dichtel <nicolas.dichtel@6wind.com> * Since the nla_put_net64() API has been changed, therefore, the ip_set_compat.h.in should provides the macro IPSET_NLA_PUT_NET64 that point to the nla_put_net64() with appropriate number of arguments. The build script should distinguish the API changes by detect for the existence of nla_put_64bit() function in include/net/netlink.h. This function was added in the same patches set and called by the nla_put_be64() that called by nla_put_net64() respectively. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=e9bbe898cbe89b17ad3993c136aa13d0431cd537 Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in7
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_counter.h10
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_skbinfo.h7
-rw-r--r--kernel/include/uapi/linux/netfilter/ipset/ip_set.h1
4 files changed, 18 insertions, 7 deletions
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
index 15d0763..fe24255 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -10,6 +10,7 @@
#@HAVE_ETHER_ADDR_EQUAL@ HAVE_ETHER_ADDR_EQUAL
#@HAVE_NLA_PUT_BE16@ HAVE_NLA_PUT_BE16
#@HAVE_NLA_PUT_BE64@ HAVE_NLA_PUT_BE64
+#@HAVE_NLA_PUT_64BIT@ HAVE_NLA_PUT_64BIT
#@HAVE_NL_INFO_PORTID@ HAVE_NL_INFO_PORTID
#define HAVE_NETLINK_DUMP_START_ARGS @HAVE_NETLINK_DUMP_START_ARGS@
#@HAVE_NS_CAPABLE@ HAVE_NS_CAPABLE
@@ -160,6 +161,12 @@ static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
}
#endif
+#ifdef HAVE_NLA_PUT_64BIT
+#define IPSET_NLA_PUT_NET64(skb, t, v, pa) nla_put_be64(skb, t, v, pa)
+#else
+#define IPSET_NLA_PUT_NET64(skb, t, v, pa) nla_put_be64(skb, t, v)
+#endif
+
#ifdef HAVE_NL_INFO_PORTID
#define NETLINK_PORTID(skb) NETLINK_CB(skb).portid
#else
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_counter.h b/kernel/include/linux/netfilter/ipset/ip_set_counter.h
index d61e0e5..f2f1e8f 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_counter.h
+++ b/kernel/include/linux/netfilter/ipset/ip_set_counter.h
@@ -53,10 +53,12 @@ ip_set_update_counter(struct ip_set_counter *counter,
static inline bool
ip_set_put_counter(struct sk_buff *skb, const struct ip_set_counter *counter)
{
- return nla_put_net64(skb, IPSET_ATTR_BYTES,
- cpu_to_be64(ip_set_get_bytes(counter))) ||
- nla_put_net64(skb, IPSET_ATTR_PACKETS,
- cpu_to_be64(ip_set_get_packets(counter)));
+ return IPSET_NLA_PUT_NET64(skb, IPSET_ATTR_BYTES,
+ cpu_to_be64(ip_set_get_bytes(counter)),
+ IPSET_ATTR_PAD) ||
+ IPSET_NLA_PUT_NET64(skb, IPSET_ATTR_PACKETS,
+ cpu_to_be64(ip_set_get_packets(counter)),
+ IPSET_ATTR_PAD);
}
static inline void
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_skbinfo.h b/kernel/include/linux/netfilter/ipset/ip_set_skbinfo.h
index b03dd6a..c6df3a1 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_skbinfo.h
+++ b/kernel/include/linux/netfilter/ipset/ip_set_skbinfo.h
@@ -23,9 +23,10 @@ ip_set_put_skbinfo(struct sk_buff *skb, const struct ip_set_skbinfo *skbinfo)
{
/* Send nonzero parameters only */
return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
- nla_put_net64(skb, IPSET_ATTR_SKBMARK,
- cpu_to_be64((u64)skbinfo->skbmark << 32 |
- skbinfo->skbmarkmask))) ||
+ IPSET_NLA_PUT_NET64(skb, IPSET_ATTR_SKBMARK,
+ cpu_to_be64((u64)skbinfo->skbmark << 32 |
+ skbinfo->skbmarkmask),
+ IPSET_ATTR_PAD)) ||
(skbinfo->skbprio &&
nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
cpu_to_be32(skbinfo->skbprio))) ||
diff --git a/kernel/include/uapi/linux/netfilter/ipset/ip_set.h b/kernel/include/uapi/linux/netfilter/ipset/ip_set.h
index def91b9..4a6776f 100644
--- a/kernel/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/kernel/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -118,6 +118,7 @@ enum {
IPSET_ATTR_SKBMARK,
IPSET_ATTR_SKBPRIO,
IPSET_ATTR_SKBQUEUE,
+ IPSET_ATTR_PAD,
__IPSET_ATTR_ADT_MAX,
};
#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)