mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Su Yanjun <suyj.fnst@cn.fujitsu.com>" <suyj.fnst@cn.fujitsu.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<kuznet@ms2.inr.ac.ru>, <yoshfuji@linux-ipv6.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<suyanjun218@gmail.com>
Subject: Re: [PATCH] vti4: Fix a ipip packet processing bug in 'IPCOMP' virtual tunnel
Date: Fri, 4 Jan 2019 16:42:05 +0800	[thread overview]
Message-ID: <a289564b-c33a-d2fb-dab2-31e15695844f@cn.fujitsu.com> (raw)
In-Reply-To: <20190104074333.GE3581@gauss3.secunet.de>

On 1/4/2019 3:43 PM, Steffen Klassert wrote:

> On Thu, Jan 03, 2019 at 07:48:41AM -0500, Su Yanjun wrote:
>> Recently we run a network test over ipcomp virtual tunnel.We find that
>> if a ipv4 packet needs fragment, then the peer can't receive
>> it.
>>
>> We deep into the code and find that when packet need fragment the smaller
>> fragment will be encapsulated by ipip not ipcomp. So when the ipip packet
>> goes into xfrm, it's skb->dev is not properly set. The ipv4 reassembly code
>> always set skb'dev to the last fragment's dev. After ipv4 defrag processing,
>> when the kernel rp_filter parameter is set, the skb will be drop by -EXDEV
>> error.
> Why not just leaving rp_filter disabled or in 'loose mode' if you use ipcomp?
In my option rp_filter should not affect the ip_vti functionality.
The root cause is the origin tunnel code doesn't update skb->dev.
vti only cares about ipcomp, esp, ah packets.
>> This patch adds compatible support for the ipip process in ipcomp virtual tunnel.
>>
>> Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com>
>> ---
>>   net/ipv4/ip_vti.c | 25 ++++++++++++++++++++++++-
>>   1 file changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
>> index de31b30..63de2f6 100644
>> --- a/net/ipv4/ip_vti.c
>> +++ b/net/ipv4/ip_vti.c
>> @@ -65,6 +65,9 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi,
>>   
>>   		XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel;
>>   
>> +		if (iph->protocol == IPPROTO_IPIP)
>> +			skb->dev = tunnel->dev;
>> +
>>   		return xfrm_input(skb, nexthdr, spi, encap_type);
>>   	}
>>   
>> @@ -76,10 +79,15 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi,
>>   
>>   static int vti_rcv(struct sk_buff *skb)
>>   {
>> +	__be32 spi = 0;
>> +	
>>   	XFRM_SPI_SKB_CB(skb)->family = AF_INET;
>>   	XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
>> +	
>> +	if (ip_hdr(skb)->protocol == IPPROTO_IPIP)
>> +		spi = ip_hdr(skb)->saddr;
>>   
>> -	return vti_input(skb, ip_hdr(skb)->protocol, 0, 0);
>> +	return vti_input(skb, ip_hdr(skb)->protocol, spi, 0);
> You use the src address as spi, how is this supposed to work?
>
This code derives from xfrm4_tunnel and i just want the vti can handle 
ipip packet as xfrm4 tunnel does.


Thanks,
Su



  reply	other threads:[~2019-01-04  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 12:48 Su Yanjun
2019-01-04  7:43 ` Steffen Klassert
2019-01-04  8:42   ` Su Yanjun <suyj.fnst@cn.fujitsu.com> [this message]
2019-01-04 10:33     ` Steffen Klassert

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=a289564b-c33a-d2fb-dab2-31e15695844f@cn.fujitsu.com \
    --to=suyj.fnst@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=suyanjun218@gmail.com \
    --cc=yoshfuji@linux-ipv6.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

all inboxes | Powered by JetHome®