Browse Source

Merge remote-tracking branch 'origin/freebsd/current/master' into hardened/current/master

Conflicts:
	share/man/man5/src.conf.5 (unresolved)
hardened/current/master
Shawn Webb 9 months ago
parent
commit
c6015b0b0f
Signed by: Shawn Webb <shawn.webb@hardenedbsd.org> GPG Key ID: FF2E67A277F8E1FA
53 changed files with 2174 additions and 761 deletions
  1. +2
    -0
      ObsoleteFiles.inc
  2. +18
    -20
      contrib/netbsd-tests/lib/libpthread/t_condwait.c
  3. +4
    -2
      lib/libc/sys/Makefile.inc
  4. +3
    -6
      lib/libsysdecode/Makefile
  5. +15
    -6
      lib/libsysdecode/mktables
  6. +63
    -6
      sbin/ifconfig/sfp.c
  7. +1
    -0
      sbin/ping/Makefile
  8. +2
    -48
      sbin/ping/ping.c
  9. +98
    -0
      sbin/ping/utils.c
  10. +10
    -25
      sbin/ping/utils.h
  11. +0
    -1
      sbin/ping6/Makefile
  12. +28
    -10
      sbin/ping6/ping6.c
  13. +6
    -2
      share/man/man5/src.conf.5
  14. +1
    -1
      share/man/man7/arch.7
  15. +1
    -0
      stand/defs.mk
  16. +2
    -0
      stand/efi/loader/copy.c
  17. +6
    -1
      stand/i386/boot2/Makefile
  18. +16
    -23
      stand/libsa/Makefile
  19. +0
    -348
      stand/libsa/qdivrem.c
  20. +0
    -114
      stand/libsa/quad.h
  21. +2
    -2
      sys/arm/mv/a37x0_gpio.c
  22. +1
    -2
      sys/arm64/arm64/pmap.c
  23. +1
    -1
      sys/arm64/conf/GENERIC
  24. +1
    -0
      sys/arm64/include/pmap.h
  25. +4
    -1
      sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  26. +3
    -2
      sys/compat/linuxkpi/common/include/linux/workqueue.h
  27. +1
    -0
      sys/conf/files.amd64
  28. +1
    -0
      sys/conf/files.i386
  29. +1
    -1
      sys/dev/fdt/simple_mfd.c
  30. +2
    -53
      sys/dev/md/md.c
  31. +1516
    -0
      sys/dev/ntb/test/ntb_tool.c
  32. +25
    -0
      sys/kern/subr_scanf.c
  33. +6
    -0
      sys/modules/dtb/mv/Makefile
  34. +1
    -1
      sys/modules/ntb/Makefile
  35. +9
    -0
      sys/modules/ntb/ntb_tool/Makefile
  36. +40
    -14
      sys/net/iflib.c
  37. +47
    -32
      sys/net/sff8472.h
  38. +1
    -0
      sys/ofed/drivers/infiniband/ulp/sdp/sdp.h
  39. +7
    -1
      sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c
  40. +1
    -1
      sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
  41. +3
    -2
      sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c
  42. +1
    -1
      sys/ofed/include/rdma/ib_mad.h
  43. +1
    -2
      sys/sys/mdioctl.h
  44. +1
    -1
      sys/sys/param.h
  45. +4
    -2
      sys/vm/vm_reserv.c
  46. +6
    -3
      tests/sys/netpfil/common/Makefile
  47. +156
    -0
      tests/sys/netpfil/common/nat.sh
  48. +14
    -4
      tests/sys/netpfil/common/utils.subr
  49. +2
    -2
      usr.bin/usbhidctl/usbhid.c
  50. +10
    -10
      usr.sbin/config/main.c
  51. +7
    -8
      usr.sbin/config/mkmakefile.c
  52. +7
    -2
      usr.sbin/usbconfig/usbconfig.8
  53. +16
    -0
      usr.sbin/usbconfig/usbconfig.c

+ 2
- 0
ObsoleteFiles.inc View File

@@ -38,6 +38,8 @@
# xargs -n1 | sort | uniq -d;
# done

# 20190816: dir.h removed from POSIX
OLD_FILES+=usr/include/sys/dir.h
# 20190729: gzip'ed a.out support removed
OLD_FILES+=usr/include/sys/inflate.h
# 20190722: cap_random(3) removed

+ 18
- 20
contrib/netbsd-tests/lib/libpthread/t_condwait.c View File

@@ -1,4 +1,4 @@
/* $NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $ */
/* $NetBSD: t_condwait.c,v 1.8 2019/08/11 11:42:23 martin Exp $ */

/*
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $");
__RCSID("$NetBSD: t_condwait.c,v 1.8 2019/08/11 11:42:23 martin Exp $");

#include <sys/time.h>
#include <errno.h>
@@ -50,10 +50,7 @@ static const int debug = 1;
static void *
run(void *param)
{
struct timespec ts, to, te;
#ifdef __FreeBSD__
struct timespec tw;
#endif
struct timespec ts, to, te, twmin, twmax;
clockid_t clck;
pthread_condattr_t attr;
pthread_cond_t cond;
@@ -88,22 +85,23 @@ run(void *param)
printf("elapsed: %lld.%09ld sec\n",
(long long)to.tv_sec, to.tv_nsec);
}
twmin.tv_sec = WAITTIME;
twmin.tv_nsec = 0;
if (isQEMU()) {
double to_seconds = to.tv_sec + 1e-9 * to.tv_nsec;
ATF_REQUIRE(to_seconds >= WAITTIME * 0.9);
/* Loose upper limit because of qemu timing bugs */
ATF_REQUIRE(to_seconds < WAITTIME * 2.5);
struct timespec td, t;
// td.tv_sec = 0;
// td.tv_nsec = 900000000;
t = twmin;
// timespecsub(&t, &td, &twmin);
td.tv_sec = 2;
td.tv_nsec = 500000000;
timespecadd(&t, &td, &twmax);
} else {
#ifdef __FreeBSD__
tw.tv_sec = WAITTIME;
tw.tv_nsec = 0;
ATF_REQUIRE(timespeccmp(&to, &tw, >=));
tw.tv_sec++;
ATF_REQUIRE(timespeccmp(&to, &tw, <=));
#else
ATF_REQUIRE_EQ(to.tv_sec, WAITTIME);
#endif
twmax = twmin;
twmax.tv_sec++;
}
ATF_REQUIRE(timespeccmp(&to, &twmin, >=));
ATF_REQUIRE(timespeccmp(&to, &twmax, <=));
break;
default:
ATF_REQUIRE_MSG(0, "pthread_cond_timedwait: %s", strerror(ret));
@@ -152,5 +150,5 @@ ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, cond_wait_real);
ATF_TP_ADD_TC(tp, cond_wait_mono);
return 0;
return atf_no_error();
}

+ 4
- 2
lib/libc/sys/Makefile.inc View File

@@ -134,12 +134,14 @@ NOTE_GNU_STACK=''
.endif

${SASM}:
printf '#include "compat.h"\n' > ${.TARGET}
printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET}
printf '#include "compat.h"\n' >> ${.TARGET}
printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET}
printf ${NOTE_GNU_STACK} >>${.TARGET}

${SPSEUDO}:
printf '#include "compat.h"\n' > ${.TARGET}
printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET}
printf '#include "compat.h"\n' >> ${.TARGET}
printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \
>> ${.TARGET}
printf ${NOTE_GNU_STACK} >>${.TARGET}

+ 3
- 6
lib/libsysdecode/Makefile View File

@@ -107,7 +107,7 @@ MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
sysdecode_mask.3 sysdecode_wait4_options.3 \
sysdecode_mask.3 sysdecode_wait6_options.3

CLEANFILES= ioctl.c ioctl.c.tmp tables.h tables.h.tmp
CLEANFILES= ioctl.c ioctl.c.tmp tables.h

.if defined(COMPAT_32BIT)
CPP+= -m32
@@ -123,11 +123,8 @@ CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}}

DEPENDOBJS+= tables.h
incdir=${SYSROOT:U${DESTDIR}}${INCLUDEDIR}
tables.h: mktables ${incdir}/netinet/in.h ${incdir}/netinet/tcp.h \
${incdir}/netinet6/in6.h
sh ${.CURDIR}/mktables ${incdir} ${.TARGET}.tmp && \
mv -f ${.TARGET}.tmp ${.TARGET}
tables.h: mktables
sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}

# mkioctls runs find(1) for headers so needs to rebuild every time. This used
# to be a hack only done in buildworld.

+ 15
- 6
lib/libsysdecode/mktables View File

@@ -43,7 +43,8 @@ fi
include_dir=$1
if [ -n "$2" ]; then
output_file="$2"
exec > "$output_file"
output_tmp=$(mktemp -u)
exec > "$output_tmp"
fi

