netfilter: conntrack: remove invert_tuple indirection from l3 protocol trackers
Its simpler to just handle it directly in nf_ct_invert_tuple(). Also gets rid of need to pass l3proto pointer to resolve_conntrack(). Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:

committed by
Pablo Neira Ayuso

parent
47a91b14de
commit
d1b6fe9494
@@ -41,15 +41,6 @@ struct conntrack6_net {
|
||||
unsigned int users;
|
||||
};
|
||||
|
||||
static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple,
|
||||
const struct nf_conntrack_tuple *orig)
|
||||
{
|
||||
memcpy(tuple->src.u3.ip6, orig->dst.u3.ip6, sizeof(tuple->src.u3.ip6));
|
||||
memcpy(tuple->dst.u3.ip6, orig->src.u3.ip6, sizeof(tuple->dst.u3.ip6));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
|
||||
unsigned int *dataoff, u_int8_t *protonum)
|
||||
{
|
||||
@@ -290,7 +281,6 @@ static void ipv6_hooks_unregister(struct net *net)
|
||||
|
||||
const struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 = {
|
||||
.l3proto = PF_INET6,
|
||||
.invert_tuple = ipv6_invert_tuple,
|
||||
.get_l4proto = ipv6_get_l4proto,
|
||||
.net_ns_get = ipv6_hooks_register,
|
||||
.net_ns_put = ipv6_hooks_unregister,
|
||||
|
@@ -152,8 +152,7 @@ icmpv6_error_message(struct net *net, struct nf_conn *tmpl,
|
||||
|
||||
/* Ordinarily, we'd expect the inverted tupleproto, but it's
|
||||
been preserved inside the ICMP. */
|
||||
if (!nf_ct_invert_tuple(&intuple, &origtuple,
|
||||
&nf_conntrack_l3proto_ipv6, inproto)) {
|
||||
if (!nf_ct_invert_tuple(&intuple, &origtuple, inproto)) {
|
||||
pr_debug("icmpv6_error: Can't invert tuple\n");
|
||||
return -NF_ACCEPT;
|
||||
}
|
||||
|
Reference in New Issue
Block a user