summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-12-01 17:50:11 +0000
committerimp <imp@FreeBSD.org>2006-12-01 17:50:11 +0000
commita46bddd7e4f844c71a433fcb1fae69dc31ff1b79 (patch)
tree06a7e9cd7cfa79c3a2a4140f6b395891e84a68a2 /sys/net
parent5757d9c0fc8fb7356b8d16131a69eac10a49533c (diff)
downloadFreeBSD-src-a46bddd7e4f844c71a433fcb1fae69dc31ff1b79.zip
FreeBSD-src-a46bddd7e4f844c71a433fcb1fae69dc31ff1b79.tar.gz
Move the __packed declarations. This makes sizeof(struct llc) 8 again
on the arm. Add an assert to ensure that the size is 8 to prefent others from falling into this trap (we should have more of these). Why the construct: struct foo { union bar { struct { ... } __packed fred; ... } __packed wilma; } __packed; has a different packing than: struct foo { union bar { struct { ... } fred __packed; ... } wilma __packed; } __packed; is beyond my ability to ferret out of the gcc documentation. Most likely some subtle binding issue (eg before it says the struct itself is packed, while after it means that the whole struct is packed into the thing it is in). Pointers to relevant documentation would be appreciated.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_llc.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/sys/net/if_llc.h b/sys/net/if_llc.h
index 8d96686..0d96372 100644
--- a/sys/net/if_llc.h
+++ b/sys/net/if_llc.h
@@ -52,15 +52,15 @@ struct llc {
u_int8_t format_id;
u_int8_t class;
u_int8_t window_x2;
- } type_u __packed;
+ } __packed type_u;
struct {
u_int8_t num_snd_x2;
u_int8_t num_rcv_x2;
- } type_i __packed;
+ } __packed type_i;
struct {
u_int8_t control;
u_int8_t num_rcv_x2;
- } type_s __packed;
+ } __packed type_s;
struct {
u_int8_t control;
/*
@@ -72,17 +72,17 @@ struct llc {
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
- } type_frmr __packed;
+ } __packed type_frmr;
struct {
u_int8_t control;
u_int8_t org_code[3];
u_int16_t ether_type;
- } type_snap __packed;
+ } __packed type_snap;
struct {
u_int8_t control;
u_int8_t control_ext;
- } type_raw __packed;
- } llc_un /* XXX __packed ??? */;
+ } __packed type_raw;
+ } __packed llc_un;
} __packed;
struct frmrinfo {
@@ -114,6 +114,10 @@ struct frmrinfo {
#define LLC_FRMRLEN 7
#define LLC_SNAPFRAMELEN 8
+#ifdef CTASSERT
+CTASSERT(sizeof (struct llc) == LLC_SNAPFRAMELEN);
+#endif
+
/*
* Unnumbered LLC format commands
*/
OpenPOWER on IntegriCloud