svn commit: r361576 - in head/sys: netinet netinet6
Alexander V. Chernikov
melifaro at FreeBSD.org
Thu May 28 08:00:09 UTC 2020
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;
More information about the svn-src-head
mailing list