diff mbox

net/core: use htons for skb->protocol

Message ID 20100629163246.GA18647@Chamillionaire.breakpoint.cc
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Sebastian Andrzej Siewior June 29, 2010, 4:32 p.m. UTC
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

This is only noticed by people that are not doing everything correct in
the first place.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/core/dev.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

David Miller June 29, 2010, 10:17 p.m. UTC | #1
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Date: Tue, 29 Jun 2010 18:32:46 +0200

> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> 
> This is only noticed by people that are not doing everything correct in
> the first place.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

It's in network byte order so you should use ntohs().
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Daney June 29, 2010, 10:19 p.m. UTC | #2
On 06/29/2010 09:32 AM, Sebastian Andrzej Siewior wrote:
> From: Sebastian Andrzej Siewior<bigeasy@linutronix.de>
>
> This is only noticed by people that are not doing everything correct in
> the first place.
>
> Signed-off-by: Sebastian Andrzej Siewior<bigeasy@linutronix.de>
> ---
>   net/core/dev.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 2b3bf53..78ad37c 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 2b3bf53..78ad37c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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);
 			}