net/core: use htons for skb->protocol
Subsystems (2)
PATCH 1/1 net/core: use htons for skb->protocol
From: Sebastian Andrzej Siewior <[email protected]>
This is only noticed by people that are not doing everything correct in the first place.
--- net/core/dev.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/core/dev.c +2 -1
@@ -1541,7 +1541,8 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)if (net_ratelimit ())printk (KERN_CRIT "protocol %04x is " "buggy, dev %s\n" , - skb2->protocol, dev->name); +htons (skb2->protocol), + dev->name);skb_reset_network_header (skb2); }
Signature · 1 line
1.7.0.4
David Miller
maintainerFrom: Sebastian Andrzej Siewior <[email protected]>
Date: Tue, 29 Jun 2010 18:32:46 +0200
Quoted 6 lines
From: Sebastian Andrzej Siewior <[email protected]>
This is only noticed by people that are not doing everything correct in the first place.
Signed-off-by Sebastian Andrzej Siewior <[email protected]>
It's in network byte order so you should use ntohs().
Quoted 15 lines · Sebastian Andrzej Siewior
From: Sebastian Andrzej Siewior<[email protected]>
This is only noticed by people that are not doing everything correct in the first place.
Signed-off-by Sebastian Andrzej Siewior<[email protected]>--- net/core/dev.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)net/core/dev.c +0
-0
net/core/dev.c static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) · line 1544
Quoted 5 lines
net/core/dev.c +1
-1@@ -1541,7 +1541,8 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)if (net_ratelimit ()) printk(KERN_CRIT "protocol %04x is " "buggy, dev %s\n", - skb2->protocol, dev->name); + htons(skb2->protocol),
Would ntohs() be more appropriate here? It looks like you are converting from network order to host order for printing.
David Daney
PATCH v2 1/1 net/core: use ntohs for skb->protocol
In reply to David MillerFrom: Sebastian Andrzej Siewior <[email protected]>
This is only noticed by people that are not doing everything correct in the first place.
--- net/core/dev.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/core/dev.c +2 -1
@@ -1537,7 +1537,8 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)if (net_ratelimit ())printk (KERN_CRIT "protocol %04x is " "buggy, dev %s\n" , - skb2->protocol, dev->name); +ntohs (skb2->protocol), + dev->name);skb_reset_network_header (skb2); }
Signature · 1 line
1.6.6.1
Re: [PATCH v2] net/core: use ntohs for skb->protocol
From: Sebastian Andrzej Siewior <[email protected]>
Date: Wed, 30 Jun 2010 11:02:29 +0200
Quoted 6 lines
From: Sebastian Andrzej Siewior <[email protected]>
This is only noticed by people that are not doing everything correct in the first place.
Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Applied to net-next-2.6, thanks.