netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH] ipv6: Fix ip6_xmit to send fragments if ipfragok is true
Date: Thu, 31 Jul 2008 17:11:56 +0800	[thread overview]
Message-ID: <489181DC.40507@cn.fujitsu.com> (raw)
In-Reply-To: <20080731082053.GA6463@gondor.apana.org.au>

Herbert Xu wrote:
> On Thu, Jul 31, 2008 at 01:55:57PM +0800, Wei Yongjun wrote:
>   
>> SCTP used ip6_xmit() to send fragments after received ICMP packet too
>> big message. But while send packet used ip6_xmit, the skb->local_df is
>> not initialized. So when skb if enter ip6_fragment
>> <../cgi-bin/global.cgi?pattern=ip6_fragment&type=reference>(), the following
>> code will discard the skb.
>>     
>
> That sounds broken.  ip6_xmit is for TCP-like protocols that
> perform PMTU-discovery.  Therefore it should never fragment
> locally.
>
> So either SCTP needs to do the same, or it should switch to
> something other than ip6_xmit.
>   

So what does the ipfragok paramater means?
TCP used  ip6_xmit always set ipfragok = 0. But if ipfragok=1, what will 
happend?

If ipfragok = 0, and skb->len > mtu, ip6_xmit will discard the skb.

If ipfragok=1, ip6_xmit will pass skb to ip6_output() and send skb used 
ip6_fragment(), but skb will be discard since local_df is 0, it seems 
that ipfragok has no effect.

skb->local_df is set to 1 if np->pmtudisc < IPV6_PMTUDISC_DO in other 
place, so I think it may also set to 1 if np->pmtudisc < 
IPV6_PMTUDISC_DO, and send the skb used ip6_fragment(). Is this correct?

As I know, if I send skb in IPv4 used ip_queue_xmit(ipfragok=1), skb 
will be send in fragments if len > mtu.

int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
              struct ipv6_txoptions *opt, int ipfragok)
{
        ...
        mtu = dst_mtu(dst);
        if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) {
                IP6_INC_STATS(ip6_dst_idev(skb->dst),
                              IPSTATS_MIB_OUTREQUESTS);
                return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
                                dst_output);
        }

        if (net_ratelimit())
                printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
        ...
}

int ip6_output(struct sk_buff *skb)
{
        if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) ||
                                dst_allfrag(skb->dst))
                return ip6_fragment(skb, ip6_output2);
        else
                return ip6_output2(skb);
}



  reply	other threads:[~2008-07-31  9:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-31  5:55 [PATCH] ipv6: Fix ip6_xmit to send fragments if ipfragok is true Wei Yongjun
2008-07-31  8:20 ` Herbert Xu
2008-07-31  9:11   ` Wei Yongjun [this message]
2008-07-31  9:23     ` Herbert Xu
2008-07-31  9:55       ` [PATCHv2] " Wei Yongjun
2008-07-31 10:41         ` Herbert Xu
2008-08-01  3:47           ` 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=489181DC.40507@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --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).