diff options
author | Pavel Roskin <proski@gnu.org> | 2005-11-10 16:03:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-11-10 16:03:08 -0500 |
commit | ac57d04267383829ce817e522e4ebbb39f50ae75 (patch) | |
tree | 5a011cf76a5aa8698d33fbb80655561e31e8ac47 /include/linux/if_ether.h | |
parent | fb286bb2990a107009dbf25f6ffebeb7df77f9be (diff) |
[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 <linux/types.h> so that the
userspace programs are not confused by __be16. Thanks to David S.
Miller.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/if_ether.h')
-rw-r--r-- | include/linux/if_ether.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index d21c305c6c64..fe26d431de87 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef _LINUX_IF_ETHER_H | 21 | #ifndef _LINUX_IF_ETHER_H |
22 | #define _LINUX_IF_ETHER_H | 22 | #define _LINUX_IF_ETHER_H |
23 | 23 | ||
24 | #include <linux/types.h> | ||
25 | |||
24 | /* | 26 | /* |
25 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble | 27 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
26 | * and FCS/CRC (frame check sequence). | 28 | * and FCS/CRC (frame check sequence). |
@@ -100,7 +102,7 @@ | |||
100 | struct ethhdr { | 102 | struct ethhdr { |
101 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 103 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
102 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 104 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
103 | unsigned short h_proto; /* packet type ID field */ | 105 | __be16 h_proto; /* packet type ID field */ |
104 | } __attribute__((packed)); | 106 | } __attribute__((packed)); |
105 | 107 | ||
106 | #ifdef __KERNEL__ | 108 | #ifdef __KERNEL__ |