[NETFILTER]: nfnetlink: rename functions containing 'nfattr'
There is no struct nfattr anymore, rename functions to 'nlattr'. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
df6fb868d6
commit
fdf708322d
@@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);
|
||||
/* Generic function for tcp/udp/sctp/dccp and alike. This needs to be
|
||||
* in ip_conntrack_core, since we don't want the protocols to autoload
|
||||
* or depend on ctnetlink */
|
||||
int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
|
||||
int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
|
||||
const struct nf_conntrack_tuple *tuple)
|
||||
{
|
||||
NLA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(u_int16_t),
|
||||
@@ -842,20 +842,20 @@ int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
|
||||
nla_put_failure:
|
||||
return -1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_ct_port_tuple_to_nfattr);
|
||||
EXPORT_SYMBOL_GPL(nf_ct_port_tuple_to_nlattr);
|
||||
|
||||
static const size_t cta_min_proto[CTA_PROTO_MAX+1] = {
|
||||
[CTA_PROTO_SRC_PORT] = sizeof(u_int16_t),
|
||||
[CTA_PROTO_DST_PORT] = sizeof(u_int16_t)
|
||||
};
|
||||
|
||||
int nf_ct_port_nfattr_to_tuple(struct nlattr *tb[],
|
||||
int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
|
||||
struct nf_conntrack_tuple *t)
|
||||
{
|
||||
if (!tb[CTA_PROTO_SRC_PORT] || !tb[CTA_PROTO_DST_PORT])
|
||||
return -EINVAL;
|
||||
|
||||
if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
||||
if (nlattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
||||
return -EINVAL;
|
||||
|
||||
t->src.u.tcp.port = *(__be16 *)nla_data(tb[CTA_PROTO_SRC_PORT]);
|
||||
@@ -863,7 +863,7 @@ int nf_ct_port_nfattr_to_tuple(struct nlattr *tb[],
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_ct_port_nfattr_to_tuple);
|
||||
EXPORT_SYMBOL_GPL(nf_ct_port_nlattr_to_tuple);
|
||||
#endif
|
||||
|
||||
/* Used by ipt_REJECT and ip6t_REJECT. */
|
||||
|
@@ -61,8 +61,8 @@ ctnetlink_dump_tuples_proto(struct sk_buff *skb,
|
||||
goto nla_put_failure;
|
||||
NLA_PUT(skb, CTA_PROTO_NUM, sizeof(u_int8_t), &tuple->dst.protonum);
|
||||
|
||||
if (likely(l4proto->tuple_to_nfattr))
|
||||
ret = l4proto->tuple_to_nfattr(skb, tuple);
|
||||
if (likely(l4proto->tuple_to_nlattr))
|
||||
ret = l4proto->tuple_to_nlattr(skb, tuple);
|
||||
|
||||
nla_nest_end(skb, nest_parms);
|
||||
|
||||
@@ -84,8 +84,8 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb,
|
||||
if (!nest_parms)
|
||||
goto nla_put_failure;
|
||||
|
||||
if (likely(l3proto->tuple_to_nfattr))
|
||||
ret = l3proto->tuple_to_nfattr(skb, tuple);
|
||||
if (likely(l3proto->tuple_to_nlattr))
|
||||
ret = l3proto->tuple_to_nlattr(skb, tuple);
|
||||
|
||||
nla_nest_end(skb, nest_parms);
|
||||
|
||||
@@ -153,7 +153,7 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct nf_conn *ct)
|
||||
struct nlattr *nest_proto;
|
||||
int ret;
|
||||
|
||||
if (!l4proto->to_nfattr) {
|
||||
if (!l4proto->to_nlattr) {
|
||||
nf_ct_l4proto_put(l4proto);
|
||||
return 0;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct nf_conn *ct)
|
||||
if (!nest_proto)
|
||||
goto nla_put_failure;
|
||||
|
||||
ret = l4proto->to_nfattr(skb, nest_proto, ct);
|
||||
ret = l4proto->to_nlattr(skb, nest_proto, ct);
|
||||
|
||||
nf_ct_l4proto_put(l4proto);
|
||||
|
||||
@@ -195,8 +195,8 @@ ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct nf_conn *ct)
|
||||
goto nla_put_failure;
|
||||
NLA_PUT(skb, CTA_HELP_NAME, strlen(helper->name), helper->name);
|
||||
|
||||
if (helper->to_nfattr)
|
||||
helper->to_nfattr(skb, ct);
|
||||
if (helper->to_nlattr)
|
||||
helper->to_nlattr(skb, ct);
|
||||
|
||||
nla_nest_end(skb, nest_helper);
|
||||
out:
|
||||
@@ -512,8 +512,8 @@ ctnetlink_parse_tuple_ip(struct nlattr *attr, struct nf_conntrack_tuple *tuple)
|
||||
|
||||
l3proto = nf_ct_l3proto_find_get(tuple->src.l3num);
|
||||
|
||||
if (likely(l3proto->nfattr_to_tuple))
|
||||
ret = l3proto->nfattr_to_tuple(tb, tuple);
|
||||
if (likely(l3proto->nlattr_to_tuple))
|
||||
ret = l3proto->nlattr_to_tuple(tb, tuple);
|
||||
|
||||
nf_ct_l3proto_put(l3proto);
|
||||
|
||||
@@ -534,7 +534,7 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr,
|
||||
|
||||
nla_parse_nested(tb, CTA_PROTO_MAX, attr, NULL);
|
||||
|
||||
if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
||||
if (nlattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
||||
return -EINVAL;
|
||||
|
||||
if (!tb[CTA_PROTO_NUM])
|
||||
@@ -543,8 +543,8 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr,
|
||||
|
||||
l4proto = nf_ct_l4proto_find_get(tuple->src.l3num, tuple->dst.protonum);
|
||||
|
||||
if (likely(l4proto->nfattr_to_tuple))
|
||||
ret = l4proto->nfattr_to_tuple(tb, tuple);
|
||||
if (likely(l4proto->nlattr_to_tuple))
|
||||
ret = l4proto->nlattr_to_tuple(tb, tuple);
|
||||
|
||||
nf_ct_l4proto_put(l4proto);
|
||||
|
||||
@@ -602,18 +602,18 @@ static int nfnetlink_parse_nat_proto(struct nlattr *attr,
|
||||
|
||||
nla_parse_nested(tb, CTA_PROTONAT_MAX, attr, NULL);
|
||||
|
||||
if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
|
||||
if (nlattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
|
||||
return -EINVAL;
|
||||
|
||||
npt = nf_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum);
|
||||
|
||||
if (!npt->nfattr_to_range) {
|
||||
if (!npt->nlattr_to_range) {
|
||||
nf_nat_proto_put(npt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* nfattr_to_range returns 1 if it parsed, 0 if not, neg. on error */
|
||||
if (npt->nfattr_to_range(tb, range) > 0)
|
||||
/* nlattr_to_range returns 1 if it parsed, 0 if not, neg. on error */
|
||||
if (npt->nlattr_to_range(tb, range) > 0)
|
||||
range->flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
|
||||
|
||||
nf_nat_proto_put(npt);
|
||||
@@ -637,7 +637,7 @@ nfnetlink_parse_nat(struct nlattr *nat,
|
||||
|
||||
nla_parse_nested(tb, CTA_NAT_MAX, nat, NULL);
|
||||
|
||||
if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat))
|
||||
if (nlattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat))
|
||||
return -EINVAL;
|
||||
|
||||
if (tb[CTA_NAT_MINIP])
|
||||
@@ -696,7 +696,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
||||
u_int8_t u3 = nfmsg->nfgen_family;
|
||||
int err = 0;
|
||||
|
||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||
if (nlattr_bad_size(cda, CTA_MAX, cta_min))
|
||||
return -EINVAL;
|
||||
|
||||
if (cda[CTA_TUPLE_ORIG])
|
||||
@@ -754,7 +754,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
||||
ctnetlink_done);
|
||||
}
|
||||
|
||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||
if (nlattr_bad_size(cda, CTA_MAX, cta_min))
|
||||
return -EINVAL;
|
||||
|
||||
if (cda[CTA_TUPLE_ORIG])
|
||||
@@ -928,8 +928,8 @@ ctnetlink_change_protoinfo(struct nf_conn *ct, struct nlattr *cda[])
|
||||
|
||||
l4proto = nf_ct_l4proto_find_get(l3num, npt);
|
||||
|
||||
if (l4proto->from_nfattr)
|
||||
err = l4proto->from_nfattr(tb, ct);
|
||||
if (l4proto->from_nlattr)
|
||||
err = l4proto->from_nlattr(tb, ct);
|
||||
nf_ct_l4proto_put(l4proto);
|
||||
|
||||
return err;
|
||||
@@ -1045,7 +1045,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
||||
u_int8_t u3 = nfmsg->nfgen_family;
|
||||
int err = 0;
|
||||
|
||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||
if (nlattr_bad_size(cda, CTA_MAX, cta_min))
|
||||
return -EINVAL;
|
||||
|
||||
if (cda[CTA_TUPLE_ORIG]) {
|
||||
@@ -1329,7 +1329,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
|
||||
u_int8_t u3 = nfmsg->nfgen_family;
|
||||
int err = 0;
|
||||
|
||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||
if (nlattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||
return -EINVAL;
|
||||
|
||||
if (nlh->nlmsg_flags & NLM_F_DUMP) {
|
||||
@@ -1393,7 +1393,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
|
||||
unsigned int i;
|
||||
int err;
|
||||
|
||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||
if (nlattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||
return -EINVAL;
|
||||
|
||||
if (cda[CTA_EXPECT_TUPLE]) {
|
||||
@@ -1534,7 +1534,7 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
|
||||
u_int8_t u3 = nfmsg->nfgen_family;
|
||||
int err = 0;
|
||||
|
||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||
if (nlattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||
return -EINVAL;
|
||||
|
||||
if (!cda[CTA_EXPECT_TUPLE]
|
||||
|
@@ -274,8 +274,8 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 __read_mostly = {
|
||||
.destroy = gre_destroy,
|
||||
.me = THIS_MODULE,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -1067,7 +1067,7 @@ static int tcp_new(struct nf_conn *conntrack,
|
||||
#include <linux/netfilter/nfnetlink.h>
|
||||
#include <linux/netfilter/nfnetlink_conntrack.h>
|
||||
|
||||
static int tcp_to_nfattr(struct sk_buff *skb, struct nlattr *nla,
|
||||
static int tcp_to_nlattr(struct sk_buff *skb, struct nlattr *nla,
|
||||
const struct nf_conn *ct)
|
||||
{
|
||||
struct nlattr *nest_parms;
|
||||
@@ -1113,7 +1113,7 @@ static const size_t cta_min_tcp[CTA_PROTOINFO_TCP_MAX+1] = {
|
||||
[CTA_PROTOINFO_TCP_FLAGS_REPLY] = sizeof(struct nf_ct_tcp_flags)
|
||||
};
|
||||
|
||||
static int nfattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
|
||||
static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
|
||||
{
|
||||
struct nlattr *attr = cda[CTA_PROTOINFO_TCP];
|
||||
struct nlattr *tb[CTA_PROTOINFO_TCP_MAX+1];
|
||||
@@ -1125,7 +1125,7 @@ static int nfattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
|
||||
|
||||
nla_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr, NULL);
|
||||
|
||||
if (nfattr_bad_size(tb, CTA_PROTOINFO_TCP_MAX, cta_min_tcp))
|
||||
if (nlattr_bad_size(tb, CTA_PROTOINFO_TCP_MAX, cta_min_tcp))
|
||||
return -EINVAL;
|
||||
|
||||
if (!tb[CTA_PROTOINFO_TCP_STATE])
|
||||
@@ -1387,10 +1387,10 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 __read_mostly =
|
||||
.new = tcp_new,
|
||||
.error = tcp_error,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.to_nfattr = tcp_to_nfattr,
|
||||
.from_nfattr = nfattr_to_tcp,
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.to_nlattr = tcp_to_nlattr,
|
||||
.from_nlattr = nlattr_to_tcp,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_users = &tcp_sysctl_table_users,
|
||||
@@ -1416,10 +1416,10 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6 __read_mostly =
|
||||
.new = tcp_new,
|
||||
.error = tcp_error,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.to_nfattr = tcp_to_nfattr,
|
||||
.from_nfattr = nfattr_to_tcp,
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.to_nlattr = tcp_to_nlattr,
|
||||
.from_nlattr = nlattr_to_tcp,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_users = &tcp_sysctl_table_users,
|
||||
|
@@ -203,8 +203,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4 __read_mostly =
|
||||
.new = udp_new,
|
||||
.error = udp_error,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_users = &udp_sysctl_table_users,
|
||||
@@ -230,8 +230,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6 __read_mostly =
|
||||
.new = udp_new,
|
||||
.error = udp_error,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_users = &udp_sysctl_table_users,
|
||||
|
@@ -203,8 +203,8 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite4 __read_mostly =
|
||||
.new = udplite_new,
|
||||
.error = udplite_error,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_users = &udplite_sysctl_table_users,
|
||||
@@ -226,8 +226,8 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite6 __read_mostly =
|
||||
.new = udplite_new,
|
||||
.error = udplite_error,
|
||||
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
|
||||
.tuple_to_nfattr = nf_ct_port_tuple_to_nfattr,
|
||||
.nfattr_to_tuple = nf_ct_port_nfattr_to_tuple,
|
||||
.tuple_to_nlattr = nf_ct_port_tuple_to_nlattr,
|
||||
.nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
.ctl_table_users = &udplite_sysctl_table_users,
|
||||
|
@@ -769,7 +769,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
|
||||
|
||||
UDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type));
|
||||
|
||||
if (nfattr_bad_size(nfula, NFULA_CFG_MAX, nfula_cfg_min)) {
|
||||
if (nlattr_bad_size(nfula, NFULA_CFG_MAX, nfula_cfg_min)) {
|
||||
UDEBUG("bad attribute size\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@@ -796,7 +796,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
|
||||
struct nfqnl_queue_entry *entry;
|
||||
int err;
|
||||
|
||||
if (nfattr_bad_size(nfqa, NFQA_MAX, nfqa_verdict_min)) {
|
||||
if (nlattr_bad_size(nfqa, NFQA_MAX, nfqa_verdict_min)) {
|
||||
QDEBUG("bad attribute size\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -876,7 +876,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
|
||||
|
||||
QDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type));
|
||||
|
||||
if (nfattr_bad_size(nfqa, NFQA_CFG_MAX, nfqa_cfg_min)) {
|
||||
if (nlattr_bad_size(nfqa, NFQA_CFG_MAX, nfqa_cfg_min)) {
|
||||
QDEBUG("bad attribute size\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user