+#define INP_IS_FLOW_CONTROLLED(_inp_) \
+ ((_inp_)->inp_flags & INP_FLOW_CONTROLLED)
+#define INP_IS_FLOW_SUSPENDED(_inp_) \
+ (((_inp_)->inp_flags & INP_FLOW_SUSPENDED) || \
+ ((_inp_)->inp_socket->so_flags & SOF_SUSPENDED))
+#define INP_WAIT_FOR_IF_FEEDBACK(_inp_) \
+ (((_inp_)->inp_flags & (INP_FLOW_CONTROLLED | INP_FLOW_SUSPENDED)) != 0)
+
+#define INP_NO_CELLULAR(_inp) \
+ ((_inp)->inp_flags & INP_NO_IFT_CELLULAR)
+#define INP_NO_EXPENSIVE(_inp) \
+ ((_inp)->inp_flags2 & INP2_NO_IFF_EXPENSIVE)
+#define INP_AWDL_UNRESTRICTED(_inp) \
+ ((_inp)->inp_flags2 & INP2_AWDL_UNRESTRICTED)
+#define INP_INTCOPROC_ALLOWED(_inp) \
+ ((_inp)->inp_flags2 & INP2_INTCOPROC_ALLOWED)
+
+#endif /* BSD_KERNEL_PRIVATE */
+
+/*
+ * Flags for inp_flags.
+ *
+ * Some of these are publicly defined for legacy reasons, as they are
+ * (unfortunately) used by certain applications to determine, at compile
+ * time, whether or not the OS supports certain features.
+ */
+#ifdef BSD_KERNEL_PRIVATE
+#define INP_RECVOPTS 0x00000001 /* receive incoming IP options */
+#define INP_RECVRETOPTS 0x00000002 /* receive IP options for reply */
+#define INP_RECVDSTADDR 0x00000004 /* receive IP dst address */
+#define INP_HDRINCL 0x00000008 /* user supplies entire IP header */
+#define INP_HIGHPORT 0x00000010 /* user wants "high" port binding */
+#define INP_LOWPORT 0x00000020 /* user wants "low" port binding */
+#endif /* BSD_KERNEL_PRIVATE */
+
+#define INP_ANONPORT 0x00000040 /* port chosen for user */
+
+#ifdef BSD_KERNEL_PRIVATE
+#define INP_RECVIF 0x00000080 /* receive incoming interface */
+#define INP_MTUDISC 0x00000100 /* unused */
+#define INP_STRIPHDR 0x00000200 /* strip hdrs in raw_ip (for OT) */
+#define INP_RECV_ANYIF 0x00000400 /* don't restrict inbound iface */
+#define INP_INADDR_ANY 0x00000800 /* local address wasn't specified */
+#define INP_IN6ADDR_ANY INP_INADDR_ANY
+#define INP_RECVTTL 0x00001000 /* receive incoming IP TTL */
+#define INP_UDP_NOCKSUM 0x00002000 /* turn off outbound UDP checksum */
+#define INP_BOUND_IF 0x00004000 /* bind socket to an interface */
+#endif /* BSD_KERNEL_PRIVATE */
+
+#define IN6P_IPV6_V6ONLY 0x00008000 /* restrict AF_INET6 socket for v6 */
+
+#ifdef BSD_KERNEL_PRIVATE
+#define IN6P_PKTINFO 0x00010000 /* receive IP6 dst and I/F */
+#define IN6P_HOPLIMIT 0x00020000 /* receive hoplimit */
+#define IN6P_HOPOPTS 0x00040000 /* receive hop-by-hop options */
+#define IN6P_DSTOPTS 0x00080000 /* receive dst options after rthdr */
+#define IN6P_RTHDR 0x00100000 /* receive routing header */
+#define IN6P_RTHDRDSTOPTS 0x00200000 /* receive dstoptions before rthdr */
+#define IN6P_TCLASS 0x00400000 /* receive traffic class value */
+#define INP_RECVTOS IN6P_TCLASS /* receive incoming IP TOS */
+#define IN6P_AUTOFLOWLABEL 0x00800000 /* attach flowlabel automatically */
+#endif /* BSD_KERNEL_PRIVATE */
+
+#define IN6P_BINDV6ONLY 0x01000000 /* do not grab IPv4 traffic */
+
+#ifdef BSD_KERNEL_PRIVATE
+#define IN6P_RFC2292 0x02000000 /* used RFC2292 API on the socket */
+#define IN6P_MTU 0x04000000 /* receive path MTU */
+#define INP_PKTINFO 0x08000000 /* rcv and snd PKTINFO for IPv4 */
+#define INP_FLOW_SUSPENDED 0x10000000 /* flow suspended */
+#define INP_NO_IFT_CELLULAR 0x20000000 /* do not use cellular interface */
+#define INP_FLOW_CONTROLLED 0x40000000 /* flow controlled */
+#define INP_FC_FEEDBACK 0x80000000 /* got interface flow adv feedback */
+
+#define INP_CONTROLOPTS \
+ (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|INP_RECVIF|INP_RECVTTL| \
+ INP_PKTINFO|IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|IN6P_DSTOPTS| \
+ IN6P_RTHDR|IN6P_RTHDRDSTOPTS|IN6P_TCLASS|IN6P_RFC2292|IN6P_MTU)
+
+#define INP_UNMAPPABLEOPTS \
+ (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR| IN6P_TCLASS|IN6P_AUTOFLOWLABEL)
+
+/*
+ * Flags for inp_flags2.
+ *
+ * Overflowed INP flags; use INP2 prefix to avoid misuse.
+ */
+#define INP2_TIMEWAIT 0x00000001 /* in TIMEWAIT */
+#define INP2_IN_FCTREE 0x00000002 /* in inp_fc_tree */
+#define INP2_WANT_APP_POLICY 0x00000004 /* necp app policy check is desired */
+#define INP2_NO_IFF_EXPENSIVE 0x00000008 /* do not use expensive interface */
+#define INP2_INHASHLIST 0x00000010 /* pcb is in inp_hash list */
+#define INP2_AWDL_UNRESTRICTED 0x00000020 /* AWDL restricted mode allowed */
+#define INP2_KEEPALIVE_OFFLOAD 0x00000040 /* Enable UDP or TCP keepalive offload */
+#define INP2_INTCOPROC_ALLOWED 0x00000080 /* Allow communication via internal co-processor interfaces */
+#define INP2_CONNECT_IN_PROGRESS 0x00000100 /* A connect call is in progress, so binds are intermediate steps */
+
+/*
+ * Flags passed to in_pcblookup*() functions.
+ */
+#define INPLOOKUP_WILDCARD 1
+
+#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
+#define sotoin6pcb(so) sotoinpcb(so)