Skip to contentSkip to conversation

firewire net: Ensure checksumming in upper layer.

PATCH Applied YOSHIFUJI Hideaki 4 participants 8 messages Jan 20, 2013 – Jan 21, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firewire net: Ensure checksumming in upper layer.

It is wrong to set skb->ip_summed to CHECKSUM_UNNECESSARY unless the device has already checked it.

---
 drivers/firewire/net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/net.c +1 -1
index e7a711f5..df6a1ca 100644
@@ -520,7 +520,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
 	dev = netdev_priv(net);
 	/* Write metadata, and then pass to the receive level */
 	skb->dev = net;
-	skb->ip_summed = CHECKSUM_UNNECESSARY;  /* don't check it */
+	skb->ip_summed = CHECKSUM_NONE;
 
 	/*
 	 * Parse the encapsulation header. This actually does the job of
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 13 lines · On Jan 20 YOSHIFUJI Hideaki wrote:

It is wrong to set skb->ip_summed to CHECKSUM_UNNECESSARY unless the device has already checked it.

---
 drivers/firewire/net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/net.c +0 -0
index e7a711f5..df6a1ca 100644

drivers/firewire/net.c static int fwnet_finish_incoming_packet(struct net_device *net, · line 526

Quoted 8 lines
drivers/firewire/net.c +1 -1
@@ -520,7 +520,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
 	dev = netdev_priv(net);
 	/* Write metadata, and then pass to the receive level */
 	skb->dev = net;
-	skb->ip_summed = CHECKSUM_UNNECESSARY;  /* don't check it */
+	skb->ip_summed = CHECKSUM_NONE;
 
 	/*
 	 * Parse the encapsulation header. This actually does the job of

Indeed neither the device nor the lower drivers check protocol checksums. But the CRCs of the encapsulating 1394 packets are checked in hardware. Shall protocol checksums be verified regardless?

Signature · 10 lines
Stefan Richter
-=====-===-= ---= =-=--
http://arcgraph.de/sr/

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
#2 lore raw
Quoted 20 lines · Stefan Richter
Quoted 19 lines · On Jan 20 YOSHIFUJI Hideaki wrote:

It is wrong to set skb->ip_summed to CHECKSUM_UNNECESSARY unless the device has already checked it.

---
 drivers/firewire/net.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/net.c +1 -1
index e7a711f5..df6a1ca 100644
@@ -520,7 +520,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
 	dev = netdev_priv(net);
 	/* Write metadata, and then pass to the receive level */
 	skb->dev = net;
-	skb->ip_summed = CHECKSUM_UNNECESSARY;  /* don't check it */
+	skb->ip_summed = CHECKSUM_NONE;
 
Quoted 6 lines

drivers/firewire/net.c static int fwnet_finish_incoming_packet(struct net_device *net, · line 526

Quoted 2 lines
drivers/firewire/net.c +0 -0
 	/*
 	 * Parse the encapsulation header. This actually does the job of

Indeed neither the device nor the lower drivers check protocol checksums. But the CRCs of the encapsulating 1394 packets are checked in hardware. Shall protocol checksums be verified regardless?

Yes, because packets may come from off-link source.

--yoshfuji

#3 lore raw
Quoted 7 lines
Quoted 4 lines

Indeed neither the device nor the lower drivers check protocol checksums. But the CRCs of the encapsulating 1394 packets are checked in hardware. Shall protocol checksums be verified regardless?

Yes, because packets may come from off-link source.

Hm, I can't see any off-link packets coming from fwnet_finish_incoming_packet()

So I wont verify checksums in the driver.

Stephan

#4 lore raw
Quoted 11 lines · Stephan Gatzka
Quoted 7 lines
Quoted 4 lines

Indeed neither the device nor the lower drivers check protocol checksums. But the CRCs of the encapsulating 1394 packets are checked in hardware. Shall protocol checksums be verified regardless?

Yes, because packets may come from off-link source.

Hm, I can't see any off-link packets coming from fwnet_finish_incoming_packet()

So I wont verify checksums in the driver.

"Off-link source" means the source exists on the different L2 network. In other words, source is connected via router(s).

ethernet firewire
Host -------------- Router ------------ Host

--yoshfuji

#5 lore raw
Quoted 7 lines

"Off-link source" means the source exists on the different L2 network. In other words, source is connected via router(s).

ethernet firewire
Host -------------- Router ------------ Host

O.k., understood. But the receiving router verifies the checksum of incoming packets and sends them on the firewire link. On firewire we have CRC checksums to ensure the integrity of packets.

I agree with your patch but I don't see why we should check them in the driver. I thought your patch will ensure that the checksums will be verified in the upper layers.

Stephan

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012

#6 lore raw
Quoted 11 lines · Stephan Gatzka
Quoted 7 lines

"Off-link source" means the source exists on the different L2 network. In other words, source is connected via router(s).

ethernet firewire
Host -------------- Router ------------ Host

O.k., understood. But the receiving router verifies the checksum of incoming packets and sends them on the firewire link. On firewire we have CRC checksums to ensure the integrity of packets.

I agree with your patch but I don't see why we should check them in the driver. I thought your patch will ensure that the checksums will be verified in the upper layers.

Routers do not inspect whole packet.
For IPv4, we have IP checksum, but routers (usually) do not check upper-layer (e.g. UDP) checksum.
For IPv6, we do not have IP checksum.

CHECKSUM_UNNECESSARY means the driver has verified upper layer (e.g. TCP/UDP) checksum. Modern hardware can perform upper-layer checksumming as well. But of course, not all drivers are required to verify the upper-layer checksum; if the driver do not verify checksum in the packet, just say CHECKSUM_NONE.

Regards,

--yoshfuji

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012