Skip to content

Commit

Permalink
[NETFILTER]: nfnetlink: rename functions containing 'nfattr'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Oct 10, 2007
1 parent df6fb86 commit fdf7083
Show file tree
Hide file tree
Showing 22 changed files with 101 additions and 101 deletions.
2 changes: 1 addition & 1 deletion include/linux/netfilter/nfnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct nfnetlink_subsystem
extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);

#define nfattr_bad_size(tb, max, cta_min) \
#define nlattr_bad_size(tb, max, cta_min) \
({ int __i, __res = 0; \
for (__i=1; __i <= max; __i++) { \
if (!cta_min[__i]) \
Expand Down
2 changes: 1 addition & 1 deletion include/net/netfilter/nf_conntrack_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct nf_conntrack_helper

void (*destroy)(struct nf_conn *ct);

int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct);
int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct);
};

extern struct nf_conntrack_helper *
Expand Down
4 changes: 2 additions & 2 deletions include/net/netfilter/nf_conntrack_l3proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ struct nf_conntrack_l3proto
int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff,
unsigned int *dataoff, u_int8_t *protonum);

int (*tuple_to_nfattr)(struct sk_buff *skb,
int (*tuple_to_nlattr)(struct sk_buff *skb,
const struct nf_conntrack_tuple *t);

int (*nfattr_to_tuple)(struct nlattr *tb[],
int (*nlattr_to_tuple)(struct nlattr *tb[],
struct nf_conntrack_tuple *t);

#ifdef CONFIG_SYSCTL
Expand Down
12 changes: 6 additions & 6 deletions include/net/netfilter/nf_conntrack_l4proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ struct nf_conntrack_l4proto
int pf, unsigned int hooknum);

/* convert protoinfo to nfnetink attributes */
int (*to_nfattr)(struct sk_buff *skb, struct nlattr *nla,
int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
const struct nf_conn *ct);

/* convert nfnetlink attributes to protoinfo */
int (*from_nfattr)(struct nlattr *tb[], struct nf_conn *ct);
int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct);

int (*tuple_to_nfattr)(struct sk_buff *skb,
int (*tuple_to_nlattr)(struct sk_buff *skb,
const struct nf_conntrack_tuple *t);
int (*nfattr_to_tuple)(struct nlattr *tb[],
int (*nlattr_to_tuple)(struct nlattr *tb[],
struct nf_conntrack_tuple *t);

#ifdef CONFIG_SYSCTL
Expand Down Expand Up @@ -111,9 +111,9 @@ extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);

/* Generic netlink helpers */
extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *tuple);
extern int nf_ct_port_nfattr_to_tuple(struct nlattr *tb[],
extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
struct nf_conntrack_tuple *t);

/* Log invalid packets */
Expand Down
8 changes: 4 additions & 4 deletions include/net/netfilter/nf_nat_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ struct nf_nat_protocol
enum nf_nat_manip_type maniptype,
const struct nf_conn *ct);

int (*range_to_nfattr)(struct sk_buff *skb,
int (*range_to_nlattr)(struct sk_buff *skb,
const struct nf_nat_range *range);

int (*nfattr_to_range)(struct nlattr *tb[],
int (*nlattr_to_range)(struct nlattr *tb[],
struct nf_nat_range *range);
};

Expand All @@ -62,9 +62,9 @@ extern int init_protocols(void) __init;
extern void cleanup_protocols(void);
extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);

