summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-03-22 21:48:39 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-03-22 21:48:39 +0000
commit11504cf1bcb3f16cc4988e28213e7d580acb25cf (patch)
tree8df5ca9f191427a8ed95f38ae9c3cef7b3603ce8
parent78059f51ef6ad45fdd8e1f120b6e32f0b761054e (diff)
Remove padding from union inpaddru.
Alignment of IPv4 address with lower part of IPv6 address looks like a leftover from times when IPv6 compatible addresses should contain IPv4 addreses. Better use a simple union for both IPv4 and IPv6 addresses like everywhere else. Use this type also for common zero address. OK mvs@
-rw-r--r--sys/netinet/in_pcb.c8
-rw-r--r--sys/netinet/in_pcb.h11
2 files changed, 6 insertions, 13 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 5eda7fd4691..12c0b86cf54 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.297 2024/03/22 18:05:01 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.298 2024/03/22 21:48:38 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -102,11 +102,7 @@
#endif
const struct in_addr zeroin_addr;
-
-const union {
- struct in_addr za_in;
- struct in6_addr za_in6;
-} zeroin46_addr;
+const union inpaddru zeroin46_addr;
/*
* These configure the range of local port addresses assigned to
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index e16647f33fb..683f1a7c49b 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.h,v 1.153 2024/03/22 18:05:01 bluhm Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.154 2024/03/22 21:48:38 bluhm Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
@@ -120,11 +120,8 @@
struct pf_state_key;
union inpaddru {
+ struct in_addr iau_addr;
struct in6_addr iau_addr6;
- struct {
- uint8_t pad[12];
- struct in_addr inaddr; /* easier transition */
- } iau_a4u;
};
/*
@@ -142,9 +139,9 @@ struct inpcb {
struct inpcbtable *inp_table; /* [I] inet queue/hash table */
union inpaddru inp_faddru; /* [t] Foreign address. */
union inpaddru inp_laddru; /* [t] Local address. */
-#define inp_faddr inp_faddru.iau_a4u.inaddr
+#define inp_faddr inp_faddru.iau_addr
#define inp_faddr6 inp_faddru.iau_addr6
-#define inp_laddr inp_laddru.iau_a4u.inaddr
+#define inp_laddr inp_laddru.iau_addr
#define inp_laddr6 inp_laddru.iau_addr6
u_int16_t inp_fport; /* [t] foreign port */
u_int16_t inp_lport; /* [t] local port */