From ac57d04267383829ce817e522e4ebbb39f50ae75 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 10 Nov 2005 13:03:08 -0800 Subject: [PATCH] [NET]: Annotate h_proto in struct ethhdr The protocol field in ethernet headers is big-endian and should be annotated as such. This patch allows detection of missing ntohs() calls on the ethernet protocol field when sparse is run with __CHECK_ENDIAN__ defined. This is a revised version that includes so that the userspace programs are not confused by __be16. Thanks to David S. Miller. Signed-off-by: Pavel Roskin Signed-off-by: David S. Miller --- include/linux/if_ether.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index d21c305c6c..fe26d431de 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -21,6 +21,8 @@ #ifndef _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H +#include + /* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble * and FCS/CRC (frame check sequence). @@ -100,7 +102,7 @@ struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ - unsigned short h_proto; /* packet type ID field */ + __be16 h_proto; /* packet type ID field */ } __attribute__((packed)); #ifdef __KERNEL__ -- 2.39.5