From owner-svn-src-head@freebsd.org Thu May 28 08:00:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5D963299DA; Thu, 28 May 2020 08:00:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Xg954T1mz470f; Thu, 28 May 2020 08:00:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94C4A22D21; Thu, 28 May 2020 08:00:09 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04S809xa063296; Thu, 28 May 2020 08:00:09 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04S809Au063294; Thu, 28 May 2020 08:00:09 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202005280800.04S809Au063294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 28 May 2020 08:00:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361576 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 361576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2020 08:00:09 -0000 Author: melifaro Date: Thu May 28 08:00:08 2020 New Revision: 361576 URL: https://svnweb.freebsd.org/changeset/base/361576 Log: Use fib[46]_lookup() in mtu calculations. fib[46]_lookup_nh_ represents pre-epoch generation of fib api, providing less guarantees over pointer validness and requiring on-stack data copying. Conversion is straight-forwarded, as the only 2 differences are requirement of running in network epoch and the need to handle RTF_GATEWAY case in the caller code. Differential Revision: https://reviews.freebsd.org/D24974 Modified: head/sys/netinet/tcp_subr.c head/sys/netinet6/icmp6.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Thu May 28 07:35:07 2020 (r361575) +++ head/sys/netinet/tcp_subr.c Thu May 28 08:00:08 2020 (r361576) @@ -2920,7 +2920,7 @@ tcp_mtudisc(struct inpcb *inp, int mtuoffer) uint32_t tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *cap) { - struct nhop4_extended nh4; + struct nhop_object *nh; struct ifnet *ifp; uint32_t maxmtu = 0; @@ -2928,12 +2928,12 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap * if (inc->inc_faddr.s_addr != INADDR_ANY) { - if (fib4_lookup_nh_ext(inc->inc_fibnum, inc->inc_faddr, - NHR_REF, 0, &nh4) != 0) + nh = fib4_lookup(inc->inc_fibnum, inc->inc_faddr, 0, NHR_NONE, 0); + if (nh == NULL) return (0); - ifp = nh4.nh_ifp; - maxmtu = nh4.nh_mtu; + ifp = nh->nh_ifp; + maxmtu = nh->nh_mtu; /* Report additional interface capabilities. */ if (cap != NULL) { @@ -2945,7 +2945,6 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap * cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; } } - fib4_free_nh_ext(inc->inc_fibnum, &nh4); } return (maxmtu); } @@ -2955,7 +2954,7 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap * uint32_t tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap) { - struct nhop6_extended nh6; + struct nhop_object *nh; struct in6_addr dst6; uint32_t scopeid; struct ifnet *ifp; @@ -2968,12 +2967,12 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap if (!IN6_IS_ADDR_UNSPECIFIED(&inc->inc6_faddr)) { in6_splitscope(&inc->inc6_faddr, &dst6, &scopeid); - if (fib6_lookup_nh_ext(inc->inc_fibnum, &dst6, scopeid, 0, - 0, &nh6) != 0) + nh = fib6_lookup(inc->inc_fibnum, &dst6, scopeid, NHR_NONE, 0); + if (nh == NULL) return (0); - ifp = nh6.nh_ifp; - maxmtu = nh6.nh_mtu; + ifp = nh->nh_ifp; + maxmtu = nh->nh_mtu; /* Report additional interface capabilities. */ if (cap != NULL) { @@ -2985,7 +2984,6 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; } } - fib6_free_nh_ext(inc->inc_fibnum, &nh6); } return (maxmtu); Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Thu May 28 07:35:07 2020 (r361575) +++ head/sys/netinet6/icmp6.c Thu May 28 08:00:08 2020 (r361576) @@ -402,6 +402,8 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; int code, error, icmp6len, ip6len, noff, off, sum; + NET_EPOCH_ASSERT(); + m = *mp; off = *offp;