summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-11-11 04:45:45 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-11-11 04:45:45 +0000
commit0edee7c82a646eb1d7b12e367f4d6a88155cdb1f (patch)
tree134abc0ea1115a41f40c60be5ebc97b175f55de7
parentbb5d4d008b587d397c24d694cb8bc771520a7046 (diff)
align ifaliasreq.ifra_addr similar to the way that ifreq is fixed --
a gruesome union, to block the compiler from placing the struct incorrectly aligned on stack frames ok guenther
-rw-r--r--sys/net/if.h10
-rw-r--r--sys/netinet/in_var.h10
-rw-r--r--sys/netinet6/in6_var.h10
3 files changed, 24 insertions, 6 deletions
diff --git a/sys/net/if.h b/sys/net/if.h
index 96303d2db84..e00ffa3dc98 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.135 2012/10/05 17:17:04 camield Exp $ */
+/* $OpenBSD: if.h,v 1.136 2012/11/11 04:45:37 deraadt Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -646,7 +646,13 @@ struct ifreq {
struct ifaliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct sockaddr ifra_addr;
+ union {
+ struct sockaddr ifrau_addr;
+ int ifrau_align;
+ } ifra_ifrau;
+#ifndef ifra_addr
+#define ifra_addr ifra_ifrau.ifrau_addr
+#endif
struct sockaddr ifra_dstaddr;
#define ifra_broadaddr ifra_dstaddr
struct sockaddr ifra_mask;
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index e87aee999f2..110ed7944c2 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_var.h,v 1.17 2011/10/13 18:23:40 claudio Exp $ */
+/* $OpenBSD: in_var.h,v 1.18 2012/11/11 04:45:44 deraadt Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
@@ -62,7 +62,13 @@ struct in_ifaddr {
struct in_aliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct sockaddr_in ifra_addr;
+ union {
+ struct sockaddr_in ifrau_addr;
+ int ifrau_align;
+ } ifra_ifrau;
+#ifndef ifra_addr
+#define ifra_addr ifra_ifrau.ifrau_addr
+#endif
struct sockaddr_in ifra_dstaddr;
#define ifra_broadaddr ifra_dstaddr
struct sockaddr_in ifra_mask;
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 55f85009a71..add70ba7733 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_var.h,v 1.34 2011/10/13 18:23:40 claudio Exp $ */
+/* $OpenBSD: in6_var.h,v 1.35 2012/11/11 04:45:44 deraadt Exp $ */
/* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */
/*
@@ -258,7 +258,13 @@ struct in6_ifreq {
struct in6_aliasreq {
char ifra_name[IFNAMSIZ];
- struct sockaddr_in6 ifra_addr;
+ union {
+ struct sockaddr_in6 ifrau_addr;
+ int ifrau_align;
+ } ifra_ifrau;
+#ifndef ifra_addr
+#define ifra_addr ifra_ifrau.ifrau_addr
+#endif
struct sockaddr_in6 ifra_dstaddr;
struct sockaddr_in6 ifra_prefixmask;
int ifra_flags;