aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/hastd/nv.c9
-rw-r--r--sbin/ifconfig/ifconfig.c9
-rw-r--r--sbin/ipf/libipf/printdstl_live.c3
-rw-r--r--sbin/ipf/libipf/printdstlist.c2
-rw-r--r--sbin/ipf/libipf/printdstlistdata.c5
-rw-r--r--sbin/ipf/libipf/printhash_live.c11
-rw-r--r--sbin/ipf/libipf/printhashdata.c19
-rw-r--r--sbin/ipf/libipf/printpooldata.c2
-rw-r--r--sbin/ipfw/nptv6.c49
-rw-r--r--sbin/mount/getmntopts.c1
-rw-r--r--sbin/rcorder/rcorder.c8
-rw-r--r--sbin/reboot/boot_i386.88
12 files changed, 75 insertions, 51 deletions
diff --git a/sbin/hastd/nv.c b/sbin/hastd/nv.c
index fd6b56c1148d..4e50d0026e7b 100644
--- a/sbin/hastd/nv.c
+++ b/sbin/hastd/nv.c
@@ -98,7 +98,7 @@ struct nvhdr {
} __packed;
#define NVH_DATA(nvh) ((unsigned char *)nvh + NVH_HSIZE(nvh))
#define NVH_HSIZE(nvh) \
- (sizeof(struct nvhdr) + roundup2((nvh)->nvh_namesize, 8))
+ (sizeof(struct nvhdr) + roundup2((size_t)(nvh)->nvh_namesize, 8))
#define NVH_DSIZE(nvh) \
(((nvh)->nvh_type & NV_ORDER_MASK) == NV_ORDER_HOST ? \
(nvh)->nvh_dsize : \
@@ -248,11 +248,8 @@ nv_validate(struct nv *nv, size_t *extrap)
break;
}
dsize = NVH_DSIZE(nvh);
- if (dsize == 0) {
- error = EINVAL;
- break;
- }
- if (size < NVH_SIZE(nvh)) {
+ if (roundup2(dsize, 8) == 0 ||
+ roundup2(dsize, 8) > size - NVH_HSIZE(nvh)) {
error = EINVAL;
break;
}
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 74dfb73f565f..bbfe7bb8adab 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1398,8 +1398,8 @@ unsetifdescr(const char *val, int value, int s, const struct afswtch *afp)
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
"\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \
-"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6" \
-"\36VXLAN_HWCSUM\37VXLAN_HWTSO\40TXTLS_RTLMT"
+"\26RXCSUM_IPV6\27TXCSUM_IPV6\30HWSTATS\31TXRTLMT\32HWRXTSTMP\33MEXTPG" \
+"\34TXTLS4\35TXTLS6\36VXLAN_HWCSUM\37VXLAN_HWTSO\40TXTLS_RTLMT"
/*
* Print the status of the interface. If an address family was
@@ -1678,11 +1678,6 @@ static struct cmd basic_cmds[] = {
DEF_CMD("-alias", -IFF_UP, notealias),
DEF_CMD("delete", -IFF_UP, notealias),
DEF_CMD("remove", -IFF_UP, notealias),
-#ifdef notdef
-#define EN_SWABIPS 0x1000
- DEF_CMD("swabips", EN_SWABIPS, setifflags),
- DEF_CMD("-swabips", -EN_SWABIPS, setifflags),
-#endif
DEF_CMD_ARG("netmask", setifnetmask),
DEF_CMD_ARG("metric", setifmetric),
DEF_CMD_ARG("broadcast", setifbroadaddr),
diff --git a/sbin/ipf/libipf/printdstl_live.c b/sbin/ipf/libipf/printdstl_live.c
index 088448e6656d..72cb75a832c9 100644
--- a/sbin/ipf/libipf/printdstl_live.c
+++ b/sbin/ipf/libipf/printdstl_live.c
@@ -40,6 +40,9 @@ printdstl_live( ippool_dst_t *d, int fd, char *name, int opts,
if ((d->ipld_flags & IPHASH_DELETE) != 0)
PRINTF("# ");
+ if (opts & OPT_SAVEOUT)
+ PRINTF("{\n");
+
if ((opts & OPT_DEBUG) == 0)
PRINTF("\t{");
diff --git a/sbin/ipf/libipf/printdstlist.c b/sbin/ipf/libipf/printdstlist.c
index 2cf41ffe414c..497d7004c94c 100644
--- a/sbin/ipf/libipf/printdstlist.c
+++ b/sbin/ipf/libipf/printdstlist.c
@@ -42,6 +42,8 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts,
return (NULL);
}
+ if (opts & OPT_SAVEOUT)
+ PRINTF("\t");
node = printdstlistnode(n, bcopywrap, opts, fields);
free(n);
diff --git a/sbin/ipf/libipf/printdstlistdata.c b/sbin/ipf/libipf/printdstlistdata.c
index 7940d2ae021b..546bf35cabf6 100644
--- a/sbin/ipf/libipf/printdstlistdata.c
+++ b/sbin/ipf/libipf/printdstlistdata.c
@@ -11,8 +11,7 @@
void
printdstlistdata( ippool_dst_t *pool, int opts)
{
-
- if ((opts & OPT_DEBUG) == 0) {
+ if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {
if ((pool->ipld_flags & IPDST_DELETE) != 0)
PRINTF("# ");
PRINTF("pool ");
@@ -24,7 +23,7 @@ printdstlistdata( ippool_dst_t *pool, int opts)
printunit(pool->ipld_unit);
- if ((opts & OPT_DEBUG) == 0) {
+ if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) {
PRINTF("/dstlist (name %s;", pool->ipld_name);
if (pool->ipld_policy != IPLDP_NONE) {
PRINTF(" policy ");
diff --git a/sbin/ipf/libipf/printhash_live.c b/sbin/ipf/libipf/printhash_live.c
index 3caaa5e022fe..427daa18316b 100644
--- a/sbin/ipf/libipf/printhash_live.c
+++ b/sbin/ipf/libipf/printhash_live.c
@@ -26,7 +26,9 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)
if ((hp->iph_flags & IPHASH_DELETE) != 0)
PRINTF("# ");
- if ((opts & OPT_DEBUG) == 0)
+ if (opts & OPT_SAVEOUT)
+ PRINTF("{\n");
+ else if ((opts & OPT_DEBUG) == 0)
PRINTF("\t{");
obj.ipfo_rev = IPFILTER_VERSION;
@@ -50,6 +52,8 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)
last = 1;
if (bcmp(&zero, &entry, sizeof(zero)) == 0)
break;
+ if (opts & OPT_SAVEOUT)
+ PRINTF("\t");
(void) printhashnode(hp, &entry, bcopywrap, opts, fields);
printed++;
}
@@ -59,7 +63,10 @@ printhash_live(iphtable_t *hp, int fd, char *name, int opts, wordtab_t *fields)
if (printed == 0)
putchar(';');
- if ((opts & OPT_DEBUG) == 0)
+ if ((opts & OPT_DEBUG) == 0 || (opts & OPT_SAVEOUT))
PRINTF(" };\n");
+
+ (void) ioctl(fd,SIOCIPFDELTOK, &iter.ili_key);
+
return (hp->iph_next);
}
diff --git a/sbin/ipf/libipf/printhashdata.c b/sbin/ipf/libipf/printhashdata.c
index 690243d63f1e..6fa62e67556d 100644
--- a/sbin/ipf/libipf/printhashdata.c
+++ b/sbin/ipf/libipf/printhashdata.c
@@ -12,7 +12,11 @@ void
printhashdata(iphtable_t *hp, int opts)
{
- if ((opts & OPT_DEBUG) == 0) {
+ if (opts & OPT_SAVEOUT) {
+ if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE)
+ PRINTF("# ");
+ PRINTF("pool ");
+ } else if ((opts & OPT_DEBUG) == 0) {
if ((hp->iph_type & IPHASH_ANON) == IPHASH_ANON)
PRINTF("# 'anonymous' table refs %d\n", hp->iph_ref);
if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE)
@@ -37,6 +41,8 @@ printhashdata(iphtable_t *hp, int opts)
}
PRINTF(" role=");
} else {
+ if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE)
+ PRINTF("# ");
PRINTF("Hash Table %s: %s",
ISDIGIT(*hp->iph_name) ? "Number" : "Name",
hp->iph_name);
@@ -48,7 +54,16 @@ printhashdata(iphtable_t *hp, int opts)
printunit(hp->iph_unit);
- if ((opts & OPT_DEBUG) == 0) {
+ if ((opts & OPT_SAVEOUT)) {
+ if ((hp->iph_type & ~IPHASH_ANON) == IPHASH_LOOKUP)
+ PRINTF("/hash");
+ PRINTF("(%s \"%s\"; size %lu;",
+ ISDIGIT(*hp->iph_name) ? "number" : "name",
+ hp->iph_name, (u_long)hp->iph_size);
+ if (hp->iph_seed != 0)
+ PRINTF(" seed %lu;", hp->iph_seed);
+ PRINTF(")\n", hp->iph_seed);
+ } else if ((opts & OPT_DEBUG) == 0) {
if ((hp->iph_type & ~IPHASH_ANON) == IPHASH_LOOKUP)
PRINTF(" type=hash");
PRINTF(" %s=%s size=%lu",
diff --git a/sbin/ipf/libipf/printpooldata.c b/sbin/ipf/libipf/printpooldata.c
index bd5af316eb19..b203522734be 100644
--- a/sbin/ipf/libipf/printpooldata.c
+++ b/sbin/ipf/libipf/printpooldata.c
@@ -13,6 +13,8 @@ printpooldata(ip_pool_t *pool, int opts)
{
if (opts & OPT_SAVEOUT) {
+ if ((pool->ipo_flags & IPOOL_DELETE) != 0)
+ PRINTF("# ");
PRINTF("pool ");
} else if ((opts & OPT_DEBUG) == 0) {
if ((pool->ipo_flags & IPOOL_ANON) != 0)
diff --git a/sbin/ipfw/nptv6.c b/sbin/ipfw/nptv6.c
index 45cee5df8125..5f66cce5aacb 100644
--- a/sbin/ipfw/nptv6.c
+++ b/sbin/ipfw/nptv6.c
@@ -154,10 +154,10 @@ static struct _s_x nptv6newcmds[] = {
{ NULL, 0 }
};
-
static void
nptv6_parse_prefix(const char *arg, struct in6_addr *prefix, int *len)
{
+ long plen;
char *p, *l;
p = strdup(arg);
@@ -168,13 +168,15 @@ nptv6_parse_prefix(const char *arg, struct in6_addr *prefix, int *len)
if (inet_pton(AF_INET6, p, prefix) != 1)
errx(EX_USAGE, "Bad prefix: %s", p);
if (l != NULL) {
- *len = (int)strtol(l, &l, 10);
- if (*l != '\0' || *len <= 0 || *len > 64)
+ plen = strtol(l, &l, 10);
+ if (*l != '\0' || plen < 8 || plen > 64)
errx(EX_USAGE, "Bad prefix length: %s", arg);
+ *len = plen;
} else
*len = 0;
free(p);
}
+
/*
* Creates new nptv6 instance
* ipfw nptv6 <NAME> create int_prefix <prefix> ext_prefix <prefix>
@@ -190,10 +192,10 @@ nptv6_create(const char *name, uint8_t set, int ac, char *av[])
struct in6_addr mask;
ipfw_nptv6_cfg *cfg;
ipfw_obj_lheader *olh;
- int tcmd, flags, plen;
+ int tcmd, flags, iplen, eplen, pplen;
char *p;
- plen = 0;
+ iplen = eplen = pplen = 0;
memset(buf, 0, sizeof(buf));
olh = (ipfw_obj_lheader *)buf;
cfg = (ipfw_nptv6_cfg *)(olh + 1);
@@ -206,10 +208,8 @@ nptv6_create(const char *name, uint8_t set, int ac, char *av[])
switch (tcmd) {
case TOK_INTPREFIX:
NEED1("IPv6 prefix required");
- nptv6_parse_prefix(*av, &cfg->internal, &plen);
+ nptv6_parse_prefix(*av, &cfg->internal, &iplen);
flags |= NPTV6_HAS_INTPREFIX;
- if (plen > 0)
- goto check_prefix;
ac--; av++;
break;
case TOK_EXTPREFIX:
@@ -217,10 +217,8 @@ nptv6_create(const char *name, uint8_t set, int ac, char *av[])
errx(EX_USAGE,
"Only one ext_prefix or ext_if allowed");
NEED1("IPv6 prefix required");
- nptv6_parse_prefix(*av, &cfg->external, &plen);
+ nptv6_parse_prefix(*av, &cfg->external, &eplen);
flags |= NPTV6_HAS_EXTPREFIX;
- if (plen > 0)
- goto check_prefix;
ac--; av++;
break;
case TOK_EXTIF:
@@ -237,24 +235,29 @@ nptv6_create(const char *name, uint8_t set, int ac, char *av[])
break;
case TOK_PREFIXLEN:
NEED1("IPv6 prefix length required");
- plen = strtol(*av, &p, 10);
-check_prefix:
- if (*p != '\0' || plen < 8 || plen > 64)
+ pplen = strtol(*av, &p, 10);
+ if (*p != '\0' || pplen < 8 || pplen > 64)
errx(EX_USAGE, "wrong prefix length: %s", *av);
- /* RFC 6296 Sec. 3.1 */
- if (cfg->plen > 0 && cfg->plen != plen) {
- warnx("Prefix length mismatch (%d vs %d). "
- "It was extended up to %d",
- cfg->plen, plen, MAX(plen, cfg->plen));
- plen = MAX(plen, cfg->plen);
- }
- cfg->plen = plen;
- flags |= NPTV6_HAS_PREFIXLEN;
ac--; av++;
break;
}
}
+ /* RFC 6296 Sec. 3.1 */
+ if (pplen != 0) {
+ if ((eplen != 0 && eplen != pplen) ||
+ (iplen != 0 && iplen != pplen))
+ errx(EX_USAGE, "prefix length mismatch");
+ cfg->plen = pplen;
+ flags |= NPTV6_HAS_PREFIXLEN;
+ } else if (eplen != 0 || iplen != 0) {
+ if (eplen != 0 && iplen != 0 && eplen != iplen)
+ errx(EX_USAGE, "prefix length mismatch");
+ warnx("use prefixlen instead");
+ cfg->plen = eplen ? eplen : iplen;
+ flags |= NPTV6_HAS_PREFIXLEN;
+ }
+
/* Check validness */
if ((flags & NPTV6_HAS_INTPREFIX) != NPTV6_HAS_INTPREFIX)
errx(EX_USAGE, "int_prefix required");
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index 31987f7b0b78..fab25466425f 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -192,6 +192,7 @@ getmntpoint(const char *name)
strncpy(statfsp->f_mntfromname, device, len);
}
if (stat(ddevname, &mntdevstat) == 0 &&
+ S_ISCHR(mntdevstat.st_mode) &&
mntdevstat.st_rdev == devstat.st_rdev)
return (statfsp);
}
diff --git a/sbin/rcorder/rcorder.c b/sbin/rcorder/rcorder.c
index 87b0e873c7ae..3d2a67c82a5a 100644
--- a/sbin/rcorder/rcorder.c
+++ b/sbin/rcorder/rcorder.c
@@ -980,9 +980,11 @@ do_file(filenode *fnode, strnodelist *stack_ptr)
fnode->last->next = fnode->next;
}
- if (fnode->issues_count)
- warnx("`%s' was seen in circular dependencies for %d times.",
- fnode->filename, fnode->issues_count);
+ if (fnode->issues_count) {
+ warnx("`%s' was seen in circular dependencies %d time%s.",
+ fnode->filename, fnode->issues_count,
+ fnode->issues_count > 1 ? "s" : "");
+ }
DPRINTF((stderr, "nuking %s\n", fnode->filename));
}
diff --git a/sbin/reboot/boot_i386.8 b/sbin/reboot/boot_i386.8
index 67f76a4ec4e3..612ff75bd850 100644
--- a/sbin/reboot/boot_i386.8
+++ b/sbin/reboot/boot_i386.8
@@ -32,9 +32,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94
-.\"
-.Dd July 11, 2020
+.Dd April 7, 2025
.Dt BOOT 8 i386
.Os
.Sh NAME
@@ -47,14 +45,14 @@ An automatic consistency check of the file systems will be performed,
and unless this fails, the system will resume multi-user operations.
.Pp
.Sy Cold starts .
-Most i386 PCs attempt to boot first from floppy disk drive 0 (sometimes
+Legacy i386 PCs attempt to boot first from floppy disk drive 0 (sometimes
known as drive A:) and, failing that, from hard disk drive 0 (sometimes
known as drive C:, or as drive 0x80 to the BIOS).
Some BIOSes allow
you to change this default sequence, and may also include a CD-ROM
drive as a boot device.
.Pp
-Some newer PCs boot using UEFI firmware, not BIOS.
+Contemporary PCs boot using UEFI firmware, not BIOS.
That process is described
in
.Xr uefi 8 .