[rtems commit] Use network epoch to protect local IPv4 addresses hash.

Sebastian Huber sebh at rtems.org
Mon Jul 11 11:47:03 UTC 2022


Module:    rtems
Branch:    master
Commit:    94c33ba9920922e05f2dd4c384eaa01f91a58408
Changeset: http://git.rtems.org/rtems/commit/?id=94c33ba9920922e05f2dd4c384eaa01f91a58408

Author:    Gleb Smirnoff <glebius at FreeBSD.org>
Date:      Sun Oct 10 10:02:26 2021 -0700

Use network epoch to protect local IPv4 addresses hash.

The modification to the hash are already naturally locked by
in_control_sx.  Convert the hash lists to CK lists. Remove the
in_ifaddr_rmlock. Assert the network epoch where necessary.

Most cases when the hash lookup is done the epoch is already entered.
Cover a few cases, that need entering the epoch, which mostly is
initial configuration of tunnel interfaces and multicast addresses.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D32584

---

 cpukit/include/machine/_kernel_in.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cpukit/include/machine/_kernel_in.h b/cpukit/include/machine/_kernel_in.h
index 69b189cfe0..c9dcfbd033 100644
--- a/cpukit/include/machine/_kernel_in.h
+++ b/cpukit/include/machine/_kernel_in.h
@@ -50,7 +50,11 @@ int	 in_broadcast(struct in_addr, struct ifnet *);
 int	 in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *);
 int	 in_canforward(struct in_addr);
 int	 in_localaddr(struct in_addr);
+#if __FreeBSD_version >= 1400039
+bool	 in_localip(struct in_addr);
+#else
 int	 in_localip(struct in_addr);
+#endif
 int	 in_ifhasaddr(struct ifnet *, struct in_addr);
 struct in_ifaddr *in_findlocal(uint32_t, bool);
 int	 inet_aton(const char *, struct in_addr *); /* in libkern */



More information about the vc mailing list