* [PATCH] r8169: fix checksum broken
@ 2010-11-12 10:15 Shan Wei
2010-11-12 20:44 ` David Miller
2010-11-12 22:47 ` Francois Romieu
0 siblings, 2 replies; 8+ messages in thread
From: Shan Wei @ 2010-11-12 10:15 UTC (permalink / raw)
To: romieu; +Cc: netdev@vger.kernel.org, David Miller
If r8196 received packets with invalid sctp/igmp(not tcp, udp) checksum, r8196 set skb->ip_summed
wit CHECKSUM_UNNECESSARY. This cause that upper protocol don't check checksum field.
I am not family with r8196 driver. I try to guess the meaning of RxProtoIP and IPFail.
RxProtoIP stands for received IPv4 packet that upper protocol is not tcp and udp.
!(opts1 & IPFail) is true means that driver correctly to check checksum in IPv4 header.
If it's right, I think we should not set ip_summed wit CHECKSUM_UNNECESSARY for my sctp packets
with invalid checksum.
If it's not right, please tell me.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
drivers/net/r8169.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index d88ce9f..2cf6c2e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -4440,8 +4440,7 @@ static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1)
u32 status = opts1 & RxProtoMask;
if (((status == RxProtoTCP) && !(opts1 & TCPFail)) ||
- ((status == RxProtoUDP) && !(opts1 & UDPFail)) ||
- ((status == RxProtoIP) && !(opts1 & IPFail)))
+ ((status == RxProtoUDP) && !(opts1 & UDPFail)))
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb_checksum_none_assert(skb);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-12 10:15 [PATCH] r8169: fix checksum broken Shan Wei
@ 2010-11-12 20:44 ` David Miller
2010-11-12 22:47 ` Francois Romieu
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2010-11-12 20:44 UTC (permalink / raw)
To: shanwei; +Cc: romieu, netdev
From: Shan Wei <shanwei@cn.fujitsu.com>
Date: Fri, 12 Nov 2010 18:15:25 +0800
> If r8196 received packets with invalid sctp/igmp(not tcp, udp) checksum, r8196 set skb->ip_summed
> wit CHECKSUM_UNNECESSARY. This cause that upper protocol don't check checksum field.
>
> I am not family with r8196 driver. I try to guess the meaning of RxProtoIP and IPFail.
> RxProtoIP stands for received IPv4 packet that upper protocol is not tcp and udp.
> !(opts1 & IPFail) is true means that driver correctly to check checksum in IPv4 header.
>
> If it's right, I think we should not set ip_summed wit CHECKSUM_UNNECESSARY for my sctp packets
> with invalid checksum.
>
> If it's not right, please tell me.
>
>
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Francois, please review, it looks correct to my eyes.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-12 10:15 [PATCH] r8169: fix checksum broken Shan Wei
2010-11-12 20:44 ` David Miller
@ 2010-11-12 22:47 ` Francois Romieu
2010-11-12 23:13 ` Francois Romieu
1 sibling, 1 reply; 8+ messages in thread
From: Francois Romieu @ 2010-11-12 22:47 UTC (permalink / raw)
To: Shan Wei; +Cc: netdev@vger.kernel.org, David Miller
Shan Wei <shanwei@cn.fujitsu.com> :
> If r8196 received packets with invalid sctp/igmp(not tcp, udp) checksum, r8196 set skb->ip_summed
> wit CHECKSUM_UNNECESSARY. This cause that upper protocol don't check checksum field.
...
Which kind of device do you use : PCI-E 8168 / 810x or PCI 8169 ?
Have a nice night.
--
Ueimor
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-12 22:47 ` Francois Romieu
@ 2010-11-12 23:13 ` Francois Romieu
2010-11-15 3:31 ` Shan Wei
2010-11-17 19:54 ` David Miller
0 siblings, 2 replies; 8+ messages in thread
From: Francois Romieu @ 2010-11-12 23:13 UTC (permalink / raw)
To: Shan Wei; +Cc: netdev@vger.kernel.org, David Miller
Francois Romieu <romieu@fr.zoreil.com> :
[...]
> Which kind of device do you use : PCI-E 8168 / 810x or PCI 8169 ?
Wrong page. Forget it.
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
--
Ueimor
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-12 23:13 ` Francois Romieu
@ 2010-11-15 3:31 ` Shan Wei
2010-11-15 21:01 ` Francois Romieu
2010-11-17 19:54 ` David Miller
1 sibling, 1 reply; 8+ messages in thread
From: Shan Wei @ 2010-11-15 3:31 UTC (permalink / raw)
To: David Miller; +Cc: Francois Romieu, netdev@vger.kernel.org, jgarzik
Francois Romieu wrote, at 11/13/2010 07:13 AM:
> Francois Romieu <romieu@fr.zoreil.com> :
> [...]
>> Which kind of device do you use : PCI-E 8168 / 810x or PCI 8169 ?
>
> Wrong page. Forget it.
>
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
While grepping IPFail variable, maybe cp_rx_csum_ok() in 8139cp driver also has same bug.
There is no NIC on hand using RealTek RTL-8139C+ series 10/100 PCI Ethernet driver,
So don't confirm it.
===
[PATCH] 8139cp: fix checksum broken
I am not family with RealTek RTL-8139C+ series 10/100 PCI Ethernet driver.
I try to guess the meaning of RxProtoIP and IPFail.
RxProtoIP stands for received IPv4 packet that upper protocol is not tcp and udp.
!(status & IPFail) is true means that driver correctly to check checksum in IPv4 header.
If these are right, driver will set ip_summed with CHECKSUM_UNNECESSARY for other
upper protocol, e.g. sctp, igmp protocol. This will cause protocol stack ignores
checksum check for packets with invalid checksum.
This patch is only compile-test.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
drivers/net/8139cp.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index ac422cd..dd16e83 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -490,13 +490,11 @@ static inline unsigned int cp_rx_csum_ok (u32 status)
{
unsigned int protocol = (status >> 16) & 0x3;
- if (likely((protocol == RxProtoTCP) && (!(status & TCPFail))))
+ if (((protocol == RxProtoTCP) && !(status & TCPFail)) ||
+ ((protocol == RxProtoUDP) && !(status & UDPFail)))
return 1;
- else if ((protocol == RxProtoUDP) && (!(status & UDPFail)))
- return 1;
- else if ((protocol == RxProtoIP) && (!(status & IPFail)))
- return 1;
- return 0;
+ else
+ return 0;
}
static int cp_rx_poll(struct napi_struct *napi, int budget)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-15 3:31 ` Shan Wei
@ 2010-11-15 21:01 ` Francois Romieu
2010-11-17 19:55 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Francois Romieu @ 2010-11-15 21:01 UTC (permalink / raw)
To: Shan Wei; +Cc: David Miller, netdev@vger.kernel.org, jgarzik
Shan Wei <shanwei@cn.fujitsu.com> :
[...]
> If these are right, driver will set ip_summed with CHECKSUM_UNNECESSARY for other
> upper protocol, e.g. sctp, igmp protocol. This will cause protocol stack ignores
> checksum check for packets with invalid checksum.
The documentation of these bits is identical for the 8139c+ and the 8169.
--
Ueimor
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-12 23:13 ` Francois Romieu
2010-11-15 3:31 ` Shan Wei
@ 2010-11-17 19:54 ` David Miller
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2010-11-17 19:54 UTC (permalink / raw)
To: romieu; +Cc: shanwei, netdev
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Sat, 13 Nov 2010 00:13:25 +0100
> Francois Romieu <romieu@fr.zoreil.com> :
> [...]
>> Which kind of device do you use : PCI-E 8168 / 810x or PCI 8169 ?
>
> Wrong page. Forget it.
>
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: fix checksum broken
2010-11-15 21:01 ` Francois Romieu
@ 2010-11-17 19:55 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-11-17 19:55 UTC (permalink / raw)
To: romieu; +Cc: shanwei, netdev, jgarzik
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Mon, 15 Nov 2010 22:01:23 +0100
> Shan Wei <shanwei@cn.fujitsu.com> :
> [...]
>> If these are right, driver will set ip_summed with CHECKSUM_UNNECESSARY for other
>> upper protocol, e.g. sctp, igmp protocol. This will cause protocol stack ignores
>> checksum check for packets with invalid checksum.
>
> The documentation of these bits is identical for the 8139c+ and the 8169.
Also applied, thank you.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-11-17 19:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12 10:15 [PATCH] r8169: fix checksum broken Shan Wei
2010-11-12 20:44 ` David Miller
2010-11-12 22:47 ` Francois Romieu
2010-11-12 23:13 ` Francois Romieu
2010-11-15 3:31 ` Shan Wei
2010-11-15 21:01 ` Francois Romieu
2010-11-17 19:55 ` David Miller
2010-11-17 19:54 ` David Miller
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).