Skip to content

Commit b9e61f0

Browse files
kaberummakynes
authored andcommitted
netfilter: ctnetlink: remove dead NAT code
The NAT range to nlattr conversation callbacks and helpers are entirely dead code and are also useless since there are no NAT ranges in conntrack context, they are only used for initially selecting a tuple. The final NAT information is contained in the selected tuples of the conntrack entry. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 0af051b commit b9e61f0

File tree

9 files changed

+1
-25
lines changed

9 files changed

+1
-25
lines changed

include/net/netfilter/nf_nat_protocol.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ struct nf_nat_protocol {
3232
enum nf_nat_manip_type maniptype,
3333
const struct nf_conn *ct);
3434

35-
int (*range_to_nlattr)(struct sk_buff *skb,
36-
const struct nf_nat_ipv4_range *range);
37-
3835
int (*nlattr_to_range)(struct nlattr *tb[],
3936
struct nf_nat_ipv4_range *range);
4037
};
@@ -64,8 +61,6 @@ extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
6461
const struct nf_conn *ct,
6562
u_int16_t *rover);
6663

67-
extern int nf_nat_proto_range_to_nlattr(struct sk_buff *skb,
68-
const struct nf_nat_ipv4_range *range);
6964
extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
7065
struct nf_nat_ipv4_range *range);
7166

net/ipv4/netfilter/nf_nat_proto_common.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,6 @@ void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
9696
EXPORT_SYMBOL_GPL(nf_nat_proto_unique_tuple);
9797

9898
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
99-
int nf_nat_proto_range_to_nlattr(struct sk_buff *skb,
100-
const struct nf_nat_ipv4_range *range)
101-
{
102-
NLA_PUT_BE16(skb, CTA_PROTONAT_PORT_MIN, range->min.all);
103-
NLA_PUT_BE16(skb, CTA_PROTONAT_PORT_MAX, range->max.all);
104-
return 0;
105-
106-
nla_put_failure:
107-
return -1;
108-
}
109-
EXPORT_SYMBOL_GPL(nf_nat_proto_nlattr_to_range);
110-
11199
int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
112100
struct nf_nat_ipv4_range *range)
113101
{
@@ -122,5 +110,5 @@ int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
122110
}
123111
return 0;
124112
}
125-
EXPORT_SYMBOL_GPL(nf_nat_proto_range_to_nlattr);
113+
EXPORT_SYMBOL_GPL(nf_nat_proto_nlattr_to_range);
126114
#endif

net/ipv4/netfilter/nf_nat_proto_dccp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ static const struct nf_nat_protocol nf_nat_protocol_dccp = {
8484
.in_range = nf_nat_proto_in_range,
8585
.unique_tuple = dccp_unique_tuple,
8686
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
87-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
8887
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
8988
#endif
9089
};

net/ipv4/netfilter/nf_nat_proto_gre.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ static const struct nf_nat_protocol gre = {
123123
.in_range = nf_nat_proto_in_range,
124124
.unique_tuple = gre_unique_tuple,
125125
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
126-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
127126
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
128127
#endif
129128
};

net/ipv4/netfilter/nf_nat_proto_icmp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ const struct nf_nat_protocol nf_nat_protocol_icmp = {
7878
.in_range = icmp_in_range,
7979
.unique_tuple = icmp_unique_tuple,
8080
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
81-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
8281
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
8382
#endif
8483
};

net/ipv4/netfilter/nf_nat_proto_sctp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ static const struct nf_nat_protocol nf_nat_protocol_sctp = {
7474
.in_range = nf_nat_proto_in_range,
7575
.unique_tuple = sctp_unique_tuple,
7676
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
77-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
7877
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
7978
#endif
8079
};

net/ipv4/netfilter/nf_nat_proto_tcp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const struct nf_nat_protocol nf_nat_protocol_tcp = {
8686
.in_range = nf_nat_proto_in_range,
8787
.unique_tuple = tcp_unique_tuple,
8888
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
89-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
9089
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
9190
#endif
9291
};

net/ipv4/netfilter/nf_nat_proto_udp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ const struct nf_nat_protocol nf_nat_protocol_udp = {
7777
.in_range = nf_nat_proto_in_range,
7878
.unique_tuple = udp_unique_tuple,
7979
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
80-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
8180
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
8281
#endif
8382
};

net/ipv4/netfilter/nf_nat_proto_udplite.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static const struct nf_nat_protocol nf_nat_protocol_udplite = {
7676
.in_range = nf_nat_proto_in_range,
7777
.unique_tuple = udplite_unique_tuple,
7878
#if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
79-
.range_to_nlattr = nf_nat_proto_range_to_nlattr,
8079
.nlattr_to_range = nf_nat_proto_nlattr_to_range,
8180
#endif
8281
};

0 commit comments

Comments
 (0)