/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1982, 1986, 1990, 19934* The Regents of the University of California.5* Copyright (c) 2010-2011 Juniper Networks, Inc.6* All rights reserved.7*8* Portions of this software were developed by Robert N. M. Watson under9* contract to Juniper Networks, Inc.10*11* Redistribution and use in source and binary forms, with or without12* modification, are permitted provided that the following conditions13* are met:14* 1. Redistributions of source code must retain the above copyright15* notice, this list of conditions and the following disclaimer.16* 2. Redistributions in binary form must reproduce the above copyright17* notice, this list of conditions and the following disclaimer in the18* documentation and/or other materials provided with the distribution.19* 3. Neither the name of the University nor the names of its contributors20* may be used to endorse or promote products derived from this software21* without specific prior written permission.22*23* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND24* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE27* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33* SUCH DAMAGE.34*/3536#ifndef _NETINET_IN_PCB_VAR_H_37#define _NETINET_IN_PCB_VAR_H_3839/*40* Definitions shared between netinet/in_pcb.c and netinet6/in6_pcb.c41*/4243VNET_DECLARE(uint32_t, in_pcbhashseed);44#define V_in_pcbhashseed VNET(in_pcbhashseed)4546void inp_lock(struct inpcb *inp, const inp_lookup_t lock);47void inp_unlock(struct inpcb *inp, const inp_lookup_t lock);48int inp_trylock(struct inpcb *inp, const inp_lookup_t lock);49bool inp_smr_lock(struct inpcb *, const inp_lookup_t);50int in_pcb_lport(struct inpcb *, struct in_addr *, u_short *,51struct ucred *, int);52int in_pcb_lport_dest(const struct inpcb *inp, struct sockaddr *lsa,53u_short *lportp, struct sockaddr *fsa, u_short fport,54struct ucred *cred, int lookupflags);55struct inpcb *in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short,56int, int, struct ucred *);57int in_pcbinshash(struct inpcb *);58void in_pcbrehash(struct inpcb *);59void in_pcbremhash_locked(struct inpcb *);6061/*62* Load balance groups used for the SO_REUSEPORT_LB socket option. Each group63* (or unique address:port combination) can be re-used at most64* INPCBLBGROUP_SIZMAX (256) times. The inpcbs are stored in il_inp which65* is dynamically resized as processes bind/unbind to that specific group.66*/67struct inpcblbgroup {68CK_LIST_ENTRY(inpcblbgroup) il_list;69LIST_HEAD(, inpcb) il_pending; /* PCBs waiting for listen() */70struct epoch_context il_epoch_ctx;71struct ucred *il_cred;72uint16_t il_lport; /* (c) */73u_char il_vflag; /* (c) */74uint8_t il_numa_domain;75int il_fibnum;76union in_dependaddr il_dependladdr; /* (c) */77#define il_laddr il_dependladdr.id46_addr.ia46_addr478#define il6_laddr il_dependladdr.id6_addr79uint32_t il_inpsiz; /* max count in il_inp[] (h) */80uint32_t il_inpcnt; /* cur count in il_inp[] (h) */81uint32_t il_pendcnt; /* cur count in il_pending (h) */82struct inpcb *il_inp[]; /* (h) */83};8485#endif /* !_NETINET_IN_PCB_VAR_H_ */868788