all_headers=
@@ -167,9 +168,17 @@ fi

# Generate a .depend file for our output file
if [ -n "$output_file" ]; then
echo "$output_file: \\" > ".depend.$output_file"
echo "$all_headers" | tr ' ' '\n' | sort -u |
sed -e "s,^, $include_dir/," -e 's,$, \\,' >> \
".depend.$output_file"
echo >> ".depend.$output_file"
depend_tmp=$(mktemp -u)
{
echo "$output_file: \\"
echo "$all_headers" | tr ' ' '\n' | sort -u |
sed -e "s,^, $include_dir/," -e 's,$, \\,'
echo
} > "$depend_tmp"
if cmp -s "$output_tmp" "$output_file"; then
rm -f "$output_tmp" "$depend_tmp"
else
mv -f "$depend_tmp" ".depend.${output_file}"
mv -f "$output_tmp" "$output_file"
fi
fi

+ 63
- 6
sbin/ifconfig/sfp.c View File

@@ -69,7 +69,7 @@ struct _nv {
const char *find_value(struct _nv *x, int value);
const char *find_zero_bit(struct _nv *x, int value, int sz);

/* SFF-8024 Rev. 4.1 Table 4-3: Connector Types */
/* SFF-8024 Rev. 4.6 Table 4-3: Connector Types */
static struct _nv conn[] = {
{ 0x00, "Unknown" },
{ 0x01, "SC" },
@@ -77,18 +77,23 @@ static struct _nv conn[] = {
{ 0x03, "Fibre Channel Style 2 copper" },
{ 0x04, "BNC/TNC" },
{ 0x05, "Fibre Channel coaxial" },
{ 0x06, "FiberJack" },
{ 0x06, "Fiber Jack" },
{ 0x07, "LC" },
{ 0x08, "MT-RJ" },
{ 0x09, "MU" },
{ 0x0A, "SG" },
{ 0x0B, "Optical pigtail" },
{ 0x0C, "MPO Parallel Optic" },
{ 0x0C, "MPO 1x12 Parallel Optic" },
{ 0x0D, "MPO 2x16 Parallel Optic" },
{ 0x20, "HSSDC II" },
{ 0x21, "Copper pigtail" },
{ 0x22, "RJ45" },
{ 0x23, "No separable connector" },
{ 0x24, "MXC 2x16" },
{ 0x25, "CS optical connector" },
{ 0x26, "Mini CS optical connector" },
{ 0x27, "MPO 2x12 Parallel Optic" },
{ 0x28, "MPO 1x16 Parallel Optic" },
{ 0, NULL }
};

@@ -184,9 +189,61 @@ static struct _nv eth_1040g[] = {
};
#define SFF_8636_EXT_COMPLIANCE 0x80

/* SFF-8024 Rev. 4.2 table 4-4: Extended Specification Compliance */
/* SFF-8024 Rev. 4.6 table 4-4: Extended Specification Compliance */
static struct _nv eth_extended_comp[] = {
{ 0xFF, "Reserved" },
{ 0x55, "128GFC LW" },
{ 0x54, "128GFC SW" },
{ 0x53, "128GFC EA" },
{ 0x52, "64GFC LW" },
{ 0x51, "64GFC SW" },
{ 0x50, "64GFC EA" },
{ 0x4F, "Reserved" },
{ 0x4E, "Reserved" },
{ 0x4D, "Reserved" },
{ 0x4C, "Reserved" },
{ 0x4B, "Reserved" },
{ 0x4A, "Reserved" },
{ 0x49, "Reserved" },
{ 0x48, "Reserved" },
{ 0x47, "Reserved" },
{ 0x46, "200GBASE-LR4" },
{ 0x45, "50GBASE-LR" },
{ 0x44, "200G 1550nm PSM4" },
{ 0x43, "200GBASE-FR4" },
{ 0x42, "50GBASE-FR or 200GBASE-DR4" },
{ 0x41, "50GBASE-SR/100GBASE-SR2/200GBASE-SR4" },
{ 0x40, "50GBASE-CR/100GBASE-CR2/200GBASE-CR4" },
{ 0x3F, "Reserved" },
{ 0x3E, "Reserved" },
{ 0x3D, "Reserved" },
{ 0x3C, "Reserved" },
{ 0x3B, "Reserved" },
{ 0x3A, "Reserved" },
{ 0x39, "Reserved" },
{ 0x38, "Reserved" },
{ 0x37, "Reserved" },
{ 0x36, "Reserved" },
{ 0x35, "Reserved" },
{ 0x34, "Reserved" },
{ 0x33, "50GAUI/100GAUI-2/200GAUI-4 AOC (BER <2.6e-4)" },
{ 0x32, "50GAUI/100GAUI-2/200GAUI-4 ACC (BER <2.6e-4)" },
{ 0x31, "50GAUI/100GAUI-2/200GAUI-4 AOC (BER <1e-6)" },
{ 0x30, "50GAUI/100GAUI-2/200GAUI-4 ACC (BER <1e-6)" },
{ 0x2F, "Reserved" },
{ 0x2E, "Reserved" },
{ 0x2D, "Reserved" },
{ 0x2C, "Reserved" },
{ 0x2B, "Reserved" },
{ 0x2A, "Reserved" },
{ 0x29, "Reserved" },
{ 0x28, "Reserved" },
{ 0x27, "100G-LR" },
{ 0x26, "100G-FR" },
{ 0x25, "100GBASE-DR" },
{ 0x24, "4WDM-40 MSA" },
{ 0x23, "4WDM-20 MSA" },
{ 0x22, "4WDM-10 MSA" },
{ 0x21, "100G PAM4 BiDi" },
{ 0x20, "100G SWDM4" },
{ 0x1F, "40G SWDM4" },
@@ -207,8 +264,8 @@ static struct _nv eth_extended_comp[] = {
{ 0x10, "40GBASE-ER4" },
{ 0x0F, "Reserved" },
{ 0x0E, "Reserved" },
{ 0x0D, "25GBASE-CR CA-N" },
{ 0x0C, "25GBASE-CR CA-S" },
{ 0x0D, "25GBASE-CR CA-25G-N" },
{ 0x0C, "25GBASE-CR CA-25G-S" },
{ 0x0B, "100GBASE-CR4 or 25GBASE-CR CA-L" },
{ 0x0A, "Reserved" },
{ 0x09, "Obsolete" },

+ 1
- 0
sbin/ping/Makefile View File

@@ -5,6 +5,7 @@

PACKAGE=runtime
PROG= ping
SRCS= ping.c utils.c
MAN= ping.8
BINOWN= root
BINMODE=4555

+ 2
- 48
sbin/ping/ping.c View File

@@ -99,6 +99,8 @@ __FBSDID("$FreeBSD$");
#include <time.h>
#include <unistd.h>

#include "utils.h"

#define INADDR_LEN ((int)sizeof(in_addr_t))
#define TIMEVAL_LEN ((int)sizeof(struct tv32))
#define MASK_LEN (ICMP_MASKLEN - ICMP_MINLEN)
@@ -209,7 +211,6 @@ static volatile sig_atomic_t siginfo_p;
static cap_channel_t *capdns;

static void fill(char *, char *);
static u_short in_cksum(u_char *, int);
static cap_channel_t *capdns_setup(void);
static void check_status(void);
static void finish(void) __dead2;
@@ -1343,53 +1344,6 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timespec *tv)
}
}

/*
* in_cksum --
* Checksum routine for Internet Protocol family headers (C Version)
*/
u_short
in_cksum(u_char *addr, int len)
{
int nleft, sum;
u_char *w;
union {
u_short us;
u_char uc[2];
} last;
u_short answer;

nleft = len;
sum = 0;
w = addr;

/*
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
* sequential 16 bit words to it, and at the end, fold back all the
* carry bits from the top 16 bits into the lower 16 bits.
*/
while (nleft > 1) {
u_short data;

memcpy(&data, w, sizeof(data));
sum += data;
w += sizeof(data);
nleft -= sizeof(data);
}

/* mop up an odd byte, if necessary */
if (nleft == 1) {
last.uc[0] = *w;
last.uc[1] = 0;
sum += last.us;
}

/* add back carry outs from top 16 bits to low 16 bits */
sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
sum += (sum >> 16); /* add carry */
answer = ~sum; /* truncate to 16 bits */
return(answer);
}

/*
* status --
* Print out statistics when SIGINFO is received.

+ 98
- 0
sbin/ping/utils.c View File

@@ -0,0 +1,98 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Mike Muuss.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*/

#if 0
#ifndef lint
static const char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */

#ifndef lint
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#endif /* not lint */
#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <string.h>

#include "utils.h"

/*
* in_cksum --
* Checksum routine for Internet Protocol family headers (C Version)
*/
u_short
in_cksum(u_char *addr, int len)
{
int nleft, sum;
u_char *w;
union {
u_short us;
u_char uc[2];
} last;
u_short answer;

nleft = len;
sum = 0;
w = addr;

/*
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
* sequential 16 bit words to it, and at the end, fold back all the
* carry bits from the top 16 bits into the lower 16 bits.
*/
while (nleft > 1) {
u_short data;

memcpy(&data, w, sizeof(data));
sum += data;
w += sizeof(data);
nleft -= sizeof(data);
}

/* mop up an odd byte, if necessary */
if (nleft == 1) {
last.uc[0] = *w;
last.uc[1] = 0;
sum += last.us;
}

/* add back carry outs from top 16 bits to low 16 bits */
sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
sum += (sum >> 16); /* add carry */
answer = ~sum; /* truncate to 16 bits */
return(answer);
}

sys/sys/dir.h → sbin/ping/utils.h View File

@@ -1,8 +1,8 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (C) 2019 Jan Sucan <jansucan@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -12,14 +12,11 @@
* 2. 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.
* 3. Neither the name of the University 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 REGENTS OR CONTRIBUTORS BE LIABLE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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)
@@ -28,26 +25,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dir.h 8.2 (Berkeley) 1/4/94
* $FreeBSD$
*/

