From 4e0576c023ac197944b4ce166c449f7fca25d023 Mon Sep 17 00:00:00 2001 From: Jennifer Averett Date: Mon, 15 Sep 2003 14:28:11 +0000 Subject: 2003-09-15 Jennifer Averett PR 481/networking * net/ethernet.h, net/if_arp.h, netinet/if_ether.h: Network structs should be packed --- cpukit/libnetworking/ChangeLog | 6 ++++++ cpukit/libnetworking/net/ethernet.h | 4 +++- cpukit/libnetworking/net/if_arp.h | 11 ++++++----- cpukit/libnetworking/netinet/if_ether.h | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) (limited to 'cpukit') diff --git a/cpukit/libnetworking/ChangeLog b/cpukit/libnetworking/ChangeLog index 13ea7fc5fd..74c14fd612 100644 --- a/cpukit/libnetworking/ChangeLog +++ b/cpukit/libnetworking/ChangeLog @@ -1,3 +1,9 @@ +2003-09-15 Jennifer Averett + + PR 481/networking + * net/ethernet.h, net/if_arp.h, netinet/if_ether.h: Network structs + should be packed + 2003-09-04 Joel Sherrill * rtems/mkrootfs.c, rtems/mkrootfs.h: URL for license changed. diff --git a/cpukit/libnetworking/net/ethernet.h b/cpukit/libnetworking/net/ethernet.h index c6c07189ec..1f988d7b9e 100644 --- a/cpukit/libnetworking/net/ethernet.h +++ b/cpukit/libnetworking/net/ethernet.h @@ -8,6 +8,8 @@ #ifndef _NET_ETHERNET_H_ #define _NET_ETHERNET_H_ +#include + /* * The number of bytes in an ethernet (MAC) address. */ @@ -50,7 +52,7 @@ struct ether_header { u_char ether_dhost[ETHER_ADDR_LEN]; u_char ether_shost[ETHER_ADDR_LEN]; - u_short ether_type; + u_short ether_type BYTE_PACK; }; /* diff --git a/cpukit/libnetworking/net/if_arp.h b/cpukit/libnetworking/net/if_arp.h index dd726bf856..a581c21558 100644 --- a/cpukit/libnetworking/net/if_arp.h +++ b/cpukit/libnetworking/net/if_arp.h @@ -37,6 +37,7 @@ #ifndef _NET_IF_ARP_H_ #define _NET_IF_ARP_H_ +#include /* * Address Resolution Protocol. * @@ -48,13 +49,13 @@ * specified. Field names used correspond to RFC 826. */ struct arphdr { - u_short ar_hrd; /* format of hardware address */ + u_short ar_hrd BYTE_PACK; /* format of hardware address */ #define ARPHRD_ETHER 1 /* ethernet hardware format */ #define ARPHRD_FRELAY 15 /* frame relay hardware format */ - u_short ar_pro; /* format of protocol address */ - u_char ar_hln; /* length of hardware address */ - u_char ar_pln; /* length of protocol address */ - u_short ar_op; /* one of: */ + u_short ar_pro BYTE_PACK; /* format of protocol address */ + u_char ar_hln BYTE_PACK; /* length of hardware address */ + u_char ar_pln BYTE_PACK; /* length of protocol address */ + u_short ar_op BYTE_PACK; /* one of: */ #define ARPOP_REQUEST 1 /* request to resolve address */ #define ARPOP_REPLY 2 /* response to previous request */ #define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ diff --git a/cpukit/libnetworking/netinet/if_ether.h b/cpukit/libnetworking/netinet/if_ether.h index 22c8e97187..41c0bbe220 100644 --- a/cpukit/libnetworking/netinet/if_ether.h +++ b/cpukit/libnetworking/netinet/if_ether.h @@ -37,6 +37,7 @@ #ifndef _NETINET_IF_ETHER_H_ #define _NETINET_IF_ETHER_H_ +#include #include #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ @@ -82,7 +83,7 @@ * RFC 826. */ struct ether_arp { - struct arphdr ea_hdr; /* fixed-size header */ + struct arphdr ea_hdr BYTE_PACK; /* fixed-size header */ u_char arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ u_char arp_spa[4]; /* sender protocol address */ u_char arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ -- cgit v1.2.3