CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Sun Apr 14 18:02:55 UTC 2024 Modified Files: src/sys/netinet: sctputil.h Log Message: s/force_comile_error/force_compile_error/ To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctputil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctputil.h diff -u src/sys/netinet/sctputil.h:1.3 src/sys/netinet/sctputil.h:1.4 --- src/sys/netinet/sctputil.h:1.3 Sun Jan 19 20:51:13 2020 +++ src/sys/netinet/sctputil.h Sun Apr 14 18:02:55 2024 @@ -1,5 +1,5 @@ /* $KAME: sctputil.h,v 1.15 2005/03/06 16:04:19 itojun Exp $ */ -/* $NetBSD: sctputil.h,v 1.3 2020/01/19 20:51:13 riastradh Exp $ */ +/* $NetBSD: sctputil.h,v 1.4 2024/04/14 18:02:55 andvar Exp $ */ #ifndef __SCTPUTIL_H__ #define __SCTPUTIL_H__ @@ -85,7 +85,7 @@ pool_init(&(zone), size, 0, 0, 0, name, NULL, IPL_NET); #else /* don't know this OS! */ - force_comile_error; + force_compile_error; #endif /* SCTP_ZONE_GET: allocate element from the zone */ @@ -105,7 +105,7 @@ pool_get(, PR_NOWAIT); #else /* don't know this OS! */ - force_comile_error; + force_compile_error; #endif /* SCTP_ZONE_FREE: free element from the zone */ @@ -125,7 +125,7 @@ pool_put(, element); #else /* don't know this OS! */ - force_comile_error; + force_compile_error; #endif #define sctp_get_associd(stcb) ((sctp_assoc_t)stcb->asoc.my_vtag)
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Sun Apr 14 18:02:55 UTC 2024 Modified Files: src/sys/netinet: sctputil.h Log Message: s/force_comile_error/force_compile_error/ To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctputil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sat Feb 24 21:39:05 UTC 2024 Modified Files: src/sys/netinet: if_arp.c Log Message: Attribute debug message. Fixes PR 57959 To generate a diff of this commit: cvs rdiff -u -r1.311 -r1.312 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.311 src/sys/netinet/if_arp.c:1.312 --- src/sys/netinet/if_arp.c:1.311 Tue Nov 15 10:47:39 2022 +++ src/sys/netinet/if_arp.c Sat Feb 24 21:39:05 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.311 2022/11/15 10:47:39 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.312 2024/02/24 21:39:05 mlelstv Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.311 2022/11/15 10:47:39 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.312 2024/02/24 21:39:05 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1355,8 +1355,8 @@ arp_llinfo_output(struct ifnet *ifp, __u if (sip.s_addr == INADDR_ANY) { char ipbuf[INET_ADDRSTRLEN]; - log(LOG_DEBUG, "source can't be " - "determined: dst=%s\n", + log(LOG_DEBUG, "%s: source can't be " + "determined: dst=%s\n", __func__, IN_PRINT(ipbuf, )); return; }
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sat Feb 24 21:39:05 UTC 2024 Modified Files: src/sys/netinet: if_arp.c Log Message: Attribute debug message. Fixes PR 57959 To generate a diff of this commit: cvs rdiff -u -r1.311 -r1.312 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: bouyer Date: Wed Sep 13 15:58:13 UTC 2023 Modified Files: src/sys/netinet: sctp_output.c Log Message: handle EHOSTDOWN the same way as EHOSTUNREACH in sctp_med_chunk_output(). Compile-tested only (I don't have a sctp setup); proposed in http://mail-index.netbsd.org/tech-net/2023/09/11/msg008611.html LGTM from Greg Troxel and Robert Swindells To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/netinet/sctp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_output.c diff -u src/sys/netinet/sctp_output.c:1.33 src/sys/netinet/sctp_output.c:1.34 --- src/sys/netinet/sctp_output.c:1.33 Fri Nov 4 09:01:53 2022 +++ src/sys/netinet/sctp_output.c Wed Sep 13 15:58:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_output.c,v 1.33 2022/11/04 09:01:53 ozaki-r Exp $ */ +/* $NetBSD: sctp_output.c,v 1.34 2023/09/13 15:58:13 bouyer Exp $ */ /* $KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.33 2022/11/04 09:01:53 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.34 2023/09/13 15:58:13 bouyer Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -5643,7 +5643,8 @@ sctp_med_chunk_output(struct sctp_inpcb } hbflag = 0; } - if (error == EHOSTUNREACH) { + if (error == EHOSTUNREACH || + error == EHOSTDOWN) { /* * Destination went * unreachable during @@ -5921,7 +5922,8 @@ sctp_med_chunk_output(struct sctp_inpcb } hbflag = 0; } -if (error == EHOSTUNREACH) { +if (error == EHOSTUNREACH || +error == EHOSTDOWN) { /* * Destination went unreachable during * this send
CVS commit: src/sys/netinet
Module Name:src Committed By: bouyer Date: Wed Sep 13 15:58:13 UTC 2023 Modified Files: src/sys/netinet: sctp_output.c Log Message: handle EHOSTDOWN the same way as EHOSTUNREACH in sctp_med_chunk_output(). Compile-tested only (I don't have a sctp setup); proposed in http://mail-index.netbsd.org/tech-net/2023/09/11/msg008611.html LGTM from Greg Troxel and Robert Swindells To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/netinet/sctp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: bouyer Date: Wed Sep 13 15:54:28 UTC 2023 Modified Files: src/sys/netinet: tcp_output.c Log Message: Handle EHOSTDOWN the same way as EHOSTUNREACH and ENETDOWN for established connections. Avoid premature end of tcp connection with "Host is down" error in case of transient link-layer failure. Discussed and patch proposed in http://mail-index.netbsd.org/tech-net/2023/09/11/msg008610.html and followups. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/netinet/tcp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_output.c diff -u src/sys/netinet/tcp_output.c:1.218 src/sys/netinet/tcp_output.c:1.219 --- src/sys/netinet/tcp_output.c:1.218 Fri Nov 4 09:01:53 2022 +++ src/sys/netinet/tcp_output.c Wed Sep 13 15:54:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_output.c,v 1.218 2022/11/04 09:01:53 ozaki-r Exp $ */ +/* $NetBSD: tcp_output.c,v 1.219 2023/09/13 15:54:28 bouyer Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -135,7 +135,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.218 2022/11/04 09:01:53 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.219 2023/09/13 15:54:28 bouyer Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1612,8 +1612,8 @@ out: TCP_STATINC(TCP_STAT_SELFQUENCH); tcp_quench(tp->t_inpcb); error = 0; - } else if ((error == EHOSTUNREACH || error == ENETDOWN) && - TCPS_HAVERCVDSYN(tp->t_state)) { + } else if ((error == EHOSTUNREACH || error == ENETDOWN || + error == EHOSTDOWN) && TCPS_HAVERCVDSYN(tp->t_state)) { tp->t_softerror = error; error = 0; }
CVS commit: src/sys/netinet
Module Name:src Committed By: bouyer Date: Wed Sep 13 15:54:28 UTC 2023 Modified Files: src/sys/netinet: tcp_output.c Log Message: Handle EHOSTDOWN the same way as EHOSTUNREACH and ENETDOWN for established connections. Avoid premature end of tcp connection with "Host is down" error in case of transient link-layer failure. Discussed and patch proposed in http://mail-index.netbsd.org/tech-net/2023/09/11/msg008610.html and followups. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/netinet/tcp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mrg Date: Mon Aug 14 03:03:48 UTC 2023 Modified Files: src/sys/netinet: dccp_tfrc.c Log Message: avoid uninitialised variable use. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/netinet/dccp_tfrc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/dccp_tfrc.c diff -u src/sys/netinet/dccp_tfrc.c:1.10 src/sys/netinet/dccp_tfrc.c:1.11 --- src/sys/netinet/dccp_tfrc.c:1.10 Mon Aug 7 23:28:58 2023 +++ src/sys/netinet/dccp_tfrc.c Mon Aug 14 03:03:48 2023 @@ -1,5 +1,5 @@ /* $KAME: dccp_tfrc.c,v 1.16 2006/03/01 17:34:08 nishida Exp $ */ -/* $NetBSD: dccp_tfrc.c,v 1.10 2023/08/07 23:28:58 mrg Exp $ */ +/* $NetBSD: dccp_tfrc.c,v 1.11 2023/08/14 03:03:48 mrg Exp $ */ /* * Copyright (c) 2003 Nils-Erik Mattsson @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dccp_tfrc.c,v 1.10 2023/08/07 23:28:58 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dccp_tfrc.c,v 1.11 2023/08/14 03:03:48 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_dccp.h" @@ -384,7 +384,7 @@ tfrc_time_no_feedback(void *ccb) /* half send rate */ cb->x.denom *= 2; v.num = cb->s; - v.denom *= TFRC_MAX_BACK_OFF_TIME; + v.denom = TFRC_MAX_BACK_OFF_TIME; if (fixpoint_cmp(>x, ) < 0) cb->x = v; @@ -414,7 +414,7 @@ tfrc_time_no_feedback(void *ccb) v.num = cb->s; v.num *= 4; - v.denom *= cb->rtt; + v.denom = cb->rtt; v.num *= 100; normalize(, ); if (!cb->idle || fixpoint_cmp(>x_recv, ) >= 0) {
CVS commit: src/sys/netinet
Module Name:src Committed By: mrg Date: Mon Aug 14 03:03:48 UTC 2023 Modified Files: src/sys/netinet: dccp_tfrc.c Log Message: avoid uninitialised variable use. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/netinet/dccp_tfrc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: rin Date: Fri Jun 16 03:02:30 UTC 2023 Modified Files: src/sys/netinet: in.h Log Message: White space fixes. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/netinet/in.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.h diff -u src/sys/netinet/in.h:1.114 src/sys/netinet/in.h:1.115 --- src/sys/netinet/in.h:1.114 Wed Feb 3 18:13:13 2021 +++ src/sys/netinet/in.h Fri Jun 16 03:02:30 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: in.h,v 1.114 2021/02/03 18:13:13 roy Exp $ */ +/* $NetBSD: in.h,v 1.115 2023/06/16 03:02:30 rin Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -107,7 +107,7 @@ typedef __sa_family_t sa_family_t; #define IPPROTO_CARP 112 /* Common Address Resolution Protocol */ #define IPPROTO_L2TP 115 /* L2TPv3 */ #define IPPROTO_SCTP 132 /* SCTP */ -#define IPPROTO_PFSYNC 240 /* PFSYNC */ +#define IPPROTO_PFSYNC 240 /* PFSYNC */ #define IPPROTO_RAW 255 /* raw IP packet */ #define IPPROTO_MAX 256 @@ -353,22 +353,22 @@ struct ip_mreq { #define IPCTL_ALLOWSRCRT 7 /* allow/drop all source-routed pkts */ #define IPCTL_SUBNETSARELOCAL 8 /* treat subnets as local addresses */ #define IPCTL_MTUDISC 9 /* allow path MTU discovery */ -#define IPCTL_ANONPORTMIN 10 /* minimum ephemeral port */ -#define IPCTL_ANONPORTMAX 11 /* maximum ephemeral port */ -#define IPCTL_MTUDISCTIMEOUT 12 /* allow path MTU discovery */ -#define IPCTL_MAXFLOWS 13 /* maximum ip flows allowed */ -#define IPCTL_HOSTZEROBROADCAST 14 /* is host zero a broadcast addr? */ -#define IPCTL_GIF_TTL 15 /* default TTL for gif encap packet */ -#define IPCTL_LOWPORTMIN 16 /* minimum reserved port */ -#define IPCTL_LOWPORTMAX 17 /* maximum reserved port */ -#define IPCTL_MAXFRAGPACKETS 18 /* max packets reassembly queue */ -#define IPCTL_GRE_TTL 19 /* default TTL for gre encap packet */ -#define IPCTL_CHECKINTERFACE 20 /* drop pkts in from 'wrong' iface */ -#define IPCTL_IFQ 21 /* IP packet input queue */ -#define IPCTL_RANDOMID 22 /* use random IP ids (if configured) */ -#define IPCTL_LOOPBACKCKSUM23 /* do IP checksum on loopback */ +#define IPCTL_ANONPORTMIN 10 /* minimum ephemeral port */ +#define IPCTL_ANONPORTMAX 11 /* maximum ephemeral port */ +#define IPCTL_MTUDISCTIMEOUT 12 /* allow path MTU discovery */ +#define IPCTL_MAXFLOWS 13 /* maximum ip flows allowed */ +#define IPCTL_HOSTZEROBROADCAST 14 /* is host zero a broadcast addr? */ +#define IPCTL_GIF_TTL 15 /* default TTL for gif encap packet */ +#define IPCTL_LOWPORTMIN 16 /* minimum reserved port */ +#define IPCTL_LOWPORTMAX 17 /* maximum reserved port */ +#define IPCTL_MAXFRAGPACKETS 18 /* max packets reassembly queue */ +#define IPCTL_GRE_TTL 19 /* default TTL for gre encap packet */ +#define IPCTL_CHECKINTERFACE 20 /* drop pkts in from 'wrong' iface */ +#define IPCTL_IFQ 21 /* IP packet input queue */ +#define IPCTL_RANDOMID 22 /* use random IP ids (if configured) */ +#define IPCTL_LOOPBACKCKSUM 23 /* do IP checksum on loopback */ #define IPCTL_STATS 24 /* IP statistics */ -#define IPCTL_DAD_COUNT25 /* DAD packets to send */ +#define IPCTL_DAD_COUNT 25 /* DAD packets to send */ #endif /* _NETBSD_SOURCE */
CVS commit: src/sys/netinet
Module Name:src Committed By: rin Date: Fri Jun 16 03:02:30 UTC 2023 Modified Files: src/sys/netinet: in.h Log Message: White space fixes. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/netinet/in.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Wed Apr 19 22:00:18 UTC 2023 Modified Files: src/sys/netinet: ip_output.c Log Message: Again allow multicast packets to be sent from unnumbered interfaces. To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.325 src/sys/netinet/ip_output.c:1.326 --- src/sys/netinet/ip_output.c:1.325 Wed Apr 19 02:43:40 2023 +++ src/sys/netinet/ip_output.c Wed Apr 19 22:00:18 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.325 2023/04/19 02:43:40 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.326 2023/04/19 22:00:18 mlelstv Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.325 2023/04/19 02:43:40 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.326 2023/04/19 22:00:18 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -348,11 +348,6 @@ ip_output(struct mbuf *m0, struct mbuf * } mtu = ifp->if_mtu; ia = in_get_ia_from_ifp_psref(ifp, _ia); - if (ia == NULL) { - IP_STATINC(IP_STAT_IFNOADDR); - error = EADDRNOTAVAIL; - goto bad; - } if (IN_MULTICAST(ip->ip_dst.s_addr) || ip->ip_dst.s_addr == INADDR_BROADCAST) { isbroadcast = 0;
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Wed Apr 19 22:00:18 UTC 2023 Modified Files: src/sys/netinet: ip_output.c Log Message: Again allow multicast packets to be sent from unnumbered interfaces. To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Apr 19 02:43:40 UTC 2023 Modified Files: src/sys/netinet: ip_output.c Log Message: Revert "Fix panic on packet sending via a route with rt_ifa of AF_LINK." The fix is mistakenly upstreamed. To generate a diff of this commit: cvs rdiff -u -r1.324 -r1.325 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.324 src/sys/netinet/ip_output.c:1.325 --- src/sys/netinet/ip_output.c:1.324 Mon Nov 21 09:51:13 2022 +++ src/sys/netinet/ip_output.c Wed Apr 19 02:43:40 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.324 2022/11/21 09:51:13 knakahara Exp $ */ +/* $NetBSD: ip_output.c,v 1.325 2023/04/19 02:43:40 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.324 2022/11/21 09:51:13 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.325 2023/04/19 02:43:40 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -531,15 +531,6 @@ ip_output(struct mbuf *m0, struct mbuf * if (in_nullhost(ip->ip_src)) { struct ifaddr *xifa; - /* If rt_ifa is AF_LINK, ia can be NULL. */ - if (ia == NULL) { - KASSERTMSG(rt->rt_ifa->ifa_addr->sa_family == AF_LINK, - "sa_family=%d", rt->rt_ifa->ifa_addr->sa_family); - IP_STATINC(IP_STAT_NOROUTE); - error = EHOSTUNREACH; - goto bad; - } - xifa = >ia_ifa; if (xifa->ifa_getifa != NULL) { ia4_release(ia, _ia); @@ -591,15 +582,6 @@ ip_output(struct mbuf *m0, struct mbuf * sendit: if ((flags & (IP_FORWARDING|IP_NOIPNEWID)) == 0) { - /* If rt_ifa is AF_LINK, ia can be NULL. */ - if (ia == NULL) { - KASSERTMSG(rt->rt_ifa->ifa_addr->sa_family == AF_LINK, - "sa_family=%d", rt->rt_ifa->ifa_addr->sa_family); - IP_STATINC(IP_STAT_NOROUTE); - error = EHOSTUNREACH; - goto bad; - } - if (m->m_pkthdr.len < IP_MINFRAGSIZE) { ip->ip_id = 0; } else if ((m->m_pkthdr.csum_flags & M_CSUM_TSOv4) == 0) {
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Apr 19 02:43:40 UTC 2023 Modified Files: src/sys/netinet: ip_output.c Log Message: Revert "Fix panic on packet sending via a route with rt_ifa of AF_LINK." The fix is mistakenly upstreamed. To generate a diff of this commit: cvs rdiff -u -r1.324 -r1.325 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Fri Apr 7 06:44:08 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Select virtual address as sender if backing interface is anonymous. Use correct scope for IPv6. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/netinet/ip_carp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_carp.c diff -u src/sys/netinet/ip_carp.c:1.118 src/sys/netinet/ip_carp.c:1.119 --- src/sys/netinet/ip_carp.c:1.118 Sun Mar 26 10:32:38 2023 +++ src/sys/netinet/ip_carp.c Fri Apr 7 06:44:08 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $ */ +/* $NetBSD: ip_carp.c,v 1.119 2023/04/07 06:44:08 mlelstv Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.119 2023/04/07 06:44:08 mlelstv Exp $"); /* * TODO: @@ -1091,6 +1091,8 @@ carp_send_ad(void *v) _s = pserialize_read_enter(); ifa = ifaof_ifpforaddr(, sc->sc_carpdev); if (ifa == NULL) + ifa = ifaof_ifpforaddr(, >sc_if); + if (ifa == NULL) ip->ip_src.s_addr = 0; else ip->ip_src.s_addr = @@ -1142,6 +1144,7 @@ carp_send_ad(void *v) if (sc->sc_naddrs6) { struct ip6_hdr *ip6; struct ifaddr *ifa; + struct ifnet *ifp; int _s; MGETHDR(m, M_DONTWAIT, MT_HEADER); @@ -1168,7 +1171,12 @@ carp_send_ad(void *v) memset(, 0, sizeof(sa)); sa.sa_family = AF_INET6; _s = pserialize_read_enter(); - ifa = ifaof_ifpforaddr(, sc->sc_carpdev); + ifp = sc->sc_carpdev; + ifa = ifaof_ifpforaddr(, ifp); + if (ifa == NULL) { /* This should never happen with IPv6 */ + ifp = >sc_if; + ifa = ifaof_ifpforaddr(, ifp); + } if (ifa == NULL) /* This should never happen with IPv6 */ memset(>ip6_src, 0, sizeof(struct in6_addr)); else @@ -1179,7 +1187,7 @@ carp_send_ad(void *v) ip6->ip6_dst.s6_addr16[0] = htons(0xff02); ip6->ip6_dst.s6_addr8[15] = 0x12; - if (in6_setscope(>ip6_dst, >sc_if, NULL) != 0) { + if (in6_setscope(>ip6_dst, ifp, NULL) != 0) { if_statinc(>sc_if, if_oerrors); m_freem(m); CARP_LOG(sc, ("in6_setscope failed"));
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Fri Apr 7 06:44:08 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Select virtual address as sender if backing interface is anonymous. Use correct scope for IPv6. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/netinet/ip_carp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Mar 26 10:32:38 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Use backing device to send advertisements. Otherwise the packets originate from the virtual MAC address, which confuses switches. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/netinet/ip_carp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Mar 26 10:32:38 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Use backing device to send advertisements. Otherwise the packets originate from the virtual MAC address, which confuses switches. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/netinet/ip_carp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_carp.c diff -u src/sys/netinet/ip_carp.c:1.117 src/sys/netinet/ip_carp.c:1.118 --- src/sys/netinet/ip_carp.c:1.117 Fri Sep 2 23:48:11 2022 +++ src/sys/netinet/ip_carp.c Sun Mar 26 10:32:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.117 2022/09/02 23:48:11 thorpej Exp $ */ +/* $NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.117 2022/09/02 23:48:11 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $"); /* * TODO: @@ -1876,6 +1876,9 @@ carp_join_multicast(struct carp_softc *s struct ip_moptions *imo = >sc_imo, tmpimo; struct in_addr addr; + if (sc->sc_carpdev == NULL) + return (ENETDOWN); + memset(, 0, sizeof(tmpimo)); addr.s_addr = INADDR_CARP_GROUP; if ((tmpimo.imo_membership[0] = @@ -1885,7 +1888,7 @@ carp_join_multicast(struct carp_softc *s imo->imo_membership[0] = tmpimo.imo_membership[0]; imo->imo_num_memberships = 1; - imo->imo_multicast_if_index = sc->sc_if.if_index; + imo->imo_multicast_if_index = sc->sc_carpdev->if_index; imo->imo_multicast_ttl = CARP_DFLTTL; imo->imo_multicast_loop = 0; return (0); @@ -1970,6 +1973,9 @@ carp_join_multicast6(struct carp_softc * struct sockaddr_in6 addr6; int error; + if (sc->sc_carpdev == NULL) + return (ENETDOWN); + /* Join IPv6 CARP multicast group */ memset(, 0, sizeof(addr6)); addr6.sin6_family = AF_INET6; @@ -1996,7 +2002,7 @@ carp_join_multicast6(struct carp_softc * } /* apply v6 multicast membership */ - im6o->im6o_multicast_if_index = sc->sc_if.if_index; + im6o->im6o_multicast_if_index = sc->sc_carpdev->if_index; if (imm) LIST_INSERT_HEAD(>im6o_memberships, imm, i6mm_chain);
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Dec 11 08:09:20 UTC 2022 Modified Files: src/sys/netinet: tcp_vtw.h Log Message: Need larger fat pointers for 128bit cache lines. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/tcp_vtw.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Dec 11 08:09:20 UTC 2022 Modified Files: src/sys/netinet: tcp_vtw.h Log Message: Need larger fat pointers for 128bit cache lines. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/tcp_vtw.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_vtw.h diff -u src/sys/netinet/tcp_vtw.h:1.9 src/sys/netinet/tcp_vtw.h:1.10 --- src/sys/netinet/tcp_vtw.h:1.9 Thu Apr 19 21:21:44 2018 +++ src/sys/netinet/tcp_vtw.h Sun Dec 11 08:09:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_vtw.h,v 1.9 2018/04/19 21:21:44 christos Exp $ */ +/* $NetBSD: tcp_vtw.h,v 1.10 2022/12/11 08:09:20 mlelstv Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -151,7 +151,11 @@ */ struct fatp_mi; +#if CACHE_LINE_SIZE == 128 +typedef uint64_t fatp_word_t; +#else typedef uint32_t fatp_word_t; +#endif typedef struct fatp_mi fatp_t; @@ -161,7 +165,7 @@ typedef struct fatp_mi fatp_t; #define FATP_NTAGS (CACHE_LINE_SIZE / sizeof(fatp_word_t) - 1) #define FATP_NXT_WIDTH (sizeof(fatp_word_t) * NBBY - FATP_NTAGS) -#define FATP_MAX (1 << FATP_NXT_WIDTH) +#define FATP_MAX (1 << (FATP_NXT_WIDTH < 31 ? FATP_NXT_WIDTH : 31)) /* Worked example: ULP32 with 64-byte cacheline (32-bit x86): * 15 tags per cacheline. At most 2^17 fat pointers per fatp_ctl_t.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 7 08:33:02 UTC 2022 Modified Files: src/sys/netinet: ip_encap.c ip_encap.h Log Message: Refactor ip_encap.[ch] - remove encap_attach() which is no longer used - remove USE_RADIX code in ip_encap.c, which is used for encap_attach() only - remove mask members in encaptab To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.27 -r1.28 src/sys/netinet/ip_encap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_encap.c diff -u src/sys/netinet/ip_encap.c:1.76 src/sys/netinet/ip_encap.c:1.77 --- src/sys/netinet/ip_encap.c:1.76 Wed Dec 7 08:28:46 2022 +++ src/sys/netinet/ip_encap.c Wed Dec 7 08:33:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_encap.c,v 1.76 2022/12/07 08:28:46 knakahara Exp $ */ +/* $NetBSD: ip_encap.c,v 1.77 2022/12/07 08:33:02 knakahara Exp $ */ /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ /* @@ -57,18 +57,8 @@ */ /* XXX is M_NETADDR correct? */ -/* - * With USE_RADIX the code will use radix table for tunnel lookup, for - * tunnels registered with encap_attach() with a addr/mask pair. - * Faster on machines with thousands of tunnel registerations (= interfaces). - * - * The code assumes that radix table code can handle non-continuous netmask, - * as it will pass radix table memory region with (src + dst) sockaddr pair. - */ -#define USE_RADIX - #include -__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.76 2022/12/07 08:28:46 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.77 2022/12/07 08:33:02 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_mrouting.h" @@ -128,13 +118,6 @@ static struct encaptab *encap6_lookup(st static int encap_add(struct encaptab *); static int encap_remove(struct encaptab *); static void encap_afcheck(int, const struct sockaddr *, const struct sockaddr *); -#ifdef USE_RADIX -static struct radix_node_head *encap_rnh(int); -static int mask_matchlen(const struct sockaddr *); -#else -static int mask_match(const struct encaptab *, const struct sockaddr *, - const struct sockaddr *); -#endif static void encap_key_init(struct encap_key *, const struct sockaddr *, const struct sockaddr *); static void encap_key_inc(struct encap_key *); @@ -158,11 +141,6 @@ static struct { struct lwp *busy; } encap_whole __cacheline_aligned; -#ifdef USE_RADIX -struct radix_node_head *encap_head[2]; /* 0 for AF_INET, 1 for AF_INET6 */ -static bool encap_head_updating = false; -#endif - static thmap_t *encap_map[2]; /* 0 for AF_INET, 1 for AF_INET6 */ static bool encap_initialized = false; @@ -205,18 +183,6 @@ encap_init(void) PSLIST_INIT(_table); #endif -#ifdef USE_RADIX - /* - * initialize radix lookup table when the radix subsystem is inited. - */ - rn_delayedinit((void *)_head[0], - sizeof(struct sockaddr_pack) << 3); -#ifdef INET6 - rn_delayedinit((void *)_head[1], - sizeof(struct sockaddr_pack) << 3); -#endif -#endif - encap_map[0] = thmap_create(0, NULL, THMAP_NOCOPY); #ifdef INET6 encap_map[1] = thmap_create(0, NULL, THMAP_NOCOPY); @@ -233,10 +199,6 @@ encap4_lookup(struct mbuf *m, int off, i struct encaptab *ep, *match; int prio, matchprio; int s; -#ifdef USE_RADIX - struct radix_node_head *rnh = encap_rnh(AF_INET); - struct radix_node *rn; -#endif thmap_t *emap = encap_map[0]; struct encap_key key; @@ -260,26 +222,6 @@ encap4_lookup(struct mbuf *m, int off, i matchprio = 0; s = pserialize_read_enter(); -#ifdef USE_RADIX - if (encap_head_updating) { - /* - * Update in progress. Do nothing. - */ - pserialize_read_exit(s); - return NULL; - } - - rn = rnh->rnh_matchaddr((void *), rnh); - if (rn && (rn->rn_flags & RNF_ROOT) == 0) { - struct encaptab *encapp = (struct encaptab *)rn; - - psref_acquire(match_psref, >psref, - encaptab.elem_class); - match = encapp; - matchprio = mask_matchlen(match->srcmask) + - mask_matchlen(match->dstmask); - } -#endif encap_key_init(, sintosa(), sintosa()); while ((ep = thmap_get(emap, , sizeof(key))) != NULL) { @@ -335,42 +277,21 @@ encap4_lookup(struct mbuf *m, int off, i psref_acquire(_psref, >psref, encaptab.elem_class); - if (ep->func) { - pserialize_read_exit(s); - /* ep->func is sleepable. e.g. rtalloc1 */ - prio = (*ep->func)(m, off, proto, ep->arg); - s = pserialize_read_enter(); - } else { -#ifdef USE_RADIX - psref_release(_psref, >psref, - encaptab.elem_class); - continue; -#else - prio = mask_match(ep, (struct sockaddr *), - (struct sockaddr *)); -#endif - } + pserialize_read_exit(s); + /* ep->func is sleepable. e.g. rtalloc1 */ + prio = (*ep->func)(m, off, proto, ep->arg); + s = pserialize_read_enter(); /* * We prioritize the matches by using bit length of the - * matches. mask_match() and user-supplied matching
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 7 08:33:02 UTC 2022 Modified Files: src/sys/netinet: ip_encap.c ip_encap.h Log Message: Refactor ip_encap.[ch] - remove encap_attach() which is no longer used - remove USE_RADIX code in ip_encap.c, which is used for encap_attach() only - remove mask members in encaptab To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.27 -r1.28 src/sys/netinet/ip_encap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 7 08:28:46 UTC 2022 Modified Files: src/sys/netinet: ip_encap.c ip_encap.h Log Message: Implement encap_attach_addr() which is used by IP-encaped tunnels. The tunnels attached by encap_attach() can process receiving packets fastly as the softc is searched by radix-tree. However, the tunnels cannot use priority function which decides tunnel's softc by not only source and destination but also other informations. On the other hand, the tunnels attached by encap_attach_func() can use priority function. However, the tunnels can be slow receiving processing as the softc is searched by linear search (and uses each priority function). encap_attach_addr() can be used for tunnels which is fixed tunnel source address and tunnel destination address. The tunnels attached by encap_attach_addr() is searched by thmap(9), so the receiving processing can be fast. Moreover, the tunnels can use priority function. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/ip_encap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_encap.c diff -u src/sys/netinet/ip_encap.c:1.75 src/sys/netinet/ip_encap.c:1.76 --- src/sys/netinet/ip_encap.c:1.75 Wed Dec 7 08:27:03 2022 +++ src/sys/netinet/ip_encap.c Wed Dec 7 08:28:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_encap.c,v 1.75 2022/12/07 08:27:03 knakahara Exp $ */ +/* $NetBSD: ip_encap.c,v 1.76 2022/12/07 08:28:46 knakahara Exp $ */ /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ /* @@ -68,7 +68,7 @@ #define USE_RADIX #include -__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.75 2022/12/07 08:27:03 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.76 2022/12/07 08:28:46 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_mrouting.h" @@ -89,6 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v #include #include #include +#include #include @@ -134,6 +135,9 @@ static int mask_matchlen(const struct so static int mask_match(const struct encaptab *, const struct sockaddr *, const struct sockaddr *); #endif +static void encap_key_init(struct encap_key *, const struct sockaddr *, +const struct sockaddr *); +static void encap_key_inc(struct encap_key *); /* * In encap[46]_lookup(), ep->func can sleep(e.g. rtalloc1) while walking @@ -159,6 +163,8 @@ struct radix_node_head *encap_head[2]; / static bool encap_head_updating = false; #endif +static thmap_t *encap_map[2]; /* 0 for AF_INET, 1 for AF_INET6 */ + static bool encap_initialized = false; /* * must be done before other encap interfaces initialization. @@ -210,6 +216,11 @@ encap_init(void) sizeof(struct sockaddr_pack) << 3); #endif #endif + + encap_map[0] = thmap_create(0, NULL, THMAP_NOCOPY); +#ifdef INET6 + encap_map[1] = thmap_create(0, NULL, THMAP_NOCOPY); +#endif } #ifdef INET @@ -226,6 +237,8 @@ encap4_lookup(struct mbuf *m, int off, i struct radix_node_head *rnh = encap_rnh(AF_INET); struct radix_node *rn; #endif + thmap_t *emap = encap_map[0]; + struct encap_key key; KASSERT(m->m_len >= sizeof(*ip)); @@ -267,6 +280,51 @@ encap4_lookup(struct mbuf *m, int off, i mask_matchlen(match->dstmask); } #endif + + encap_key_init(, sintosa(), sintosa()); + while ((ep = thmap_get(emap, , sizeof(key))) != NULL) { + struct psref elem_psref; + + KASSERT(ep->af == AF_INET); + + if (ep->proto >= 0 && ep->proto != proto) { + encap_key_inc(); + continue; + } + + psref_acquire(_psref, >psref, + encaptab.elem_class); + if (ep->func) { + pserialize_read_exit(s); + prio = (*ep->func)(m, off, proto, ep->arg); + s = pserialize_read_enter(); + } else { + prio = pack.mine.sin_len + pack.yours.sin_len; + } + + if (prio <= 0) { + psref_release(_psref, >psref, + encaptab.elem_class); + encap_key_inc(); + continue; + } + if (prio > matchprio) { + /* release last matched ep */ + if (match != NULL) +psref_release(match_psref, >psref, +encaptab.elem_class); + + psref_copy(match_psref, _psref, + encaptab.elem_class); + matchprio = prio; + match = ep; + } + + psref_release(_psref, >psref, + encaptab.elem_class); + encap_key_inc(); + } + PSLIST_READER_FOREACH(ep, _table, struct encaptab, chain) { struct psref elem_psref; @@ -386,6 +444,8 @@ encap6_lookup(struct mbuf *m, int off, i struct radix_node_head *rnh = encap_rnh(AF_INET6); struct radix_node *rn; #endif + thmap_t *emap = encap_map[1]; + struct encap_key key; KASSERT(m->m_len >= sizeof(*ip6)); @@ -427,6 +487,50 @@ encap6_lookup(struct mbuf *m, int off, i mask_matchlen(match->dstmask); } #endif + + encap_key_init(, sin6tosa(), sin6tosa()); + while ((ep = thmap_get(emap, , sizeof(key))) != NULL) { + struct psref elem_psref; + + KASSERT(ep->af ==
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 7 08:28:46 UTC 2022 Modified Files: src/sys/netinet: ip_encap.c ip_encap.h Log Message: Implement encap_attach_addr() which is used by IP-encaped tunnels. The tunnels attached by encap_attach() can process receiving packets fastly as the softc is searched by radix-tree. However, the tunnels cannot use priority function which decides tunnel's softc by not only source and destination but also other informations. On the other hand, the tunnels attached by encap_attach_func() can use priority function. However, the tunnels can be slow receiving processing as the softc is searched by linear search (and uses each priority function). encap_attach_addr() can be used for tunnels which is fixed tunnel source address and tunnel destination address. The tunnels attached by encap_attach_addr() is searched by thmap(9), so the receiving processing can be fast. Moreover, the tunnels can use priority function. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/ip_encap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 7 08:27:03 UTC 2022 Modified Files: src/sys/netinet: ip_encap.c ip_encap.h Log Message: refactor: use typedef for ip_encap priority function To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.25 -r1.26 src/sys/netinet/ip_encap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 7 08:27:03 UTC 2022 Modified Files: src/sys/netinet: ip_encap.c ip_encap.h Log Message: refactor: use typedef for ip_encap priority function To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/netinet/ip_encap.c cvs rdiff -u -r1.25 -r1.26 src/sys/netinet/ip_encap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_encap.c diff -u src/sys/netinet/ip_encap.c:1.74 src/sys/netinet/ip_encap.c:1.75 --- src/sys/netinet/ip_encap.c:1.74 Sat Aug 22 01:43:07 2020 +++ src/sys/netinet/ip_encap.c Wed Dec 7 08:27:03 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_encap.c,v 1.74 2020/08/22 01:43:07 riastradh Exp $ */ +/* $NetBSD: ip_encap.c,v 1.75 2022/12/07 08:27:03 knakahara Exp $ */ /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ /* @@ -68,7 +68,7 @@ #define USE_RADIX #include -__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.74 2020/08/22 01:43:07 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.75 2022/12/07 08:27:03 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_mrouting.h" @@ -750,7 +750,7 @@ fail: const struct encaptab * encap_attach_func(int af, int proto, -int (*func)(struct mbuf *, int, int, void *), +encap_priofunc_t *func, const struct encapsw *esw, void *arg) { struct encaptab *ep; Index: src/sys/netinet/ip_encap.h diff -u src/sys/netinet/ip_encap.h:1.25 src/sys/netinet/ip_encap.h:1.26 --- src/sys/netinet/ip_encap.h:1.25 Fri Sep 14 05:09:51 2018 +++ src/sys/netinet/ip_encap.h Wed Dec 7 08:27:03 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_encap.h,v 1.25 2018/09/14 05:09:51 maxv Exp $ */ +/* $NetBSD: ip_encap.h,v 1.26 2022/12/07 08:27:03 knakahara Exp $ */ /* $KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $ */ /* @@ -62,6 +62,8 @@ struct encapsw { #define encapsw4 encapsw46._encapsw4 #define encapsw6 encapsw46._encapsw6 +typedef int encap_priofunc_t(struct mbuf *, int, int, void *); + struct encaptab { struct radix_node nodes[2]; struct pslist_entry chain; @@ -73,7 +75,7 @@ struct encaptab { struct sockaddr *srcmask; struct sockaddr *dst; /* remote addr */ struct sockaddr *dstmask; - int (*func) (struct mbuf *, int, int, void *); + encap_priofunc_t *func; const struct encapsw *esw; void *arg; struct psref_target psref; @@ -106,7 +108,7 @@ const struct encaptab *encap_attach(int, const struct sockaddr *, const struct sockaddr *, const struct sockaddr *, const struct encapsw *, void *); const struct encaptab *encap_attach_func(int, int, - int (*)(struct mbuf *, int, int, void *), + encap_priofunc_t *, const struct encapsw *, void *); void *encap6_ctlinput(int, const struct sockaddr *, void *); int encap_detach(const struct encaptab *);
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Mon Nov 21 09:51:13 UTC 2022 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix panic on packet sending via a route with rt_ifa of AF_LINK. A route with rt_ifa of AF_LINK can be set by some routing daemons when it adds a route that has a gateway of AF_LINK. If there is no address on a target interface, the kernel sets an AF_LINK address of the interface to rt_ifa of the route. In that case, a variable of a local address in ip_output (ia) can be NULL and we need more NULL-checks of it. To generate a diff of this commit: cvs rdiff -u -r1.323 -r1.324 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.323 src/sys/netinet/ip_output.c:1.324 --- src/sys/netinet/ip_output.c:1.323 Fri Nov 4 09:00:58 2022 +++ src/sys/netinet/ip_output.c Mon Nov 21 09:51:13 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.323 2022/11/04 09:00:58 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.324 2022/11/21 09:51:13 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.323 2022/11/04 09:00:58 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.324 2022/11/21 09:51:13 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -531,6 +531,15 @@ ip_output(struct mbuf *m0, struct mbuf * if (in_nullhost(ip->ip_src)) { struct ifaddr *xifa; + /* If rt_ifa is AF_LINK, ia can be NULL. */ + if (ia == NULL) { + KASSERTMSG(rt->rt_ifa->ifa_addr->sa_family == AF_LINK, + "sa_family=%d", rt->rt_ifa->ifa_addr->sa_family); + IP_STATINC(IP_STAT_NOROUTE); + error = EHOSTUNREACH; + goto bad; + } + xifa = >ia_ifa; if (xifa->ifa_getifa != NULL) { ia4_release(ia, _ia); @@ -582,6 +591,15 @@ ip_output(struct mbuf *m0, struct mbuf * sendit: if ((flags & (IP_FORWARDING|IP_NOIPNEWID)) == 0) { + /* If rt_ifa is AF_LINK, ia can be NULL. */ + if (ia == NULL) { + KASSERTMSG(rt->rt_ifa->ifa_addr->sa_family == AF_LINK, + "sa_family=%d", rt->rt_ifa->ifa_addr->sa_family); + IP_STATINC(IP_STAT_NOROUTE); + error = EHOSTUNREACH; + goto bad; + } + if (m->m_pkthdr.len < IP_MINFRAGSIZE) { ip->ip_id = 0; } else if ((m->m_pkthdr.csum_flags & M_CSUM_TSOv4) == 0) {
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Mon Nov 21 09:51:13 UTC 2022 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix panic on packet sending via a route with rt_ifa of AF_LINK. A route with rt_ifa of AF_LINK can be set by some routing daemons when it adds a route that has a gateway of AF_LINK. If there is no address on a target interface, the kernel sets an AF_LINK address of the interface to rt_ifa of the route. In that case, a variable of a local address in ip_output (ia) can be NULL and we need more NULL-checks of it. To generate a diff of this commit: cvs rdiff -u -r1.323 -r1.324 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Thu Nov 17 05:02:11 UTC 2022 Modified Files: src/sys/netinet: in.c Log Message: Fix sending broken RTM_DELADDR message in some operations. Here is mininum reproduction operation. # ifconfig ixg0 172.16.0.1/29 # route monitor & # ifconfig pppoe0 172.16.0.1/32 0.0.0.1 The broken RTM_DELADDR is the following. got message of size 72 on Thu Nov 17 12:50:42 2022 #13: len 72, got message of size 80 on Thu Nov 17 12:50:42 2022 RTM_DELADDR: address being removed from iface: len 80, pid 3552, metric 0, addrflags: 0 sockaddrs: 0xb4 Q00.00.ff.ff.ff.ff.00.00.00.00.00.00.00.00 pppoe0 default default This problem is related to the following two commit. (1) https://github.com/NetBSD/src/commit/b0210214689f17ec08988acd7ef8ae9cdc4c68bc that is, sys/netinet/in.c:r1.183 (2) https://github.com/NetBSD/src/commit/61bad33c44f2f6a01a030e8aa5840c015716792a that is, sys/netinet/in.c:r1.185 (1) adds in_scrubaddr() for old addresses to in_ifinit() without checking IFA_ROUTE. And then, (2) removes in_ifscrub() for POINTTOPOINT interface in in_control0. The removed in_ifscrub() is called with checking IFA_ROUTE. It seems these modifications about checking IFA_ROUTE logic causes this problem, however the real reason is calling in_ifscrub() for the interface which does not have IPv4 address. So, scrubbing old address processing should be done only if the interface already has IPv4 address. To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Thu Nov 17 05:02:11 UTC 2022 Modified Files: src/sys/netinet: in.c Log Message: Fix sending broken RTM_DELADDR message in some operations. Here is mininum reproduction operation. # ifconfig ixg0 172.16.0.1/29 # route monitor & # ifconfig pppoe0 172.16.0.1/32 0.0.0.1 The broken RTM_DELADDR is the following. got message of size 72 on Thu Nov 17 12:50:42 2022 #13: len 72, got message of size 80 on Thu Nov 17 12:50:42 2022 RTM_DELADDR: address being removed from iface: len 80, pid 3552, metric 0, addrflags: 0 sockaddrs: 0xb4 Q00.00.ff.ff.ff.ff.00.00.00.00.00.00.00.00 pppoe0 default default This problem is related to the following two commit. (1) https://github.com/NetBSD/src/commit/b0210214689f17ec08988acd7ef8ae9cdc4c68bc that is, sys/netinet/in.c:r1.183 (2) https://github.com/NetBSD/src/commit/61bad33c44f2f6a01a030e8aa5840c015716792a that is, sys/netinet/in.c:r1.185 (1) adds in_scrubaddr() for old addresses to in_ifinit() without checking IFA_ROUTE. And then, (2) removes in_ifscrub() for POINTTOPOINT interface in in_control0. The removed in_ifscrub() is called with checking IFA_ROUTE. It seems these modifications about checking IFA_ROUTE logic causes this problem, however the real reason is calling in_ifscrub() for the interface which does not have IPv4 address. So, scrubbing old address processing should be done only if the interface already has IPv4 address. To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.244 src/sys/netinet/in.c:1.245 --- src/sys/netinet/in.c:1.244 Fri Nov 4 09:03:20 2022 +++ src/sys/netinet/in.c Thu Nov 17 05:02:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $ */ +/* $NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $"); #include "arp.h" @@ -1194,7 +1194,11 @@ in_ifinit(struct ifnet *ifp, struct in_i return error; } - if (scrub || hostIsNew) { + /* + * The interface which does not have IPv4 address is not required + * to scrub old address. So, skip scrub such cases. + */ + if (oldaddr.sin_family == AF_INET && (scrub || hostIsNew)) { int newflags = ia->ia4_flags; ia->ia_ifa.ifa_addr = sintosa();
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Nov 15 09:15:44 UTC 2022 Modified Files: src/sys/netinet: if_arp.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.309 -r1.310 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.309 src/sys/netinet/if_arp.c:1.310 --- src/sys/netinet/if_arp.c:1.309 Mon Nov 14 09:32:21 2022 +++ src/sys/netinet/if_arp.c Tue Nov 15 09:15:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.309 2022/11/14 09:32:21 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.310 2022/11/15 09:15:43 roy Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.309 2022/11/14 09:32:21 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.310 2022/11/15 09:15:43 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -932,8 +932,6 @@ again: /* * DAD check, RFC 5227. - * ARP sender hardware address must match the interface - * address of the interface sending the packet. * Collision on sender address is always a duplicate. * Collision on target address is only a duplicate * IF the sender address is the null host (ie a DAD probe) @@ -945,10 +943,7 @@ again: (in_hosteq(isaddr, myaddr) || (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr) && m->m_flags & M_BCAST && - ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED))) && - m->m_pkthdr.l2_shalen == ah->ar_hln && ( - ah->ar_hln == 0 || - memcmp(m->m_pkthdr.l2_sha, ar_sha(ah), ah->ar_hln) == 0)) + ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED { struct sockaddr_dl sdl, *sdlp;
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Nov 15 09:15:44 UTC 2022 Modified Files: src/sys/netinet: if_arp.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.309 -r1.310 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Mon Nov 14 09:32:21 UTC 2022 Modified Files: src/sys/netinet: if_arp.c Log Message: arp: Validate L2 sender hardware address matches ARP probe RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf packet header. This fixes an obsure issue where an old router was sending out bogus ARP probes. To generate a diff of this commit: cvs rdiff -u -r1.308 -r1.309 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.308 src/sys/netinet/if_arp.c:1.309 --- src/sys/netinet/if_arp.c:1.308 Sat Sep 3 01:35:03 2022 +++ src/sys/netinet/if_arp.c Mon Nov 14 09:32:21 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.308 2022/09/03 01:35:03 thorpej Exp $ */ +/* $NetBSD: if_arp.c,v 1.309 2022/11/14 09:32:21 roy Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.308 2022/09/03 01:35:03 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.309 2022/11/14 09:32:21 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -932,6 +932,8 @@ again: /* * DAD check, RFC 5227. + * ARP sender hardware address must match the interface + * address of the interface sending the packet. * Collision on sender address is always a duplicate. * Collision on target address is only a duplicate * IF the sender address is the null host (ie a DAD probe) @@ -943,7 +945,10 @@ again: (in_hosteq(isaddr, myaddr) || (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr) && m->m_flags & M_BCAST && - ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED + ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED))) && + m->m_pkthdr.l2_shalen == ah->ar_hln && ( + ah->ar_hln == 0 || + memcmp(m->m_pkthdr.l2_sha, ar_sha(ah), ah->ar_hln) == 0)) { struct sockaddr_dl sdl, *sdlp;
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Mon Nov 14 09:32:21 UTC 2022 Modified Files: src/sys/netinet: if_arp.c Log Message: arp: Validate L2 sender hardware address matches ARP probe RFC 5227 section 1.1 states that for a DaD ARP probe the sender hardware address must match the hardware address of the interface sending the packet. We can now verify this by checking the mbuf packet header. This fixes an obsure issue where an old router was sending out bogus ARP probes. To generate a diff of this commit: cvs rdiff -u -r1.308 -r1.309 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:05:41 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: ipcb: add/update the description of functions >From rmind-smpnet patches To generate a diff of this commit: cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.201 src/sys/netinet/in_pcb.c:1.202 --- src/sys/netinet/in_pcb.c:1.201 Fri Nov 4 09:05:04 2022 +++ src/sys/netinet/in_pcb.c Fri Nov 4 09:05:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.c,v 1.202 2022/11/04 09:05:41 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.202 2022/11/04 09:05:41 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -192,6 +192,10 @@ inpcb_init(struct inpcbtable *table, int RUN_ONCE(, inpcb_poolinit); } +/* + * inpcb_create: construct a new PCB and associated with a given socket. + * Sets the PCB state to INP_ATTACHED and makes PCB globally visible. + */ int inpcb_create(struct socket *so, void *v) { @@ -462,6 +466,14 @@ inpcb_bind_port(struct inpcb *inp, struc return 0; } +/* + * inpcb_bind: assign a local IP address and port number to the PCB. + * + * If the address is not a wildcard, verify that it corresponds to a + * local interface. If a port is specified and it is privileged, then + * check the permission. Check whether the address or port is in use, + * and if so, whether we can re-use them. + */ int inpcb_bind(void *v, struct sockaddr_in *sin, struct lwp *l) { @@ -501,10 +513,11 @@ inpcb_bind(void *v, struct sockaddr_in * } /* - * Connect from a socket to a specified address. - * Both address and port must be specified in argument sin. - * If don't have a local address for this socket yet, - * then pick one. + * inpcb_connect: connect from a socket to a specified address, i.e., + * assign a foreign IP address and port number to the PCB. + * + * Both address and port must be specified in the name argument. + * If there is no local address for this socket yet, then pick one. */ int inpcb_connect(void *v, struct sockaddr_in *sin, struct lwp *l) @@ -638,6 +651,11 @@ inpcb_connect(void *v, struct sockaddr_i return 0; } +/* + * inpcb_disconnect: remove any foreign IP/port association. + * + * Note: destroys the PCB if socket was closed. + */ void inpcb_disconnect(void *v) { @@ -657,6 +675,9 @@ inpcb_disconnect(void *v) inpcb_destroy(inp); } +/* + * inpcb_destroy: destroy PCB as well as the associated socket. + */ void inpcb_destroy(void *v) { @@ -706,6 +727,9 @@ inpcb_destroy(void *v) mutex_enter(softnet_lock); /* reacquire the softnet_lock */ } +/* + * inpcb_fetch_sockaddr: fetch the local IP address and port number. + */ void inpcb_fetch_sockaddr(struct inpcb *inp, struct sockaddr_in *sin) { @@ -716,6 +740,9 @@ inpcb_fetch_sockaddr(struct inpcb *inp, sockaddr_in_init(sin, _laddr(inp), inp->inp_lport); } +/* + * inpcb_fetch_peeraddr: fetch the foreign IP address and port number. + */ void inpcb_fetch_peeraddr(struct inpcb *inp, struct sockaddr_in *sin) { @@ -727,13 +754,14 @@ inpcb_fetch_peeraddr(struct inpcb *inp, } /* - * Pass some notification to all connections of a protocol - * associated with address dst. The local address and/or port numbers - * may be specified to limit the search. The "usual action" will be - * taken, depending on the ctlinput cmd. The caller must filter any - * cmds that are uninteresting (e.g., no error in the map). - * Call the protocol specific routine (if any) to report - * any errors for each matching socket. + * inpcb_notify: pass some notification to all connections of a protocol + * associated with destination address. The local address and/or port + * numbers may be specified to limit the search. The "usual action" will + * be taken, depending on the command. + * + * The caller must filter any commands that are not interesting (e.g., + * no error in the map). Call the protocol specific routine (if any) to + * report any errors for each matching socket. * * Must be called at splsoftnet. */ @@ -859,10 +887,10 @@ inpcb_purgeif(struct inpcbtable *table, } /* - * Check for alternatives when higher level complains - * about service problems. For now, invalidate cached - * routing information. If the route was created dynamically - * (by a redirect), time to try a default gateway again. + * inpcb_losing: check for alternatives when higher level complains about + * service problems. For now, invalidate cached routing information. + * If the route was created dynamically (by a redirect), time to
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:05:41 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: ipcb: add/update the description of functions >From rmind-smpnet patches To generate a diff of this commit: cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:05:04 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: replace leading white spaces with tabs To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:05:04 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: replace leading white spaces with tabs To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.200 src/sys/netinet/in_pcb.c:1.201 --- src/sys/netinet/in_pcb.c:1.200 Fri Nov 4 09:04:27 2022 +++ src/sys/netinet/in_pcb.c Fri Nov 4 09:05:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.200 2022/11/04 09:04:27 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.200 2022/11/04 09:04:27 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -619,15 +619,15 @@ inpcb_connect(void *v, struct sockaddr_i in4p_faddr(inp) = sin->sin_addr; inp->inp_fport = sin->sin_port; -/* Late bind, if needed */ + /* Late bind, if needed */ if (inp->inp_bindportonsend) { - struct sockaddr_in lsin = *((const struct sockaddr_in *) + struct sockaddr_in lsin = *((const struct sockaddr_in *) inp->inp_socket->so_proto->pr_domain->dom_sa_any); lsin.sin_addr = in4p_laddr(inp); lsin.sin_port = 0; if ((error = inpcb_bind_port(inp, , l->l_cred)) != 0) - return error; + return error; } inpcb_set_state(inp, INP_CONNECTED);
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:03:56 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: use NULL To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.198 src/sys/netinet/in_pcb.c:1.199 --- src/sys/netinet/in_pcb.c:1.198 Fri Nov 4 09:03:20 2022 +++ src/sys/netinet/in_pcb.c Fri Nov 4 09:03:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.c,v 1.199 2022/11/04 09:03:56 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.199 2022/11/04 09:03:56 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -747,7 +747,7 @@ inpcb_notify(struct inpcbtable *table, s in_port_t fport = fport_arg, lport = lport_arg; int nmatch; - if (in_nullhost(faddr) || notify == 0) + if (in_nullhost(faddr) || notify == NULL) return (0); nmatch = 0; @@ -773,7 +773,7 @@ inpcb_notifyall(struct inpcbtable *table { struct inpcb *inp; - if (in_nullhost(faddr) || notify == 0) + if (in_nullhost(faddr) || notify == NULL) return; TAILQ_FOREACH(inp, >inpt_queue, inp_queue) {
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:03:56 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: use NULL To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:02:38 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: use pool_cache instead of pool To generate a diff of this commit: cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 4 09:02:38 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: use pool_cache instead of pool To generate a diff of this commit: cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.196 src/sys/netinet/in_pcb.c:1.197 --- src/sys/netinet/in_pcb.c:1.196 Fri Nov 4 09:01:53 2022 +++ src/sys/netinet/in_pcb.c Fri Nov 4 09:02:38 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.196 2022/11/04 09:01:53 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.196 2022/11/04 09:01:53 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -156,20 +156,20 @@ int anonportmax = IPPORT_ANONMAX; int lowportmin = IPPORT_RESERVEDMIN; int lowportmax = IPPORT_RESERVEDMAX; -static struct pool in4pcb_pool; +static pool_cache_t in4pcb_pool_cache; #ifdef INET6 -static struct pool in6pcb_pool; +static pool_cache_t in6pcb_pool_cache; #endif static int inpcb_poolinit(void) { - pool_init(_pool, sizeof(struct in4pcb), 0, 0, 0, "in4pcbpl", NULL, - IPL_NET); + in4pcb_pool_cache = pool_cache_init(sizeof(struct in4pcb), coherency_unit, + 0, 0, "in4pcbpl", NULL, IPL_NET, NULL, NULL, NULL); #ifdef INET6 - pool_init(_pool, sizeof(struct in6pcb), 0, 0, 0, "in6pcbpl", NULL, - IPL_NET); + in6pcb_pool_cache = pool_cache_init(sizeof(struct in6pcb), coherency_unit, + 0, 0, "in6pcbpl", NULL, IPL_NET, NULL, NULL, NULL); #endif return 0; } @@ -203,22 +203,26 @@ inpcb_create(struct socket *so, void *v) KASSERT(soaf(so) == AF_INET || soaf(so) == AF_INET6); if (soaf(so) == AF_INET) - inp = pool_get(_pool, PR_NOWAIT|PR_ZERO); + inp = pool_cache_get(in4pcb_pool_cache, PR_NOWAIT); else - inp = pool_get(_pool, PR_NOWAIT|PR_ZERO); + inp = pool_cache_get(in6pcb_pool_cache, PR_NOWAIT); #else KASSERT(soaf(so) == AF_INET); - inp = pool_get(_pool, PR_NOWAIT|PR_ZERO); + inp = pool_cache_get(in4pcb_pool_cache, PR_NOWAIT); #endif if (inp == NULL) return (ENOBUFS); + if (soaf(so) == AF_INET) + memset(inp, 0, sizeof(struct in4pcb)); +#ifdef INET6 + else + memset(inp, 0, sizeof(struct in6pcb)); +#endif inp->inp_af = soaf(so); inp->inp_table = table; inp->inp_socket = so; inp->inp_portalgo = PORTALGO_DEFAULT; inp->inp_bindportonsend = false; - inp->inp_overudp_cb = NULL; - inp->inp_overudp_arg = NULL; if (inp->inp_af == AF_INET) { in4p_errormtu(inp) = -1; @@ -237,12 +241,12 @@ inpcb_create(struct socket *so, void *v) if (error != 0) { #ifdef INET6 if (inp->inp_af == AF_INET) -pool_put(_pool, inp); +pool_cache_put(in4pcb_pool_cache, inp); else -pool_put(_pool, inp); +pool_cache_put(in6pcb_pool_cache, inp); #else KASSERT(inp->inp_af == AF_INET); - pool_put(_pool, inp); + pool_cache_put(in4pcb_pool_cache, inp); #endif return error; } @@ -692,12 +696,12 @@ inpcb_destroy(void *v) #ifdef INET6 if (inp->inp_af == AF_INET) - pool_put(_pool, inp); + pool_cache_put(in4pcb_pool_cache, inp); else - pool_put(_pool, inp); + pool_cache_put(in6pcb_pool_cache, inp); #else KASSERT(inp->inp_af == AF_INET); - pool_put(_pool, inp); + pool_cache_put(in4pcb_pool_cache, inp); #endif mutex_enter(softnet_lock); /* reacquire the softnet_lock */ }
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Oct 31 00:56:33 UTC 2022 Modified Files: src/sys/netinet: tcp_subr.c Log Message: tcp: fix wrong logic in tcp_drop Pointed out by mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.293 -r1.294 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.293 src/sys/netinet/tcp_subr.c:1.294 --- src/sys/netinet/tcp_subr.c:1.293 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_subr.c Mon Oct 31 00:56:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.293 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.294 2022/10/31 00:56:33 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.293 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.294 2022/10/31 00:56:33 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1022,7 +1022,7 @@ tcp_drop(struct tcpcb *tp, int errno) KASSERT(tp->t_inpcb != NULL); so = tp->t_inpcb->inp_socket; - if (so != NULL) + if (so == NULL) return NULL; if (TCPS_HAVERCVDSYN(tp->t_state)) {
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Oct 31 00:56:33 UTC 2022 Modified Files: src/sys/netinet: tcp_subr.c Log Message: tcp: fix wrong logic in tcp_drop Pointed out by mlelstv@ To generate a diff of this commit: cvs rdiff -u -r1.293 -r1.294 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Sun Oct 30 08:45:46 UTC 2022 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: tcp: restore NULL check for inp in tcp_ctloutput To generate a diff of this commit: cvs rdiff -u -r1.235 -r1.236 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Sun Oct 30 08:45:46 UTC 2022 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: tcp: restore NULL check for inp in tcp_ctloutput To generate a diff of this commit: cvs rdiff -u -r1.235 -r1.236 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.235 src/sys/netinet/tcp_usrreq.c:1.236 --- src/sys/netinet/tcp_usrreq.c:1.235 Sat Oct 29 15:35:16 2022 +++ src/sys/netinet/tcp_usrreq.c Sun Oct 30 08:45:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.235 2022/10/29 15:35:16 ozaki-r Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.236 2022/10/30 08:45:46 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.235 2022/10/29 15:35:16 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.236 2022/10/30 08:45:46 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -272,6 +272,10 @@ tcp_ctloutput(int op, struct socket *so, s = splsoftnet(); inp = sotoinpcb(so); + if (inp == NULL) { + splx(s); + return ECONNRESET; + } if (level != IPPROTO_TCP) { switch (family) { case PF_INET:
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Sat Oct 29 15:35:17 UTC 2022 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: tcp: restore NULL checks for inp To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.234 src/sys/netinet/tcp_usrreq.c:1.235 --- src/sys/netinet/tcp_usrreq.c:1.234 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/tcp_usrreq.c Sat Oct 29 15:35:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.234 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.235 2022/10/29 15:35:16 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.234 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.235 2022/10/29 15:35:16 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -502,6 +502,8 @@ tcp_detach(struct socket *so) int s; inp = sotoinpcb(so); + if (inp == NULL) + return; tp = intotcpcb(inp); s = splsoftnet(); @@ -518,6 +520,8 @@ tcp_accept(struct socket *so, struct soc int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_ACCEPT); @@ -556,6 +560,8 @@ tcp_bind(struct socket *so, struct socka int ostate = 0; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_BIND); @@ -597,6 +603,8 @@ tcp_listen(struct socket *so, struct lwp int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_LISTEN); @@ -636,6 +644,8 @@ tcp_connect(struct socket *so, struct so int ostate = 0; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_CONNECT); @@ -719,6 +729,8 @@ tcp_connect2(struct socket *so, struct s KASSERT(solocked(so)); inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_CONNECT2); @@ -738,6 +750,8 @@ tcp_disconnect(struct socket *so) int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_DISCONNECT); @@ -771,6 +785,8 @@ tcp_shutdown(struct socket *so) int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_SHUTDOWN); @@ -798,6 +814,8 @@ tcp_abort(struct socket *so) int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_ABORT); @@ -846,6 +864,8 @@ tcp_peeraddr(struct socket *so, struct s int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_PEERADDR); @@ -874,6 +894,8 @@ tcp_sockaddr(struct socket *so, struct s int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_SOCKADDR); @@ -902,6 +924,8 @@ tcp_rcvd(struct socket *so, int flags, s int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_RCVD); @@ -934,6 +958,8 @@ tcp_recvoob(struct socket *so, struct mb int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_RCVOOB); @@ -976,6 +1002,8 @@ tcp_send(struct socket *so, struct mbuf int s; inp = sotoinpcb(so); + if (inp == NULL) + return EINVAL; tp = intotcpcb(inp); ostate = tcp_debug_capture(tp, PRU_SEND); @@ -1011,6 +1039,11 @@ tcp_sendoob(struct socket *so, struct mb int s; inp = sotoinpcb(so); + if (inp == NULL) { + m_freem(m); + m_freem(control); + return EINVAL; + } tp = intotcpcb(inp); if (tp->t_template == NULL) { /*
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Sat Oct 29 15:35:17 UTC 2022 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: tcp: restore NULL checks for inp To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Sat Oct 29 02:56:29 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: fix for kernels without INET6 To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.193 src/sys/netinet/in_pcb.c:1.194 --- src/sys/netinet/in_pcb.c:1.193 Fri Oct 28 05:25:36 2022 +++ src/sys/netinet/in_pcb.c Sat Oct 29 02:56:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.193 2022/10/28 05:25:36 ozaki-r Exp $ */ +/* $NetBSD: in_pcb.c,v 1.194 2022/10/29 02:56:29 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.193 2022/10/28 05:25:36 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.194 2022/10/29 02:56:29 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -157,7 +157,9 @@ int lowportmin = IPPORT_RESERVEDMIN; int lowportmax = IPPORT_RESERVEDMAX; static struct pool in4pcb_pool; +#ifdef INET6 static struct pool in6pcb_pool; +#endif static int inpcb_poolinit(void) @@ -165,8 +167,10 @@ inpcb_poolinit(void) pool_init(_pool, sizeof(struct in4pcb), 0, 0, 0, "in4pcbpl", NULL, IPL_NET); +#ifdef INET6 pool_init(_pool, sizeof(struct in6pcb), 0, 0, 0, "in6pcbpl", NULL, IPL_NET); +#endif return 0; } @@ -195,12 +199,17 @@ in_pcballoc(struct socket *so, void *v) struct inpcb *inp; int s; +#ifdef INET6 KASSERT(soaf(so) == AF_INET || soaf(so) == AF_INET6); if (soaf(so) == AF_INET) inp = pool_get(_pool, PR_NOWAIT|PR_ZERO); else inp = pool_get(_pool, PR_NOWAIT|PR_ZERO); +#else + KASSERT(soaf(so) == AF_INET); + inp = pool_get(_pool, PR_NOWAIT|PR_ZERO); +#endif if (inp == NULL) return (ENOBUFS); inp->inp_af = soaf(so); @@ -226,10 +235,15 @@ in_pcballoc(struct socket *so, void *v) if (ipsec_enabled) { int error = ipsec_init_pcbpolicy(so, >inp_sp); if (error != 0) { +#ifdef INET6 if (inp->inp_af == AF_INET) pool_put(_pool, inp); else pool_put(_pool, inp); +#else + KASSERT(inp->inp_af == AF_INET); + pool_put(_pool, inp); +#endif return error; } inp->inp_sp->sp_inp = inp; @@ -665,6 +679,7 @@ in_pcbdetach(void *v) } rtcache_free(>inp_route); ip_freemoptions(inp->inp_moptions); +#ifdef INET6 if (inp->inp_af == AF_INET6) { if (in6p_outputopts(inp) != NULL) { ip6_clearpktopts(in6p_outputopts(inp), -1); @@ -672,12 +687,18 @@ in_pcbdetach(void *v) } ip6_freemoptions(in6p_moptions(inp)); } +#endif sofree(so); /* drops the socket's lock */ +#ifdef INET6 if (inp->inp_af == AF_INET) pool_put(_pool, inp); else pool_put(_pool, inp); +#else + KASSERT(inp->inp_af == AF_INET); + pool_put(_pool, inp); +#endif mutex_enter(softnet_lock); /* reacquire the softnet_lock */ } @@ -1096,10 +1117,15 @@ void in_pcbstate(struct inpcb *inp, int state) { +#ifdef INET6 if (inp->inp_af == AF_INET6) { in6_pcbstate(inp, state); return; } +#else + if (inp->inp_af != AF_INET) + return; +#endif if (inp->inp_state > INP_ATTACHED) LIST_REMOVE(inp, inp_hash); @@ -1130,8 +1156,10 @@ in_pcbrtentry(struct inpcb *inp) struct sockaddr_in dst4; } u; +#ifdef INET6 if (inp->inp_af == AF_INET6) return in6_pcbrtentry(inp); +#endif if (inp->inp_af != AF_INET) return (NULL);
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Sat Oct 29 02:56:29 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: inpcb: fix for kernels without INET6 To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Sep 20 10:12:18 UTC 2022 Modified Files: src/sys/netinet: tcp_syncache.c tcp_syncache.h Log Message: syncache: make some functions static To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/tcp_syncache.c \ src/sys/netinet/tcp_syncache.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_syncache.c diff -u src/sys/netinet/tcp_syncache.c:1.1 src/sys/netinet/tcp_syncache.c:1.2 --- src/sys/netinet/tcp_syncache.c:1.1 Tue Sep 20 07:19:14 2022 +++ src/sys/netinet/tcp_syncache.c Tue Sep 20 10:12:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_syncache.c,v 1.1 2022/09/20 07:19:14 ozaki-r Exp $ */ +/* $NetBSD: tcp_syncache.c,v 1.2 2022/09/20 10:12:18 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_syncache.c,v 1.1 2022/09/20 07:19:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_syncache.c,v 1.2 2022/09/20 10:12:18 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -201,7 +201,11 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_syncache #endif /* IPSEC*/ #endif -static void syn_cache_timer(void *); +static void syn_cache_timer(void *); +static struct syn_cache * + syn_cache_lookup(const struct sockaddr *, const struct sockaddr *, + struct syn_cache_head **); +static int syn_cache_respond(struct syn_cache *); /* syn hash parameters */ #define TCP_SYN_HASH_SIZE 293 @@ -497,7 +501,7 @@ syn_cache_cleanup(struct tcpcb *tp) /* * Find an entry in the syn cache. */ -struct syn_cache * +static struct syn_cache * syn_cache_lookup(const struct sockaddr *src, const struct sockaddr *dst, struct syn_cache_head **headp) { @@ -1094,7 +1098,7 @@ syn_cache_add(struct sockaddr *src, stru * Returns 0 on success. */ -int +static int syn_cache_respond(struct syn_cache *sc) { #ifdef INET6 Index: src/sys/netinet/tcp_syncache.h diff -u src/sys/netinet/tcp_syncache.h:1.1 src/sys/netinet/tcp_syncache.h:1.2 --- src/sys/netinet/tcp_syncache.h:1.1 Tue Sep 20 07:19:14 2022 +++ src/sys/netinet/tcp_syncache.h Tue Sep 20 10:12:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_syncache.h,v 1.1 2022/09/20 07:19:14 ozaki-r Exp $ */ +/* $NetBSD: tcp_syncache.h,v 1.2 2022/09/20 10:12:18 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -207,15 +207,13 @@ int syn_cache_add(struct sockaddr *, st struct mbuf *, u_char *, int, struct tcp_opt_info *); void syn_cache_unreach(const struct sockaddr *, const struct sockaddr *, struct tcphdr *); -struct socket *syn_cache_get(struct sockaddr *, struct sockaddr *, +struct socket + *syn_cache_get(struct sockaddr *, struct sockaddr *, struct tcphdr *, struct socket *so, struct mbuf *); void syn_cache_init(void); void syn_cache_insert(struct syn_cache *, struct tcpcb *); -struct syn_cache *syn_cache_lookup(const struct sockaddr *, const struct sockaddr *, - struct syn_cache_head **); void syn_cache_reset(struct sockaddr *, struct sockaddr *, struct tcphdr *); -int syn_cache_respond(struct syn_cache *); void syn_cache_cleanup(struct tcpcb *); #endif
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Sep 20 10:12:18 UTC 2022 Modified Files: src/sys/netinet: tcp_syncache.c tcp_syncache.h Log Message: syncache: make some functions static To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/tcp_syncache.c \ src/sys/netinet/tcp_syncache.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Tue Jun 28 01:44:19 UTC 2022 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: tcp(4): Bail early on sendoob if not connected. XXX Not sure if testing tp->t_template is the right way to discern this -- I just reached for it because the downstream crash is a panic on tp->t_template == NULL in tcp_output. XXX In principle this could try connecting to the address, except it's not passed down from the logic in uipc_socket.c to tcp_sendoob. Reported-by: syzbot+a01f4cfec72790855...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.230 -r1.231 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.230 src/sys/netinet/tcp_usrreq.c:1.231 --- src/sys/netinet/tcp_usrreq.c:1.230 Wed Aug 4 08:47:10 2021 +++ src/sys/netinet/tcp_usrreq.c Tue Jun 28 01:44:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.231 2022/06/28 01:44:19 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.231 2022/06/28 01:44:19 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1158,6 +1158,16 @@ tcp_sendoob(struct socket *so, struct mb m_freem(control); return error; } + if (tp->t_template == NULL) { + /* + * XXX FreeBSD appears to open the connection + * automagically in this case, but the socket address + * isn't passed through here so we can't do that. + */ + m_freem(m); + m_freem(control); + return ENOTCONN; + } ostate = tcp_debug_capture(tp, PRU_SENDOOB);
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Tue Jun 28 01:44:19 UTC 2022 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: tcp(4): Bail early on sendoob if not connected. XXX Not sure if testing tp->t_template is the right way to discern this -- I just reached for it because the downstream crash is a panic on tp->t_template == NULL in tcp_output. XXX In principle this could try connecting to the address, except it's not passed down from the logic in uipc_socket.c to tcp_sendoob. Reported-by: syzbot+a01f4cfec72790855...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.230 -r1.231 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Mon Jun 27 01:29:51 UTC 2022 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Remove confusable comment. The comment was added in tcp_subr.c:r1.124 (2002/03/15). tcp_drain() is called from softint context only, now. To generate a diff of this commit: cvs rdiff -u -r1.289 -r1.290 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Mon Jun 27 01:29:51 UTC 2022 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Remove confusable comment. The comment was added in tcp_subr.c:r1.124 (2002/03/15). tcp_drain() is called from softint context only, now. To generate a diff of this commit: cvs rdiff -u -r1.289 -r1.290 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.289 src/sys/netinet/tcp_subr.c:1.290 --- src/sys/netinet/tcp_subr.c:1.289 Sat Jul 31 20:29:37 2021 +++ src/sys/netinet/tcp_subr.c Mon Jun 27 01:29:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.289 2021/07/31 20:29:37 andvar Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.290 2022/06/27 01:29:51 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.289 2021/07/31 20:29:37 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.290 2022/06/27 01:29:51 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1297,8 +1297,7 @@ tcp_drain(void) } if (tp != NULL) { /* - * We may be called from a device's interrupt - * context. If the tcpcb is already busy, + * If the tcpcb is already busy, * just bail out now. */ if (tcp_reass_lock_try(tp) == 0)
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Mon Jun 13 09:23:23 UTC 2022 Modified Files: src/sys/netinet: raw_ip.c Log Message: Refactor like in_pcb.c:r1.187 and in6_pcb.c:r1.168. Use TAILQ_FOREACH instead of TAILQ_FOREACH_SAFE about inpt_queue. rip_pcbnotify() doesn't use "ninph" pointer and doesn't remove elements. To generate a diff of this commit: cvs rdiff -u -r1.180 -r1.181 src/sys/netinet/raw_ip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/raw_ip.c diff -u src/sys/netinet/raw_ip.c:1.180 src/sys/netinet/raw_ip.c:1.181 --- src/sys/netinet/raw_ip.c:1.180 Tue Sep 8 14:12:57 2020 +++ src/sys/netinet/raw_ip.c Mon Jun 13 09:23:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.180 2020/09/08 14:12:57 christos Exp $ */ +/* $NetBSD: raw_ip.c,v 1.181 2022/06/13 09:23:23 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.180 2020/09/08 14:12:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.181 2022/06/13 09:23:23 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -241,11 +241,11 @@ rip_pcbnotify(struct inpcbtable *table, struct in_addr faddr, struct in_addr laddr, int proto, int errno, void (*notify)(struct inpcb *, int)) { - struct inpcb_hdr *inph, *ninph; + struct inpcb_hdr *inph; int nmatch; nmatch = 0; - TAILQ_FOREACH_SAFE(inph, >inpt_queue, inph_queue, ninph) { + TAILQ_FOREACH(inph, >inpt_queue, inph_queue) { struct inpcb *inp = (struct inpcb *)inph; if (inp->inp_af != AF_INET) continue;
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Mon Jun 13 09:23:23 UTC 2022 Modified Files: src/sys/netinet: raw_ip.c Log Message: Refactor like in_pcb.c:r1.187 and in6_pcb.c:r1.168. Use TAILQ_FOREACH instead of TAILQ_FOREACH_SAFE about inpt_queue. rip_pcbnotify() doesn't use "ninph" pointer and doesn't remove elements. To generate a diff of this commit: cvs rdiff -u -r1.180 -r1.181 src/sys/netinet/raw_ip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Fri Jun 10 09:54:54 UTC 2022 Modified Files: src/sys/netinet: in_pcb.h Log Message: "inp_hash" is not used now. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/netinet/in_pcb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.h diff -u src/sys/netinet/in_pcb.h:1.69 src/sys/netinet/in_pcb.h:1.70 --- src/sys/netinet/in_pcb.h:1.69 Tue Sep 8 14:12:57 2020 +++ src/sys/netinet/in_pcb.h Fri Jun 10 09:54:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.h,v 1.69 2020/09/08 14:12:57 christos Exp $ */ +/* $NetBSD: in_pcb.h,v 1.70 2022/06/10 09:54:54 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -83,7 +83,6 @@ struct mbuf; */ struct inpcb { struct inpcb_hdr inp_head; -#define inp_hash inp_head.inph_hash #define inp_queue inp_head.inph_queue #define inp_af inp_head.inph_af #define inp_ppcb inp_head.inph_ppcb
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Fri Jun 10 09:54:54 UTC 2022 Modified Files: src/sys/netinet: in_pcb.h Log Message: "inp_hash" is not used now. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/netinet/in_pcb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Fri Jun 10 09:51:11 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: Use LIST_FOREACH macro. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.187 src/sys/netinet/in_pcb.c:1.188 --- src/sys/netinet/in_pcb.c:1.187 Thu Jun 9 07:01:27 2022 +++ src/sys/netinet/in_pcb.c Fri Jun 10 09:51:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.187 2022/06/09 07:01:27 knakahara Exp $ */ +/* $NetBSD: in_pcb.c,v 1.188 2022/06/10 09:51:10 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.187 2022/06/09 07:01:27 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.188 2022/06/10 09:51:10 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -691,7 +691,8 @@ in_pcbnotify(struct inpcbtable *table, s void (*notify)(struct inpcb *, int)) { struct inpcbhead *head; - struct inpcb *inp, *ninp; + struct inpcb_hdr *inph; + struct inpcb *inp; u_int16_t fport = fport_arg, lport = lport_arg; int nmatch; @@ -700,10 +701,11 @@ in_pcbnotify(struct inpcbtable *table, s nmatch = 0; head = INPCBHASH_CONNECT(table, faddr, fport, laddr, lport); - for (inp = (struct inpcb *)LIST_FIRST(head); inp != NULL; inp = ninp) { - ninp = (struct inpcb *)LIST_NEXT(inp, inp_hash); + LIST_FOREACH(inph, head, inph_hash) { + inp = (struct inpcb *)inph; if (inp->inp_af != AF_INET) continue; + if (in_hosteq(inp->inp_faddr, faddr) && inp->inp_fport == fport && inp->inp_lport == lport &&
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Fri Jun 10 09:51:11 UTC 2022 Modified Files: src/sys/netinet: in_pcb.c Log Message: Use LIST_FOREACH macro. To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Wed May 18 13:37:52 UTC 2022 Modified Files: src/sys/netinet: sctp_constants.h Log Message: s/yeild/yield/ To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctp_constants.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Wed May 18 13:37:52 UTC 2022 Modified Files: src/sys/netinet: sctp_constants.h Log Message: s/yeild/yield/ To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctp_constants.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_constants.h diff -u src/sys/netinet/sctp_constants.h:1.3 src/sys/netinet/sctp_constants.h:1.4 --- src/sys/netinet/sctp_constants.h:1.3 Sat Jan 1 08:34:35 2022 +++ src/sys/netinet/sctp_constants.h Wed May 18 13:37:52 2022 @@ -1,5 +1,5 @@ /* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $ */ -/* $NetBSD: sctp_constants.h,v 1.3 2022/01/01 08:34:35 msaitoh Exp $ */ +/* $NetBSD: sctp_constants.h,v 1.4 2022/05/18 13:37:52 andvar Exp $ */ #ifndef __SCTP_CONSTANTS_H__ #define __SCTP_CONSTANTS_H__ @@ -755,7 +755,7 @@ * course the overhead of the next pointer as well). Using 15 as * an example will yield * ((8 * 15) + 8) or 128 bytes of overhead * for each timewait block that gets initialized. Increasing it to - * 31 would yeild 256 bytes per block. + * 31 would yield 256 bytes per block. */ /* Undef the following turns on per EP behavior */ #define SCTP_VTAG_TIMEWAIT_PER_STACK 1
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Tue Mar 15 21:40:00 UTC 2022 Modified Files: src/sys/netinet: ip_mroute.c Log Message: s/heaader/header/ To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/sys/netinet/ip_mroute.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_mroute.c diff -u src/sys/netinet/ip_mroute.c:1.164 src/sys/netinet/ip_mroute.c:1.165 --- src/sys/netinet/ip_mroute.c:1.164 Thu Nov 12 13:13:45 2020 +++ src/sys/netinet/ip_mroute.c Tue Mar 15 21:39:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_mroute.c,v 1.164 2020/11/12 13:13:45 kardel Exp $ */ +/* $NetBSD: ip_mroute.c,v 1.165 2022/03/15 21:39:59 andvar Exp $ */ /* * Copyright (c) 1992, 1993 @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.164 2020/11/12 13:13:45 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.165 2022/03/15 21:39:59 andvar Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1846,7 +1846,7 @@ vif_encapcheck(struct mbuf *m, int off, #endif /* - * Accept the packet only if the inner heaader is multicast + * Accept the packet only if the inner header is multicast * and the outer header matches a tunnel-mode vif. Order * checks in the hope that common non-matching packets will be * rejected quickly. Assume that unicast IPv4 traffic in a
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Tue Mar 15 21:40:00 UTC 2022 Modified Files: src/sys/netinet: ip_mroute.c Log Message: s/heaader/header/ To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/sys/netinet/ip_mroute.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Sat Jan 1 13:18:43 UTC 2022 Modified Files: src/sys/netinet: accept_filter.h Log Message: s/creting/creating/ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/accept_filter.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/accept_filter.h diff -u src/sys/netinet/accept_filter.h:1.2 src/sys/netinet/accept_filter.h:1.3 --- src/sys/netinet/accept_filter.h:1.2 Sun Aug 10 14:07:41 2008 +++ src/sys/netinet/accept_filter.h Sat Jan 1 13:18:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: accept_filter.h,v 1.2 2008/08/10 14:07:41 tls Exp $ */ +/* $NetBSD: accept_filter.h,v 1.3 2022/01/01 13:18:43 andvar Exp $ */ /* * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ /* * Valid accept filter list - * Currently it is used for creting sysctl object + * Currently it is used for creating sysctl object */ #define ACCF_DATA 1 /* Data ready accept filter */
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Sat Jan 1 13:18:43 UTC 2022 Modified Files: src/sys/netinet: accept_filter.h Log Message: s/creting/creating/ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/accept_filter.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Thu Dec 30 23:03:44 UTC 2021 Modified Files: src/sys/netinet: tcp_output.c Log Message: s/bandwith/bandwidth/ To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/sys/netinet/tcp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_output.c diff -u src/sys/netinet/tcp_output.c:1.213 src/sys/netinet/tcp_output.c:1.214 --- src/sys/netinet/tcp_output.c:1.213 Fri Jun 12 11:04:45 2020 +++ src/sys/netinet/tcp_output.c Thu Dec 30 23:03:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_output.c,v 1.213 2020/06/12 11:04:45 roy Exp $ */ +/* $NetBSD: tcp_output.c,v 1.214 2021/12/30 23:03:44 andvar Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -135,7 +135,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.213 2020/06/12 11:04:45 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.214 2021/12/30 23:03:44 andvar Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -907,9 +907,9 @@ again: * and does at most one step per received ACK. This fast * scaling has the drawback of growing the send buffer beyond * what is strictly necessary to make full use of a given - * delay*bandwith product. However testing has shown this not + * delay*bandwidth product. However testing has shown this not * to be much of an problem. At worst we are trading wasting - * of available bandwith (the non-use of it) for wasting some + * of available bandwidth (the non-use of it) for wasting some * socket buffer memory. * * TODO: Shrink send buffer during idle periods together
CVS commit: src/sys/netinet
Module Name:src Committed By: andvar Date: Thu Dec 30 23:03:44 UTC 2021 Modified Files: src/sys/netinet: tcp_output.c Log Message: s/bandwith/bandwidth/ To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/sys/netinet/tcp_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: msaitoh Date: Sun Dec 5 03:08:20 UTC 2021 Modified Files: src/sys/netinet: sctp_output.c sctputil.c Log Message: s/measurment/measurement/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/sctp_output.c cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: msaitoh Date: Sun Dec 5 03:08:20 UTC 2021 Modified Files: src/sys/netinet: sctp_output.c sctputil.c Log Message: s/measurment/measurement/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/netinet/sctp_output.c cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_output.c diff -u src/sys/netinet/sctp_output.c:1.26 src/sys/netinet/sctp_output.c:1.27 --- src/sys/netinet/sctp_output.c:1.26 Thu Oct 21 13:21:55 2021 +++ src/sys/netinet/sctp_output.c Sun Dec 5 03:08:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_output.c,v 1.26 2021/10/21 13:21:55 andvar Exp $ */ +/* $NetBSD: sctp_output.c,v 1.27 2021/12/05 03:08:19 msaitoh Exp $ */ /* $KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.26 2021/10/21 13:21:55 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.27 2021/12/05 03:08:19 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -4900,7 +4900,7 @@ sctp_clean_up_datalist(struct sctp_tcb * if (i) { /* Any chunk NOT 0 you zap the time * chunk 0 gets zapped or set based on - * if a RTO measurment is needed. + * if a RTO measurement is needed. */ data_list[i]->do_rtt = 0; } Index: src/sys/netinet/sctputil.c diff -u src/sys/netinet/sctputil.c:1.17 src/sys/netinet/sctputil.c:1.18 --- src/sys/netinet/sctputil.c:1.17 Sat Jul 24 21:31:39 2021 +++ src/sys/netinet/sctputil.c Sun Dec 5 03:08:19 2021 @@ -1,5 +1,5 @@ /* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */ -/* $NetBSD: sctputil.c,v 1.17 2021/07/24 21:31:39 andvar Exp $ */ +/* $NetBSD: sctputil.c,v 1.18 2021/12/05 03:08:19 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.17 2021/07/24 21:31:39 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.18 2021/12/05 03:08:19 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1719,7 +1719,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb net->lastsv = SCTP_CLOCK_GRANULARITY; } } else { - /* First RTO measurment */ + /* First RTO measurement */ net->lastsa = calc_time; net->lastsv = calc_time >> 1; first_measure = 1;
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 19 20:01:09 UTC 2021 Modified Files: src/sys/netinet: in_pcb.c Log Message: netinet: Allow binding the unspecified address when no addresses exist You should always be able to bind to the unspecified address even if no addresses have been configured on any interface. For example, a DHCP client could be started before the loopback interface has been fully configured. To generate a diff of this commit: cvs rdiff -u -r1.185 -r1.186 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 19 20:01:09 UTC 2021 Modified Files: src/sys/netinet: in_pcb.c Log Message: netinet: Allow binding the unspecified address when no addresses exist You should always be able to bind to the unspecified address even if no addresses have been configured on any interface. For example, a DHCP client could be started before the loopback interface has been fully configured. To generate a diff of this commit: cvs rdiff -u -r1.185 -r1.186 src/sys/netinet/in_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_pcb.c diff -u src/sys/netinet/in_pcb.c:1.185 src/sys/netinet/in_pcb.c:1.186 --- src/sys/netinet/in_pcb.c:1.185 Tue Sep 8 14:12:57 2020 +++ src/sys/netinet/in_pcb.c Tue Oct 19 20:01:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.185 2020/09/08 14:12:57 christos Exp $ */ +/* $NetBSD: in_pcb.c,v 1.186 2021/10/19 20:01:09 roy Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.185 2020/09/08 14:12:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.186 2021/10/19 20:01:09 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -436,8 +436,6 @@ in_pcbbind(void *v, struct sockaddr_in * if (inp->inp_af != AF_INET) return (EINVAL); - if (IN_ADDRLIST_READER_EMPTY()) - return (EADDRNOTAVAIL); if (inp->inp_lport || !in_nullhost(inp->inp_laddr)) return (EINVAL);
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Tue Sep 21 15:05:41 UTC 2021 Modified Files: src/sys/netinet: in.c Log Message: don't opencode kauth_cred_get() To generate a diff of this commit: cvs rdiff -u -r1.241 -r1.242 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.241 src/sys/netinet/in.c:1.242 --- src/sys/netinet/in.c:1.241 Tue Sep 29 15:33:36 2020 +++ src/sys/netinet/in.c Tue Sep 21 11:05:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.241 2020/09/29 19:33:36 roy Exp $ */ +/* $NetBSD: in.c,v 1.242 2021/09/21 15:05:41 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.241 2020/09/29 19:33:36 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.242 2021/09/21 15:05:41 christos Exp $"); #include "arp.h" @@ -521,7 +521,8 @@ in_control0(struct socket *so, u_long cm goto out; } - if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_INTERFACE, + if (kauth_authorize_network(kauth_cred_get(), + KAUTH_NETWORK_INTERFACE, KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd, NULL) != 0) { error = EPERM; @@ -565,7 +566,8 @@ in_control0(struct socket *so, u_long cm break; case SIOCSIFBRDADDR: - if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_INTERFACE, + if (kauth_authorize_network(kauth_cred_get(), + KAUTH_NETWORK_INTERFACE, KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd, NULL) != 0) { error = EPERM;
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Tue Sep 21 15:05:41 UTC 2021 Modified Files: src/sys/netinet: in.c Log Message: don't opencode kauth_cred_get() To generate a diff of this commit: cvs rdiff -u -r1.241 -r1.242 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Wed Aug 4 08:47:10 UTC 2021 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: Get the value of the right variable (from RVP) To generate a diff of this commit: cvs rdiff -u -r1.229 -r1.230 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.229 src/sys/netinet/tcp_usrreq.c:1.230 --- src/sys/netinet/tcp_usrreq.c:1.229 Mon Mar 8 13:17:27 2021 +++ src/sys/netinet/tcp_usrreq.c Wed Aug 4 04:47:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.229 2021/03/08 18:17:27 christos Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.229 2021/03/08 18:17:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -480,7 +480,7 @@ tcp_ctloutput(int op, struct socket *so, optval = tp->t_keepcnt; goto setval; case TCP_KEEPINIT: - optval = tp->t_keepcnt; + optval = tp->t_keepinit; setval: error = sockopt_set(sopt, , sizeof(optval)); break; default:
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Wed Aug 4 08:47:10 UTC 2021 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: Get the value of the right variable (from RVP) To generate a diff of this commit: cvs rdiff -u -r1.229 -r1.230 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Tue Mar 9 13:48:16 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Move the offset addition in one place and mask the random generated value to make sure that the isn is monotonic. To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.287 src/sys/netinet/tcp_subr.c:1.288 --- src/sys/netinet/tcp_subr.c:1.287 Mon Mar 8 13:17:27 2021 +++ src/sys/netinet/tcp_subr.c Tue Mar 9 08:48:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.288 2021/03/09 13:48:16 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.288 2021/03/09 13:48:16 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2210,23 +2210,23 @@ tcp_new_iss1(void *laddr, void *faddr, u #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif - /* - * Add the offset in to the computed value. - */ - tcp_iss += tcp_iss_seq; -#ifdef TCPISS_DEBUG - printf("ISS %08x\n", tcp_iss); -#endif } else { /* * Randomize. */ - tcp_iss = cprng_fast32(); + tcp_iss = cprng_fast32() & TCP_ISS_RANDOM_MASK; #ifdef TCPISS_DEBUG printf("ISS random 0x%08x, ", tcp_iss); #endif } + /* + * Add the offset in to the computed value. + */ + tcp_iss += tcp_iss_seq; +#ifdef TCPISS_DEBUG + printf("ISS %08x\n", tcp_iss); +#endif return tcp_iss; }
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Tue Mar 9 13:48:16 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Move the offset addition in one place and mask the random generated value to make sure that the isn is monotonic. To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 22:01:18 UTC 2021 Modified Files: src/sys/netinet: in_var.h Log Message: mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/netinet/in_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.101 src/sys/netinet/in_var.h:1.102 --- src/sys/netinet/in_var.h:1.101 Mon Mar 8 15:01:54 2021 +++ src/sys/netinet/in_var.h Mon Mar 8 17:01:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.101 2021/03/08 20:01:54 christos Exp $ */ +/* $NetBSD: in_var.h,v 1.102 2021/03/08 22:01:18 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,6 @@ #define _NETINET_IN_VAR_H_ #include -#include #define IN_IFF_TENTATIVE 0x01 /* tentative address */ #define IN_IFF_DUPLICATED 0x02 /* DAD detected duplicate */ @@ -383,6 +382,7 @@ struct in_multi { #ifdef _KERNEL #include +#include extern pktqueue_t *ip_pktq;
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 22:01:18 UTC 2021 Modified Files: src/sys/netinet: in_var.h Log Message: mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/netinet/in_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 18:17:27 UTC 2021 Modified Files: src/sys/netinet: tcp_input.c tcp_subr.c tcp_usrreq.c tcp_var.h Log Message: Remove the unused "addin" argument (it was always 0) and go back using a random iss by default (instead of rfc1948) To generate a diff of this commit: cvs rdiff -u -r1.427 -r1.428 src/sys/netinet/tcp_input.c cvs rdiff -u -r1.286 -r1.287 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.228 -r1.229 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/tcp_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_input.c diff -u src/sys/netinet/tcp_input.c:1.427 src/sys/netinet/tcp_input.c:1.428 --- src/sys/netinet/tcp_input.c:1.427 Fri Feb 19 10:43:56 2021 +++ src/sys/netinet/tcp_input.c Mon Mar 8 13:17:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $ */ +/* $NetBSD: tcp_input.c,v 1.428 2021/03/08 18:17:27 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.428 2021/03/08 18:17:27 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -4258,7 +4258,7 @@ syn_cache_add(struct sockaddr *src, stru sc->sc_iss = tcp_new_iss1(>sin_addr, >sin_addr, dstin->sin_port, - srcin->sin_port, sizeof(dstin->sin_addr), 0); + srcin->sin_port, sizeof(dstin->sin_addr)); break; } #ifdef INET6 @@ -4269,7 +4269,7 @@ syn_cache_add(struct sockaddr *src, stru sc->sc_iss = tcp_new_iss1(>sin6_addr, >sin6_addr, dstin6->sin6_port, - srcin6->sin6_port, sizeof(dstin6->sin6_addr), 0); + srcin6->sin6_port, sizeof(dstin6->sin6_addr)); break; } #endif Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.286 src/sys/netinet/tcp_subr.c:1.287 --- src/sys/netinet/tcp_subr.c:1.286 Mon Mar 8 12:53:20 2021 +++ src/sys/netinet/tcp_subr.c Mon Mar 8 13:17:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -163,7 +163,7 @@ int tcp_mssdflt = TCP_MSS; int tcp_minmss = TCP_MINMSS; int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; int tcp_do_rfc1323 = 1; /* window scaling / timestamps (obsolete) */ -int tcp_do_rfc1948 = 1; /* ISS by cryptographic hash */ +int tcp_do_rfc1948 = 0; /* ISS by cryptographic hash */ int tcp_do_sack = 1; /* selective acknowledgement */ int tcp_do_win_scale = 1; /* RFC1323 window scaling */ int tcp_do_timestamps = 1; /* RFC1323 timestamps */ @@ -2136,21 +2136,19 @@ tcp_seq tcp_iss_seq = 0; /* tcp initial * Get a new sequence value given a tcp control block */ tcp_seq -tcp_new_iss(struct tcpcb *tp, tcp_seq addin) +tcp_new_iss(struct tcpcb *tp) { if (tp->t_inpcb != NULL) { - return (tcp_new_iss1(>t_inpcb->inp_laddr, + return tcp_new_iss1(>t_inpcb->inp_laddr, >t_inpcb->inp_faddr, tp->t_inpcb->inp_lport, - tp->t_inpcb->inp_fport, sizeof(tp->t_inpcb->inp_laddr), - addin)); + tp->t_inpcb->inp_fport, sizeof(tp->t_inpcb->inp_laddr)); } #ifdef INET6 if (tp->t_in6pcb != NULL) { - return (tcp_new_iss1(>t_in6pcb->in6p_laddr, + return tcp_new_iss1(>t_in6pcb->in6p_laddr, >t_in6pcb->in6p_faddr, tp->t_in6pcb->in6p_lport, - tp->t_in6pcb->in6p_fport, sizeof(tp->t_in6pcb->in6p_laddr), - addin)); + tp->t_in6pcb->in6p_fport, sizeof(tp->t_in6pcb->in6p_laddr)); } #endif @@ -2176,7 +2174,7 @@ tcp_iss_secret_init(void) */ tcp_seq tcp_new_iss1(void *laddr, void *faddr, u_int16_t lport, u_int16_t fport, -size_t addrsz, tcp_seq addin) +size_t addrsz) { tcp_seq tcp_iss; @@ -2209,55 +2207,27 @@ tcp_new_iss1(void *laddr, void *faddr, u memcpy(_iss, hash, sizeof(tcp_iss)); - /* - * Now increment our "timer", and add it in to - * the computed value. - * - * XXX Use `addin'? - * XXX TCP_ISSINCR too large to use? - */ #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif - tcp_iss += tcp_iss_seq + addin; + /* + * Add the offset in to the computed value. + */ + tcp_iss += tcp_iss_seq; #ifdef TCPISS_DEBUG - printf("new ISS 0x%08x\n", tcp_iss); + printf("ISS %08x\n", tcp_iss); #endif } else { /* * Randomize. */ tcp_iss = cprng_fast32(); - - /* - * If we were asked to add some amount to a known value, - * we will take a random value obtained above,
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 18:17:27 UTC 2021 Modified Files: src/sys/netinet: tcp_input.c tcp_subr.c tcp_usrreq.c tcp_var.h Log Message: Remove the unused "addin" argument (it was always 0) and go back using a random iss by default (instead of rfc1948) To generate a diff of this commit: cvs rdiff -u -r1.427 -r1.428 src/sys/netinet/tcp_input.c cvs rdiff -u -r1.286 -r1.287 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.228 -r1.229 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/tcp_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 18:03:25 UTC 2021 Modified Files: src/sys/netinet: files.netinet in_var.h ip_input.c Removed Files: src/sys/netinet: ip_id.c Log Message: remove now unused pseudo-random ip id code. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/netinet/files.netinet cvs rdiff -u -r1.99 -r1.100 src/sys/netinet/in_var.h cvs rdiff -u -r1.16 -r0 src/sys/netinet/ip_id.c cvs rdiff -u -r1.400 -r1.401 src/sys/netinet/ip_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/files.netinet diff -u src/sys/netinet/files.netinet:1.28 src/sys/netinet/files.netinet:1.29 --- src/sys/netinet/files.netinet:1.28 Sat Jul 29 01:48:16 2017 +++ src/sys/netinet/files.netinet Mon Mar 8 13:03:25 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.netinet,v 1.28 2017/07/29 05:48:16 maxv Exp $ +# $NetBSD: files.netinet,v 1.29 2021/03/08 18:03:25 christos Exp $ defflag opt_tcp_debug.h TCP_DEBUG defparam opt_tcp_debug.h TCP_NDEBUG @@ -34,7 +34,6 @@ file netinet/in_proto.c inet file netinet/in_selsrc.c inet & ipselsrc file netinet/ip_flow.c inet & gateway file netinet/ip_icmp.c inet -file netinet/ip_id.c inet file netinet/ip_input.c inet file netinet/ip_mroute.c inet & mrouting file netinet/ip_output.c inet Index: src/sys/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.99 src/sys/netinet/in_var.h:1.100 --- src/sys/netinet/in_var.h:1.99 Mon Mar 8 12:54:23 2021 +++ src/sys/netinet/in_var.h Mon Mar 8 13:03:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.99 2021/03/08 17:54:23 christos Exp $ */ +/* $NetBSD: in_var.h,v 1.100 2021/03/08 18:03:25 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -447,14 +447,6 @@ void in_addrhash_insert(struct in_ifaddr void in_addrhash_remove(struct in_ifaddr *); int ipflow_fastforward(struct mbuf *); -struct ipid_state; -typedef struct ipid_state ipid_state_t; - -ipid_state_t * ip_id_init(void); -void ip_id_fini(ipid_state_t *); -uint16_t ip_randomid(ipid_state_t *, uint16_t); - -extern ipid_state_t * ip_ids; extern uint16_t ip_id; extern int ip_do_randomid; Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.400 src/sys/netinet/ip_input.c:1.401 --- src/sys/netinet/ip_input.c:1.400 Sun Mar 7 09:58:27 2021 +++ src/sys/netinet/ip_input.c Mon Mar 8 13:03:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.400 2021/03/07 14:58:27 christos Exp $ */ +/* $NetBSD: ip_input.c,v 1.401 2021/03/08 18:03:25 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.400 2021/03/07 14:58:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.401 2021/03/08 18:03:25 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -189,7 +189,6 @@ struct rttimer_queue *ip_mtudisc_timeout pktqueue_t * ip_pktq __read_mostly; pfil_head_t * inet_pfil_hook __read_mostly; -ipid_state_t * ip_ids __read_mostly; percpu_t * ipstat_percpu __read_mostly; static percpu_t *ipforward_rt_percpu __cacheline_aligned; @@ -291,7 +290,6 @@ ip_init(void) ip_reass_init(); - ip_ids = ip_id_init(); ip_id = time_uptime & 0xf; #ifdef GATEWAY
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 18:03:25 UTC 2021 Modified Files: src/sys/netinet: files.netinet in_var.h ip_input.c Removed Files: src/sys/netinet: ip_id.c Log Message: remove now unused pseudo-random ip id code. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/netinet/files.netinet cvs rdiff -u -r1.99 -r1.100 src/sys/netinet/in_var.h cvs rdiff -u -r1.16 -r0 src/sys/netinet/ip_id.c cvs rdiff -u -r1.400 -r1.401 src/sys/netinet/ip_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:54:43 UTC 2021 Modified Files: src/sys/netinet: tcp_timer.c Log Message: Add some randomness to the iss offset To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/netinet/tcp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_timer.c diff -u src/sys/netinet/tcp_timer.c:1.95 src/sys/netinet/tcp_timer.c:1.96 --- src/sys/netinet/tcp_timer.c:1.95 Thu May 3 03:13:48 2018 +++ src/sys/netinet/tcp_timer.c Mon Mar 8 12:54:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $ */ +/* $NetBSD: tcp_timer.c,v 1.96 2021/03/08 17:54:43 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.96 2021/03/08 17:54:43 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_timer.c, #include #include #include +#include #include @@ -257,7 +258,7 @@ tcp_slowtimo_work(struct work *wk, void { mutex_enter(softnet_lock); - tcp_iss_seq += TCP_ISSINCR; /* increment iss */ + tcp_iss_seq += TCP_ISSINCR + (TCP_ISS_RANDOM_MASK & cprng_fast32()); tcp_now++; /* for timestamps */ mutex_exit(softnet_lock);
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:54:43 UTC 2021 Modified Files: src/sys/netinet: tcp_timer.c Log Message: Add some randomness to the iss offset To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/netinet/tcp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:54:23 UTC 2021 Modified Files: src/sys/netinet: in_var.h Log Message: Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/in_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.98 src/sys/netinet/in_var.h:1.99 --- src/sys/netinet/in_var.h:1.98 Fri Sep 11 11:22:12 2020 +++ src/sys/netinet/in_var.h Mon Mar 8 12:54:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.98 2020/09/11 15:22:12 roy Exp $ */ +/* $NetBSD: in_var.h,v 1.99 2021/03/08 17:54:23 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,6 +65,7 @@ #define _NETINET_IN_VAR_H_ #include +#include #define IN_IFF_TENTATIVE 0x01 /* tentative address */ #define IN_IFF_DUPLICATED 0x02 /* DAD detected duplicate */ @@ -469,7 +470,8 @@ ip_newid_range(const struct in_ifaddr *i if (ip_do_randomid) { /* XXX ignore num */ - return ip_randomid(ip_ids, ia ? ia->ia_idsalt : 0); + id = (uint16_t)cprng_fast32(); + return id ? id : 1; } /* Never allow an IP ID of 0 (detect wrap). */
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:54:23 UTC 2021 Modified Files: src/sys/netinet: in_var.h Log Message: Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/in_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:53:20 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Don't increment the iss sequence on each connection because it exposes information (Amit Klein) To generate a diff of this commit: cvs rdiff -u -r1.285 -r1.286 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:53:20 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Don't increment the iss sequence on each connection because it exposes information (Amit Klein) To generate a diff of this commit: cvs rdiff -u -r1.285 -r1.286 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.285 src/sys/netinet/tcp_subr.c:1.286 --- src/sys/netinet/tcp_subr.c:1.285 Sun Mar 7 09:58:54 2021 +++ src/sys/netinet/tcp_subr.c Mon Mar 8 12:53:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.285 2021/03/07 14:58:54 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.285 2021/03/07 14:58:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2216,7 +2216,6 @@ tcp_new_iss1(void *laddr, void *faddr, u * XXX Use `addin'? * XXX TCP_ISSINCR too large to use? */ - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif @@ -2252,7 +2251,6 @@ tcp_new_iss1(void *laddr, void *faddr, u } else { tcp_iss &= TCP_ISS_RANDOM_MASK; tcp_iss += tcp_iss_seq; - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS %08x\n", tcp_iss); #endif
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 7 15:01:00 UTC 2021 Modified Files: src/sys/netinet: ip6.h Log Message: netinet/netinet6: Add necessary includes to make these standalone. (from riastradh) To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/netinet/ip6.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip6.h diff -u src/sys/netinet/ip6.h:1.29 src/sys/netinet/ip6.h:1.30 --- src/sys/netinet/ip6.h:1.29 Wed Feb 3 13:13:13 2021 +++ src/sys/netinet/ip6.h Sun Mar 7 10:01:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6.h,v 1.29 2021/02/03 18:13:13 roy Exp $ */ +/* $NetBSD: ip6.h,v 1.30 2021/03/07 15:01:00 christos Exp $ */ /* $KAME: ip6.h,v 1.45 2003/06/05 04:46:38 keiichi Exp $ */ /* @@ -64,6 +64,11 @@ #ifndef _NETINET_IP6_H_ #define _NETINET_IP6_H_ +#include +#include + +#include + /* * Definition for internet protocol version 6. * RFC 2460
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 7 15:01:00 UTC 2021 Modified Files: src/sys/netinet: ip6.h Log Message: netinet/netinet6: Add necessary includes to make these standalone. (from riastradh) To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/netinet/ip6.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 7 14:58:54 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: netinet: Enable RFC 1948 pseudorandom TCP ISS selection by default. (from riastradh) To generate a diff of this commit: cvs rdiff -u -r1.284 -r1.285 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.284 src/sys/netinet/tcp_subr.c:1.285 --- src/sys/netinet/tcp_subr.c:1.284 Fri Jun 12 07:04:45 2020 +++ src/sys/netinet/tcp_subr.c Sun Mar 7 09:58:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.284 2020/06/12 11:04:45 roy Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.285 2021/03/07 14:58:54 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.284 2020/06/12 11:04:45 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.285 2021/03/07 14:58:54 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -163,7 +163,7 @@ int tcp_mssdflt = TCP_MSS; int tcp_minmss = TCP_MINMSS; int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; int tcp_do_rfc1323 = 1; /* window scaling / timestamps (obsolete) */ -int tcp_do_rfc1948 = 0; /* ISS by cryptographic hash */ +int tcp_do_rfc1948 = 1; /* ISS by cryptographic hash */ int tcp_do_sack = 1; /* selective acknowledgement */ int tcp_do_win_scale = 1; /* RFC1323 window scaling */ int tcp_do_timestamps = 1; /* RFC1323 timestamps */
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 7 14:58:54 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: netinet: Enable RFC 1948 pseudorandom TCP ISS selection by default. (from riastradh) To generate a diff of this commit: cvs rdiff -u -r1.284 -r1.285 src/sys/netinet/tcp_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 7 14:58:28 UTC 2021 Modified Files: src/sys/netinet: ip_input.c Log Message: netinet: Enable random IP fragment ids by default (from riastradh) To generate a diff of this commit: cvs rdiff -u -r1.399 -r1.400 src/sys/netinet/ip_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.399 src/sys/netinet/ip_input.c:1.400 --- src/sys/netinet/ip_input.c:1.399 Fri Feb 19 09:51:59 2021 +++ src/sys/netinet/ip_input.c Sun Mar 7 09:58:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.399 2021/02/19 14:51:59 christos Exp $ */ +/* $NetBSD: ip_input.c,v 1.400 2021/03/07 14:58:27 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.399 2021/02/19 14:51:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.400 2021/03/07 14:58:27 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -168,7 +168,7 @@ int ip_directedbcast = 0; int ip_allowsrcrt = 0; int ip_mtudisc = 1; int ip_mtudisc_timeout = IPMTUDISCTIMEOUT; -int ip_do_randomid = 0; +int ip_do_randomid = 1; /* * XXX - Setting ip_checkinterface mostly implements the receive side of
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 7 14:58:28 UTC 2021 Modified Files: src/sys/netinet: ip_input.c Log Message: netinet: Enable random IP fragment ids by default (from riastradh) To generate a diff of this commit: cvs rdiff -u -r1.399 -r1.400 src/sys/netinet/ip_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.