#ifndef _SYS_DIR_H_
#define _SYS_DIR_H_
#ifndef PING_H
#define PING_H 1

#include <sys/cdefs.h>
#include <sys/types.h>

#ifdef __CC_SUPPORTS_WARNING
#warning "The information in this file should be obtained from <dirent.h>"
#warning "and is provided solely (and temporarily) for backward compatibility."
#endif

#include <dirent.h>
u_short in_cksum(u_char *, int);

/*
* Backwards compatibility.
*/
#define direct dirent
#define DIRSIZ(dp) _GENERIC_DIRSIZ(dp)

#endif /* !_SYS_DIR_H_ */
#endif

+ 0
- 1
sbin/ping6/Makefile View File

@@ -7,7 +7,6 @@ PROG= ping6
MAN= ping6.8

CFLAGS+=-DIPSEC -DKAME_SCOPEID
WARNS?= 3

BINOWN= root
BINMODE=4555

+ 28
- 10
sbin/ping6/ping6.c View File

@@ -279,7 +279,7 @@ static void pr_suptypes(struct icmp6_nodeinfo *, size_t);
static void pr_nodeaddr(struct icmp6_nodeinfo *, int);
static int myechoreply(const struct icmp6_hdr *);
static int mynireply(const struct icmp6_nodeinfo *);
static char *dnsdecode(const u_char *, const u_char *, const u_char *,
static const char *dnsdecode(const u_char *, const u_char *, const u_char *,
char *, size_t);
static void pr_pack(u_char *, int, struct msghdr *);
static void pr_exthdrs(struct msghdr *);
@@ -1446,10 +1446,26 @@ mynireply(const struct icmp6_nodeinfo *nip)
return 0;
}

