diff options
-rw-r--r-- | Makefile.inc1 | 9 | ||||
-rw-r--r-- | Makefile.libcompat | 8 | ||||
-rw-r--r-- | UPDATING | 10 | ||||
-rwxr-xr-x | etc/rc.d/routing | 36 | ||||
-rw-r--r-- | lib/libc++/Makefile | 2 | ||||
-rw-r--r-- | lib/libcxxrt/Makefile | 2 | ||||
-rw-r--r-- | share/mk/bsd.sys.mk | 26 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_xpt.c | 21 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c | 2 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c | 63 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 1 | ||||
-rw-r--r-- | sys/geom/geom_dev.c | 85 | ||||
-rwxr-xr-x | tests/etc/rc.d/routing_test.sh | 113 |
13 files changed, 195 insertions, 183 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index 012ea0c..e5e29e7 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -527,19 +527,12 @@ TARGET_ABI= gnueabihf TARGET_ABI= gnueabi .endif .endif -.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc -# GCC requires -isystem and -L when using a cross-compiler. -XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib -# Force using libc++ for external GCC. -XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ - -nostdinc++ -L${WORLDTMP}/../lib/libc++ -.else +.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "clang" TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 XCFLAGS+= -target ${TARGET_TRIPLE} .endif XCFLAGS+= --sysroot=${WORLDTMP} -.else .endif # ${MK_CROSS_COMPILER} == "no" .if !empty(BFLAGS) diff --git a/Makefile.libcompat b/Makefile.libcompat index 2cbaf2e..08d684c 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -72,14 +72,6 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} -# GCC requires -isystem when using a cross-compiler. -LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include - -.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc -# Force using libc++ for external GCC. -LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \ - -nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++ -.endif # Yes, the flags are redundant. LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \ @@ -31,6 +31,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160527: + CAM will now strip leading spaces from SCSI disks' serial numbers. + This will effect users who create UFS filesystems on SCSI disks using + those disk's diskid device nodes. For example, if /etc/fstab + previously contained a line like + "/dev/diskid/DISK-%20%20%20%20%20%20%20ABCDEFG0123456", you should + change it to "/dev/diskid/DISK-ABCDEFG0123456". Users of geom + transforms like gmirror may also be affected. ZFS users should + generally be fine. + 20160523: The bitstring(3) API has been updated with new functionality and improved performance. But it is binary-incompatible with the old API. diff --git a/etc/rc.d/routing b/etc/rc.d/routing index 5924486..3d3f5a5 100755 --- a/etc/rc.d/routing +++ b/etc/rc.d/routing @@ -126,12 +126,31 @@ routing_stop_atm() return 0 } +get_fibmod() +{ + local _fibs + + _fibs=$((`${SYSCTL_N} net.fibs` - 1)) + if [ ${_fibs} -gt 0 ]; then + echo "-fib 0-${_fibs}" + else + echo + fi +} + static_inet() { - local _action _if _skip + local _action _if _skip _fibmod _action=$1 _if=$2 + _fibmod=`get_fibmod` + + # Provide loopback route in all routing tables. This has to come + # first so that any following routes can be added. + static_routes="_loopback ${static_routes}" + route__loopback="-inet 127.0.0.1 -iface lo0 ${_fibmod}" + # Add default route. case ${defaultrouter} in [Nn][Oo] | '') @@ -166,27 +185,24 @@ static_inet() static_inet6() { - local _action _if _skip fibmod fibs allfibs + local _action _if _skip fibmod allfibs _action=$1 _if=$2 - # get the number of FIBs supported. - fibs=$((`${SYSCTL_N} net.fibs` - 1)) - allfibs=`${SYSCTL_N} net.add_addr_allfibs` - if [ "$fibs" -gt 0 ] && [ "$allfibs" -ne 0 ]; then - fibmod="-fib 0-$fibs" - else - fibmod= - fi + fibmod=`get_fibmod` # Add pre-defined static routes first. ipv6_static_routes="_v4mapped _v4compat ${ipv6_static_routes}" ipv6_static_routes="_lla _llma ${ipv6_static_routes}" + ipv6_static_routes="_loopback ${ipv6_static_routes}" # disallow "internal" addresses to appear on the wire ipv6_route__v4mapped="::ffff:0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}" ipv6_route__v4compat="::0.0.0.0 -prefixlen 96 ::1 -reject ${fibmod}" + # Create a loopback route in every fib + ipv6_route__loopback="::1 -prefixlen 128 -iface lo0 ${fibmod}" + # Disallow link-local unicast packets without outgoing scope # identifiers. However, if you set "ipv6_default_interface", # for the host case, you will allow to omit the identifiers. diff --git a/lib/libc++/Makefile b/lib/libc++/Makefile index 5db0934..984e70b 100644 --- a/lib/libc++/Makefile +++ b/lib/libc++/Makefile @@ -63,7 +63,7 @@ cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOMETA .endfor WARNS= 0 -CFLAGS+= -isystem ${HDRDIR} -isystem ${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT +CFLAGS+= -I${HDRDIR} -I${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT .if empty(CXXFLAGS:M-std=*) CXXFLAGS+= -std=c++11 .endif diff --git a/lib/libcxxrt/Makefile b/lib/libcxxrt/Makefile index f2efe8d..15420a6 100644 --- a/lib/libcxxrt/Makefile +++ b/lib/libcxxrt/Makefile @@ -21,7 +21,7 @@ SRCS+= libelftc_dem_gnu3.c\ guard.cc WARNS= 0 -CFLAGS+= -isystem ${SRCDIR} -nostdinc++ +CFLAGS+= -I${SRCDIR} -nostdinc++ .if empty(CXXFLAGS:M-std=*) CXXFLAGS+= -std=c++11 .endif diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 4f157be..7f74de1 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -178,6 +178,32 @@ ACFLAGS+= ${ACFLAGS.${.IMPSRC:T}} CFLAGS+= ${CFLAGS.${.IMPSRC:T}} CXXFLAGS+= ${CXXFLAGS.${.IMPSRC:T}} +# Special handling for external GCC. +.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc" +# GCC's --sysroot support for a cross-compiler without a default +# TARGET_SYSTEM_ROOT does not add sysroot/usr/include in or the C++ +# include path of sysroot/usr/include/c++/v1. They need to be added in +# when not using -nostdinc/-nostdinc++. This is not a problem with a +# non-cross-compiler external GCC or the in-tree cross-compiler GCC which +# has a default TARGET_SYSTEM_ROOT. +.if ${CC:M--sysroot=*} || ${CFLAGS:M--sysroot=*} +.if ${CFLAGS:M-nostdinc} == "" +CFLAGS+= -isystem =/usr/include +.endif +# Add in sysroot/usr/lib to ensure that it comes before /usr/local/lib +# from ports compilers. +LDFLAGS+= -L=/usr/lib +# We want to force building the system with our in-tree libc++. Note that +# this also requires a symlink in OBJDIR/lib/libc++/libstdc++.so to +# sysroot/usr/lib/libc++.so. +.if ${CXXFLAGS:M-nostdinc++} == "" && ${CXXFLAGS:M-nostdlib} == "" +CXXFLAGS+= -std=c++11 \ + -nostdinc++ -isystem =/usr/include/c++/v1 +LDFLAGS+= -L${OBJTOP}/lib/libc++ +.endif +.endif # --sysroot +.endif # X_COMPILER_TYPE == gcc + .if defined(SRCTOP) # Prevent rebuilding during install to support read-only objdirs. .if !make(all) && make(install) && empty(.MAKE.MODE:Mmeta) diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 30a9104..a8684c1 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -1559,13 +1559,22 @@ probe_device_check: (u_int8_t *)malloc((serial_buf->length + 1), M_CAMXPT, M_NOWAIT); if (path->device->serial_num != NULL) { + int start, slen; + + start = strspn(serial_buf->serial_num, " "); + slen = serial_buf->length - start; + if (slen <= 0) { + /* + * SPC5r05 says that an all-space serial + * number means no product serial number + * is available + */ + slen = 0; + } memcpy(path->device->serial_num, - serial_buf->serial_num, - serial_buf->length); - path->device->serial_num_len = - serial_buf->length; - path->device->serial_num[serial_buf->length] - = '\0'; + &serial_buf->serial_num[start], slen); + path->device->serial_num_len = slen; + path->device->serial_num[slen] = '\0'; } } else if (cam_periph_error(done_ccb, 0, SF_RETRY_UA|SF_NO_PRINT, diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c index 9f3b44b..3bb9146 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -120,7 +120,6 @@ * - ARC header release, as it removes from L2ARC buflists */ -#include <sys/types.h> #include <sys/spa.h> #include <sys/zio.h> #include <sys/zio_compress.h> @@ -141,7 +140,6 @@ #include <zfs_fletcher.h> #include <sys/sdt.h> -#include <vm/vm_pageout.h> #include <machine/vmparam.h> #ifdef illumos diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index 4ab5896..9cf5d18 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -85,32 +85,17 @@ vdev_geom_set_rotation_rate(vdev_t *vd, struct g_consumer *cp) } static void -vdev_geom_attrchanged(struct g_consumer *cp, const char *attr) +vdev_geom_set_physpath(struct g_consumer *cp, boolean_t do_null_update) { + boolean_t needs_update; vdev_t *vd; - spa_t *spa; char *physpath; int error, physpath_len; - vd = cp->private; - if (vd == NULL) - return; - - if (strcmp(attr, "GEOM::rotation_rate") == 0) { - vdev_geom_set_rotation_rate(vd, cp); - return; - } - - if (strcmp(attr, "GEOM::physpath") != 0) - return; - if (g_access(cp, 1, 0, 0) != 0) return; - /* - * Record/Update physical path information for this device. - */ - spa = vd->vdev_spa; + vd = cp->private; physpath_len = MAXPATHLEN; physpath = g_malloc(physpath_len, M_WAITOK|M_ZERO); error = g_io_getattr("GEOM::physpath", cp, &physpath_len, physpath); @@ -122,12 +107,46 @@ vdev_geom_attrchanged(struct g_consumer *cp, const char *attr) g_topology_assert(); old_physpath = vd->vdev_physpath; vd->vdev_physpath = spa_strdup(physpath); - spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); - if (old_physpath != NULL) + if (old_physpath != NULL) { + needs_update = (strcmp(old_physpath, + vd->vdev_physpath) != 0); spa_strfree(old_physpath); + } else + needs_update = do_null_update; } g_free(physpath); + + /* + * If the physical path changed, update the config. + * Only request an update for previously unset physpaths if + * requested by the caller. + */ + if (needs_update) + spa_async_request(vd->vdev_spa, SPA_ASYNC_CONFIG_UPDATE); + +} + +static void +vdev_geom_attrchanged(struct g_consumer *cp, const char *attr) +{ + vdev_t *vd; + char *old_physpath; + int error; + + vd = cp->private; + if (vd == NULL) + return; + + if (strcmp(attr, "GEOM::rotation_rate") == 0) { + vdev_geom_set_rotation_rate(vd, cp); + return; + } + + if (strcmp(attr, "GEOM::physpath") == 0) { + vdev_geom_set_physpath(cp, /*do_null_update*/B_TRUE); + return; + } } static void @@ -257,8 +276,10 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd) * 2) Set it to a linked list of vdevs, not just a single vdev */ cp->private = vd; - if (vd != NULL) + if (vd != NULL) { vd->vdev_tsd = cp; + vdev_geom_set_physpath(cp, /*do_null_update*/B_FALSE); + } cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; return (cp); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 6b25d39..a987138 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -75,7 +75,6 @@ #include <sys/sched.h> #include <sys/acl.h> #include <vm/vm_param.h> -#include <vm/vm_pageout.h> /* * Programming rules. diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 005cc3c..d74b92e 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -222,55 +222,68 @@ g_dev_print(void) } static void -g_dev_attrchanged(struct g_consumer *cp, const char *attr) +g_dev_set_physpath(struct g_consumer *cp) +{ + struct g_dev_softc *sc; + char *physpath; + int error, physpath_len; + + if (g_access(cp, 1, 0, 0) != 0) + return; + + sc = cp->private; + physpath_len = MAXPATHLEN; + physpath = g_malloc(physpath_len, M_WAITOK|M_ZERO); + error = g_io_getattr("GEOM::physpath", cp, &physpath_len, physpath); + g_access(cp, -1, 0, 0); + if (error == 0 && strlen(physpath) != 0) { + struct cdev *dev, *old_alias_dev; + struct cdev **alias_devp; + + dev = sc->sc_dev; + old_alias_dev = sc->sc_alias; + alias_devp = (struct cdev **)&sc->sc_alias; + make_dev_physpath_alias(MAKEDEV_WAITOK, alias_devp, dev, + old_alias_dev, physpath); + } else if (sc->sc_alias) { + destroy_dev((struct cdev *)sc->sc_alias); + sc->sc_alias = NULL; + } + g_free(physpath); +} + +static void +g_dev_set_media(struct g_consumer *cp) { struct g_dev_softc *sc; struct cdev *dev; char buf[SPECNAMELEN + 6]; sc = cp->private; - if (strcmp(attr, "GEOM::media") == 0) { - dev = sc->sc_dev; + dev = sc->sc_dev; + snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name); + devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK); + devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK); + dev = sc->sc_alias; + if (dev != NULL) { snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name); devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK); devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK); - dev = sc->sc_alias; - if (dev != NULL) { - snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name); - devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, - M_WAITOK); - devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, - M_WAITOK); - } - return; } +} - if (strcmp(attr, "GEOM::physpath") != 0) +static void +g_dev_attrchanged(struct g_consumer *cp, const char *attr) +{ + + if (strcmp(attr, "GEOM::media") == 0) { + g_dev_set_media(cp); return; + } - if (g_access(cp, 1, 0, 0) == 0) { - char *physpath; - int error, physpath_len; - - physpath_len = MAXPATHLEN; - physpath = g_malloc(physpath_len, M_WAITOK|M_ZERO); - error = - g_io_getattr("GEOM::physpath", cp, &physpath_len, physpath); - g_access(cp, -1, 0, 0); - if (error == 0 && strlen(physpath) != 0) { - struct cdev *old_alias_dev; - struct cdev **alias_devp; - - dev = sc->sc_dev; - old_alias_dev = sc->sc_alias; - alias_devp = (struct cdev **)&sc->sc_alias; - make_dev_physpath_alias(MAKEDEV_WAITOK, alias_devp, - dev, old_alias_dev, physpath); - } else if (sc->sc_alias) { - destroy_dev((struct cdev *)sc->sc_alias); - sc->sc_alias = NULL; - } - g_free(physpath); + if (strcmp(attr, "GEOM::physpath") == 0) { + g_dev_set_physpath(cp); + return; } } diff --git a/tests/etc/rc.d/routing_test.sh b/tests/etc/rc.d/routing_test.sh index 693af23..4fd6754 100755 --- a/tests/etc/rc.d/routing_test.sh +++ b/tests/etc/rc.d/routing_test.sh @@ -31,108 +31,43 @@ # # $FreeBSD$ -atf_test_case static_ipv6_loopback_route_for_each_fib cleanup -static_ipv6_loopback_route_for_each_fib_head() +atf_test_case static_ipv4_loopback_route_for_each_fib cleanup +static_ipv4_loopback_route_for_each_fib_head() { - atf_set "descr" "Every FIB should have a static IPv6 loopback route" - atf_set "require.user" "root" - atf_set "require.config" "fibs" - atf_set "require.progs" "sysrc" + atf_set "descr" "Every FIB should have a static IPv4 loopback route" } -static_ipv6_loopback_route_for_each_fib_body() +static_ipv4_loopback_route_for_each_fib_body() { - # Configure the TAP interface to use an RFC5737 nonrouteable address - # and a non-default fib - ADDR="192.0.2.2" - SUBNET="192.0.2.0" - MASK="24" + local nfibs fib + nfibs=`sysctl -n net.fibs` - # Check system configuration - if [ 0 != `sysctl -n net.add_addr_allfibs` ]; then - atf_skip "This test requires net.add_addr_allfibs=0" - fi - - get_fibs 1 - get_tap - - # Configure a TAP interface in /etc/rc.conf. Register the sysrc - # variable for cleanup. - echo "ifconfig_${TAP}" >> "sysrc_vars_to_cleanup" - sysrc ifconfig_${TAP}="${ADDR}/${MASK} fib ${FIB0}" - - # Start the interface - service netif start ${TAP} - # Check for an IPv6 loopback route - setfib ${FIB0} netstat -rn -f inet6 | grep -q "^::1.*lo0$" - if [ 0 -eq $? ]; then - atf_pass - else - setfib ${FIB0} netstat -rn -f inet6 - atf_fail "Did not find an IPv6 loopback route" - fi -} -static_ipv6_loopback_route_for_each_fib_cleanup() -{ - cleanup_sysrc - cleanup_tap + # Check for an IPv4 loopback route + for fib in `seq 0 $((${nfibs} - 1))`; do + atf_check -o match:"interface: lo0" -s exit:0 \ + setfib -F ${fib} route -4 get 127.0.0.1 + done } -atf_init_test_cases() +atf_test_case static_ipv6_loopback_route_for_each_fib cleanup +static_ipv6_loopback_route_for_each_fib_head() { - atf_add_test_case static_ipv6_loopback_route_for_each_fib + atf_set "descr" "Every FIB should have a static IPv6 loopback route" } - -# Looks up one or more fibs from the configuration data and validates them. -# Returns the results in the env varilables FIB0, FIB1, etc. -# parameter numfibs The number of fibs to lookup -get_fibs() +static_ipv6_loopback_route_for_each_fib_body() { - NUMFIBS=$1 - net_fibs=`sysctl -n net.fibs` - i=0 - while [ $i -lt "$NUMFIBS" ]; do - fib=`atf_config_get "fibs" | \ - awk -v i=$(( i + 1 )) '{print $i}'` - echo "fib is ${fib}" - eval FIB${i}=${fib} - if [ "$fib" -ge "$net_fibs" ]; then - msg="The ${i}th configured fib is ${fub}, which is " - msg="$msg not less than net.fibs (${net_fibs})" - atf_skip "$msg" - fi - i=$(( $i + 1 )) - done -} - + local nfibs fib + nfibs=`sysctl -n net.fibs` -# Creates a new tap(4) interface, registers it for cleanup, and returns the -# name via the environment variable TAP -get_tap() -{ - local TAPN=0 - while ! ifconfig tap${TAPN} create > /dev/null 2>&1; do - if [ "$TAPN" -ge 8 ]; then - atf_skip "Could not create a tap(4) interface" - else - TAPN=$(($TAPN + 1)) - fi + # Check for an IPv6 loopback route + for fib in `seq 0 $((${nfibs} - 1))`; do + atf_check -o match:"interface: lo0" -s exit:0 \ + setfib -F ${fib} route -6 get ::1 done - local TAPD=tap${TAPN} - # Record the TAP device so we can clean it up later - echo ${TAPD} >> "tap_devices_to_cleanup" - TAP=${TAPD} } -cleanup_sysrc() +atf_init_test_cases() { - for var in `cat "sysrc_vars_to_cleanup"`; do - sysrc -x $var - done + atf_add_test_case static_ipv4_loopback_route_for_each_fib + atf_add_test_case static_ipv6_loopback_route_for_each_fib } -cleanup_tap() -{ - for TAPD in `cat "tap_devices_to_cleanup"`; do - ifconfig ${TAPD} destroy - done -} |