-/* $OpenBSD: in_pcb.c,v 1.241 2018/09/07 10:55:35 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.242 2018/09/10 22:21:39 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
return (&table->inpt_hashtbl[SipHash24_End(&ctx) & table->inpt_mask]);
}
-#define INPCBHASH(table, faddr, fport, laddr, lport, rdom) \
- in_pcbhash(table, rdom, faddr, fport, laddr, lport)
-
struct inpcbhead *
in6_pcbhash(struct inpcbtable *table, int rdom,
const struct in6_addr *faddr, u_short fport,
return (&table->inpt_hashtbl[SipHash24_End(&ctx) & table->inpt_mask]);
}
-#define IN6PCBHASH(table, faddr, fport, laddr, lport, rdom) \
- in6_pcbhash(table, rdom, faddr, fport, laddr, lport)
-
struct inpcbhead *
in_pcblhash(struct inpcbtable *table, int rdom, u_short lport)
{
return (&table->inpt_lhashtbl[SipHash24_End(&ctx) & table->inpt_lmask]);
}
-#define INPCBLHASH(table, lport, rdom) in_pcblhash(table, rdom, lport)
-
void
in_pcbinit(struct inpcbtable *table, int hashsize)
{
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);
- head = INPCBLHASH(table, inp->inp_lport, inp->inp_rtableid);
+ head = in_pcblhash(table, inp->inp_rtableid, inp->inp_lport);
LIST_INSERT_HEAD(head, inp, inp_lhash);
#ifdef INET6
if (sotopf(so) == PF_INET6)
- head = IN6PCBHASH(table, &inp->inp_faddr6, inp->inp_fport,
- &inp->inp_laddr6, inp->inp_lport,
- rtable_l2(inp->inp_rtableid));
+ head = in6_pcbhash(table, rtable_l2(inp->inp_rtableid),
+ &inp->inp_faddr6, inp->inp_fport,
+ &inp->inp_laddr6, inp->inp_lport);
else
#endif /* INET6 */
- head = INPCBHASH(table, &inp->inp_faddr, inp->inp_fport,
- &inp->inp_laddr, inp->inp_lport,
- rtable_l2(inp->inp_rtableid));
+ head = in_pcbhash(table, rtable_l2(inp->inp_rtableid),
+ &inp->inp_faddr, inp->inp_fport,
+ &inp->inp_laddr, inp->inp_lport);
LIST_INSERT_HEAD(head, inp, inp_hash);
so->so_pcb = inp;
u_int rdomain;
rdomain = rtable_l2(rtable);
- head = INPCBLHASH(table, lport, rdomain);
+ head = in_pcblhash(table, rdomain, lport);
LIST_FOREACH(inp, head, inp_lhash) {
if (rtable_l2(inp->inp_rtableid) != rdomain)
continue;
NET_ASSERT_LOCKED();
LIST_REMOVE(inp, inp_lhash);
- head = INPCBLHASH(table, inp->inp_lport, inp->inp_rtableid);
+ head = in_pcblhash(table, inp->inp_rtableid, inp->inp_lport);
LIST_INSERT_HEAD(head, inp, inp_lhash);
LIST_REMOVE(inp, inp_hash);
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
- head = IN6PCBHASH(table, &inp->inp_faddr6, inp->inp_fport,
- &inp->inp_laddr6, inp->inp_lport,
- rtable_l2(inp->inp_rtableid));
+ head = in6_pcbhash(table, rtable_l2(inp->inp_rtableid),
+ &inp->inp_faddr6, inp->inp_fport,
+ &inp->inp_laddr6, inp->inp_lport);
else
#endif /* INET6 */
- head = INPCBHASH(table, &inp->inp_faddr, inp->inp_fport,
- &inp->inp_laddr, inp->inp_lport,
- rtable_l2(inp->inp_rtableid));
+ head = in_pcbhash(table, rtable_l2(inp->inp_rtableid),
+ &inp->inp_faddr, inp->inp_fport,
+ &inp->inp_laddr, inp->inp_lport);
LIST_INSERT_HEAD(head, inp, inp_hash);
}
u_int rdomain;
rdomain = rtable_l2(rtable);
- head = INPCBHASH(table, &faddr, fport, &laddr, lport, rdomain);
+ head = in_pcbhash(table, rdomain, &faddr, fport, &laddr, lport);
LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
u_int rdomain;
rdomain = rtable_l2(rtable);
- head = IN6PCBHASH(table, faddr, fport, laddr, lport, rdomain);
+ head = in6_pcbhash(table, rdomain, faddr, fport, laddr, lport);
LIST_FOREACH(inp, head, inp_hash) {
if (!(inp->inp_flags & INP_IPV6))
continue;
#endif
rdomain = rtable_l2(rtable);
- head = INPCBHASH(table, &zeroin_addr, 0, key1, lport, rdomain);
+ head = in_pcbhash(table, rdomain, &zeroin_addr, 0, key1, lport);
LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
break;
}
if (inp == NULL && key1->s_addr != key2->s_addr) {
- head = INPCBHASH(table, &zeroin_addr, 0, key2, lport, rdomain);
+ head = in_pcbhash(table, rdomain,
+ &zeroin_addr, 0, key2, lport);
LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
#endif
rdomain = rtable_l2(rtable);
- head = IN6PCBHASH(table, &zeroin6_addr, 0, key1, lport, rdomain);
+ head = in6_pcbhash(table, rdomain, &zeroin6_addr, 0, key1, lport);
LIST_FOREACH(inp, head, inp_hash) {
if (!(inp->inp_flags & INP_IPV6))
continue;
break;
}
if (inp == NULL && ! IN6_ARE_ADDR_EQUAL(key1, key2)) {
- head = IN6PCBHASH(table, &zeroin6_addr, 0, key2, lport,
- rdomain);
+ head = in6_pcbhash(table, rdomain,
+ &zeroin6_addr, 0, key2, lport);
LIST_FOREACH(inp, head, inp_hash) {
if (!(inp->inp_flags & INP_IPV6))
continue;