static char *
/*
* Decode a name from a DNS message.
*
* Format of the message is described in RFC 1035 subsection 4.1.4.
*
* Arguments:
* sp - Pointer to a DNS pointer octet or to the first octet of a label
* in the message.
* ep - Pointer to the end of the message (one step past the last octet).
* base - Pointer to the beginning of the message.
* buf - Buffer into which the decoded name will be saved.
* bufsiz - Size of the buffer 'buf'.
*
* Return value:
* Pointer to an octet immediately following the ending zero octet
* of the decoded label, or NULL if an error occured.
*/
static const char *
dnsdecode(const u_char *sp, const u_char *ep, const u_char *base, char *buf,
size_t bufsiz)
/*base for compressed name*/
{
int i;
const u_char *cp;
@@ -1502,8 +1518,7 @@ dnsdecode(const u_char *sp, const u_char *ep, const u_char *base, char *buf,
if (i != 0)
return NULL; /*not terminated*/
cp++;
sp = cp;
return buf;
return cp;
}

/*
@@ -1523,7 +1538,8 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
int hoplim;
struct sockaddr *from;
int fromlen;
u_char *cp = NULL, *dp, *end = buf + cc;
const u_char *cp = NULL;
u_char *dp, *end = buf + cc;
struct in6_pktinfo *pktinfo = NULL;
struct timespec tv, tp;
struct tv32 tpp;
@@ -1696,9 +1712,10 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr)
} else {
i = 0;
while (cp < end) {
if (dnsdecode((const u_char *)cp, end,
cp = dnsdecode((const u_char *)cp, end,
(const u_char *)(ni + 1), dnsname,
sizeof(dnsname)) == NULL) {
sizeof(dnsname));
if (cp == NULL) {
printf("???");
break;
}
@@ -2474,8 +2491,9 @@ pr_icmph(struct icmp6_hdr *icp, u_char *end)
}
printf(", subject=%s", niqcode[ni->ni_code]);
cp = (const u_char *)(ni + 1);
if (dnsdecode(cp, end, NULL, dnsname,
sizeof(dnsname)) != NULL)
cp = dnsdecode(cp, end, NULL, dnsname,
sizeof(dnsname));
if (cp != NULL)
printf("(%s)", dnsname);
else
printf("(invalid)");

+ 6
- 2
share/man/man5/src.conf.5 View File

@@ -1,6 +1,10 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.\" $FreeBSD$
<<<<<<< HEAD
.Dd August 14, 2019
=======
.Dd August 16, 2019
>>>>>>> origin/freebsd/current/master
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -260,7 +264,7 @@ and
.Pa crtend.o .
.Pp
This is a default setting on
powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64.
sparc64/sparc64.
.It Va WITH_BSD_CRTBEGIN
Enable the BSD licensed
.Pa crtbegin.o
@@ -268,7 +272,7 @@ and
.Pa crtend.o .
.Pp
This is a default setting on
amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64.
amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64.
.It Va WITH_BSD_GREP
Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
.It Va WITHOUT_BSNMP

+ 1
- 1
share/man/man7/arch.7 View File

@@ -93,7 +93,7 @@ architectures, the final release.
.It aarch64 Ta 11.0
.It alpha Ta 3.2 Ta 6.4
.It amd64 Ta 5.1
.It arm Ta 6.0
.It arm Ta 6.0 Ta 12.x
.It armeb Ta 8.0 Ta 11.x
.It armv6 Ta 10.0
.It armv7 Ta 12.0

+ 1
- 0
stand/defs.mk View File

@@ -34,6 +34,7 @@ SASRC= ${BOOTSRC}/libsa
SYSDIR= ${SRCTOP}/sys
UBOOTSRC= ${BOOTSRC}/uboot
ZFSSRC= ${SASRC}/zfs
LIBCSRC= ${SRCTOP}/lib/libc

BOOTOBJ= ${OBJTOP}/stand


+ 2
- 0
stand/efi/loader/copy.c View File

@@ -178,6 +178,8 @@ out:
#ifndef EFI_STAGING_SIZE
#if defined(__amd64__)
#define EFI_STAGING_SIZE 100
#elif defined(__arm__)
#define EFI_STAGING_SIZE 32
#else
#define EFI_STAGING_SIZE 64
#endif

+ 6
- 1
stand/i386/boot2/Makefile View File

@@ -78,7 +78,12 @@ boot2.ldr:
boot2.bin: boot2.out
${OBJCOPY} -S -O binary boot2.out ${.TARGET}

boot2.out: ${BTXCRT} boot2.o sio.o
# For __ashldi3
.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins
CFLAGS.ashldi3.c= -Wno-missing-prototypes
CLEANFILES+= ashldi3.o

boot2.out: ${BTXCRT} boot2.o sio.o ashldi3.o
${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}

SRCS= boot2.c boot2.h

+ 16
- 23
stand/libsa/Makefile View File

@@ -9,7 +9,6 @@
.include <bsd.init.mk>

LIBSA_CPUARCH?=${MACHINE_CPUARCH}
LIBC_SRC= ${SRCTOP}/lib/libc

LIB?= sa

@@ -21,20 +20,20 @@ SRCS+= gzguts.h zutil.h __main.c abort.c assert.c bcd.c environment.c getopt.c g
# private (pruned) versions of libc string functions
SRCS+= strcasecmp.c

.PATH: ${LIBC_SRC}/net
.PATH: ${LIBCSRC}/net

SRCS+= ntoh.c

# string functions from libc
.PATH: ${LIBC_SRC}/string
.PATH: ${LIBCSRC}/string
SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \
memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \
qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \
strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \
strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \
strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c

# stdlib functions from libc
.PATH: ${LIBC_SRC}/stdlib
.PATH: ${LIBCSRC}/stdlib
SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c

# common boot code
@@ -42,7 +41,7 @@ SRCS+= abs.c strtol.c strtoll.c strtoul.c strtoull.c
SRCS+= subr_boot.c

.if ${MACHINE_CPUARCH} == "arm"
.PATH: ${LIBC_SRC}/arm/gen
.PATH: ${LIBCSRC}/arm/gen

# Do not generate movt/movw, because the relocation fixup for them does not
# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8).
@@ -54,36 +53,30 @@ CFLAGS.clang+= -mno-movt
.endif
CFLAGS.clang+= -mfpu=none

# Compiler support functions
.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/
# __clzsi2 and ctzsi2 for various builtin functions
SRCS+= clzsi2.c ctzsi2.c
# Divide and modulus functions called by the compiler
SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c

.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/arm/
SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
.endif

.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
.PATH: ${LIBC_SRC}/${MACHINE_CPUARCH}/gen
.PATH: ${LIBCSRC}/${MACHINE_CPUARCH}/gen
.endif

.if ${MACHINE_CPUARCH} == "powerpc"
.PATH: ${LIBC_SRC}/quad
# Compiler support functions
.PATH: ${SRCTOP}/contrib/compiler-rt/lib/builtins/
# __clzsi2 and ctzsi2 for various builtin functions
SRCS+= clzsi2.c ctzsi2.c
# Divide and modulus functions called by the compiler
SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
SRCS+= ashldi3.c ashrdi3.c lshrdi3.c
SRCS+= syncicache.c
.endif

.if ${MACHINE_CPUARCH} == "mips"
.PATH: ${LIBC_SRC}/quad
SRCS+= ashldi3.c ashrdi3.c lshrdi3.c
.if ${MACHINE_CPUARCH} == "powerpc"
SRCS+= syncicache.c
.endif

# uuid functions from libc
.PATH: ${LIBC_SRC}/uuid
.PATH: ${LIBCSRC}/uuid
SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c

# _setjmp/_longjmp

+ 0
- 348
stand/libsa/qdivrem.c View File

@@ -1,348 +0,0 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* From: Id: qdivrem.c,v 1.7 1997/11/07 09:20:40 phk Exp
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

/*
* Multiprecision divide. This algorithm is from Knuth vol. 2 (2nd ed),
* section 4.3.1, pp. 257--259.
*/

#include "quad.h"

#define B (1 << HALF_BITS) /* digit base */

/* Combine two `digits' to make a single two-digit number. */
#define COMBINE(a, b) (((u_int)(a) << HALF_BITS) | (b))

_Static_assert(sizeof(int) / 2 == sizeof(short),
"Bitwise functions in libstand are broken on this architecture\n");

/* select a type for digits in base B: use unsigned short if they fit */
typedef unsigned short digit;

/*
* Shift p[0]..p[len] left `sh' bits, ignoring any bits that
* `fall out' the left (there never will be any such anyway).
* We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS.
*/
static void
shl(digit *p, int len, int sh)
{
int i;

for (i = 0; i < len; i++)
p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
p[i] = LHALF(p[i] << sh);
}

/*
* __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
*
* We do this in base 2-sup-HALF_BITS, so that all intermediate products
* fit within u_int. As a consequence, the maximum length dividend and
* divisor are 4 `digits' in this base (they are shorter if they have
* leading zeros).
*/
u_quad_t
__qdivrem(uq, vq, arq)
u_quad_t uq, vq, *arq;
{
union uu tmp;
digit *u, *v, *q;
digit v1, v2;
u_int qhat, rhat, t;
int m, n, d, j, i;
digit uspace[5], vspace[5], qspace[5];

/*
* Take care of special cases: divide by zero, and u < v.
*/
if (vq == 0) {
/* divide by zero. */
static volatile const unsigned int zero = 0;

tmp.ul[H] = tmp.ul[L] = 1 / zero;
if (arq)
*arq = uq;
return (tmp.q);
}
if (uq < vq) {
if (arq)
*arq = uq;
return (0);
}
u = &uspace[0];
v = &vspace[0];
q = &qspace[0];

/*
* Break dividend and divisor into digits in base B, then
* count leading zeros to determine m and n. When done, we
* will have:
* u = (u[1]u[2]...u[m+n]) sub B
* v = (v[1]v[2]...v[n]) sub B
* v[1] != 0
* 1 < n <= 4 (if n = 1, we use a different division algorithm)
* m >= 0 (otherwise u < v, which we already checked)
* m + n = 4
* and thus
* m = 4 - n <= 2
*/
tmp.uq = uq;
u[0] = 0;
u[1] = HHALF(tmp.ul[H]);
u[2] = LHALF(tmp.ul[H]);
u[3] = HHALF(tmp.ul[L]);
u[4] = LHALF(tmp.ul[L]);
tmp.uq = vq;
v[1] = HHALF(tmp.ul[H]);
v[2] = LHALF(tmp.ul[H]);
v[3] = HHALF(tmp.ul[L]);
v[4] = LHALF(tmp.ul[L]);
for (n = 4; v[1] == 0; v++) {
if (--n == 1) {
u_int rbj; /* r*B+u[j] (not root boy jim) */
digit q1, q2, q3, q4;

/*
* Change of plan, per exercise 16.
* r = 0;
* for j = 1..4:
* q[j] = floor((r*B + u[j]) / v),
* r = (r*B + u[j]) % v;
* We unroll this completely here.
*/
t = v[2]; /* nonzero, by definition */
q1 = u[1] / t;
rbj = COMBINE(u[1] % t, u[2]);
q2 = rbj / t;
rbj = COMBINE(rbj % t, u[3]);
q3 = rbj / t;
rbj = COMBINE(rbj % t, u[4]);
q4 = rbj / t;
if (arq)
*arq = rbj % t;
tmp.ul[H] = COMBINE(q1, q2);
tmp.ul[L] = COMBINE(q3, q4);
return (tmp.q);
}
}

/*
* By adjusting q once we determine m, we can guarantee that
* there is a complete four-digit quotient at &qspace[1] when
* we finally stop.
*/
for (m = 4 - n; u[1] == 0; u++)
m--;
for (i = 4 - m; --i >= 0;)
q[i] = 0;
q += 4 - m;

/*
* Here we run Program D, translated from MIX to C and acquiring
* a few minor changes.
*
* D1: choose multiplier 1 << d to ensure v[1] >= B/2.
*/
d = 0;
for (t = v[1]; t < B / 2; t <<= 1)
d++;
if (d > 0) {
shl(&u[0], m + n, d); /* u <<= d */
shl(&v[1], n - 1, d); /* v <<= d */
}
/*
* D2: j = 0.
*/
j = 0;
v1 = v[1]; /* for D3 -- note that v[1..n] are constant */
v2 = v[2]; /* for D3 */
do {
digit uj0, uj1, uj2;

/*
* D3: Calculate qhat (\^q, in TeX notation).
* Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
* let rhat = (u[j]*B + u[j+1]) mod v[1].
* While rhat < B and v[2]*qhat > rhat*B+u[j+2],
* decrement qhat and increase rhat correspondingly.
* Note that if rhat >= B, v[2]*qhat < rhat*B.
*/
uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */
uj1 = u[j + 1]; /* for D3 only */
uj2 = u[j + 2]; /* for D3 only */
if (uj0 == v1) {
qhat = B;
rhat = uj1;
goto qhat_too_big;
} else {
u_int nn = COMBINE(uj0, uj1);
qhat = nn / v1;
rhat = nn % v1;
}
while (v2 * qhat > COMBINE(rhat, uj2)) {
qhat_too_big:
qhat--;
if ((rhat += v1) >= B)
break;
}
/*
* D4: Multiply and subtract.
* The variable `t' holds any borrows across the loop.
* We split this up so that we do not require v[0] = 0,
* and to eliminate a final special case.
*/
for (t = 0, i = n; i > 0; i--) {
t = u[i + j] - v[i] * qhat - t;
u[i + j] = LHALF(t);
t = (B - HHALF(t)) & (B - 1);
}
t = u[j] - t;
u[j] = LHALF(t);
/*
* D5: test remainder.
* There is a borrow if and only if HHALF(t) is nonzero;
* in that (rare) case, qhat was too large (by exactly 1).
* Fix it by adding v[1..n] to u[j..j+n].
*/
if (HHALF(t)) {
qhat--;
for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
t += u[i + j] + v[i];
u[i + j] = LHALF(t);
t = HHALF(t);
}
u[j] = LHALF(u[j] + t);
}
q[j] = qhat;
} while (++j <= m); /* D7: loop on j. */

/*
* If caller wants the remainder, we have to calculate it as
* u[m..m+n] >> d (this is at most n digits and thus fits in
* u[m+1..m+n], but we may need more source digits).
*/
if (arq) {
if (d) {
for (i = m + n; i > m; --i)
u[i] = (u[i] >> d) |
LHALF(u[i - 1] << (HALF_BITS - d));
u[i] = 0;
}
tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
tmp.ul[L] = COMBINE(uspace[3], uspace[4]);
*arq = tmp.q;
}

tmp.ul[H] = COMBINE(qspace[1], qspace[2]);
tmp.ul[L] = COMBINE(qspace[3], qspace[4]);
return (tmp.q);
}

