2003-09-15 Jay Monkman <jtm@smothsmothie.com>

PR 481/networking
	* net/ethernet.h, net/if_arp.h, netinet/if_ether.h: Network structs
	should be packed
This commit is contained in:
Jennifer Averett
2003-09-15 14:39:41 +00:00
parent cf9ebac886
commit daa8db7c7a
4 changed files with 17 additions and 7 deletions

View File

@@ -1,3 +1,9 @@
2003-09-15 Jay Monkman <jtm@smothsmothie.com>
PR 481/networking
* net/ethernet.h, net/if_arp.h, netinet/if_ether.h: Network structs
should be packed
2003-09-15 Jay Monkman <jtm@smoothsmoothie.com>
PR 482/networking

View File

@@ -8,6 +8,8 @@
#ifndef _NET_ETHERNET_H_
#define _NET_ETHERNET_H_
#include <netinet/in.h>
/*
* 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;
};
/*

View File

@@ -37,6 +37,7 @@
#ifndef _NET_IF_ARP_H_
#define _NET_IF_ARP_H_
#include <netinet/in.h>
/*
* 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 */

View File

@@ -37,6 +37,7 @@
#ifndef _NETINET_IF_ETHER_H_
#define _NETINET_IF_ETHER_H_
#include <netinet/in.h>
#include <net/ethernet.h>
#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 */