Date: Wed, 20 Mar 2019 23:32:37 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r345354 - in projects/fuse2: . contrib/blacklist/bin contrib/googletest/googletest/test contrib/llvm/tools/clang/lib/Basic contrib/llvm/tools/lld/ELF contrib/llvm/tools/lld/docs contrib... Message-ID: <201903202332.x2KNWbgU016872@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Wed Mar 20 23:32:37 2019 New Revision: 345354 URL: https://svnweb.freebsd.org/changeset/base/345354 Log: MFHead @345353 Added: projects/fuse2/sys/modules/fusefs/ - copied from r345353, head/sys/modules/fusefs/ Replaced: projects/fuse2/contrib/googletest/googletest/test/gtest_skip_test.cc - copied unchanged from r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc Deleted: projects/fuse2/sys/modules/fuse/ Modified: projects/fuse2/Makefile.inc1 projects/fuse2/UPDATING projects/fuse2/contrib/blacklist/bin/blacklistd.c projects/fuse2/contrib/llvm/tools/clang/lib/Basic/Version.cpp projects/fuse2/contrib/llvm/tools/lld/ELF/Config.h projects/fuse2/contrib/llvm/tools/lld/ELF/Driver.cpp projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.cpp projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.h projects/fuse2/contrib/llvm/tools/lld/ELF/Options.td projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.cpp projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.h projects/fuse2/contrib/llvm/tools/lld/ELF/Writer.cpp projects/fuse2/contrib/llvm/tools/lld/docs/ld.lld.1 projects/fuse2/contrib/openmp/runtime/src/kmp.h projects/fuse2/contrib/openmp/runtime/src/kmp_runtime.cpp projects/fuse2/lib/Makefile projects/fuse2/lib/clang/include/clang/Basic/Version.inc projects/fuse2/lib/clang/include/lld/Common/Version.inc projects/fuse2/lib/clang/include/llvm/Support/VCSRevision.h projects/fuse2/lib/libjail/jail.c projects/fuse2/lib/libomp/Makefile projects/fuse2/release/Makefile.ec2 projects/fuse2/release/tools/ec2.conf projects/fuse2/sbin/bectl/bectl_jail.c projects/fuse2/sbin/ipfw/ipfw.8 projects/fuse2/sbin/ipfw/ipfw2.h projects/fuse2/sbin/ipfw/nat64lsn.c projects/fuse2/sbin/mount_fusefs/mount_fusefs.c projects/fuse2/share/man/man9/sysctl.9 projects/fuse2/share/mk/src.opts.mk projects/fuse2/stand/common/interp_forth.c projects/fuse2/stand/common/load_elf.c projects/fuse2/sys/amd64/sgx/sgx.c projects/fuse2/sys/arm/include/platformvar.h projects/fuse2/sys/conf/NOTES projects/fuse2/sys/conf/files projects/fuse2/sys/conf/kern.post.mk projects/fuse2/sys/conf/kmod.mk projects/fuse2/sys/conf/options projects/fuse2/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c projects/fuse2/sys/dev/ahci/ahci_pci.c projects/fuse2/sys/dev/cpufreq/cpufreq_dt.c projects/fuse2/sys/dev/cxgbe/adapter.h projects/fuse2/sys/dev/cxgbe/common/common.h projects/fuse2/sys/dev/cxgbe/common/t4_hw.c projects/fuse2/sys/dev/cxgbe/firmware/t4fw_interface.h projects/fuse2/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h projects/fuse2/sys/dev/cxgbe/t4_main.c projects/fuse2/sys/dev/cxgbe/t4_sched.c projects/fuse2/sys/dev/cxgbe/t4_sge.c projects/fuse2/sys/dev/cxgbe/tom/t4_cpl_io.c projects/fuse2/sys/dev/cxgbe/tom/t4_listen.c projects/fuse2/sys/dev/cxgbe/tom/t4_tom.c projects/fuse2/sys/dev/e1000/if_em.c projects/fuse2/sys/dev/extres/phy/phy.c projects/fuse2/sys/dev/extres/regulator/regulator.c projects/fuse2/sys/dev/extres/syscon/syscon.c projects/fuse2/sys/dev/ichsmb/ichsmb_pci.c projects/fuse2/sys/dev/ixgbe/if_ix.c projects/fuse2/sys/dev/ixgbe/if_ixv.c projects/fuse2/sys/dev/ixl/if_iavf.c projects/fuse2/sys/dev/ixl/ixl_pf_main.c projects/fuse2/sys/dev/pci/pcivar.h projects/fuse2/sys/dev/psci/psci.c projects/fuse2/sys/dev/psci/psci.h projects/fuse2/sys/dev/sound/pci/hda/hdac.c projects/fuse2/sys/dev/sound/pci/hda/hdacc.c projects/fuse2/sys/fs/fuse/fuse.h projects/fuse2/sys/fs/fuse/fuse_file.c projects/fuse2/sys/fs/fuse/fuse_ipc.c projects/fuse2/sys/fs/fuse/fuse_main.c projects/fuse2/sys/fs/fuse/fuse_node.c projects/fuse2/sys/fs/fuse/fuse_vfsops.c projects/fuse2/sys/fs/fuse/fuse_vnops.c projects/fuse2/sys/modules/Makefile projects/fuse2/sys/modules/ipfw_nat64/Makefile projects/fuse2/sys/net/bpf.c projects/fuse2/sys/net/iflib.c projects/fuse2/sys/net/iflib.h projects/fuse2/sys/netinet6/ip_fw_nat64.h projects/fuse2/sys/netpfil/ipfw/nat64/nat64lsn.c projects/fuse2/sys/netpfil/ipfw/nat64/nat64lsn.h projects/fuse2/sys/netpfil/ipfw/nat64/nat64lsn_control.c projects/fuse2/sys/sys/param.h projects/fuse2/sys/sys/stat.h projects/fuse2/sys/sys/sysctl.h projects/fuse2/sys/ufs/ffs/ffs_softdep.c projects/fuse2/sys/vm/vm_fault.c projects/fuse2/tests/sys/netmap/ctrl-api-test.c projects/fuse2/usr.bin/lockf/lockf.c projects/fuse2/usr.sbin/makefs/mtree.c projects/fuse2/usr.sbin/makefs/tests/makefs_tests_common.sh Directory Properties: projects/fuse2/ (props changed) projects/fuse2/contrib/blacklist/ (props changed) projects/fuse2/contrib/compiler-rt/ (props changed) projects/fuse2/contrib/libc++/ (props changed) projects/fuse2/contrib/libunwind/ (props changed) projects/fuse2/contrib/llvm/ (props changed) projects/fuse2/contrib/llvm/tools/clang/ (props changed) projects/fuse2/contrib/llvm/tools/lld/ (props changed) projects/fuse2/contrib/llvm/tools/lldb/ (props changed) projects/fuse2/contrib/openmp/ (props changed) Modified: projects/fuse2/Makefile.inc1 ============================================================================== --- projects/fuse2/Makefile.inc1 Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/Makefile.inc1 Wed Mar 20 23:32:37 2019 (r345354) @@ -1162,7 +1162,7 @@ buildworld_epilogue: .PHONY @echo "--------------------------------------------------------------" @echo ">>> World build completed on `LC_ALL=C date`" @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \ - echo -n ">>> World build in $$seconds seconds, "; \ + echo -n ">>> World built in $$seconds seconds, "; \ echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" @@ -1648,7 +1648,7 @@ buildkernel: .MAKE .PHONY .endfor @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ - echo -n ">>> Kernel(s) build for${BUILDKERNELS} in $$seconds seconds, "; \ + echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \ echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" Modified: projects/fuse2/UPDATING ============================================================================== --- projects/fuse2/UPDATING Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/UPDATING Wed Mar 20 23:32:37 2019 (r345354) @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190320: + The fuse(4) module has been renamed to fusefs(4) for consistency with + other filesystems. You should update any kld_load="fuse" entries in + /etc/rc.conf, fuse_load="YES" entries in /boot/loader.conf, and + "options FUSE" enties in kernel config files. + 20190304: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 8.0.0. Please see the 20141231 entry below for information about Modified: projects/fuse2/contrib/blacklist/bin/blacklistd.c ============================================================================== --- projects/fuse2/contrib/blacklist/bin/blacklistd.c Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/blacklist/bin/blacklistd.c Wed Mar 20 23:32:37 2019 (r345354) @@ -328,7 +328,7 @@ again: if (dbi.id[0]) { run_change("rem", &c, dbi.id, 0); sockaddr_snprintf(buf, sizeof(buf), "%a", ss); - syslog(LOG_INFO, "released %s/%d:%d after %d seconds", + (*lfun)(LOG_INFO, "released %s/%d:%d after %d seconds", buf, c.c_lmask, c.c_port, c.c_duration); } state_del(state, &c); Copied: projects/fuse2/contrib/googletest/googletest/test/gtest_skip_test.cc (from r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/fuse2/contrib/googletest/googletest/test/gtest_skip_test.cc Wed Mar 20 23:32:37 2019 (r345354, copy of r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc) @@ -0,0 +1,55 @@ +// Copyright 2008 Google Inc. +// All Rights Reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: arseny.aprelev@gmail.com (Arseny Aprelev) +// + +#include "gtest/gtest.h" + +using ::testing::Test; + +TEST(SkipTest, DoesSkip) { + GTEST_SKIP(); + EXPECT_EQ(0, 1); +} + +class Fixture : public Test { + protected: + void SetUp() override { + GTEST_SKIP() << "skipping all tests for this fixture"; + } +}; + +TEST_F(Fixture, SkipsOneTest) { + EXPECT_EQ(5, 7); +} + +TEST_F(Fixture, SkipsAnotherTest) { + EXPECT_EQ(99, 100); +} Modified: projects/fuse2/contrib/llvm/tools/clang/lib/Basic/Version.cpp ============================================================================== --- projects/fuse2/contrib/llvm/tools/clang/lib/Basic/Version.cpp Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/clang/lib/Basic/Version.cpp Wed Mar 20 23:32:37 2019 (r345354) @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_80/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/Config.h ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/Config.h Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/Config.h Wed Mar 20 23:32:37 2019 (r345354) @@ -122,6 +122,7 @@ struct Configuration { uint64_t> CallGraphProfile; bool AllowMultipleDefinition; + bool AllowShlibUndefined; bool AndroidPackDynRelocs; bool ARMHasBlx = false; bool ARMHasMovtMovw = false; Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/Driver.cpp ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/Driver.cpp Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/Driver.cpp Wed Mar 20 23:32:37 2019 (r345354) @@ -758,6 +758,9 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args Args.hasFlag(OPT_allow_multiple_definition, OPT_no_allow_multiple_definition, false) || hasZOption(Args, "muldefs"); + Config->AllowShlibUndefined = + Args.hasFlag(OPT_allow_shlib_undefined, OPT_no_allow_shlib_undefined, + Args.hasArg(OPT_shared)); Config->AuxiliaryList = args::getStrings(Args, OPT_auxiliary); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.cpp ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.cpp Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.cpp Wed Mar 20 23:32:37 2019 (r345354) @@ -865,7 +865,7 @@ SharedFile<ELFT>::SharedFile(MemoryBufferRef M, String // Partially parse the shared object file so that we can call // getSoName on this object. -template <class ELFT> void SharedFile<ELFT>::parseSoName() { +template <class ELFT> void SharedFile<ELFT>::parseDynamic() { const Elf_Shdr *DynamicSec = nullptr; const ELFFile<ELFT> Obj = this->getObj(); ArrayRef<Elf_Shdr> Sections = CHECK(Obj.sections(), this); @@ -902,12 +902,16 @@ template <class ELFT> void SharedFile<ELFT>::parseSoNa ArrayRef<Elf_Dyn> Arr = CHECK(Obj.template getSectionContentsAsArray<Elf_Dyn>(DynamicSec), this); for (const Elf_Dyn &Dyn : Arr) { - if (Dyn.d_tag == DT_SONAME) { + if (Dyn.d_tag == DT_NEEDED) { uint64_t Val = Dyn.getVal(); if (Val >= this->StringTable.size()) + fatal(toString(this) + ": invalid DT_NEEDED entry"); + DtNeeded.push_back(this->StringTable.data() + Val); + } else if (Dyn.d_tag == DT_SONAME) { + uint64_t Val = Dyn.getVal(); + if (Val >= this->StringTable.size()) fatal(toString(this) + ": invalid DT_SONAME entry"); SoName = this->StringTable.data() + Val; - return; } } } @@ -975,7 +979,7 @@ uint32_t SharedFile<ELFT>::getAlignment(ArrayRef<Elf_S return (Ret > UINT32_MAX) ? 0 : Ret; } -// Fully parse the shared object file. This must be called after parseSoName(). +// Fully parse the shared object file. This must be called after parseDynamic(). // // This function parses symbol versions. If a DSO has version information, // the file has a ".gnu.version_d" section which contains symbol version Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.h ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.h Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/InputFiles.h Wed Mar 20 23:32:37 2019 (r345354) @@ -323,6 +323,7 @@ template <class ELFT> class SharedFile : public ELFFil public: std::vector<const Elf_Verdef *> Verdefs; + std::vector<StringRef> DtNeeded; std::string SoName; static bool classof(const InputFile *F) { @@ -331,7 +332,7 @@ template <class ELFT> class SharedFile : public ELFFil SharedFile(MemoryBufferRef M, StringRef DefaultSoName); - void parseSoName(); + void parseDynamic(); void parseRest(); uint32_t getAlignment(ArrayRef<Elf_Shdr> Sections, const Elf_Sym &Sym); std::vector<const Elf_Verdef *> parseVerdefs(); @@ -348,6 +349,9 @@ template <class ELFT> class SharedFile : public ELFFil // Mapping from Elf_Verdef data structures to information about Elf_Vernaux // data structures in the output file. std::map<const Elf_Verdef *, NeededVer> VerdefMap; + + // Used for --no-allow-shlib-undefined. + bool AllNeededIsKnown; // Used for --as-needed bool IsNeeded; Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/Options.td ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/Options.td Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/Options.td Wed Mar 20 23:32:37 2019 (r345354) @@ -63,6 +63,10 @@ defm allow_multiple_definition: B<"allow-multiple-defi "Allow multiple definitions", "Do not allow multiple definitions (default)">; +defm allow_shlib_undefined: B<"allow-shlib-undefined", + "Allow unresolved references in shared libraries (default when linking a shared library)", + "Do not allow unresolved references in shared libraries (default when linking an executable)">; + defm apply_dynamic_relocs: B<"apply-dynamic-relocs", "Apply link-time values for dynamic relocations", "Do not apply link-time values for dynamic relocations (default)">; @@ -492,12 +496,10 @@ def plugin_opt_thinlto: J<"plugin-opt=thinlto">; def plugin_opt_slash: J<"plugin-opt=/">; // Options listed below are silently ignored for now for compatibility. -def: F<"allow-shlib-undefined">; def: F<"detect-odr-violations">; def: Flag<["-"], "g">; def: F<"long-plt">; def: F<"no-add-needed">; -def: F<"no-allow-shlib-undefined">; def: F<"no-copy-dt-needed-entries">; def: F<"no-ctors-in-init-array">; def: F<"no-keep-memory">; Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Wed Mar 20 23:32:37 2019 (r345354) @@ -93,7 +93,7 @@ template <class ELFT> void SymbolTable::addFile(InputF // .so file if (auto *F = dyn_cast<SharedFile<ELFT>>(File)) { // DSOs are uniquified not by filename but by soname. - F->parseSoName(); + F->parseDynamic(); if (errorCount()) return; Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.h ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.h Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/SymbolTable.h Wed Mar 20 23:32:37 2019 (r345354) @@ -80,6 +80,9 @@ class SymbolTable { (public) void handleDynamicList(); + // Set of .so files to not link the same shared object file more than once. + llvm::DenseMap<StringRef, InputFile *> SoNames; + private: std::pair<Symbol *, bool> insertName(StringRef Name); @@ -106,9 +109,6 @@ class SymbolTable { (public) // same name, only one of them is linked, and the other is ignored. This set // is used to uniquify them. llvm::DenseSet<llvm::CachedHashStringRef> ComdatGroups; - - // Set of .so files to not link the same shared object file more than once. - llvm::DenseMap<StringRef, InputFile *> SoNames; // A map from demangled symbol names to their symbol objects. // This mapping is 1:N because two symbols with different versions Modified: projects/fuse2/contrib/llvm/tools/lld/ELF/Writer.cpp ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/ELF/Writer.cpp Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/ELF/Writer.cpp Wed Mar 20 23:32:37 2019 (r345354) @@ -1668,6 +1668,27 @@ template <class ELFT> void Writer<ELFT>::finalizeSecti if (In.Iplt && !In.Iplt->empty()) In.Iplt->addSymbols(); + if (!Config->AllowShlibUndefined) { + // Error on undefined symbols in a shared object, if all of its DT_NEEDED + // entires are seen. These cases would otherwise lead to runtime errors + // reported by the dynamic linker. + // + // ld.bfd traces all DT_NEEDED to emulate the logic of the dynamic linker to + // catch more cases. That is too much for us. Our approach resembles the one + // used in ld.gold, achieves a good balance to be useful but not too smart. + for (InputFile *File : SharedFiles) { + SharedFile<ELFT> *F = cast<SharedFile<ELFT>>(File); + F->AllNeededIsKnown = llvm::all_of(F->DtNeeded, [&](StringRef Needed) { + return Symtab->SoNames.count(Needed); + }); + } + for (Symbol *Sym : Symtab->getSymbols()) + if (Sym->isUndefined() && !Sym->isWeak()) + if (auto *F = dyn_cast_or_null<SharedFile<ELFT>>(Sym->File)) + if (F->AllNeededIsKnown) + error(toString(F) + ": undefined reference to " + toString(*Sym)); + } + // Now that we have defined all possible global symbols including linker- // synthesized ones. Visit all symbols to give the finishing touches. for (Symbol *Sym : Symtab->getSymbols()) { Modified: projects/fuse2/contrib/llvm/tools/lld/docs/ld.lld.1 ============================================================================== --- projects/fuse2/contrib/llvm/tools/lld/docs/ld.lld.1 Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/llvm/tools/lld/docs/ld.lld.1 Wed Mar 20 23:32:37 2019 (r345354) @@ -56,6 +56,9 @@ option. .It Fl -allow-multiple-definition Do not error if a symbol is defined multiple times. The first definition will be used. +.It Fl -allow-shlib-undefined +Allow unresolved references in shared libraries. +This option is enabled by default when linking a shared library. .It Fl -apply-dynamic-relocs Apply link-time values for dynamic relocations. .It Fl -as-needed @@ -252,6 +255,9 @@ Set target emulation. .It Fl -Map Ns = Ns Ar file , Fl M Ar file Print a link map to .Ar file . +.It Fl -no-allow-shlib-undefined +Do not allow unresolved references in shared libraries. +This option is enabled by default when linking an executable. .It Fl -no-as-needed Always set .Dv DT_NEEDED Modified: projects/fuse2/contrib/openmp/runtime/src/kmp.h ============================================================================== --- projects/fuse2/contrib/openmp/runtime/src/kmp.h Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/openmp/runtime/src/kmp.h Wed Mar 20 23:32:37 2019 (r345354) @@ -3666,8 +3666,13 @@ extern int __kmp_read_from_file(char const *path, char extern void __kmp_query_cpuid(kmp_cpuinfo_t *p); -#define __kmp_load_mxcsr(p) _mm_setcsr(*(p)) +#if __SSE__ +static inline void __kmp_load_mxcsr(const kmp_uint32 *p) { _mm_setcsr(*(p)); } static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); } +#else +static inline void __kmp_load_mxcsr(const kmp_uint32 *) {} +static inline void __kmp_store_mxcsr(kmp_uint32 *) {} +#endif extern void __kmp_load_x87_fpu_control_word(kmp_int16 *p); extern void __kmp_store_x87_fpu_control_word(kmp_int16 *p); Modified: projects/fuse2/contrib/openmp/runtime/src/kmp_runtime.cpp ============================================================================== --- projects/fuse2/contrib/openmp/runtime/src/kmp_runtime.cpp Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/contrib/openmp/runtime/src/kmp_runtime.cpp Wed Mar 20 23:32:37 2019 (r345354) @@ -8104,7 +8104,7 @@ __kmp_determine_reduction_method( #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS -#if KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_HURD +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_HURD // basic tuning Modified: projects/fuse2/lib/Makefile ============================================================================== --- projects/fuse2/lib/Makefile Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/lib/Makefile Wed Mar 20 23:32:37 2019 (r345354) @@ -196,9 +196,7 @@ _libproc= libproc _librtld_db= librtld_db .endif -.if !defined(COMPAT_32BIT) SUBDIR.${MK_OPENMP}+= libomp -.endif SUBDIR.${MK_OPENSSL}+= libmp SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius Modified: projects/fuse2/lib/clang/include/clang/Basic/Version.inc ============================================================================== --- projects/fuse2/lib/clang/include/clang/Basic/Version.inc Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/lib/clang/include/clang/Basic/Version.inc Wed Mar 20 23:32:37 2019 (r345354) @@ -8,4 +8,4 @@ #define CLANG_VENDOR "FreeBSD " -#define SVN_REVISION "356034" +#define SVN_REVISION "356365" Modified: projects/fuse2/lib/clang/include/lld/Common/Version.inc ============================================================================== --- projects/fuse2/lib/clang/include/lld/Common/Version.inc Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/lib/clang/include/lld/Common/Version.inc Wed Mar 20 23:32:37 2019 (r345354) @@ -7,4 +7,4 @@ #define LLD_REPOSITORY_STRING "FreeBSD" // <Upstream revision at import>-<Local identifier in __FreeBSD_version style> -#define LLD_REVISION_STRING "356034-1300002" +#define LLD_REVISION_STRING "356365-1300003" Modified: projects/fuse2/lib/clang/include/llvm/Support/VCSRevision.h ============================================================================== --- projects/fuse2/lib/clang/include/llvm/Support/VCSRevision.h Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/lib/clang/include/llvm/Support/VCSRevision.h Wed Mar 20 23:32:37 2019 (r345354) @@ -1,2 +1,2 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "svn-r356034" +#define LLVM_REVISION "svn-r356365" Modified: projects/fuse2/lib/libjail/jail.c ============================================================================== --- projects/fuse2/lib/libjail/jail.c Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/lib/libjail/jail.c Wed Mar 20 23:32:37 2019 (r345354) @@ -1050,14 +1050,8 @@ kldload_param(const char *name) kl = kldload(name); else if (strncmp(name, "allow.mount.", 12) == 0) { /* Load the matching filesystem */ - const char *modname; + const char *modname = name + 12; - if (strcmp("fusefs", name + 12) == 0 || - strcmp("nofusefs", name + 12) == 0) { - modname = "fuse"; - } else { - modname = name + 12; - } kl = kldload(modname); if (kl < 0 && errno == ENOENT && strncmp(modname, "no", 2) == 0) Modified: projects/fuse2/lib/libomp/Makefile ============================================================================== --- projects/fuse2/lib/libomp/Makefile Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/lib/libomp/Makefile Wed Mar 20 23:32:37 2019 (r345354) @@ -58,7 +58,6 @@ CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti LDFLAGS+= -Wl,--warn-shared-textrel -LDFLAGS+= -Wl,--as-needed LDFLAGS+= -Wl,--gc-sections LDFLAGS+= -Wl,-z,noexecstack LDFLAGS+= -Wl,-fini=__kmp_internal_end_fini @@ -67,5 +66,6 @@ LDFLAGS+= -Wl,-soname,libomp.so VERSION_MAP= ${OMPSRC}/exports_so.txt LIBADD+= pthread +LIBADD+= m .include <bsd.lib.mk> Modified: projects/fuse2/release/Makefile.ec2 ============================================================================== --- projects/fuse2/release/Makefile.ec2 Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/release/Makefile.ec2 Wed Mar 20 23:32:37 2019 (r345354) @@ -42,6 +42,9 @@ PUBLICSNAP= --publicsnap EC2SNSREL= ${REVISION}-${BRANCH} EC2SNSVERS= ${EC2_SVNBRANCH}@${EC2_SVNREV} .endif +.if ${TARGET_ARCH} != "amd64" +EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} +.endif CLEANFILES+= ec2ami @@ -82,7 +85,8 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @echo "--------------------------------------------------------------" @false .endif - /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} --sriov --ena \ + /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ + ${EC2ARCH} --sriov --ena \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ "${TYPE}/${TARGET} ${EC2_SVNBRANCH}@${EC2_SVNREV}" \ Modified: projects/fuse2/release/tools/ec2.conf ============================================================================== --- projects/fuse2/release/tools/ec2.conf Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/release/tools/ec2.conf Wed Mar 20 23:32:37 2019 (r345354) @@ -6,7 +6,15 @@ # Packages to install into the image we're creating. This is a deliberately # minimalist set, providing only the packages necessary to bootstrap further # package installation as specified via EC2 user-data. -export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient amazon-ssm-agent" +export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient" + +# Include the amazon-ssm-agent package in amd64 images, since some users want +# to be able to use it on systems which are not connected to the Internet. +# (It is not enabled by default, however.) This package does not exist for +# aarch64, so we have to be selective about when we install it. +if [ "${TARGET_ARCH}" = "amd64" ]; then + export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent" +fi # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_loghostkey firstboot_freebsd_update firstboot_pkgs ntpd" Modified: projects/fuse2/sbin/bectl/bectl_jail.c ============================================================================== --- projects/fuse2/sbin/bectl/bectl_jail.c Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/sbin/bectl/bectl_jail.c Wed Mar 20 23:32:37 2019 (r345354) @@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include <be.h> - #include "bectl.h" -static void jailparam_grow(void); +#define MNTTYPE_ZFS 222 + static void jailparam_add(const char *name, const char *val); static int jailparam_del(const char *name); static bool jailparam_addarg(char *arg); @@ -51,84 +51,28 @@ static int jailparam_delarg(char *arg); static int bectl_search_jail_paths(const char *mnt); static int bectl_locate_jail(const char *ident); +static int bectl_jail_cleanup(char *mountpoint, int jid); -/* We'll start with 8 parameters initially and grow as needed. */ -#define INIT_PARAMCOUNT 8 - -static struct jailparam *jp; -static int jpcnt; -static int jpused; static char mnt_loc[BE_MAXPATHLEN]; +static nvlist_t *jailparams; -static void -jailparam_grow(void) -{ +static const char *disabled_params[] = { + "command", "exec.start", "nopersist", "persist", NULL +}; - jpcnt *= 2; - jp = realloc(jp, jpcnt * sizeof(*jp)); - if (jp == NULL) - err(2, "realloc"); -} static void jailparam_add(const char *name, const char *val) { - int i; - for (i = 0; i < jpused; ++i) { - if (strcmp(name, jp[i].jp_name) == 0) - break; - } - - if (i < jpused) - jailparam_free(&jp[i], 1); - else if (jpused == jpcnt) - /* The next slot isn't allocated yet */ - jailparam_grow(); - - if (jailparam_init(&jp[i], name) != 0) - return; - if (jailparam_import(&jp[i], val) != 0) - return; - ++jpused; + nvlist_add_string(jailparams, name, val); } static int jailparam_del(const char *name) { - int i; - char *val; - for (i = 0; i < jpused; ++i) { - if (strcmp(name, jp[i].jp_name) == 0) - break; - } - - if (i == jpused) - return (ENOENT); - - for (; i < jpused - 1; ++i) { - val = jailparam_export(&jp[i + 1]); - - jailparam_free(&jp[i], 1); - /* - * Given the context, the following will really only fail if - * they can't allocate the copy of the name or value. - */ - if (jailparam_init(&jp[i], jp[i + 1].jp_name) != 0) { - free(val); - return (ENOMEM); - } - if (jailparam_import(&jp[i], val) != 0) { - jailparam_free(&jp[i], 1); - free(val); - return (ENOMEM); - } - free(val); - } - - jailparam_free(&jp[i], 1); - --jpused; + nvlist_remove_all(jailparams, name); return (0); } @@ -136,6 +80,7 @@ static bool jailparam_addarg(char *arg) { char *name, *val; + size_t i, len; if (arg == NULL) return (false); @@ -156,6 +101,15 @@ jailparam_addarg(char *arg) } strlcpy(mnt_loc, val, sizeof(mnt_loc)); } + + for (i = 0; disabled_params[i] != NULL; i++) { + len = strlen(disabled_params[i]); + if (strncmp(disabled_params[i], name, len) == 0) { + fprintf(stderr, "invalid jail parameter: %s\n", name); + return (false); + } + } + jailparam_add(name, val); return (true); } @@ -176,22 +130,128 @@ jailparam_delarg(char *arg) return (jailparam_del(name)); } +static int +build_jailcmd(char ***argvp, bool interactive, int argc, char *argv[]) +{ + char *cmd, **jargv, *name, *val; + nvpair_t *nvp; + size_t i, iarg, nargv; + + cmd = NULL; + nvp = NULL; + iarg = i = 0; + if (nvlist_size(jailparams, &nargv, NV_ENCODE_NATIVE) != 0) + return (1); + + /* + * Number of args + "/usr/sbin/jail", "-c", and ending NULL. + * If interactive also include command. + */ + nargv += 3; + if (interactive) { + if (argc == 0) + nargv++; + else + nargv += argc; + } + + jargv = *argvp = calloc(nargv, sizeof(jargv)); + if (jargv == NULL) + err(2, "calloc"); + + jargv[iarg++] = strdup("/usr/sbin/jail"); + jargv[iarg++] = strdup("-c"); + while ((nvp = nvlist_next_nvpair(jailparams, nvp)) != NULL) { + name = nvpair_name(nvp); + if (nvpair_value_string(nvp, &val) != 0) + continue; + + if (asprintf(&jargv[iarg++], "%s=%s", name, val) < 0) + goto error; + } + if (interactive) { + if (argc < 1) + cmd = strdup("/bin/sh"); + else { + cmd = argv[0]; + argc--; + argv++; + } + + if (asprintf(&jargv[iarg++], "command=%s", cmd) < 0) { + goto error; + } + if (argc < 1) { + free(cmd); + cmd = NULL; + } + + for (; argc > 0; argc--) { + if (asprintf(&jargv[iarg++], "%s", argv[0]) < 0) + goto error; + argv++; + } + } + + return (0); + +error: + if (interactive && argc < 1) + free(cmd); + for (; i < iarg - 1; i++) { + free(jargv[i]); + } + free(jargv); + return (1); +} + +/* Remove jail and cleanup any non zfs mounts. */ +static int +bectl_jail_cleanup(char *mountpoint, int jid) +{ + struct statfs *mntbuf; + size_t i, searchlen, mntsize; + + if (jid >= 0 && jail_remove(jid) != 0) { + fprintf(stderr, "unable to remove jail"); + return (1); + } + + searchlen = strnlen(mountpoint, MAXPATHLEN); + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntsize; i++) { + if (strncmp(mountpoint, mntbuf[i].f_mntonname, searchlen) == 0 && + mntbuf[i].f_type != MNTTYPE_ZFS) { + + if (unmount(mntbuf[i].f_mntonname, 0) != 0) { + fprintf(stderr, "bectl jail: unable to unmount filesystem %s", + mntbuf[i].f_mntonname); + return (1); + } + } + } + + return (0); +} + int bectl_cmd_jail(int argc, char *argv[]) { - char *bootenv, *mountpoint; - int jid, mntflags, opt, ret; + char *bootenv, **jargv, *mountpoint; + int i, jid, mntflags, opt, ret; bool default_hostname, interactive, unjail; pid_t pid; + /* XXX TODO: Allow shallow */ mntflags = BE_MNT_DEEP; default_hostname = interactive = unjail = true; - jpcnt = INIT_PARAMCOUNT; - jp = malloc(jpcnt * sizeof(*jp)); - if (jp == NULL) - err(2, "malloc"); + if ((nvlist_alloc(&jailparams, NV_UNIQUE_NAME, 0)) != 0) { + fprintf(stderr, "nvlist_alloc() failed\n"); + return (1); + } + jailparam_add("persist", "true"); jailparam_add("allow.mount", "true"); jailparam_add("allow.mount.devfs", "true"); @@ -210,6 +270,8 @@ bectl_cmd_jail(int argc, char *argv[]) */ if (strcmp(optarg, "host.hostname") == 0) default_hostname = false; + } else { + return (1); } break; case 'U': @@ -236,13 +298,14 @@ bectl_cmd_jail(int argc, char *argv[]) argc -= optind; argv += optind; - /* struct jail be_jail = { 0 }; */ if (argc < 1) { fprintf(stderr, "bectl jail: missing boot environment name\n"); return (usage(false)); } bootenv = argv[0]; + argc--; + argv++; /* * XXX TODO: if its already mounted, perhaps there should be a flag to @@ -264,45 +327,46 @@ bectl_cmd_jail(int argc, char *argv[]) * This is our indicator that path was not set by the user, so we'll use * the path that libbe generated for us. */ - if (mountpoint == NULL) + if (mountpoint == NULL) { jailparam_add("path", mnt_loc); - /* Create the jail for now, attach later as-needed */ - jid = jailparam_set(jp, jpused, JAIL_CREATE); - if (jid == -1) { - fprintf(stderr, "unable to create jail. error: %d\n", errno); + mountpoint = mnt_loc; + } + + if ((build_jailcmd(&jargv, interactive, argc, argv)) != 0) { + fprintf(stderr, "unable to build argument list for jail command\n"); return (1); } - jailparam_free(jp, jpused); - free(jp); - - /* We're not interactive, nothing more to do here. */ - if (!interactive) - return (0); - pid = fork(); - switch(pid) { + + switch (pid) { case -1: perror("fork"); return (1); case 0: - jail_attach(jid); - /* We're attached within the jail... good bye! */ - chdir("/"); - if (argc > 1) - execve(argv[1], &argv[1], NULL); - else - execl("/bin/sh", "/bin/sh", NULL); - fprintf(stderr, "bectl jail: failed to execute %s\n", - (argc > 1 ? argv[1] : "/bin/sh")); - _exit(1); + execv("/usr/sbin/jail", jargv); + fprintf(stderr, "bectl jail: failed to execute\n"); default: - /* Wait for the child to get back, see if we need to unjail */ waitpid(pid, NULL, 0); } + for (i = 0; jargv[i] != NULL; i++) { + free(jargv[i]); + } + free(jargv); + + if (!interactive) + return (0); + if (unjail) { - jail_remove(jid); + /* + * We're not checking the jail id result here because in the + * case of invalid param, or last command in jail was an error + * the jail will not exist upon exit. bectl_jail_cleanup will + * only jail_remove if the jid is >= 0. + */ + jid = bectl_locate_jail(bootenv); + bectl_jail_cleanup(mountpoint, jid); be_unmount(be, bootenv, 0); } @@ -319,7 +383,6 @@ bectl_search_jail_paths(const char *mnt) /* jail_getv expects name/value strings */ snprintf(lastjid, sizeof(lastjid), "%d", 0); - jid = 0; while ((jid = jail_getv(0, "lastjid", lastjid, "path", &jailpath, NULL)) != -1) { @@ -416,7 +479,7 @@ bectl_cmd_unjail(int argc, char *argv[]) return (1); } - jail_remove(jid); + bectl_jail_cleanup(path, jid); be_unmount(be, target, 0); return (0); Modified: projects/fuse2/sbin/ipfw/ipfw.8 ============================================================================== --- projects/fuse2/sbin/ipfw/ipfw.8 Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/sbin/ipfw/ipfw.8 Wed Mar 20 23:32:37 2019 (r345354) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2019 +.Dd March 19, 2019 .Dt IPFW 8 .Os .Sh NAME @@ -3300,6 +3300,7 @@ See .Sx SYSCTL VARIABLES for more info. .Sh IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION +.Ss Stateful translation .Nm supports in-kernel IPv6/IPv4 network address and protocol translation. Stateful NAT64 translation allows IPv6-only clients to contact IPv4 servers @@ -3317,7 +3318,8 @@ to be able use stateful NAT64 translator. Stateful NAT64 uses a bunch of memory for several types of objects. When IPv6 client initiates connection, NAT64 translator creates a host entry in the states table. -Each host entry has a number of ports group entries allocated on demand. +Each host entry uses preallocated IPv4 alias entry. +Each alias entry has a number of ports group entries allocated on demand. Ports group entries contains connection state entries. There are several options to control limits and lifetime for these objects. .Pp @@ -3337,6 +3339,11 @@ First time an original packet is handled and consumed and then it is handled again as translated packet. This behavior can be changed by sysctl variable .Va net.inet.ip.fw.nat64_direct_output . +Also translated packet can be tagged using +.Cm tag +rule action, and then matched by +.Cm tagged +opcode to avoid loops and extra overhead. .Pp The stateful NAT64 configuration command is the following: .Bd -ragged -offset indent @@ -3364,15 +3371,16 @@ to represent IPv4 addresses. This IPv6 prefix should b The translator implementation follows RFC6052, that restricts the length of prefixes to one of following: 32, 40, 48, 56, 64, or 96. The Well-Known IPv6 Prefix 64:ff9b:: must be 96 bits long. -.It Cm max_ports Ar number -Maximum number of ports reserved for upper level protocols to one IPv6 client. -All reserved ports are divided into chunks between supported protocols. -The number of connections from one IPv6 client is limited by this option. -Note that closed TCP connections still remain in the list of connections until -.Cm tcp_close_age -interval will not expire. -Default value is -.Ar 2048 . +The special +.Ar ::/length +prefix can be used to handle several IPv6 prefixes with one NAT64 instance. +The NAT64 instance will determine a destination IPv4 address from prefix +.Ar length . +.It Cm states_chunks Ar number +The number of states chunks in single ports group. +Each ports group by default can keep 64 state entries in single chunk. +The above value affects the maximum number of states that can be associated with single IPv4 alias address and port. +The value must be power of 2, and up to 128. .It Cm host_del_age Ar seconds The number of seconds until the host entry for a IPv6 client will be deleted and all its resources will be released due to inactivity. Modified: projects/fuse2/sbin/ipfw/ipfw2.h ============================================================================== --- projects/fuse2/sbin/ipfw/ipfw2.h Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/sbin/ipfw/ipfw2.h Wed Mar 20 23:32:37 2019 (r345354) @@ -278,6 +278,7 @@ enum tokens { TOK_AGG_LEN, TOK_AGG_COUNT, TOK_MAX_PORTS, + TOK_STATES_CHUNKS, TOK_JMAXLEN, TOK_PORT_RANGE, TOK_HOST_DEL_AGE, Modified: projects/fuse2/sbin/ipfw/nat64lsn.c ============================================================================== --- projects/fuse2/sbin/ipfw/nat64lsn.c Wed Mar 20 23:15:58 2019 (r345353) +++ projects/fuse2/sbin/ipfw/nat64lsn.c Wed Mar 20 23:32:37 2019 (r345354) @@ -87,68 +87,70 @@ nat64lsn_print_states(void *buf) char sflags[4], *sf, *proto; ipfw_obj_header *oh; ipfw_obj_data *od; - ipfw_nat64lsn_stg *stg; - ipfw_nat64lsn_state *ste; + ipfw_nat64lsn_stg_v1 *stg; + ipfw_nat64lsn_state_v1 *ste; uint64_t next_idx; int i, sz; oh = (ipfw_obj_header *)buf; od = (ipfw_obj_data *)(oh + 1); - stg = (ipfw_nat64lsn_stg *)(od + 1); + stg = (ipfw_nat64lsn_stg_v1 *)(od + 1); sz = od->head.length - sizeof(*od); next_idx = 0; while (sz > 0 && next_idx != 0xFF) { - next_idx = stg->next_idx; + next_idx = stg->next.index; sz -= sizeof(*stg); if (stg->count == 0) { stg++; continue; } - switch (stg->proto) { - case IPPROTO_TCP: - proto = "TCP"; - break; - case IPPROTO_UDP: - proto = "UDP"; - break; - case IPPROTO_ICMPV6: - proto = "ICMPv6"; - break; - } - inet_ntop(AF_INET6, &stg->host6, s, sizeof(s)); + /* + * NOTE: addresses are in network byte order, + * ports are in host byte order. + */ inet_ntop(AF_INET, &stg->alias4, a, sizeof(a)); - ste = (ipfw_nat64lsn_state *)(stg + 1); + ste = (ipfw_nat64lsn_state_v1 *)(stg + 1); for (i = 0; i < stg->count && sz > 0; i++) { sf = sflags; + inet_ntop(AF_INET6, &ste->host6, s, sizeof(s)); inet_ntop(AF_INET, &ste->daddr, f, sizeof(f)); - if (stg->proto == IPPROTO_TCP) { + switch (ste->proto) { + case IPPROTO_TCP: + proto = "TCP"; if (ste->flags & 0x02) *sf++ = 'S'; if (ste->flags & 0x04) *sf++ = 'E'; if (ste->flags & 0x01) *sf++ = 'F'; + break; + case IPPROTO_UDP: + proto = "UDP"; + break; + case IPPROTO_ICMP: + proto = "ICMPv6"; + break; } *sf = '\0'; - switch (stg->proto) { + switch (ste->proto) { case IPPROTO_TCP: case IPPROTO_UDP: printf("%s:%d\t%s:%d\t%s\t%s\t%d\t%s:%d\n", s, ste->sport, a, ste->aport, proto, sflags, ste->idle, f, ste->dport); break; - case IPPROTO_ICMPV6: + case IPPROTO_ICMP: printf("%s\t%s\t%s\t\t%d\t%s\n", s, a, proto, ste->idle, f); break; default: printf("%s\t%s\t%d\t\t%d\t%s\n", - s, a, stg->proto, ste->idle, f); + s, a, ste->proto, ste->idle, f); } ste++; sz -= sizeof(*ste); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903202332.x2KNWbgU016872>