/*
* Divide two unsigned quads.
*/

u_quad_t
__udivdi3(a, b)
u_quad_t a, b;
{

return (__qdivrem(a, b, (u_quad_t *)0));
}

/*
* Return remainder after dividing two unsigned quads.
*/
u_quad_t
__umoddi3(a, b)
u_quad_t a, b;
{
u_quad_t r;

(void)__qdivrem(a, b, &r);
return (r);
}

/*
* Divide two signed quads.
* ??? if -1/2 should produce -1 on this machine, this code is wrong
*/
quad_t
__divdi3(a, b)
quad_t a, b;
{
u_quad_t ua, ub, uq;
int neg;

if (a < 0)
ua = -(u_quad_t)a, neg = 1;
else
ua = a, neg = 0;
if (b < 0)
ub = -(u_quad_t)b, neg ^= 1;
else
ub = b;
uq = __qdivrem(ua, ub, (u_quad_t *)0);
return (neg ? -uq : uq);
}

/*
* Return remainder after dividing two signed quads.
*
* XXX
* If -1/2 should produce -1 on this machine, this code is wrong.
*/
quad_t
__moddi3(a, b)
quad_t a, b;
{
u_quad_t ua, ub, ur;
int neg;

if (a < 0)
ua = -(u_quad_t)a, neg = 1;
else
ua = a, neg = 0;
if (b < 0)
ub = -(u_quad_t)b;
else
ub = b;
(void)__qdivrem(ua, ub, &ur);
return (neg ? -ur : ur);
}

+ 0
- 114
stand/libsa/quad.h View File

@@ -1,114 +0,0 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)quad.h 8.1 (Berkeley) 6/4/93
* $FreeBSD$
*/

/*
* Quad arithmetic.
*
* This library makes the following assumptions:
*
* - The type long long (aka quad_t) exists.
*
* - A quad variable is exactly twice as long as `long'.
*
* - The machine's arithmetic is two's complement.
*
* This library can provide 128-bit arithmetic on a machine with 128-bit
* quads and 64-bit longs, for instance, or 96-bit arithmetic on machines
* with 48-bit longs.
*/

#include <sys/cdefs.h>
#include <sys/types.h>
#include <limits.h>

_Static_assert(sizeof(quad_t) == sizeof(int) * 2,
"Bitwise function in libstand are broken on this architecture\n");

/*
* Depending on the desired operation, we view a `long long' (aka quad_t) in
* one or more of the following formats.
*/
union uu {
quad_t q; /* as a (signed) quad */
quad_t uq; /* as an unsigned quad */
int sl[2]; /* as two signed ints */
u_int ul[2]; /* as two unsigned ints */
};

/*
* Define high and low longwords.
*/
#define H _QUAD_HIGHWORD
#define L _QUAD_LOWWORD

/*
* Total number of bits in a quad_t and in the pieces that make it up.
* These are used for shifting, and also below for halfword extraction
* and assembly.
*/
#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT)
#define HALF_BITS (sizeof(int) * CHAR_BIT / 2)

/*
* Extract high and low shortwords from longword, and move low shortword of
* longword to upper half of long, i.e., produce the upper longword of
* ((quad_t)(x) << (number_of_bits_in_long/2)). (`x' must actually be u_long.)
*
* These are used in the multiply code, to split a longword into upper
* and lower halves, and to reassemble a product as a quad_t, shifted left
* (sizeof(long)*CHAR_BIT/2).
*/
#define HHALF(x) ((x) >> HALF_BITS)
#define LHALF(x) ((x) & ((1 << HALF_BITS) - 1))
#define LHUP(x) ((x) << HALF_BITS)

quad_t __divdi3(quad_t a, quad_t b);
quad_t __moddi3(quad_t a, quad_t b);
u_quad_t __qdivrem(u_quad_t u, u_quad_t v, u_quad_t *rem);
u_quad_t __udivdi3(u_quad_t a, u_quad_t b);
u_quad_t __umoddi3(u_quad_t a, u_quad_t b);

/*
* XXX
* Compensate for gcc 1 vs gcc 2. Gcc 1 defines ?sh?di3's second argument
* as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use
* both compilers.
*/
#if __GNUC__ >= 2
typedef unsigned int qshift_t;
#else
typedef u_quad_t qshift_t;
#endif

+ 2
- 2
sys/arm/mv/a37x0_gpio.c View File

@@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$");
#include "gpio_if.h"

static struct resource_spec a37x0_gpio_res_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Pinctl / GPIO */
{ SYS_RES_MEMORY, 1, RF_ACTIVE }, /* Interrupts control */
{ SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, /* Pinctl / GPIO */
{ SYS_RES_MEMORY, 1, RF_ACTIVE | RF_SHAREABLE }, /* Interrupts control */
{ -1, 0, 0 }
};


+ 1
- 2
sys/arm64/arm64/pmap.c View File

@@ -295,7 +295,6 @@ static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va);
static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap,
vm_offset_t va);

static int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode);
static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode);
static pt_entry_t *pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va);
static pt_entry_t *pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2,
@@ -5263,7 +5262,7 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma)
* latter case, the memory type may have been changed on some part of the
* virtual address range or the direct map.
*/
static int
int
pmap_change_attr(vm_offset_t va, vm_size_t size, int mode)
{
int error;

+ 1
- 1
sys/arm64/conf/GENERIC View File

@@ -326,4 +326,4 @@ options FDT
device acpi

# DTBs
makeoptions MODULES_EXTRA="dtb/allwinner dtb/rockchip dtb/rpi"
makeoptions MODULES_EXTRA="dtb/allwinner dtb/mv dtb/rockchip dtb/rpi"

+ 1
- 0
sys/arm64/include/pmap.h View File

@@ -143,6 +143,7 @@ extern vm_offset_t virtual_end;
((((va) | (pa)) & L1_OFFSET) == 0 && (size) >= L1_SIZE)

void pmap_bootstrap(vm_offset_t, vm_offset_t, vm_paddr_t, vm_size_t);
int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode);
void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode);
void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
vm_paddr_t pmap_kextract(vm_offset_t va);

+ 4
- 1
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c View File

@@ -2317,8 +2317,11 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp)
if (err == 0)
*vpp = ZTOV(zp);
ZFS_EXIT(zfsvfs);
if (err == 0)
if (err == 0) {
err = vn_lock(*vpp, flags);
if (err != 0)
vrele(*vpp);
}
if (err != 0)
*vpp = NULL;
return (err);

+ 3
- 2
sys/compat/linuxkpi/common/include/linux/workqueue.h View File

