Add the `packed' attribute to structures which describe wire protocol data.

This commit is contained in:
thorpej 1999-11-20 00:37:58 +00:00
parent 1152720a07
commit 046d593425
11 changed files with 31 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.29 1998/02/10 01:26:24 perry Exp $ */
/* $NetBSD: if_ether.h,v 1.30 1999/11/20 00:37:58 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -79,7 +79,7 @@ struct ether_arp {
u_int8_t arp_spa[4]; /* sender protocol address */
u_int8_t arp_tha[ETHER_ADDR_LEN]; /* target hardware address */
u_int8_t arp_tpa[4]; /* target protocol address */
};
} __attribute__((__packed__));
#define arp_hrd ea_hdr.ar_hrd
#define arp_pro ea_hdr.ar_pro
#define arp_hln ea_hdr.ar_hln

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp.h,v 1.7 1998/02/10 01:26:29 perry Exp $ */
/* $NetBSD: igmp.h,v 1.8 1999/11/20 00:37:58 thorpej Exp $ */
/*
* Copyright (c) 1988 Stephen Deering.
@ -56,7 +56,7 @@ struct igmp {
u_int8_t igmp_code; /* code for routing sub-messages */
u_int16_t igmp_cksum; /* IP-style checksum */
struct in_addr igmp_group; /* group address being reported */
}; /* (zero for queries) */
} __attribute__((__packed__)); /* (zero for queries) */
#define IGMP_MINLEN 8

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.h,v 1.42 1999/07/02 08:46:47 itojun Exp $ */
/* $NetBSD: in.h,v 1.43 1999/11/20 00:37:59 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -119,7 +119,7 @@
*/
struct in_addr {
u_int32_t s_addr;
};
} __attribute__((__packed__));
/*
* Definitions of bits in internet address integers.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip.h,v 1.19 1999/07/01 08:12:50 itojun Exp $ */
/* $NetBSD: ip.h,v 1.20 1999/11/20 00:37:59 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -68,7 +68,7 @@ struct ip {
u_int8_t ip_p; /* protocol */
u_int16_t ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
};
} __attribute__((__packed__));
#define IP_MAXPACKET 65535 /* maximum packet size */
@ -147,8 +147,8 @@ struct ip_timestamp {
struct ipt_ta {
struct in_addr ipt_addr;
n_time ipt_time;
} ipt_ta[1];
} ipt_timestamp;
} ipt_ta[1] __attribute__((__packed__));
} ipt_timestamp /* XXX __attribute__((__packed__)) ??? */;
};
/* flag bits for ipt_flg */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.h,v 1.13 1998/02/10 01:26:55 perry Exp $ */
/* $NetBSD: ip_icmp.h,v 1.14 1999/11/20 00:37:59 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -50,7 +50,7 @@
struct icmp_ra_addr {
u_int32_t ira_addr;
u_int32_t ira_preference;
};
} __attribute__((__packed__));
/*
* Structure of an icmp header.
@ -65,20 +65,20 @@ struct icmp {
struct ih_idseq {
n_short icd_id;
n_short icd_seq;
} ih_idseq;
} ih_idseq __attribute__((__packed__));
int32_t ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
n_short ipm_void;
n_short ipm_nextmtu;
} ih_pmtu;
} ih_pmtu __attribute__((__packed__));
struct ih_rtradv {
u_int8_t irt_num_addrs;
u_int8_t irt_wpa;
u_int16_t irt_lifetime;
} ih_rtradv;
} icmp_hun;
} ih_rtradv __attribute__((__packed__));
} icmp_hun /* XXX __attribute__((__packed__)) ??? */;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
@ -94,15 +94,15 @@ struct icmp {
n_time its_otime;
n_time its_rtime;
n_time its_ttime;
} id_ts;
} id_ts __attribute__((__packed__));
struct id_ip {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
} id_ip __attribute__((__packed__));
struct icmp_ra_addr id_radv;
u_int32_t id_mask;
int8_t id_data[1];
} icmp_dun;
} icmp_dun /* XXX __attribute__((__packed__)) ??? */;
#define icmp_otime icmp_dun.id_ts.its_otime
#define icmp_rtime icmp_dun.id_ts.its_rtime
#define icmp_ttime icmp_dun.id_ts.its_ttime

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_mroute.h,v 1.16 1999/07/01 08:12:51 itojun Exp $ */
/* $NetBSD: ip_mroute.h,v 1.17 1999/11/20 00:37:59 thorpej Exp $ */
/*
* Definitions for IP multicast forwarding.
@ -176,7 +176,7 @@ struct igmpmsg {
u_int8_t im_vif; /* vif rec'd on */
u_int8_t unused3;
struct in_addr im_src, im_dst;
};
} __attribute__((__packed__));
/*
* Argument structure used for pkt info. while upcall is made.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_var.h,v 1.39 1999/11/19 10:41:42 bouyer Exp $ */
/* $NetBSD: ip_var.h,v 1.40 1999/11/20 00:38:00 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -50,7 +50,7 @@ struct ipovly {
u_int16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
};
} __attribute__((__packed__));
/*
* Ip (reassembly or sequence) queue structures.

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp.h,v 1.10 1998/10/04 21:33:52 matt Exp $ */
/* $NetBSD: tcp.h,v 1.11 1999/11/20 00:38:00 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -66,7 +66,7 @@ struct tcphdr {
u_int16_t th_win; /* window */
u_int16_t th_sum; /* checksum */
u_int16_t th_urp; /* urgent pointer */
};
} __attribute__((__packed__));
#define TCPOPT_EOL 0
#define TCPOPT_NOP 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcpip.h,v 1.7 1998/02/10 01:27:21 perry Exp $ */
/* $NetBSD: tcpip.h,v 1.8 1999/11/20 00:38:00 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -44,7 +44,7 @@
struct tcpiphdr {
struct ipovly ti_i; /* overlaid ip structure */
struct tcphdr ti_t; /* tcp header */
};
} __attribute__((__packed__));
#define ti_x1 ti_i.ih_x1
#define ti_pr ti_i.ih_pr
#define ti_len ti_i.ih_len

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp.h,v 1.8 1998/02/10 01:27:23 perry Exp $ */
/* $NetBSD: udp.h,v 1.9 1999/11/20 00:38:00 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -47,6 +47,6 @@ struct udphdr {
u_int16_t uh_dport; /* destination port */
u_int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
};
} __attribute__((__packed__));
#endif /* _NETINET_UDP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_var.h,v 1.16 1999/11/19 10:41:43 bouyer Exp $ */
/* $NetBSD: udp_var.h,v 1.17 1999/11/20 00:38:00 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -44,7 +44,7 @@
struct udpiphdr {
struct ipovly ui_i; /* overlaid ip structure */
struct udphdr ui_u; /* udp header */
};
} __attribute__((__packed__));
#define ui_x1 ui_i.ih_x1
#define ui_pr ui_i.ih_pr
#define ui_len ui_i.ih_len