diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-06-14 17:16:04 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-06-14 17:16:04 +0000 |
commit | 4d133d65a07ca2bd6152f6a7eb81d9814201c249 (patch) | |
tree | ba027be772676cb78c653ead8de6991cb551e449 /sys/netinet | |
parent | a15dbb9d7bfd4780f683b688ec71eb19bfa54720 (diff) |
In in_pcballoc() finish the inp initialization before adding it to
the global inpcb queue and hashes.
OK visa@ mpi@ as part of a larger diff
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/in_pcb.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 9c3eeefec75..d2626718533 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.238 2018/06/14 17:00:57 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.239 2018/06/14 17:16:03 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -269,6 +269,18 @@ in_pcballoc(struct socket *so, struct inpcbtable *table) inp->inp_seclevel[SL_ESP_NETWORK] = IPSEC_ESP_NETWORK_LEVEL_DEFAULT; inp->inp_seclevel[SL_IPCOMP] = IPSEC_IPCOMP_LEVEL_DEFAULT; inp->inp_rtableid = curproc->p_p->ps_rtableid; + inp->inp_hops = -1; +#ifdef INET6 + /* + * Small change in this function to set the INP_IPV6 flag so routines + * outside pcb-specific routines don't need to use sotopf(), and all + * of its pointer chasing, later. + */ + if (sotopf(so) == PF_INET6) + inp->inp_flags = INP_IPV6; + inp->inp_cksum6 = -1; +#endif /* INET6 */ + if (table->inpt_count++ > INPCBHASH_LOADFACTOR(table->inpt_size)) (void)in_pcbresize(table, table->inpt_size * 2); TAILQ_INSERT_HEAD(&table->inpt_queue, inp, inp_queue); @@ -286,18 +298,7 @@ in_pcballoc(struct socket *so, struct inpcbtable *table) rtable_l2(inp->inp_rtableid)); LIST_INSERT_HEAD(head, inp, inp_hash); so->so_pcb = inp; - inp->inp_hops = -1; -#ifdef INET6 - /* - * Small change in this function to set the INP_IPV6 flag so routines - * outside pcb-specific routines don't need to use sotopf(), and all - * of its pointer chasing, later. - */ - if (sotopf(so) == PF_INET6) - inp->inp_flags = INP_IPV6; - inp->inp_cksum6 = -1; -#endif /* INET6 */ return (0); } |