From: bluhm Date: Fri, 22 Mar 2024 21:48:38 +0000 (+0000) Subject: Remove padding from union inpaddru. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ab27fc16fb48f41a818ee2e0a8807ce0c5a0afd0;p=openbsd 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@ --- 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 */