netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL
@ 2014-05-19 17:24 Michael Spang
  2014-05-19 17:44 ` Eric Dumazet
  2014-05-19 21:24 ` Vlad Yasevich
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Spang @ 2014-05-19 17:24 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netdev, linux-kernel, Michael Spang, stable

Changing ip_summed from CHECKSUM_PARTIAL to CHECKSUM_UNNECESSARY
will result in an incorrect checksum if the packet is sent off the box.

Cc: stable@vger.kernel.org
Signed-off-by: Michael Spang <spang@chromium.org>
---
 drivers/net/macvlan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 753a8c2..806b56a 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -267,7 +267,9 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (vlan->mode == MACVLAN_MODE_BRIDGE) {
 		const struct ethhdr *eth = (void *)skb->data;
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+		if (skb->ip_summed == CHECKSUM_NONE)
+			skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 		/* send to other bridge ports directly */
 		if (is_multicast_ether_addr(eth->h_dest)) {
-- 
2.0.0.rc2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL
  2014-05-19 17:24 [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL Michael Spang
@ 2014-05-19 17:44 ` Eric Dumazet
  2014-05-19 20:05   ` Michael Spang
  2014-05-19 21:24 ` Vlad Yasevich
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2014-05-19 17:44 UTC (permalink / raw)
  To: Michael Spang; +Cc: Patrick McHardy, netdev, linux-kernel, Daniel Lezcano

On Mon, 2014-05-19 at 13:24 -0400, Michael Spang wrote:
> Changing ip_summed from CHECKSUM_PARTIAL to CHECKSUM_UNNECESSARY
> will result in an incorrect checksum if the packet is sent off the box.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael Spang <spang@chromium.org>
> ---
>  drivers/net/macvlan.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index 753a8c2..806b56a 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -267,7 +267,9 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
>  
>  	if (vlan->mode == MACVLAN_MODE_BRIDGE) {
>  		const struct ethhdr *eth = (void *)skb->data;
> -		skb->ip_summed = CHECKSUM_UNNECESSARY;
> +
> +		if (skb->ip_summed == CHECKSUM_NONE)
> +			skb->ip_summed = CHECKSUM_UNNECESSARY;
>  
>  		/* send to other bridge ports directly */
>  		if (is_multicast_ether_addr(eth->h_dest)) {

Hi Michael

Any idea why commit 12a2856b604476c27d85a5f9a57ae1661fc46019
added this stuff then ?

You should give more infos of your use case.

CC Daniel Lezcano <daniel.lezcano@free.fr>

I removed stable@ , as stable submissions are not done like that.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL
  2014-05-19 17:44 ` Eric Dumazet
@ 2014-05-19 20:05   ` Michael Spang
  2014-05-19 20:36     ` Cong Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Spang @ 2014-05-19 20:05 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Patrick McHardy, netdev, Linux Kernel, Daniel Lezcano

On Mon, May 19, 2014 at 1:44 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> On Mon, 2014-05-19 at 13:24 -0400, Michael Spang wrote:
> > Changing ip_summed from CHECKSUM_PARTIAL to CHECKSUM_UNNECESSARY
> > will result in an incorrect checksum if the packet is sent off the box.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Michael Spang <spang@chromium.org>
> > ---
> >  drivers/net/macvlan.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> > index 753a8c2..806b56a 100644
> > --- a/drivers/net/macvlan.c
> > +++ b/drivers/net/macvlan.c
> > @@ -267,7 +267,9 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
> >
> >       if (vlan->mode == MACVLAN_MODE_BRIDGE) {
> >               const struct ethhdr *eth = (void *)skb->data;
> > -             skb->ip_summed = CHECKSUM_UNNECESSARY;
> > +
> > +             if (skb->ip_summed == CHECKSUM_NONE)
> > +                     skb->ip_summed = CHECKSUM_UNNECESSARY;
> >
> >               /* send to other bridge ports directly */
> >               if (is_multicast_ether_addr(eth->h_dest)) {
>
> Hi Michael
>
> Any idea why commit 12a2856b604476c27d85a5f9a57ae1661fc46019
> added this stuff then ?
>

I think that patch is wrong. It's not OK to change CHECKSUM_PARTIAL to
CHECKSUM_UNNECESSARY. This code is changing the meaning of the
ip_summed field from "the checksum is incomplete" to "the checksum is
complete and correct". So if the packet bounces around the network
stack and eventually gets sent out a physical NIC, the checksum was
never completed anywhere and the packet is dropped by the receiving
box.

Look at 0b7967503dc97864f283a3a06fbe23e041876138 for a patch that
fixes exactly this problem on veth devices.


>
> You should give more infos of your use case.
>
> CC Daniel Lezcano <daniel.lezcano@free.fr>
>
> I removed stable@ , as stable submissions are not done like that.
>

Perhaps I've misunderstood something, but this suggestion is right
from https://www.kernel.org/doc/Documentation/stable_kernel_rules.txt

 - To have the patch automatically included in the stable tree, add the tag
     Cc: stable@vger.kernel.org
   in the sign-off area. Once the patch is merged it will be applied to
   the stable tree without anything else needing to be done by the author
   or subsystem maintainer.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL
  2014-05-19 20:05   ` Michael Spang
@ 2014-05-19 20:36     ` Cong Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2014-05-19 20:36 UTC (permalink / raw)
  To: Michael Spang
  Cc: Eric Dumazet, Patrick McHardy, netdev, Linux Kernel,
	Daniel Lezcano

On Mon, May 19, 2014 at 1:05 PM, Michael Spang <spang@chromium.org> wrote:
> On Mon, May 19, 2014 at 1:44 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>
>> I removed stable@ , as stable submissions are not done like that.
>>
>
> Perhaps I've misunderstood something, but this suggestion is right
> from https://www.kernel.org/doc/Documentation/stable_kernel_rules.txt
>
>  - To have the patch automatically included in the stable tree, add the tag
>      Cc: stable@vger.kernel.org
>    in the sign-off area. Once the patch is merged it will be applied to
>    the stable tree without anything else needing to be done by the author
>    or subsystem maintainer.

netdev has different rules, you need to check
Documentation/networking/netdev-FAQ.txt.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL
  2014-05-19 17:24 [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL Michael Spang
  2014-05-19 17:44 ` Eric Dumazet
@ 2014-05-19 21:24 ` Vlad Yasevich
  1 sibling, 0 replies; 5+ messages in thread
From: Vlad Yasevich @ 2014-05-19 21:24 UTC (permalink / raw)
  To: Michael Spang, Patrick McHardy; +Cc: netdev, linux-kernel, stable

On 05/19/2014 01:24 PM, Michael Spang wrote:
> Changing ip_summed from CHECKSUM_PARTIAL to CHECKSUM_UNNECESSARY
> will result in an incorrect checksum if the packet is sent off the box.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael Spang <spang@chromium.org>
> ---
>  drivers/net/macvlan.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index 753a8c2..806b56a 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -267,7 +267,9 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
>  
>  	if (vlan->mode == MACVLAN_MODE_BRIDGE) {
>  		const struct ethhdr *eth = (void *)skb->data;
> -		skb->ip_summed = CHECKSUM_UNNECESSARY;
> +
> +		if (skb->ip_summed == CHECKSUM_NONE)
> +			skb->ip_summed = CHECKSUM_UNNECESSARY;
>  
>  		/* send to other bridge ports directly */
>  		if (is_multicast_ether_addr(eth->h_dest)) {
> 

Already done.  See commit f114890cdf84d753f6b41cd0cc44ba51d16313da

-vlad

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-19 21:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-19 17:24 [PATCH] macvlan: Fix checksum errors when ip_summed is CHECKSUM_PARTIAL Michael Spang
2014-05-19 17:44 ` Eric Dumazet
2014-05-19 20:05   ` Michael Spang
2014-05-19 20:36     ` Cong Wang
2014-05-19 21:24 ` Vlad Yasevich

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).