diff options
Diffstat (limited to 'freebsd/sbin')
-rw-r--r-- | freebsd/sbin/dhclient/bpf.c | 8 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dhclient.c | 24 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifconfig.c | 10 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/iflagg.c | 7 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifmedia.c | 32 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/sfp.c | 69 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/comnd.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/identify.c | 33 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/identify_ext.c | 25 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/logpage.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/modules/wdc/wdc.c | 3 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/nc_util.c | 3 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/ns.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/nvmecontrol_ext.h | 2 | ||||
-rw-r--r-- | freebsd/sbin/nvmecontrol/power.c | 3 | ||||
-rw-r--r-- | freebsd/sbin/pfctl/parse.c | 31 | ||||
-rw-r--r-- | freebsd/sbin/ping6/ping6.c | 12 |
17 files changed, 197 insertions, 71 deletions
diff --git a/freebsd/sbin/dhclient/bpf.c b/freebsd/sbin/dhclient/bpf.c index e1bfacdc..55a8586f 100644 --- a/freebsd/sbin/dhclient/bpf.c +++ b/freebsd/sbin/dhclient/bpf.c @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include <netinet/udp.h> #include <netinet/if_ether.h> +#include <capsicum_helpers.h> + #define BPF_FORMAT "/dev/bpf%d" /* @@ -166,7 +168,7 @@ if_register_send(struct interface_info *info) error("Cannot lock bpf"); cap_rights_init(&rights, CAP_WRITE); - if (cap_rights_limit(info->wfdesc, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(info->wfdesc, &rights) < 0) error("Can't limit bpf descriptor: %m"); /* @@ -272,9 +274,9 @@ if_register_receive(struct interface_info *info) error("Cannot lock bpf"); cap_rights_init(&rights, CAP_IOCTL, CAP_EVENT, CAP_READ); - if (cap_rights_limit(info->rfdesc, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(info->rfdesc, &rights) < 0) error("Can't limit bpf descriptor: %m"); - if (cap_ioctls_limit(info->rfdesc, cmds, 2) < 0 && errno != ENOSYS) + if (caph_ioctls_limit(info->rfdesc, cmds, 2) < 0) error("Can't limit ioctls for bpf descriptor: %m"); } diff --git a/freebsd/sbin/dhclient/dhclient.c b/freebsd/sbin/dhclient/dhclient.c index 0e654e9b..f088489a 100644 --- a/freebsd/sbin/dhclient/dhclient.c +++ b/freebsd/sbin/dhclient/dhclient.c @@ -514,7 +514,7 @@ main(int argc, char *argv[]) close(pipe_fd[0]); privfd = pipe_fd[1]; cap_rights_init(&rights, CAP_READ, CAP_WRITE); - if (cap_rights_limit(privfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(privfd, &rights) < 0) error("can't limit private descriptor: %m"); if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1) @@ -528,7 +528,7 @@ main(int argc, char *argv[]) if (shutdown(routefd, SHUT_WR) < 0) error("can't shutdown route socket: %m"); cap_rights_init(&rights, CAP_EVENT, CAP_READ); - if (cap_rights_limit(routefd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(routefd, &rights) < 0) error("can't limit route socket: %m"); endpwent(); @@ -1776,7 +1776,7 @@ make_request(struct interface_info *ip, struct client_lease * lease) } /* set unique client identifier */ - char client_ident[sizeof(struct hardware)]; + char client_ident[sizeof(ip->hw_address.haddr) + 1]; if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) { int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ? ip->hw_address.hlen : sizeof(client_ident)-1; @@ -1930,12 +1930,10 @@ rewrite_client_leases(void) error("can't create %s: %m", path_dhclient_db); cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_FSYNC, CAP_FTRUNCATE, CAP_SEEK, CAP_WRITE); - if (cap_rights_limit(fileno(leaseFile), &rights) < 0 && - errno != ENOSYS) { + if (caph_rights_limit(fileno(leaseFile), &rights) < 0) { error("can't limit lease descriptor: %m"); } - if (cap_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0 && - errno != ENOSYS) { + if (caph_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0) { error("can't limit lease descriptor fcntls: %m"); } } else { @@ -2463,20 +2461,24 @@ go_daemon(void) cap_rights_init(&rights); - if (pidfile != NULL) + if (pidfile != NULL) { pidfile_write(pidfile); + if (caph_rights_limit(pidfile_fileno(pidfile), &rights) < 0) + error("can't limit pidfile descriptor: %m"); + } + if (nullfd != -1) { close(nullfd); nullfd = -1; } - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) error("can't limit stdin: %m"); cap_rights_init(&rights, CAP_WRITE); - if (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDOUT_FILENO, &rights) < 0) error("can't limit stdout: %m"); - if (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDERR_FILENO, &rights) < 0) error("can't limit stderr: %m"); } diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c index 2ce85e27..2b54d6a3 100644 --- a/freebsd/sbin/ifconfig/ifconfig.c +++ b/freebsd/sbin/ifconfig/ifconfig.c @@ -155,8 +155,16 @@ static struct module_map_entry { const char *kldname; } module_map[] = { { + .ifname = "tun", + .kldname = "if_tuntap", + }, + { + .ifname = "tap", + .kldname = "if_tuntap", + }, + { .ifname = "vmnet", - .kldname = "if_tap", + .kldname = "if_tuntap", }, { .ifname = "ipsec", diff --git a/freebsd/sbin/ifconfig/iflagg.c b/freebsd/sbin/ifconfig/iflagg.c index 4952196a..c328cf3b 100644 --- a/freebsd/sbin/ifconfig/iflagg.c +++ b/freebsd/sbin/ifconfig/iflagg.c @@ -126,10 +126,13 @@ setlaggrr_limit(const char *val, int d, int s, const struct afswtch *afp) bzero(&ro, sizeof(ro)); strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname)); - ro.ro_bkt = (int)strtol(val, NULL, 10); + ro.ro_opts = LAGG_OPT_RR_LIMIT; + ro.ro_bkt = (uint32_t)strtoul(val, NULL, 10); + if (ro.ro_bkt == 0) + errx(1, "Invalid round-robin stride: %s", val); if (ioctl(s, SIOCSLAGGOPTS, &ro) != 0) - err(1, "SIOCSLAGG"); + err(1, "SIOCSLAGGOPTS"); } static void diff --git a/freebsd/sbin/ifconfig/ifmedia.c b/freebsd/sbin/ifconfig/ifmedia.c index ac2af8b6..02893547 100644 --- a/freebsd/sbin/ifconfig/ifmedia.c +++ b/freebsd/sbin/ifconfig/ifmedia.c @@ -89,6 +89,7 @@ #include <err.h> #include <errno.h> #include <fcntl.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -137,18 +138,20 @@ static void media_status(int s) { struct ifmediareq ifmr; + struct ifdownreason ifdr; int *media_list, i; - int xmedia = 1; + bool no_carrier, xmedia; (void) memset(&ifmr, 0, sizeof(ifmr)); (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); + xmedia = true; /* * Check if interface supports extended media types. */ if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = 0; - if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { + xmedia = false; + if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { /* * Interface doesn't support SIOC{G,S}IFMEDIA. */ @@ -185,6 +188,7 @@ media_status(int s) putchar('\n'); if (ifmr.ifm_status & IFM_AVALID) { + no_carrier = false; printf("\tstatus: "); switch (IFM_TYPE(ifmr.ifm_active)) { case IFM_ETHER: @@ -192,7 +196,7 @@ media_status(int s) if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else - printf("no carrier"); + no_carrier = true; break; case IFM_IEEE80211: @@ -203,9 +207,27 @@ media_status(int s) else printf("running"); } else - printf("no carrier"); + no_carrier = true; break; } + if (no_carrier) { + printf("no carrier"); + memset(&ifdr, 0, sizeof(ifdr)); + strlcpy(ifdr.ifdr_name, name, sizeof(ifdr.ifdr_name)); + if (ioctl(s, SIOCGIFDOWNREASON, (caddr_t)&ifdr) == 0) { + switch (ifdr.ifdr_reason) { + case IFDR_REASON_MSG: + printf(" (%s)", ifdr.ifdr_msg); + break; + case IFDR_REASON_VENDOR: + printf(" (vendor code %d)", + ifdr.ifdr_vendor); + break; + default: + break; + } + } + } putchar('\n'); } diff --git a/freebsd/sbin/ifconfig/sfp.c b/freebsd/sbin/ifconfig/sfp.c index 0aa3300d..6444736f 100644 --- a/freebsd/sbin/ifconfig/sfp.c +++ b/freebsd/sbin/ifconfig/sfp.c @@ -88,7 +88,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" }, @@ -96,18 +96,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 } }; @@ -203,9 +208,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" }, @@ -226,8 +283,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" }, diff --git a/freebsd/sbin/nvmecontrol/comnd.c b/freebsd/sbin/nvmecontrol/comnd.c index a4fa686f..06af943d 100644 --- a/freebsd/sbin/nvmecontrol/comnd.c +++ b/freebsd/sbin/nvmecontrol/comnd.c @@ -207,7 +207,7 @@ arg_parse(int argc, char * const * argv, const struct cmd *f) if (lopts == NULL) err(1, "option memory"); #ifndef __rtems__ - p = shortopts = malloc((2 * n + 2) * sizeof(char)); + p = shortopts = malloc((n + 3) * sizeof(char)); #else /* __rtems__ */ p = shortopts = malloc((2 * n + 3) * sizeof(char)); #endif /* __rtems__ */ diff --git a/freebsd/sbin/nvmecontrol/identify.c b/freebsd/sbin/nvmecontrol/identify.c index e494fb59..452494ef 100644 --- a/freebsd/sbin/nvmecontrol/identify.c +++ b/freebsd/sbin/nvmecontrol/identify.c @@ -67,6 +67,7 @@ static struct options { void print_namespace(struct nvme_namespace_data *nsdata) { + char cbuf[UINT128_DIG + 1]; uint32_t i; uint32_t lbaf, lbads, ms, rp; uint8_t thin_prov, ptype; @@ -78,15 +79,12 @@ print_namespace(struct nvme_namespace_data *nsdata) flbas_fmt = (nsdata->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & NVME_NS_DATA_FLBAS_FORMAT_MASK; - printf("Size (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nsze, - (long long)nsdata->nsze / 1024 / 1024); - printf("Capacity (in LBAs): %lld (%lldM)\n", - (long long)nsdata->ncap, - (long long)nsdata->ncap / 1024 / 1024); - printf("Utilization (in LBAs): %lld (%lldM)\n", - (long long)nsdata->nuse, - (long long)nsdata->nuse / 1024 / 1024); + printf("Size: %lld blocks\n", + (long long)nsdata->nsze); + printf("Capacity: %lld blocks\n", + (long long)nsdata->ncap); + printf("Utilization: %lld blocks\n", + (long long)nsdata->nuse); printf("Thin Provisioning: %s\n", thin_prov ? "Supported" : "Not Supported"); printf("Number of LBA Formats: %d\n", nsdata->nlbaf+1); @@ -153,7 +151,22 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "", (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) & NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : ""); - printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob); + printf("Optimal I/O Boundary: %u blocks\n", nsdata->noiob); + printf("NVM Capacity: %s bytes\n", + uint128_to_str(to128(nsdata->nvmcap), cbuf, sizeof(cbuf))); + if ((nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) { + printf("Preferred Write Granularity: %u blocks", + nsdata->npwg + 1); + printf("Preferred Write Alignment: %u blocks", + nsdata->npwa + 1); + printf("Preferred Deallocate Granul: %u blocks", + nsdata->npdg + 1); + printf("Preferred Deallocate Align: %u blocks", + nsdata->npda + 1); + printf("Optimal Write Size: %u blocks", + nsdata->nows + 1); + } printf("Globally Unique Identifier: "); for (i = 0; i < sizeof(nsdata->nguid); i++) printf("%02x", nsdata->nguid[i]); diff --git a/freebsd/sbin/nvmecontrol/identify_ext.c b/freebsd/sbin/nvmecontrol/identify_ext.c index 44e0011b..bb0a0d51 100644 --- a/freebsd/sbin/nvmecontrol/identify_ext.c +++ b/freebsd/sbin/nvmecontrol/identify_ext.c @@ -126,7 +126,7 @@ nvme_print_controller(struct nvme_controller_data *cdata) if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%ld\n", PAGE_SIZE * (1L << cdata->mdts)); + printf("%ld bytes\n", PAGE_SIZE * (1L << cdata->mdts)); printf("Controller ID: 0x%04x\n", cdata->ctrlr_id); printf("Version: %d.%d.%d\n", (cdata->ver >> 16) & 0xffff, (cdata->ver >> 8) & 0xff, @@ -189,6 +189,18 @@ nvme_print_controller(struct nvme_controller_data *cdata) ns_smart ? "Yes" : "No"); printf("Error Log Page Entries: %d\n", cdata->elpe+1); printf("Number of Power States: %d\n", cdata->npss+1); + if (cdata->ver >= 0x010200) { + printf("Total NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.tnvmcap), + cbuf, sizeof(cbuf))); + printf("Unallocated NVM Capacity: %s bytes\n", + uint128_to_str(to128(cdata->untncap.unvmcap), + cbuf, sizeof(cbuf))); + } + printf("Host Buffer Preferred Size: %llu bytes\n", + (long long unsigned)cdata->hmpre * 4096); + printf("Host Buffer Minimum Size: %llu bytes\n", + (long long unsigned)cdata->hmmin * 4096); printf("\n"); printf("NVM Command Set Attributes\n"); @@ -240,13 +252,6 @@ nvme_print_controller(struct nvme_controller_data *cdata) (t == NVME_CTRLR_DATA_VWC_ALL_NO) ? ", no flush all" : (t == NVME_CTRLR_DATA_VWC_ALL_YES) ? ", flush all" : ""); - if (nsmgmt) { - printf("\n"); - printf("Namespace Drive Attributes\n"); - printf("==========================\n"); - printf("NVM total cap: %s\n", - uint128_to_str(to128(cdata->untncap.tnvmcap), cbuf, sizeof(cbuf))); - printf("NVM unallocated cap: %s\n", - uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf))); - } + if (cdata->ver >= 0x010201) + printf("\nNVM Subsystem Name: %.256s\n", cdata->subnqn); } diff --git a/freebsd/sbin/nvmecontrol/logpage.c b/freebsd/sbin/nvmecontrol/logpage.c index 8ab50bea..6765efdd 100644 --- a/freebsd/sbin/nvmecontrol/logpage.c +++ b/freebsd/sbin/nvmecontrol/logpage.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-user-space.h> + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * diff --git a/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c b/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c index 3cd5cdb7..81546676 100644 --- a/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c +++ b/freebsd/sbin/nvmecontrol/modules/wdc/wdc.c @@ -1,8 +1,7 @@ #include <machine/rtems-bsd-user-space.h> /*- - * Copyright (c) 2017 Netflix, Inc - * All rights reserved. + * Copyright (c) 2017 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/nvmecontrol/nc_util.c b/freebsd/sbin/nvmecontrol/nc_util.c index f2818871..3a349c6d 100644 --- a/freebsd/sbin/nvmecontrol/nc_util.c +++ b/freebsd/sbin/nvmecontrol/nc_util.c @@ -1,8 +1,7 @@ #include <machine/rtems-bsd-user-space.h> /*- - * Copyright (c) 2017 Netflix, Inc - * All rights reserved. + * Copyright (c) 2017 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/nvmecontrol/ns.c b/freebsd/sbin/nvmecontrol/ns.c index 841c1a87..f01d3213 100644 --- a/freebsd/sbin/nvmecontrol/ns.c +++ b/freebsd/sbin/nvmecontrol/ns.c @@ -3,7 +3,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2017 Netflix, Inc + * Copyright (c) 2017 Netflix, Inc. * Copyright (C) 2018-2019 Alexander Motin <mav@FreeBSD.org> * * Redistribution and use in source and binary forms, with or without diff --git a/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h b/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h index 43042dfa..d60fcd4d 100644 --- a/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h +++ b/freebsd/sbin/nvmecontrol/nvmecontrol_ext.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (C) 2018 Netflix + * Copyright (C) 2018 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/nvmecontrol/power.c b/freebsd/sbin/nvmecontrol/power.c index 9f6eeda4..2194d9f6 100644 --- a/freebsd/sbin/nvmecontrol/power.c +++ b/freebsd/sbin/nvmecontrol/power.c @@ -1,8 +1,7 @@ #include <machine/rtems-bsd-user-space.h> /*- - * Copyright (c) 2016 Netflix, Inc - * All rights reserved. + * Copyright (c) 2016 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/freebsd/sbin/pfctl/parse.c b/freebsd/sbin/pfctl/parse.c index 83002a82..daf408de 100644 --- a/freebsd/sbin/pfctl/parse.c +++ b/freebsd/sbin/pfctl/parse.c @@ -5,7 +5,7 @@ #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define YYPATCH 20170201 +#define YYPATCH 20170430 #define YYEMPTY (-1) #define yyclearin (yychar = YYEMPTY) @@ -2765,6 +2765,8 @@ process_tabledef(char *name, struct table_opts *opts) { struct pfr_buffer ab; struct node_tinit *ti; + unsigned long maxcount; + size_t s = sizeof(maxcount); bzero(&ab, sizeof(ab)); ab.pfrb_type = PFRB_ADDRS; @@ -2792,8 +2794,19 @@ process_tabledef(char *name, struct table_opts *opts) if (!(pf->opts & PF_OPT_NOACTION) && pfctl_define_table(name, opts->flags, opts->init_addr, pf->anchor->name, &ab, pf->anchor->ruleset.tticket)) { - yyerror("cannot define table %s: %s", name, - pfr_strerror(errno)); + + if (sysctlbyname("net.pf.request_maxcount", &maxcount, &s, + NULL, 0) == -1) + maxcount = 65535; + + if (ab.pfrb_size > maxcount) + yyerror("cannot define table %s: too many elements.\n" + "Consider increasing net.pf.request_maxcount.", + name); + else + yyerror("cannot define table %s: %s", name, + pfr_strerror(errno)); + goto _error; } pf->tdirty = 1; @@ -3795,8 +3808,10 @@ top: return (0); if (next == quotec || c == ' ' || c == '\t') c = next; - else if (next == '\n') + else if (next == '\n') { + file->lineno++; continue; + } else lungetc(next); } else if (c == quotec) { @@ -4382,7 +4397,7 @@ rt_tableid_max(void) return (RT_TABLEID_MAX); #endif } -#line 4388 "parse.c" +#line 4401 "parse.c" #if YYDEBUG #include <stdio.h> /* needed for printf */ @@ -9167,7 +9182,7 @@ case 420: yyval.v.host = calloc(1, sizeof(struct node_host)); if (yyval.v.host == NULL) err(1, "route_host: calloc"); - yyval.v.host->ifname = yystack.l_mark[0].v.string; + yyval.v.host->ifname = strdup(yystack.l_mark[0].v.string); set_ipmask(yyval.v.host, 128); yyval.v.host->next = NULL; yyval.v.host->tail = yyval.v.host; @@ -9180,7 +9195,7 @@ case 421: yyval.v.host = yystack.l_mark[-1].v.host; for (n = yystack.l_mark[-1].v.host; n != NULL; n = n->next) - n->ifname = yystack.l_mark[-2].v.string; + n->ifname = strdup(yystack.l_mark[-2].v.string); } break; case 422: @@ -9350,7 +9365,7 @@ case 447: #line 4575 "parse.y" { yyval.v.i = PF_OP_GT; } break; -#line 9356 "parse.c" +#line 9369 "parse.c" } yystack.s_mark -= yym; yystate = *yystack.s_mark; diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c index 122f6d0e..db3ab05a 100644 --- a/freebsd/sbin/ping6/ping6.c +++ b/freebsd/sbin/ping6/ping6.c @@ -1089,8 +1089,8 @@ main(int argc, char *argv[]) err(1, "caph_enter_casper"); cap_rights_init(&rights_stdin); - if (cap_rights_limit(STDIN_FILENO, &rights_stdin) < 0) - err(1, "cap_rights_limit stdin"); + if (caph_rights_limit(STDIN_FILENO, &rights_stdin) < 0) + err(1, "caph_rights_limit stdin"); if (caph_limit_stdout() < 0) err(1, "caph_limit_stdout"); if (caph_limit_stderr() < 0) @@ -1098,10 +1098,10 @@ main(int argc, char *argv[]) cap_rights_init(&rights_srecv, CAP_RECV, CAP_EVENT, CAP_SETSOCKOPT); if (caph_rights_limit(srecv, &rights_srecv) < 0) - err(1, "cap_rights_limit srecv"); + err(1, "caph_rights_limit srecv"); cap_rights_init(&rights_ssend, CAP_SEND, CAP_SETSOCKOPT); if (caph_rights_limit(ssend, &rights_ssend) < 0) - err(1, "cap_rights_limit ssend"); + err(1, "caph_rights_limit ssend"); #if defined(SO_SNDBUF) && defined(SO_RCVBUF) if (sockbufsize) { @@ -1153,10 +1153,10 @@ main(int argc, char *argv[]) cap_rights_clear(&rights_srecv, CAP_SETSOCKOPT); if (caph_rights_limit(srecv, &rights_srecv) < 0) - err(1, "cap_rights_limit srecv setsockopt"); + err(1, "caph_rights_limit srecv setsockopt"); cap_rights_clear(&rights_ssend, CAP_SETSOCKOPT); if (caph_rights_limit(ssend, &rights_ssend) < 0) - err(1, "cap_rights_limit ssend setsockopt"); + err(1, "caph_rights_limit ssend setsockopt"); printf("PING6(%lu=40+8+%lu bytes) ", (unsigned long)(40 + pingerlen()), (unsigned long)(pingerlen() - 8)); |