Skip to contentSkip to conversation

(usagi-users 03606) [PATCH] [NET]: NETFILTER: remove duplicated operation and fix order in skb_clone().

PATCH YOSHIFUJI Hideaki / 吉藤英明 3 participants 6 messages Feb 17, 2006 – Feb 20, 2006 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello.

In article <[email protected]> (at Fri, 17 Feb 2006 11:38:42 +0100), Olivier MATZ <[email protected]> says:

Quoted 6 lines

in skb_clone(), the following code is done twice :

#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
	C(nfct_reasm);
	nf_conntrack_get_reasm(skb->nfct_reasm);

#endif

David, please apply the fillowing patch.

Thank you.

---
[NET]: NETFILTER: remove duplicated lines and fix order in skb_clone().

Some of netfilter-related members are initalized / copied twice in skb_clone(). Remove one. Pointed out by Olivier MATZ <[email protected]>.

And this patch also fixes order of copying / clearing members.

net/core/skbuff.c +3 -7
index 6766f11..2144952 100644
@@ -411,6 +411,9 @@ struct sk_buff *skb_clone(struct sk_buff
 	C(pkt_type);
 	C(ip_summed);
 	C(priority);
+#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
+	C(ipvs_property);
+#endif
 	C(protocol);
 	n->destructor = NULL;
 #ifdef CONFIG_NETFILTER
@@ -422,13 +425,6 @@ struct sk_buff *skb_clone(struct sk_buff
 	C(nfct_reasm);
 	nf_conntrack_get_reasm(skb->nfct_reasm);
 #endif
-#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
-	C(ipvs_property);
-#endif
-#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
-	C(nfct_reasm);
-	nf_conntrack_get_reasm(skb->nfct_reasm);
-#endif
 #ifdef CONFIG_BRIDGE_NETFILTER
 	C(nf_bridge);
 	nf_bridge_get(skb->nf_bridge);
Signature · 2 lines
YOSHIFUJI Hideaki @ USAGI Project  <[email protected]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
#2 lore raw

(usagi-users 03609) IPv6 setsockopt software MTU patch

Hi,

In my precedent mails, i pointed out that IPV6_MTU setsockopt was ineffective because the field frag_size was not used further in the ipv6 fragment code of the kernel. You can check out that this is the case by this simple proof of concept code :

http://clarinet.u-strasbg.fr/~hoerdt/mtu.c

The fix is very simple, it only grab the value of frag_size and use it in ip6_fragment file, could you please review the patch which fix that problem at :

http://clarinet.u-strasbg.fr/~hoerdt/ip6_output.c.softfrag.patch

Thanks for the attention,

Hoerdt Mickaël

#3 lore raw

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

In article <[email protected]> (at Sun, 19 Feb 2006 14:47:09 +0100), [email protected] says:

Quoted 5 lines

The fix is very simple, it only grab the value of frag_size and use it in ip6_fragment file, could you please review the patch which fix that problem at :

http://clarinet.u-strasbg.fr/~hoerdt/ip6_output.c.softfrag.patch

Thanks for the patch.
I think even we have np->frag_size, we should consider dst_mtu(&rt->u.dst) as well. No?

--yoshfuji

#4 lore raw

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

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

Thanks,

Hoerdt Mickaël

Quoted 15 lines · On Sun, Feb 19, 2006 at 11:13:44PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:

In article <[email protected]> (at Sun, 19 Feb 2006 14:47:09 +0100), [email protected] says:

Quoted 5 lines

The fix is very simple, it only grab the value of frag_size and use it in ip6_fragment file, could you please review the patch which fix that problem at :

http://clarinet.u-strasbg.fr/~hoerdt/ip6_output.c.softfrag.patch

Thanks for the patch.
I think even we have np->frag_size, we should consider dst_mtu(&rt->u.dst) as well. No?

--yoshfuji

#5 lore raw

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

In article <[email protected]> (at Sun, 19 Feb 2006 15:54:13 +0100), [email protected] says:

Quoted 4 lines

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?

net/ipv6/ip6_output.c +3 -0
index efa3e72..3264740 100644
@@ -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);
Signature · 2 lines
YOSHIFUJI Hideaki @ USAGI Project  <[email protected]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
maintainer
#6 lore raw

(usagi-users 03613) Re: [PATCH] [NET]: NETFILTER: remove duplicated operation and fix order in skb_clone().

In reply to YOSHIFUJI Hideaki / 吉藤英明

From: YOSHIFUJI Hideaki <[email protected]>
Date: Fri, 17 Feb 2006 21:51:01 +0900 (JST)

Quoted 8 lines

[NET]: NETFILTER: remove duplicated lines and fix order in skb_clone().

Some of netfilter-related members are initalized / copied twice in skb_clone(). Remove one. Pointed out by Olivier MATZ <[email protected]>.

And this patch also fixes order of copying / clearing members.

Patch applied to net-2.6, thank you very much.