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
@@ -38,15 +38,6 @@ struct conntrack4_net {
|
||||
unsigned int users;
|
||||
};
|
||||
|
||||
static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple,
|
||||
const struct nf_conntrack_tuple *orig)
|
||||
{
|
||||
tuple->src.u3.ip = orig->dst.u3.ip;
|
||||
tuple->dst.u3.ip = orig->src.u3.ip;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
|
||||
unsigned int *dataoff, u_int8_t *protonum)
|
||||
{
|
||||
@@ -306,7 +297,6 @@ static void ipv4_hooks_unregister(struct net *net)
|
||||
|
||||
const struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 = {
|
||||
.l3proto = PF_INET,
|
||||
.invert_tuple = ipv4_invert_tuple,
|
||||
.get_l4proto = ipv4_get_l4proto,
|
||||
.net_ns_get = ipv4_hooks_register,
|
||||
.net_ns_put = ipv4_hooks_unregister,
|
||||
|
@@ -142,8 +142,7 @@ icmp_error_message(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
|
||||
|
||||
/* Ordinarily, we'd expect the inverted tupleproto, but it's
|
||||
been preserved inside the ICMP. */
|
||||
if (!nf_ct_invert_tuple(&innertuple, &origtuple,
|
||||
&nf_conntrack_l3proto_ipv4, innerproto)) {
|
||||
if (!nf_ct_invert_tuple(&innertuple, &origtuple, innerproto)) {
|
||||
pr_debug("icmp_error_message: no match\n");
|
||||
return -NF_ACCEPT;
|
||||
}
|
||||
|
Reference in New Issue
Block a user