From f5bb2424450655985b56f370e46a511bf608164c Mon Sep 17 00:00:00 2001 From: patrick Date: Thu, 11 Feb 2021 10:41:19 +0000 Subject: [PATCH] Swap faddr/laddr and fport/lport arguments in call to stoeplitz_ipXport(). Technically the whole point of the stoeplitz API is that it's symmetric, meaning that the order of addresses and ports doesn't matter and will produce the same hash value. Coverity CID 1501717 ok dlg@ --- sys/netinet/in_pcb.c | 6 +++--- sys/netinet6/in6_pcb.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 99402c98425..f588061f858 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.253 2021/01/25 03:40:46 dlg Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.254 2021/02/11 10:41:19 patrick Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -522,8 +522,8 @@ in_pcbconnect(struct inpcb *inp, struct mbuf *nam) inp->inp_fport = sin->sin_port; in_pcbrehash(inp); #if NSTOEPLITZ > 0 - inp->inp_flowid = stoeplitz_ip4port(inp->inp_laddr.s_addr, - inp->inp_faddr.s_addr, inp->inp_lport, inp->inp_fport); + inp->inp_flowid = stoeplitz_ip4port(inp->inp_faddr.s_addr, + inp->inp_laddr.s_addr, inp->inp_fport, inp->inp_lport); #endif #ifdef IPSEC { diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index a0b270c90e5..08159ffb68d 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.111 2021/01/25 03:40:47 dlg Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.112 2021/02/11 10:41:19 patrick Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -303,8 +303,8 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam) inp->inp_flowinfo |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); #if NSTOEPLITZ > 0 - inp->inp_flowid = stoeplitz_ip6port(&inp->inp_laddr6, - &inp->inp_faddr6, inp->inp_lport, inp->inp_fport); + inp->inp_flowid = stoeplitz_ip6port(&inp->inp_faddr6, + &inp->inp_laddr6, inp->inp_fport, inp->inp_lport); #endif in_pcbrehash(inp); return (0); -- 2.20.1