@@ -91,11 +91,12 @@ struct delayed_work {

#define DECLARE_DELAYED_WORK(name, fn) \
struct delayed_work name; \
static void name##_init(void *arg) \
static void __linux_delayed_ ## name ## _init(void *arg) \
{ \
linux_init_delayed_work(&name, fn); \
} \
SYSINIT(name, SI_SUB_LOCK, SI_ORDER_SECOND, name##_init, NULL)
SYSINIT(name, SI_SUB_LOCK, SI_ORDER_SECOND, \
__linux_delayed_ ## name##_init, NULL)

static inline struct delayed_work *
to_delayed_work(struct work_struct *work)

+ 1
- 0
sys/conf/files.amd64 View File

@@ -235,6 +235,7 @@ dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_amd | ntb_hw_in
dev/ntb/ntb_hw/ntb_hw_amd.c optional ntb_hw_amd | ntb_hw
dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw
dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw
dev/ntb/test/ntb_tool.c optional ntb_tool
dev/nvram/nvram.c optional nvram isa
dev/random/ivy.c optional rdrand_rng !random_loadable
dev/random/nehemiah.c optional padlock_rng !random_loadable

+ 1
- 0
sys/conf/files.i386 View File

@@ -166,6 +166,7 @@ dev/ntb/ntb_if.m optional ntb | ntb_transport | if_ntb | ntb_hw_amd | ntb_hw_in
dev/ntb/ntb_hw/ntb_hw_amd.c optional ntb_hw_amd | ntb_hw
dev/ntb/ntb_hw/ntb_hw_intel.c optional ntb_hw_intel | ntb_hw
dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw
dev/ntb/test/ntb_tool.c optional ntb_tool
dev/nvram/nvram.c optional nvram isa
dev/ofw/ofwpci.c optional fdt pci
dev/pcf/pcf_isa.c optional pcf

+ 1
- 1
sys/dev/fdt/simple_mfd.c View File

@@ -187,7 +187,7 @@ simple_mfd_attach(device_t dev)

if (ofw_bus_is_compatible(dev, "syscon")) {
sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
RF_ACTIVE | RF_SHAREABLE);
if (sc->mem_res == NULL) {
device_printf(dev,
"Cannot allocate memory resource\n");

+ 2
- 53
sys/dev/md/md.c View File

@@ -151,7 +151,6 @@ CTASSERT((sizeof(struct md_ioctl32)) == 436);
#define MDIOCATTACH_32 _IOC_NEWTYPE(MDIOCATTACH, struct md_ioctl32)
#define MDIOCDETACH_32 _IOC_NEWTYPE(MDIOCDETACH, struct md_ioctl32)
#define MDIOCQUERY_32 _IOC_NEWTYPE(MDIOCQUERY, struct md_ioctl32)
#define MDIOCLIST_32 _IOC_NEWTYPE(MDIOCLIST, struct md_ioctl32)
#define MDIOCRESIZE_32 _IOC_NEWTYPE(MDIOCRESIZE, struct md_ioctl32)
#endif /* COMPAT_FREEBSD32 */

@@ -1876,48 +1875,6 @@ kern_mdquery(struct md_req *mdr)
return (error);
}

static int
kern_mdlist_locked(struct md_req *mdr)
{
struct md_s *sc;
int i;

sx_assert(&md_sx, SA_XLOCKED);

/*
* Write the number of md devices to mdr->md_units[0].
* Write the unit number of the first (mdr->md_units_nitems - 2)
* units to mdr->md_units[1::(mdr->md_units - 2)] and terminate the
* list with -1.
*
* XXX: There is currently no mechanism to retrieve unit
* numbers for more than (MDNPAD - 2) units.
*
* XXX: Due to the use of LIST_INSERT_HEAD in mdnew(), the
* list of visible unit numbers not stable.
*/
i = 1;
LIST_FOREACH(sc, &md_softc_list, list) {
if (i < mdr->md_units_nitems - 1)
mdr->md_units[i] = sc->unit;
i++;
}
mdr->md_units[MIN(i, mdr->md_units_nitems - 1)] = -1;
mdr->md_units[0] = i - 1;
return (0);
}

static int
kern_mdlist(struct md_req *mdr)
{
int error;

sx_xlock(&md_sx);
error = kern_mdlist_locked(mdr);
sx_xunlock(&md_sx);
return (error);
}

/* Copy members that are not userspace pointers. */
#define MD_IOCTL2REQ(mdio, mdr) do { \
(mdr)->md_unit = (mdio)->md_unit; \
@@ -1958,8 +1915,7 @@ mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
case MDIOCATTACH:
case MDIOCDETACH:
case MDIOCRESIZE:
case MDIOCQUERY:
case MDIOCLIST: {
case MDIOCQUERY: {
struct md_ioctl *mdio = (struct md_ioctl *)addr;
if (mdio->md_version != MDIOVERSION)
return (EINVAL);
@@ -1976,8 +1932,7 @@ mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
case MDIOCATTACH_32:
case MDIOCDETACH_32:
case MDIOCRESIZE_32:
case MDIOCQUERY_32:
case MDIOCLIST_32: {
case MDIOCQUERY_32: {
struct md_ioctl32 *mdio = (struct md_ioctl32 *)addr;
if (mdio->md_version != MDIOVERSION)
return (EINVAL);
@@ -2019,12 +1974,6 @@ mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
#endif
error = kern_mdquery(&mdr);
break;
case MDIOCLIST:
#ifdef COMPAT_FREEBSD32
case MDIOCLIST_32:
#endif
error = kern_mdlist(&mdr);
break;
default:
error = ENOIOCTL;
}

+ 1516
- 0
sys/dev/ntb/test/ntb_tool.c
File diff suppressed because it is too large
View File


+ 25
- 0
sys/kern/subr_scanf.c View File

@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/ctype.h>
#include <sys/limits.h>
#include <sys/stddef.h>

/*
* Note that stdarg.h and the ANSI style va_start macro is used for both
@@ -61,6 +62,9 @@ __FBSDID("$FreeBSD$");
#define POINTER 0x10 /* weird %p pointer (`fake hex') */
#define NOSKIP 0x20 /* do not skip blanks */
#define QUAD 0x400
#define INTMAXT 0x800 /* j: intmax_t */
#define PTRDIFFT 0x1000 /* t: ptrdiff_t */
#define SIZET 0x2000 /* z: size_t */
#define SHORTSHORT 0x4000 /** hh: char */

/*
@@ -162,6 +166,9 @@ literal:
case '*':
flags |= SUPPRESS;
goto again;
case 'j':
flags |= INTMAXT;
goto again;
case 'l':
if (flags & LONG){
flags &= ~LONG;
@@ -173,6 +180,12 @@ literal:
case 'q':
flags |= QUAD;
goto again;
case 't':
flags |= PTRDIFFT;
goto again;
case 'z':
flags |= SIZET;
goto again;
case 'h':
if (flags & SHORT){
flags &= ~SHORT;
@@ -256,6 +269,12 @@ literal:
*va_arg(ap, long *) = nread;
else if (flags & QUAD)
*va_arg(ap, quad_t *) = nread;
else if (flags & INTMAXT)
*va_arg(ap, intmax_t *) = nread;
else if (flags & SIZET)
*va_arg(ap, size_t *) = nread;
else if (flags & PTRDIFFT)
*va_arg(ap, ptrdiff_t *) = nread;
else
*va_arg(ap, int *) = nread;
continue;
@@ -533,6 +552,12 @@ literal:
*va_arg(ap, long *) = res;
else if (flags & QUAD)
*va_arg(ap, quad_t *) = res;
else if (flags & INTMAXT)
*va_arg(ap, intmax_t *) = res;
else if (flags & PTRDIFFT)
*va_arg(ap, ptrdiff_t *) = res;
else if (flags & SIZET)
*va_arg(ap, size_t *) = res;
else
*va_arg(ap, int *) = res;
nassigned++;

+ 6
- 0
sys/modules/dtb/mv/Makefile View File

@@ -1,7 +1,13 @@
# $FreeBSD$
# All the dts files for Marvell systems we support.

.if ${MACHINE_ARCH} == "armv7"
DTS= \
armada-388-clearfog.dts \
armada-388-gp.dts
.elif ${MACHINE_ARCH} == "aarch64"
DTS= \
marvell/armada-3720-espressobin.dts
.endif

.include <bsd.dtb.mk>

+ 1
- 1
sys/modules/ntb/Makefile View File

@@ -1,5 +1,5 @@
# $FreeBSD$

SUBDIR= ntb ntb_hw_amd ntb_hw_intel ntb_hw_plx ntb_transport if_ntb
SUBDIR= ntb ntb_hw_amd ntb_hw_intel ntb_hw_plx ntb_transport ntb_tool if_ntb

.include <bsd.subdir.mk>

+ 9
- 0
sys/modules/ntb/ntb_tool/Makefile View File

@@ -0,0 +1,9 @@
# $FreeBSD$

.PATH: ${SRCTOP}/sys/dev/ntb/test

KMOD = ntb_tool
SRCS = ntb_tool.c
SRCS += device_if.h bus_if.h pci_if.h ntb_if.h

.include <bsd.kmod.mk>

+ 40
- 14
sys/net/iflib.c View File

@@ -702,6 +702,7 @@ static void iflib_altq_if_start(if_t ifp);
static int iflib_altq_if_transmit(if_t ifp, struct mbuf *m);
#endif
static int iflib_register(if_ctx_t);
static void iflib_deregister(if_ctx_t);
static void iflib_init_locked(if_ctx_t ctx);
static void iflib_add_device_sysctl_pre(if_ctx_t ctx);
static void iflib_add_device_sysctl_post(if_ctx_t ctx);
@@ -4790,6 +4791,7 @@ fail_queues:
IFDI_DETACH(ctx);
fail_unlock:
CTX_UNLOCK(ctx);
iflib_deregister(ctx);
fail_ctx_free:
device_set_softc(ctx->ifc_dev, NULL);
if (ctx->ifc_flags & IFC_SC_ALLOCATED)
@@ -4983,6 +4985,7 @@ fail_iflib_detach:
IFDI_DETACH(ctx);
fail_unlock:
CTX_UNLOCK(ctx);
iflib_deregister(ctx);
fail_ctx_free:
free(ctx->ifc_softc, M_IFLIB);
free(ctx, M_IFLIB);
@@ -4999,15 +5002,7 @@ iflib_pseudo_deregister(if_ctx_t ctx)
struct taskqgroup *tqg;
iflib_fl_t fl;

/* Unregister VLAN events */
if (ctx->ifc_vlan_attach_event != NULL)
EVENTHANDLER_DEREGISTER(vlan_config, ctx->ifc_vlan_attach_event);
if (ctx->ifc_vlan_detach_event != NULL)
EVENTHANDLER_DEREGISTER(vlan_unconfig, ctx->ifc_vlan_detach_event);

ether_ifdetach(ifp);
/* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
CTX_LOCK_DESTROY(ctx);
/* XXX drain any dependent tasks */
tqg = qgroup_if_io_tqg;
for (txq = ctx->ifc_txqs, i = 0; i < NTXQSETS(ctx); i++, txq++) {
@@ -5028,10 +5023,11 @@ iflib_pseudo_deregister(if_ctx_t ctx)
if (ctx->ifc_vflr_task.gt_uniq != NULL)
taskqgroup_detach(tqg, &ctx->ifc_vflr_task);

if_free(ifp);

iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);

iflib_deregister(ctx);

if (ctx->ifc_flags & IFC_SC_ALLOCATED)
free(ctx->ifc_softc, M_IFLIB);
free(ctx, M_IFLIB);
@@ -5118,19 +5114,19 @@ iflib_device_deregister(if_ctx_t ctx)
CTX_UNLOCK(ctx);

/* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
CTX_LOCK_DESTROY(ctx);
device_set_softc(ctx->ifc_dev, NULL);
iflib_free_intr_mem(ctx);

bus_generic_detach(dev);
if_free(ifp);

iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);

iflib_deregister(ctx);

device_set_softc(ctx->ifc_dev, NULL);
if (ctx->ifc_flags & IFC_SC_ALLOCATED)
free(ctx->ifc_softc, M_IFLIB);
unref_ctx_core_offset(ctx);
STATE_LOCK_DESTROY(ctx);
free(ctx, M_IFLIB);
return (0);
}
@@ -5379,6 +5375,36 @@ iflib_register(if_ctx_t ctx)
return (0);
}

static void
iflib_deregister(if_ctx_t ctx)
{
if_t ifp = ctx->ifc_ifp;

/* Remove all media */
ifmedia_removeall(&ctx->ifc_media);

/* Unregister VLAN events */
if (ctx->ifc_vlan_attach_event != NULL) {
EVENTHANDLER_DEREGISTER(vlan_config, ctx->ifc_vlan_attach_event);
ctx->ifc_vlan_attach_event = NULL;
}
if (ctx->ifc_vlan_detach_event != NULL) {
EVENTHANDLER_DEREGISTER(vlan_unconfig, ctx->ifc_vlan_detach_event);
ctx->ifc_vlan_detach_event = NULL;
}

/* Release kobject reference */
kobj_delete((kobj_t) ctx, NULL);

/* Free the ifnet structure */
if_free(ifp);

STATE_LOCK_DESTROY(ctx);

/* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
CTX_LOCK_DESTROY(ctx);
}

static int
iflib_queues_alloc(if_ctx_t ctx)
{

+ 47
- 32
sys/net/sff8472.h View File

@@ -379,7 +379,7 @@ enum {

/*
* Table 3.2 Identifier values.
* Identifier constants has taken from SFF-8024 rev 4.2 table 4.1
* Identifier constants has taken from SFF-8024 rev 4.6 table 4.1
* (as referenced by table 3.2 footer)
* */
enum {
@@ -396,10 +396,10 @@ enum {
SFF_8024_ID_X2 = 0xA, /* X2 */
SFF_8024_ID_DWDM_SFP = 0xB, /* DWDM-SFP */
SFF_8024_ID_QSFP = 0xC, /* QSFP */
SFF_8024_ID_QSFPPLUS = 0xD, /* QSFP+ */
SFF_8024_ID_QSFPPLUS = 0xD, /* QSFP+ or later */
SFF_8024_ID_CXP = 0xE, /* CXP */
SFF_8024_ID_HD4X = 0xF, /* Shielded Mini Multilane HD 4X */
SFF_8024_ID_HD8X = 0x10, /* Shielded Mini Multilane HD 8X */
SFF_8024_ID_HD4X = 0xF, /* Shielded Mini Multilane HD 4X */
SFF_8024_ID_HD8X = 0x10, /* Shielded Mini Multilane HD 8X */
SFF_8024_ID_QSFP28 = 0x11, /* QSFP28 or later */
SFF_8024_ID_CXP2 = 0x12, /* CXP2 (aka CXP28) */
SFF_8024_ID_CDFP = 0x13, /* CDFP (Style 1/Style 2) */
@@ -408,34 +408,49 @@ enum {
SFF_8024_ID_CDFP3 = 0x16, /* CDFP (Style3) */
SFF_8024_ID_MICROQSFP = 0x17, /* microQSFP */
SFF_8024_ID_QSFP_DD = 0x18, /* QSFP-DD 8X Pluggable Transceiver */
SFF_8024_ID_LAST = SFF_8024_ID_QSFP_DD
};

static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown",
"GBIC",
"SFF",
"SFP/SFP+/SFP28",
"XBI",
"Xenpak",
"XFP",
"XFF",
"XFP-E",
"XPAK",
"X2",
"DWDM-SFP/SFP+",
"QSFP",
"QSFP+",
"CXP",
"HD4X",
"HD8X",
"QSFP28",
"CXP2",
"CDFP",
"SMM4",
"SMM8",
"CDFP3",
"microQSFP",
"QSFP-DD"};
SFF_8024_ID_OSFP8X = 0x19, /* OSFP 8X Pluggable Transceiver */
SFF_8024_ID_SFP_DD = 0x1A, /* SFP-DD 2X Pluggable Transceiver */
SFF_8024_ID_DSFP = 0x1B, /* DSFP Dual SFF Pluggable Transceiver */
SFF_8024_ID_X4ML = 0x1C, /* x4 MiniLink/OcuLink */
SFF_8024_ID_X8ML = 0x1D, /* x8 MiniLink */
SFF_8024_ID_QSFP_CMIS = 0x1E, /* QSFP+ or later w/ Common Management
Interface Specification */
SFF_8024_ID_LAST = SFF_8024_ID_QSFP_CMIS
};

static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {
"Unknown",
"GBIC",
"SFF",
"SFP/SFP+/SFP28",
"XBI",
"Xenpak",
"XFP",
"XFF",
"XFP-E",
"XPAK",
"X2",
"DWDM-SFP/SFP+",
"QSFP",
"QSFP+",
"CXP",
"HD4X",
"HD8X",
"QSFP28",
"CXP2",
"CDFP",
"SMM4",
"SMM8",
"CDFP3",
"microQSFP",
"QSFP-DD",
"QSFP8X",
"SFP-DD",
"DSFP",
"x4MiniLink/OcuLink",
"x8MiniLink",
"QSFP+(CIMS)"
};

/* Keep compatibility with old definitions */
#define SFF_8472_ID_UNKNOWN SFF_8024_ID_UNKNOWN

+ 1
- 0
sys/ofed/drivers/infiniband/ulp/sdp/sdp.h View File

@@ -454,6 +454,7 @@ struct sdp_sock {
#define SDP_LOCK_ASSERT(ssk) rw_assert(&(ssk)->lock, RA_LOCKED)

MALLOC_DECLARE(M_SDP);
SYSCTL_DECL(_net_inet_sdp);

static inline void tx_sa_reset(struct tx_srcavail_state *tx_sa)
{

+ 7
- 1
sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c View File

@@ -48,6 +48,10 @@ enum {
static void
sdp_qp_event_handler(struct ib_event *event, void *data)
{
struct socket *sk = data;

sdp_dbg(sk, "QP Event: %s (%d)", ib_event_msg(event->event),
event->event);
}

static int
@@ -71,6 +75,7 @@ sdp_init_qp(struct socket *sk, struct rdma_cm_id *id)
{
struct ib_qp_init_attr qp_init_attr = {
.event_handler = sdp_qp_event_handler,
.qp_context = sk,
.cap.max_send_wr = SDP_TX_SIZE,
.cap.max_recv_wr = SDP_RX_SIZE,
.sq_sig_type = IB_SIGNAL_REQ_WR,
@@ -439,7 +444,8 @@ sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
break;
}

sdp_dbg(sk, "event %d done. status %d\n", event->event, rc);
sdp_dbg(sk, "event %s (%d) done. status %d\n",
rdma_event_msg(event->event), event->event, rc);

if (rc) {
SDP_WLOCK(ssk);

+ 1
- 1
sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c View File

@@ -1881,7 +1881,7 @@ next:
return (error);
}

static SYSCTL_NODE(_net_inet, -1, sdp, CTLFLAG_RW, 0, "SDP");
SYSCTL_NODE(_net_inet, -1, sdp, CTLFLAG_RW, 0, "SDP");

SYSCTL_PROC(_net_inet_sdp, TCPCTL_PCBLIST, pcblist,
CTLFLAG_RD | CTLTYPE_STRUCT, 0, 0, sdp_pcblist, "S,xtcpcb",

+ 3
- 2
sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c View File

@@ -481,8 +481,9 @@ sdp_process_rx_wc(struct sdp_sock *ssk, struct ib_wc *wc)
if (unlikely(wc->status)) {
if (ssk->qp_active && sk) {
sdp_dbg(sk, "Recv completion with error. "
"Status %d, vendor: %d\n",
wc->status, wc->vendor_err);
"Status %s (%d), vendor: %d\n",
ib_wc_status_msg(wc->status), wc->status,
wc->vendor_err);
sdp_abort(sk);
ssk->qp_active = 0;
}

+ 1
- 1
sys/ofed/include/rdma/ib_mad.h View File

@@ -44,7 +44,7 @@
#include <linux/list.h>

#include <rdma/ib_verbs.h>
#include <rdma/ib_user_mad.h>
#include <uapi/rdma/ib_user_mad.h>

/* Management base versions */
#define IB_MGMT_BASE_VERSION 1

+ 1
- 2
sys/sys/mdioctl.h View File

@@ -64,7 +64,7 @@ struct md_ioctl {
int md_fwheads; /* firmware heads */
int md_fwsectors; /* firmware sectors */
char *md_label; /* label of the device */
int md_pad[MDNPAD]; /* storage for MDIOCLIST */
int md_pad[MDNPAD]; /* padding */
};

#define MD_NAME "md"
@@ -81,7 +81,6 @@ struct md_ioctl {
#define MDIOCATTACH _IOWR('m', 0, struct md_ioctl) /* attach disk */
#define MDIOCDETACH _IOWR('m', 1, struct md_ioctl) /* detach disk */
#define MDIOCQUERY _IOWR('m', 2, struct md_ioctl) /* query status */
#define MDIOCLIST _IOWR('m', 3, struct md_ioctl) /* query status */
#define MDIOCRESIZE _IOWR('m', 4, struct md_ioctl) /* resize disk */

#define MD_CLUSTER 0x01 /* Don't cluster */

+ 1
- 1
sys/sys/param.h View File

@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1300039 /* Master, propagated to newvers */
#define __FreeBSD_version 1300040 /* Master, propagated to newvers */

/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

+ 4
- 2
sys/vm/vm_reserv.c View File

@@ -316,7 +316,8 @@ sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = &vm_phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
VM_LEVEL_0_SIZE <= seg->end) {
rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT];
fullpop += rv->popcnt == VM_LEVEL_0_NPAGES;
paddr += VM_LEVEL_0_SIZE;
@@ -1055,7 +1056,8 @@ vm_reserv_init(void)
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = &vm_phys_segs[segind];
paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
while (paddr + VM_LEVEL_0_SIZE > paddr && paddr +
VM_LEVEL_0_SIZE <= seg->end) {
rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT];
rv->pages = PHYS_TO_VM_PAGE(paddr);
rv->domain = seg->domain;

+ 6
- 3
tests/sys/netpfil/common/Makefile View File

@@ -5,9 +5,12 @@ PACKAGE= tests
TESTSDIR= ${TESTSBASE}/sys/netpfil/common


ATF_TESTS_SH+= pass_block \
ATF_TESTS_SH+= \
pass_block \
nat

${PACKAGE}FILES+= utils.subr \
runner.subr
${PACKAGE}FILES+= \
utils.subr \
runner.subr

.include <bsd.test.mk>

+ 156
- 0
tests/sys/netpfil/common/nat.sh View File

@@ -0,0 +1,156 @@
#-
# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
#
# Copyright (c) 2019 Ahsan Barkati
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. 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.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
#
# $FreeBSD$
#

. $(atf_get_srcdir)/utils.subr
. $(atf_get_srcdir)/runner.subr

basic_head()
{
atf_set descr 'Basic IPv4 NAT test'
atf_set require.user root
}

basic_body()
{
firewall=$1
firewall_init $firewall
nat_init $firewall

epair_host_nat=$(vnet_mkepair)
epair_client1_nat=$(vnet_mkepair)
epair_client2_nat=$(vnet_mkepair)

vnet_mkjail nat ${epair_host_nat}b ${epair_client1_nat}a ${epair_client2_nat}a
vnet_mkjail client1 ${epair_client1_nat}b
vnet_mkjail client2 ${epair_client2_nat}b

ifconfig ${epair_host_nat}a 198.51.100.2/24 up
jexec nat ifconfig ${epair_host_nat}b 198.51.100.1/24 up

jexec nat ifconfig ${epair_client1_nat}a 192.0.2.1/24 up
jexec client1 ifconfig ${epair_client1_nat}b 192.0.2.2/24 up

jexec nat ifconfig ${epair_client2_nat}a 192.0.3.1/24 up
jexec client2 ifconfig ${epair_client2_nat}b 192.0.3.2/24 up

jexec nat sysctl net.inet.ip.forwarding=1

jexec client1 route add -net 198.51.100.0/24 192.0.2.1
jexec client2 route add -net 198.51.100.0/24 192.0.3.1

# ping fails without NAT configuration
atf_check -s exit:2 -o ignore jexec client1 ping -t 1 -c 1 198.51.100.2
atf_check -s exit:2 -o ignore jexec client2 ping -t 1 -c 1 198.51.100.2

firewall_config nat ${firewall} \
"pf" \
"nat pass on ${epair_host_nat}b inet from any to any -> (${epair_host_nat}b)" \
"ipfw" \
"ipfw -q nat 123 config if ${epair_host_nat}b" \
"ipfw -q add 1000 nat 123 all from any to any" \
"ipfnat" \
"map ${epair_host_nat}b 192.0.3.0/24 -> 0/32" \
"map ${epair_host_nat}b 192.0.2.0/24 -> 0/32" \


# ping is successful now
atf_check -s exit:0 -o ignore jexec client1 ping -t 1 -c 1 198.51.100.2
atf_check -s exit:0 -o ignore jexec client2 ping -t 1 -c 1 198.51.100.2

}

basic_cleanup()
{
firewall=$1
firewall_cleanup $firewall
}

userspace_nat_head()
{
atf_set descr 'Nat test for ipfw using userspace natd'
atf_set require.user root
}
userspace_nat_body()
{
firewall=$1
firewall_init $firewall

if ! kldstat -q -m ipdivert; then
atf_skip "This test requires ipdivert module loaded"
fi

epair_host_nat=$(vnet_mkepair)
epair_client1_nat=$(vnet_mkepair)
epair_client2_nat=$(vnet_mkepair)

vnet_mkjail nat ${epair_host_nat}b ${epair_client1_nat}a ${epair_client2_nat}a
vnet_mkjail client1 ${epair_client1_nat}b
vnet_mkjail client2 ${epair_client2_nat}b

ifconfig ${epair_host_nat}a 198.51.100.2/24 up
jexec nat ifconfig ${epair_host_nat}b 198.51.100.1/24 up

jexec nat ifconfig ${epair_client1_nat}a 192.0.2.1/24 up
jexec client1 ifconfig ${epair_client1_nat}b 192.0.2.2/24 up

jexec nat ifconfig ${epair_client2_nat}a 192.0.3.1/24 up
jexec client2 ifconfig ${epair_client2_nat}b 192.0.3.2/24 up

jexec nat sysctl net.inet.ip.forwarding=1

jexec client1 route add -net 198.51.100.0/24 192.0.2.1
jexec client2 route add -net 198.51.100.0/24 192.0.3.1
# Test the userspace NAT of ipfw
# ping fails without NAT configuration
atf_check -s exit:2 -o ignore jexec client1 ping -t 1 -c 1 198.51.100.2
atf_check -s exit:2 -o ignore jexec client2 ping -t 1 -c 1 198.51.100.2

firewall_config nat ${firewall} \
"ipfw" \
"natd -interface ${epair_host_nat}b" \
"ipfw -q add divert natd all from any to any via ${epair_host_nat}b" \

# ping is successful now
atf_check -s exit:0 -o ignore jexec client1 ping -t 1 -c 1 198.51.100.2
atf_check -s exit:0 -o ignore jexec client2 ping -t 1 -c 1 198.51.100.2
}

userspace_nat_cleanup()
{
firewall=$1
firewall_cleanup $firewall
}

setup_tests \
basic \
pf \
ipfw \
ipfnat \
userspace_nat \
ipfw

+ 14
- 4
tests/sys/netpfil/common/utils.subr View File