[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 03614) Re: IPv6 setsockopt software MTU patch



Yes, checking if np is null is safer i think.

Thanks!

Hoerdt Mickaël

On Mon, Feb 20, 2006 at 01:08:21AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
> In article <20060219145413.GD16304@xxxxxxxxxxxxxxxxxxxxx> (at Sun, 19 Feb 2006 15:54:13 +0100), hoerdt@xxxxxxxxxxxxxxxxxxxxx says:
> 
> > Yes, Hugo Santos suggested me to use the minimum of both, the new
> > patch is available there :
> > 
> > http://clarinet.u-strasbg.fr/~hoerdt/ip6_output.c.softfrag.patch2
> 
> Do you mean like this?
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@xxxxxxxxxxxxxx>
> 
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index efa3e72..3264740 100644
> --- a/net/ipv6/ip6_output.c
> +++ b/net/ipv6/ip6_output.c
> @@ -494,6 +494,7 @@ static int ip6_fragment(struct sk_buff *
>  	struct net_device *dev;
>  	struct sk_buff *frag;
>  	struct rt6_info *rt = (struct rt6_info*)skb->dst;
> +	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
>  	struct ipv6hdr *tmp_hdr;
>  	struct frag_hdr *fh;
>  	unsigned int mtu, hlen, left, len;
> @@ -506,6 +507,8 @@ static int ip6_fragment(struct sk_buff *
>  	nexthdr = *prevhdr;
>  
>  	mtu = dst_mtu(&rt->u.dst) - hlen - sizeof(struct frag_hdr);
> +	if (np && np->frag_size && np->frag_size < dst_mtu(&rt->u.dst))
> +		mtu = np->frag_size - hlen - sizeof(struct frag_hdr);
>  
>  	if (skb_shinfo(skb)->frag_list) {
>  		int first_len = skb_pagelen(skb);
> 
> 
> -- 
> YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@xxxxxxxxxxxxxx>
> GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
> 
>