extern int nf_nat_port_range_to_nfattr(struct sk_buff *skb,
extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb,
const struct nf_nat_range *range);
extern int nf_nat_port_nfattr_to_range(struct nlattr *tb[],
extern int nf_nat_port_nlattr_to_range(struct nlattr *tb[],
struct nf_nat_range *range);

#endif /*_NF_NAT_PROTO_H*/
10 changes: 5 additions & 5 deletions net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink_conntrack.h>

static int ipv4_tuple_to_nfattr(struct sk_buff *skb,
static int ipv4_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *tuple)
{
NLA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t),
Expand All @@ -378,13 +378,13 @@ static const size_t cta_min_ip[CTA_IP_MAX+1] = {
[CTA_IP_V4_DST] = sizeof(u_int32_t),
};

static int ipv4_nfattr_to_tuple(struct nlattr *tb[],
static int ipv4_nlattr_to_tuple(struct nlattr *tb[],
struct nf_conntrack_tuple *t)
{
if (!tb[CTA_IP_V4_SRC] || !tb[CTA_IP_V4_DST])
return -EINVAL;

if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
if (nlattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
return -EINVAL;

t->src.u3.ip = *(__be32 *)nla_data(tb[CTA_IP_V4_SRC]);
Expand All @@ -411,8 +411,8 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
.print_conntrack = ipv4_print_conntrack,
.get_l4proto = ipv4_get_l4proto,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.tuple_to_nfattr = ipv4_tuple_to_nfattr,
.nfattr_to_tuple = ipv4_nfattr_to_tuple,
.tuple_to_nlattr = ipv4_tuple_to_nlattr,
.nlattr_to_tuple = ipv4_nlattr_to_tuple,
#endif
#if defined(CONFIG_SYSCTL) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
.ctl_table_path = nf_net_ipv4_netfilter_sysctl_path,
Expand Down
10 changes: 5 additions & 5 deletions net/ipv4/netfilter/nf_conntrack_proto_icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff,
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink_conntrack.h>

static int icmp_tuple_to_nfattr(struct sk_buff *skb,
static int icmp_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *t)
{
NLA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(u_int16_t),
Expand All @@ -254,15 +254,15 @@ static const size_t cta_min_proto[CTA_PROTO_MAX+1] = {
[CTA_PROTO_ICMP_ID] = sizeof(u_int16_t)
};

static int icmp_nfattr_to_tuple(struct nlattr *tb[],
static int icmp_nlattr_to_tuple(struct nlattr *tb[],
struct nf_conntrack_tuple *tuple)
{
if (!tb[CTA_PROTO_ICMP_TYPE]
|| !tb[CTA_PROTO_ICMP_CODE]
|| !tb[CTA_PROTO_ICMP_ID])
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;

tuple->dst.u.icmp.type =
Expand Down Expand Up @@ -327,8 +327,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly =
.destroy = NULL,
.me = NULL,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.tuple_to_nfattr = icmp_tuple_to_nfattr,
.nfattr_to_tuple = icmp_nfattr_to_tuple,
.tuple_to_nlattr = icmp_tuple_to_nlattr,
.nlattr_to_tuple = icmp_nlattr_to_tuple,
#endif
#ifdef CONFIG_SYSCTL
.ctl_table_header = &icmp_sysctl_header,
Expand Down
8 changes: 4 additions & 4 deletions net/ipv4/netfilter/nf_nat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ EXPORT_SYMBOL(nf_nat_protocol_unregister);

#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
int
nf_nat_port_range_to_nfattr(struct sk_buff *skb,
nf_nat_port_range_to_nlattr(struct sk_buff *skb,
const struct nf_nat_range *range)
{
NLA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16),
Expand All @@ -557,10 +557,10 @@ nf_nat_port_range_to_nfattr(struct sk_buff *skb,
nla_put_failure:
return -1;
}
EXPORT_SYMBOL_GPL(nf_nat_port_nfattr_to_range);
EXPORT_SYMBOL_GPL(nf_nat_port_nlattr_to_range);

int
nf_nat_port_nfattr_to_range(struct nlattr *tb[], struct nf_nat_range *range)
nf_nat_port_nlattr_to_range(struct nlattr *tb[], struct nf_nat_range *range)
{
int ret = 0;

Expand All @@ -583,7 +583,7 @@ nf_nat_port_nfattr_to_range(struct nlattr *tb[], struct nf_nat_range *range)

return ret;
}
EXPORT_SYMBOL_GPL(nf_nat_port_range_to_nfattr);
EXPORT_SYMBOL_GPL(nf_nat_port_range_to_nlattr);
#endif

/* Noone using conntrack by the time this called. */
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/nf_nat_proto_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ static struct nf_nat_protocol gre __read_mostly = {
.in_range = gre_in_range,
.unique_tuple = gre_unique_tuple,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.range_to_nfattr = nf_nat_port_range_to_nfattr,
.nfattr_to_range = nf_nat_port_nfattr_to_range,
.range_to_nlattr = nf_nat_port_range_to_nlattr,
.nlattr_to_range = nf_nat_port_nlattr_to_range,
#endif
};

Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/nf_nat_proto_icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct nf_nat_protocol nf_nat_protocol_icmp = {
.in_range = icmp_in_range,
.unique_tuple = icmp_unique_tuple,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.range_to_nfattr = nf_nat_port_range_to_nfattr,
.nfattr_to_range = nf_nat_port_nfattr_to_range,
.range_to_nlattr = nf_nat_port_range_to_nlattr,
.nlattr_to_range = nf_nat_port_nlattr_to_range,
#endif
};
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/nf_nat_proto_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct nf_nat_protocol nf_nat_protocol_tcp = {
.in_range = tcp_in_range,
.unique_tuple = tcp_unique_tuple,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.range_to_nfattr = nf_nat_port_range_to_nfattr,
.nfattr_to_range = nf_nat_port_nfattr_to_range,
.range_to_nlattr = nf_nat_port_range_to_nlattr,
.nlattr_to_range = nf_nat_port_nlattr_to_range,
#endif
};
4 changes: 2 additions & 2 deletions net/ipv4/netfilter/nf_nat_proto_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct nf_nat_protocol nf_nat_protocol_udp = {
.in_range = udp_in_range,
.unique_tuple = udp_unique_tuple,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.range_to_nfattr = nf_nat_port_range_to_nfattr,
.nfattr_to_range = nf_nat_port_nfattr_to_range,
.range_to_nlattr = nf_nat_port_range_to_nlattr,
.nlattr_to_range = nf_nat_port_nlattr_to_range,
#endif
};
10 changes: 5 additions & 5 deletions net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ static ctl_table nf_ct_ipv6_sysctl_table[] = {
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink_conntrack.h>

static int ipv6_tuple_to_nfattr(struct sk_buff *skb,
static int ipv6_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *tuple)
{
NLA_PUT(skb, CTA_IP_V6_SRC, sizeof(u_int32_t) * 4,
Expand All @@ -355,13 +355,13 @@ static const size_t cta_min_ip[CTA_IP_MAX+1] = {
[CTA_IP_V6_DST] = sizeof(u_int32_t)*4,
};

static int ipv6_nfattr_to_tuple(struct nlattr *tb[],
static int ipv6_nlattr_to_tuple(struct nlattr *tb[],
struct nf_conntrack_tuple *t)
{
if (!tb[CTA_IP_V6_SRC] || !tb[CTA_IP_V6_DST])
return -EINVAL;

if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
if (nlattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
return -EINVAL;

memcpy(&t->src.u3.ip6, nla_data(tb[CTA_IP_V6_SRC]),
Expand All @@ -382,8 +382,8 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = {
.print_conntrack = ipv6_print_conntrack,
.get_l4proto = ipv6_get_l4proto,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.tuple_to_nfattr = ipv6_tuple_to_nfattr,
.nfattr_to_tuple = ipv6_nfattr_to_tuple,
.tuple_to_nlattr = ipv6_tuple_to_nlattr,
.nlattr_to_tuple = ipv6_nlattr_to_tuple,
#endif
#ifdef CONFIG_SYSCTL
.ctl_table_path = nf_net_netfilter_sysctl_path,
Expand Down
10 changes: 5 additions & 5 deletions net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff,

#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink_conntrack.h>
static int icmpv6_tuple_to_nfattr(struct sk_buff *skb,
static int icmpv6_tuple_to_nlattr(struct sk_buff *skb,
const struct nf_conntrack_tuple *t)
{
NLA_PUT(skb, CTA_PROTO_ICMPV6_ID, sizeof(u_int16_t),
Expand All @@ -232,15 +232,15 @@ static const size_t cta_min_proto[CTA_PROTO_MAX+1] = {
[CTA_PROTO_ICMPV6_ID] = sizeof(u_int16_t)
};

static int icmpv6_nfattr_to_tuple(struct nlattr *tb[],
static int icmpv6_nlattr_to_tuple(struct nlattr *tb[],
struct nf_conntrack_tuple *tuple)
{
if (!tb[CTA_PROTO_ICMPV6_TYPE]
|| !tb[CTA_PROTO_ICMPV6_CODE]
|| !tb[CTA_PROTO_ICMPV6_ID])
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;

tuple->dst.u.icmp.type =
Expand Down Expand Up @@ -289,8 +289,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =
.new = icmpv6_new,
.error = icmpv6_error,
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
.tuple_to_nfattr = icmpv6_tuple_to_nfattr,
.nfattr_to_tuple = icmpv6_nfattr_to_tuple,
.tuple_to_nlattr = icmpv6_tuple_to_nlattr,
.nlattr_to_tuple = icmpv6_nlattr_to_tuple,
#endif
#ifdef CONFIG_SYSCTL
.ctl_table_header = &icmpv6_sysctl_header,
Expand Down
10 changes: 5 additions & 5 deletions net/netfilter/nf_conntrack_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -842,28 +842,28 @@ 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]);
t->dst.u.tcp.port = *(__be16 *)nla_data(tb[CTA_PROTO_DST_PORT]);

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. */
Expand Down
Loading

0 comments on commit fdf7083

Please sign in to comment.