summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-04-19 10:13:59 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-04-19 10:13:59 +0000
commit5c78de79d201b5311976d0ff89fc20423df0762a (patch)
tree7d3df24ba0a97e5b7f03c1ed553f0d95486262dd
parentdbaba333e2130b81aeb7c91a39494383fd96216c (diff)
Merge IPv4 and IPv6 options in inpcb.
A internet PCB has either inp_options or inp_outputopts6. Put them into a common anonymous union. OK mvs@ kn@
-rw-r--r--sys/netinet/in_pcb.c7
-rw-r--r--sys/netinet/in_pcb.h8
2 files changed, 9 insertions, 6 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 958d8ea9be9..1a6bc7166ec 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.301 2024/04/17 20:48:51 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.302 2024/04/19 10:13:58 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -592,7 +592,6 @@ in_pcbdetach(struct inpcb *inp)
* points.
*/
sofree(so, 1);
- m_freem(inp->inp_options);
if (inp->inp_route.ro_rt) {
rtfree(inp->inp_route.ro_rt);
inp->inp_route.ro_rt = NULL;
@@ -603,8 +602,10 @@ in_pcbdetach(struct inpcb *inp)
ip6_freemoptions(inp->inp_moptions6);
} else
#endif
+ {
+ m_freem(inp->inp_options);
ip_freemoptions(inp->inp_moptions);
-
+ }
#if NPF > 0
pf_remove_divert_state(inp);
pf_inp_unlink(inp);
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 60b3ae537e0..6e0b656b19f 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.h,v 1.156 2024/04/17 20:48:51 bluhm Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.157 2024/04/19 10:13:58 bluhm Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
@@ -157,8 +157,10 @@ struct inpcb {
} inp_hu;
#define inp_ip inp_hu.hu_ip
#define inp_ipv6 inp_hu.hu_ipv6
- struct mbuf *inp_options; /* IP options */
- struct ip6_pktopts *inp_outputopts6; /* IP6 options for outgoing packets */
+ union {
+ struct mbuf *inp_options; /* IPv4 options */
+ struct ip6_pktopts *inp_outputopts6; /* IPv6 options */
+ };
int inp_hops;
union {
struct ip_moptions *mou_mo;