]> granicus.if.org Git - ipset/commitdiff
Backport nla_put_net* functions as NLA_PUT* were removed
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 10 May 2012 09:42:08 +0000 (11:42 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 10 May 2012 09:42:08 +0000 (11:42 +0200)
kernel/include/linux/netfilter/ipset/ip_set.h

index d6d549cf1f23f9a4ba89aea56394565434ee7c84..94c27fdd8753ca605eacebc168729edacf7dd573 100644 (file)
@@ -411,6 +411,28 @@ ip_set_get_h16(const struct nlattr *attr)
 #define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
 #define ipset_nest_end(skb, start)  nla_nest_end(skb, start)
 
+#ifdef NLA_PUT_NET16
+static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
+{
+       return nla_put(skb, attrtype, sizeof(__be16), &value);
+}
+
+static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value)
+{
+       return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value);
+}
+
+static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
+{
+       return nla_put(skb, attrtype, sizeof(__be32), &value);
+}
+
+static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value)
+{
+       return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value);
+}
+#endif
+
 static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
 {
        struct nlattr *__nested = ipset_nest_start(skb, type);