Commit 12ad5f65 authored by Michal Kubecek's avatar Michal Kubecek Committed by David S. Miller

ipset: drop ipset_nest_start() and ipset_nest_end()

After the previous commit, both ipset_nest_start() and ipset_nest_end() are
just aliases for nla_nest_start() and nla_nest_end() so that there is no
need to keep them.
Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Acked-by: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae0be8de
...@@ -401,33 +401,30 @@ ip_set_get_h16(const struct nlattr *attr) ...@@ -401,33 +401,30 @@ ip_set_get_h16(const struct nlattr *attr)
return ntohs(nla_get_be16(attr)); return ntohs(nla_get_be16(attr));
} }
#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr)
#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr) static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
{ {
struct nlattr *__nested = ipset_nest_start(skb, type); struct nlattr *__nested = nla_nest_start(skb, type);
int ret; int ret;
if (!__nested) if (!__nested)
return -EMSGSIZE; return -EMSGSIZE;
ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
if (!ret) if (!ret)
ipset_nest_end(skb, __nested); nla_nest_end(skb, __nested);
return ret; return ret;
} }
static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
const struct in6_addr *ipaddrptr) const struct in6_addr *ipaddrptr)
{ {
struct nlattr *__nested = ipset_nest_start(skb, type); struct nlattr *__nested = nla_nest_start(skb, type);
int ret; int ret;
if (!__nested) if (!__nested)
return -EMSGSIZE; return -EMSGSIZE;
ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr); ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr);
if (!ret) if (!ret)
ipset_nest_end(skb, __nested); nla_nest_end(skb, __nested);
return ret; return ret;
} }
......
...@@ -99,7 +99,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb) ...@@ -99,7 +99,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
struct nlattr *nested; struct nlattr *nested;
size_t memsize = mtype_memsize(map, set->dsize) + set->ext_size; size_t memsize = mtype_memsize(map, set->dsize) + set->ext_size;
nested = ipset_nest_start(skb, IPSET_ATTR_DATA); nested = nla_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) if (!nested)
goto nla_put_failure; goto nla_put_failure;
if (mtype_do_head(skb, map) || if (mtype_do_head(skb, map) ||
...@@ -109,7 +109,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb) ...@@ -109,7 +109,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
goto nla_put_failure; goto nla_put_failure;
if (unlikely(ip_set_put_flags(skb, set))) if (unlikely(ip_set_put_flags(skb, set)))
goto nla_put_failure; goto nla_put_failure;
ipset_nest_end(skb, nested); nla_nest_end(skb, nested);
return 0; return 0;
nla_put_failure: nla_put_failure:
...@@ -213,7 +213,7 @@ mtype_list(const struct ip_set *set, ...@@ -213,7 +213,7 @@ mtype_list(const struct ip_set *set,
u32 id, first = cb->args[IPSET_CB_ARG0]; u32 id, first = cb->args[IPSET_CB_ARG0];
int ret = 0; int ret = 0;
adt = ipset_nest_start(skb, IPSET_ATTR_ADT); adt = nla_nest_start(skb, IPSET_ATTR_ADT);
if (!adt) if (!adt)
return -EMSGSIZE; return -EMSGSIZE;
/* Extensions may be replaced */ /* Extensions may be replaced */
...@@ -230,7 +230,7 @@ mtype_list(const struct ip_set *set, ...@@ -230,7 +230,7 @@ mtype_list(const struct ip_set *set,
#endif #endif
ip_set_timeout_expired(ext_timeout(x, set)))) ip_set_timeout_expired(ext_timeout(x, set))))
continue; continue;
nested = ipset_nest_start(skb, IPSET_ATTR_DATA); nested = nla_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) { if (!nested) {
if (id == first) { if (id == first) {
nla_nest_cancel(skb, adt); nla_nest_cancel(skb, adt);
...@@ -244,9 +244,9 @@ mtype_list(const struct ip_set *set, ...@@ -244,9 +244,9 @@ mtype_list(const struct ip_set *set,
goto nla_put_failure; goto nla_put_failure;
if (ip_set_put_extensions(skb, set, x, mtype_is_filled(x))) if (ip_set_put_extensions(skb, set, x, mtype_is_filled(x)))
goto nla_put_failure; goto nla_put_failure;
ipset_nest_end(skb, nested); nla_nest_end(skb, nested);
} }
ipset_nest_end(skb, adt); nla_nest_end(skb, adt);
/* Set listing finished */ /* Set listing finished */
cb->args[IPSET_CB_ARG0] = 0; cb->args[IPSET_CB_ARG0] = 0;
...@@ -259,7 +259,7 @@ mtype_list(const struct ip_set *set, ...@@ -259,7 +259,7 @@ mtype_list(const struct ip_set *set,
cb->args[IPSET_CB_ARG0] = 0; cb->args[IPSET_CB_ARG0] = 0;
ret = -EMSGSIZE; ret = -EMSGSIZE;
} }
ipset_nest_end(skb, adt); nla_nest_end(skb, adt);
out: out:
rcu_read_unlock(); rcu_read_unlock();
return ret; return ret;
......
...@@ -1057,7 +1057,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb) ...@@ -1057,7 +1057,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
htable_bits = t->htable_bits; htable_bits = t->htable_bits;
rcu_read_unlock_bh(); rcu_read_unlock_bh();
nested = ipset_nest_start(skb, IPSET_ATTR_DATA); nested = nla_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) if (!nested)
goto nla_put_failure; goto nla_put_failure;
if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE, if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE,
...@@ -1079,7 +1079,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb) ...@@ -1079,7 +1079,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
goto nla_put_failure; goto nla_put_failure;
if (unlikely(ip_set_put_flags(skb, set))) if (unlikely(ip_set_put_flags(skb, set)))
goto nla_put_failure; goto nla_put_failure;
ipset_nest_end(skb, nested); nla_nest_end(skb, nested);
return 0; return 0;
nla_put_failure: nla_put_failure:
...@@ -1124,7 +1124,7 @@ mtype_list(const struct ip_set *set, ...@@ -1124,7 +1124,7 @@ mtype_list(const struct ip_set *set,
void *incomplete; void *incomplete;
int i, ret = 0; int i, ret = 0;
atd = ipset_nest_start(skb, IPSET_ATTR_ADT); atd = nla_nest_start(skb, IPSET_ATTR_ADT);
if (!atd) if (!atd)
return -EMSGSIZE; return -EMSGSIZE;
...@@ -1150,7 +1150,7 @@ mtype_list(const struct ip_set *set, ...@@ -1150,7 +1150,7 @@ mtype_list(const struct ip_set *set,
continue; continue;
pr_debug("list hash %lu hbucket %p i %u, data %p\n", pr_debug("list hash %lu hbucket %p i %u, data %p\n",
cb->args[IPSET_CB_ARG0], n, i, e); cb->args[IPSET_CB_ARG0], n, i, e);
nested = ipset_nest_start(skb, IPSET_ATTR_DATA); nested = nla_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) { if (!nested) {
if (cb->args[IPSET_CB_ARG0] == first) { if (cb->args[IPSET_CB_ARG0] == first) {
nla_nest_cancel(skb, atd); nla_nest_cancel(skb, atd);
...@@ -1163,10 +1163,10 @@ mtype_list(const struct ip_set *set, ...@@ -1163,10 +1163,10 @@ mtype_list(const struct ip_set *set,
goto nla_put_failure; goto nla_put_failure;
if (ip_set_put_extensions(skb, set, e, true)) if (ip_set_put_extensions(skb, set, e, true))
goto nla_put_failure; goto nla_put_failure;
ipset_nest_end(skb, nested); nla_nest_end(skb, nested);
} }
} }
ipset_nest_end(skb, atd); nla_nest_end(skb, atd);
/* Set listing finished */ /* Set listing finished */
cb->args[IPSET_CB_ARG0] = 0; cb->args[IPSET_CB_ARG0] = 0;
...@@ -1180,7 +1180,7 @@ mtype_list(const struct ip_set *set, ...@@ -1180,7 +1180,7 @@ mtype_list(const struct ip_set *set,
cb->args[IPSET_CB_ARG0] = 0; cb->args[IPSET_CB_ARG0] = 0;
ret = -EMSGSIZE; ret = -EMSGSIZE;
} else { } else {
ipset_nest_end(skb, atd); nla_nest_end(skb, atd);
} }
out: out:
rcu_read_unlock(); rcu_read_unlock();
......
...@@ -466,7 +466,7 @@ list_set_head(struct ip_set *set, struct sk_buff *skb) ...@@ -466,7 +466,7 @@ list_set_head(struct ip_set *set, struct sk_buff *skb)
struct nlattr *nested; struct nlattr *nested;
size_t memsize = list_set_memsize(map, set->dsize) + set->ext_size; size_t memsize = list_set_memsize(map, set->dsize) + set->ext_size;
nested = ipset_nest_start(skb, IPSET_ATTR_DATA); nested = nla_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) if (!nested)
goto nla_put_failure; goto nla_put_failure;
if (nla_put_net32(skb, IPSET_ATTR_SIZE, htonl(map->size)) || if (nla_put_net32(skb, IPSET_ATTR_SIZE, htonl(map->size)) ||
...@@ -476,7 +476,7 @@ list_set_head(struct ip_set *set, struct sk_buff *skb) ...@@ -476,7 +476,7 @@ list_set_head(struct ip_set *set, struct sk_buff *skb)
goto nla_put_failure; goto nla_put_failure;
if (unlikely(ip_set_put_flags(skb, set))) if (unlikely(ip_set_put_flags(skb, set)))
goto nla_put_failure; goto nla_put_failure;
ipset_nest_end(skb, nested); nla_nest_end(skb, nested);
return 0; return 0;
nla_put_failure: nla_put_failure:
...@@ -494,7 +494,7 @@ list_set_list(const struct ip_set *set, ...@@ -494,7 +494,7 @@ list_set_list(const struct ip_set *set,
struct set_elem *e; struct set_elem *e;
int ret = 0; int ret = 0;
atd = ipset_nest_start(skb, IPSET_ATTR_ADT); atd = nla_nest_start(skb, IPSET_ATTR_ADT);
if (!atd) if (!atd)
return -EMSGSIZE; return -EMSGSIZE;
...@@ -506,7 +506,7 @@ list_set_list(const struct ip_set *set, ...@@ -506,7 +506,7 @@ list_set_list(const struct ip_set *set,
i++; i++;
continue; continue;
} }
nested = ipset_nest_start(skb, IPSET_ATTR_DATA); nested = nla_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) if (!nested)
goto nla_put_failure; goto nla_put_failure;
ip_set_name_byindex(map->net, e->id, name); ip_set_name_byindex(map->net, e->id, name);
...@@ -514,11 +514,11 @@ list_set_list(const struct ip_set *set, ...@@ -514,11 +514,11 @@ list_set_list(const struct ip_set *set,
goto nla_put_failure; goto nla_put_failure;
if (ip_set_put_extensions(skb, set, e, true)) if (ip_set_put_extensions(skb, set, e, true))
goto nla_put_failure; goto nla_put_failure;
ipset_nest_end(skb, nested); nla_nest_end(skb, nested);
i++; i++;
} }
ipset_nest_end(skb, atd); nla_nest_end(skb, atd);
/* Set listing finished */ /* Set listing finished */
cb->args[IPSET_CB_ARG0] = 0; cb->args[IPSET_CB_ARG0] = 0;
goto out; goto out;
...@@ -531,7 +531,7 @@ list_set_list(const struct ip_set *set, ...@@ -531,7 +531,7 @@ list_set_list(const struct ip_set *set,
ret = -EMSGSIZE; ret = -EMSGSIZE;
} else { } else {
cb->args[IPSET_CB_ARG0] = i; cb->args[IPSET_CB_ARG0] = i;
ipset_nest_end(skb, atd); nla_nest_end(skb, atd);
} }
out: out:
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment