From: Patrick McHardy <kaber@trash.net>
To: Joakim Koskela <joakim.koskela@hiit.fi>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH net-2.6.22-rc7] xfrm beet interfamily support
Date: Tue, 31 Jul 2007 12:51:42 +0200 [thread overview]
Message-ID: <46AF143E.9080709@trash.net> (raw)
In-Reply-To: <200707311339.39913.joakim.koskela@hiit.fi>
Joakim Koskela wrote:
> On Thursday 19 July 2007 17:46:42 Patrick McHardy wrote:
>
>>Joakim Koskela wrote:
>>
>>>+ skb_push(skb, hdrlen);
>>>+ iphv6 = ipv6_hdr(skb);
>>>+
>>>+ skb_reset_network_header(skb);
>>>+ top_iphv6 = ipv6_hdr(skb);
>>>+
>>>+ protocol = iphv6->nexthdr;
>>>+ skb_pull(skb, delta);
>>>+ skb_reset_network_header(skb);
>>>+ top_iphv4 = ip_hdr(skb);
>>>+ skb_set_transport_header(skb, hdrlen);
>>>+ top_iphv4->ihl = (sizeof(struct iphdr) >> 2);
>>>+ top_iphv4->version = 4;
>>>+ top_iphv4->id = 0;
>>>+ top_iphv4->frag_off = htons(IP_DF);
>>>+ top_iphv4->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
>>>+ top_iphv4->saddr = x->props.saddr.a4;
>>>+ top_iphv4->daddr = x->id.daddr.a4;
>>>+ skb->transport_header += top_iphv4->ihl*4;
>>>+ top_iphv4->protocol = protocol;
>>>+
>>>+ skb->protocol = htons(ETH_P_IP);
>>>+#endif
>>
>>The output function in the IPv6/IPv4 case is called from
>>xfrm6_output_one, which loops until after a tunnel mode
>>encapsulation is done and then returns to the outer loop
>>in xfrm6_output_finish2, which passes the packet through
>>the netfilter hooks and continues with the next transform.
>>
>
>
> I'm not sure I really got this. IPv6/IPv4 means IPv6 inner, IPv4 outer, right?
> Isn't that called from xfrm4_output_one and subsequently passed through the
> right filters as well (as it has a ipv4 header by then)?
I think you're right, it uses xfrm4_output. But there's a mismatch
in either case, in both cases (IPv4 and IPv6) we first call the
POSTROUTING hook for this family, than do the transform (changing
the family), then call the OUTPUT hook for the same family. So
either the POSTROUTING or the OUTPUT hook is called for the wrong
family.
>>There are multiple problems resulting from the inter-family
>>encapsulation. First of all, the inner loop continues after
>>beet mode encapsulation, skipping the netfilter hooks in
>>case there are more transforms. It should (as with decaps = 1
>>on input) at least call netfilter hooks after an inter-family
>>transform. If the beet transform is the last one, the IPv4
>>skb will be passed through the IPv6 netfilter hooks, which is
>>clearly wrong. To fix these problems some restructuring in
>>xfrm[46]_output.c seems to be necessary.
>
>
> Couldn't this be solved just by ending the inner loop in case of beet mode (as
> it is done for tunnel)?
If the assumption that xfrm4_output is used for IPv6 in IPv4
encapsulation is correct and the problem mentioned above is
fixed, that should work fine.
next prev parent reply other threads:[~2007-07-31 10:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-16 12:06 [PATCH net-2.6.22-rc7] xfrm beet interfamily support Joakim Koskela
2007-07-16 12:56 ` Arnaldo Carvalho de Melo
2007-07-18 9:18 ` David Miller
2007-07-16 18:47 ` Patrick McHardy
2007-07-17 14:30 ` Joakim Koskela
2007-07-17 16:00 ` Patrick McHardy
2007-07-19 14:08 ` Joakim Koskela
2007-07-19 14:46 ` Patrick McHardy
2007-07-19 17:54 ` Joakim Koskela
2007-07-19 19:43 ` Patrick McHardy
2007-07-23 16:19 ` [PATCH net-2.6.22-rc7] xfrm state selection update to use inner addresses Joakim Koskela
2007-07-24 14:31 ` Patrick McHardy
2007-07-26 7:08 ` David Miller
2007-07-31 10:39 ` [PATCH net-2.6.22-rc7] xfrm beet interfamily support Joakim Koskela
2007-07-31 10:51 ` Patrick McHardy [this message]
2007-07-31 11:08 ` Joakim Koskela
2007-07-31 11:14 ` Patrick McHardy
2007-07-31 12:13 ` Joakim Koskela
2007-08-06 6:49 ` Joakim Koskela
2007-08-06 12:08 ` Patrick McHardy
2007-08-06 13:07 ` Joakim Koskela
2007-08-06 13:21 ` Patrick McHardy
-- strict thread matches above, loose matches on Subject: below --
2007-07-12 9:25 Joakim Koskela
2007-07-15 1:48 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46AF143E.9080709@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=joakim.koskela@hiit.fi \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).