aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-08 14:36:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-08 14:36:18 +0000
commit69415bc524558b9f64dd0524e76a08e267ea5bdf (patch)
treed21090413698a4d82b5dd4ceca16003ae1d3c482 /lib
parent1ae4f0f64b47a3153ae934308649bb0d0803d776 (diff)
parent81241f28284a6cb0589238d5a46bf48531da2b10 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/lib80211/lib80211_regdomain.c32
-rw-r--r--lib/lib80211/lib80211_regdomain.h2
-rw-r--r--lib/libc/include/libc_private.h2
-rw-r--r--lib/libc/stdlib/Makefile.inc4
-rw-r--r--lib/libc/stdlib/Symbol.map1
-rw-r--r--lib/libc/stdlib/cxa_thread_atexit.c110
-rw-r--r--lib/libc/stdlib/cxa_thread_atexit_impl.c153
-rw-r--r--lib/libcam/scsi_cmdparse.c74
-rw-r--r--lib/libprocstat/cd9660.c2
-rw-r--r--lib/libstand/bootp.c33
-rw-r--r--lib/libsysdecode/mktables2
11 files changed, 250 insertions, 165 deletions
diff --git a/lib/lib80211/lib80211_regdomain.c b/lib/lib80211/lib80211_regdomain.c
index 32901a6b56e7..35cc865efb58 100644
--- a/lib/lib80211/lib80211_regdomain.c
+++ b/lib/lib80211/lib80211_regdomain.c
@@ -123,6 +123,10 @@ start_element(void *data, const char *name, const char **attr)
mt->curband = &mt->rd->bands_11ng;
else if (iseq(mode, "11na"))
mt->curband = &mt->rd->bands_11na;
+ else if (iseq(mode, "11ac"))
+ mt->curband = &mt->rd->bands_11ac;
+ else if (iseq(mode, "11acg"))
+ mt->curband = &mt->rd->bands_11acg;
else
warnx("unknown mode \"%s\" at line %ld",
__DECONST(char *, mode),
@@ -184,6 +188,14 @@ decode_flag(struct mystate *mt, const char *p, int len)
FLAG(IEEE80211_CHAN_G),
FLAG(IEEE80211_CHAN_HT20),
FLAG(IEEE80211_CHAN_HT40),
+ FLAG(IEEE80211_CHAN_VHT20),
+ FLAG(IEEE80211_CHAN_VHT40),
+ FLAG(IEEE80211_CHAN_VHT80),
+ /*
+ * XXX VHT80_80? This likely should be done by
+ * 80MHz chan logic in net80211 / ifconfig.
+ */
+ FLAG(IEEE80211_CHAN_VHT160),
FLAG(IEEE80211_CHAN_ST),
FLAG(IEEE80211_CHAN_TURBO),
FLAG(IEEE80211_CHAN_PASSIVE),
@@ -515,6 +527,24 @@ lib80211_regdomain_readconfig(struct regdata *rdp, const void *p, size_t len)
}
nb->band = id;
}
+ LIST_FOREACH(nb, &dp->bands_11ac, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11ac band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
+ LIST_FOREACH(nb, &dp->bands_11acg, next) {
+ id = findid(rdp, nb->band, FREQBAND);
+ if (id == NULL) {
+ warnx("undefined 11acg band \"%s\"",
+ __DECONST(char *, nb->band));
+ errors++;
+ }
+ nb->band = id;
+ }
}
LIST_FOREACH(cp, &rdp->countries, next) {
id = cp->rd;
@@ -562,6 +592,8 @@ lib80211_regdomain_cleanup(struct regdata *rdp)
cleanup_bands(&dp->bands_11a);
cleanup_bands(&dp->bands_11ng);
cleanup_bands(&dp->bands_11na);
+ cleanup_bands(&dp->bands_11ac);
+ cleanup_bands(&dp->bands_11acg);
if (dp->name != NULL)
free(__DECONST(char *, dp->name));
}
diff --git a/lib/lib80211/lib80211_regdomain.h b/lib/lib80211/lib80211_regdomain.h
index d1803c255845..a8a4207c98ac 100644
--- a/lib/lib80211/lib80211_regdomain.h
+++ b/lib/lib80211/lib80211_regdomain.h
@@ -75,6 +75,8 @@ struct regdomain {
netband_head bands_11a; /* 11a operation */
netband_head bands_11ng;/* 11ng operation */
netband_head bands_11na;/* 11na operation */
+ netband_head bands_11ac;/* 11ac 5GHz operation */
+ netband_head bands_11acg;/* 11ac 2GHz operation */
LIST_ENTRY(regdomain) next;
};
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index 972eb2938ed4..74a7e3a841b0 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -272,6 +272,8 @@ void _malloc_thread_cleanup(void);
* thread is exiting, so its thread-local dtors should be called.
*/
void __cxa_thread_call_dtors(void);
+int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj,
+ void *dso_symbol) __hidden;
/*
* These functions are used by the threading libraries in order to protect
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index 935f3ffb35fa..00f90e2f81e0 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -5,7 +5,9 @@
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib
MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
- bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \
+ bsearch.c \
+ cxa_thread_atexit.c cxa_thread_atexit_impl.c \
+ div.c exit.c getenv.c getopt.c getopt_long.c \
getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \
hsearch_r.c imaxabs.c imaxdiv.c \
insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \
diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map
index 6cdc38e8a683..a239a42018d6 100644
--- a/lib/libc/stdlib/Symbol.map
+++ b/lib/libc/stdlib/Symbol.map
@@ -118,6 +118,7 @@ FBSD_1.4 {
FBSD_1.5 {
__cxa_thread_atexit;
+ __cxa_thread_atexit_impl;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/stdlib/cxa_thread_atexit.c b/lib/libc/stdlib/cxa_thread_atexit.c
index c96673136707..6f03ef0d3235 100644
--- a/lib/libc/stdlib/cxa_thread_atexit.c
+++ b/lib/libc/stdlib/cxa_thread_atexit.c
@@ -1,7 +1,10 @@
/*-
- * Copyright (c) 2016 Mahdi Mokhtari <mokhi64@gmail.com>
+ * Copyright (c) 2017 The FreeBSD Foundation
* All rights reserved.
*
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -27,114 +30,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/queue.h>
-#include "namespace.h"
-#include <errno.h>
-#include <link.h>
-#include <pthread.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "un-namespace.h"
#include "libc_private.h"
-/*
- * C++11 introduces the thread_local scope (like __thread with some
- * additions). As a key-feature it should support non-trivial
- * destructors, registered with __cxa_thread_atexit() to be executed
- * at the thread termination.
- *
- * The implemention keeps a _Thread_local list of destructors per each
- * thread, and calls __cxa_thread_call_dtors() on each thread's exit
- * to do cleanup. For a thread calling exit(3), in particular, for
- * the initial thread returning from main(), we call
- * __cxa_thread_call_dtors() inside exit().
- *
- * It could be possible that a dynamically loaded library, use
- * thread_local variable but is dlclose()'d before thread exit. The
- * destructor of this variable will then try to access the address,
- * for calling it but it's unloaded, so it'll crash. We're using
- * __elf_phdr_match_addr() to detect and prevent such cases and so
- * prevent the crash.
- */
-
-#define CXA_DTORS_ITERATIONS 4
-
-struct cxa_thread_dtor {
- void *obj;
- void (*func)(void *);
- void *dso;
- LIST_ENTRY(cxa_thread_dtor) entry;
-};
-static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors =
- LIST_HEAD_INITIALIZER(dtors);
-
int
__cxa_thread_atexit(void (*dtor_func)(void *), void *obj, void *dso_symbol)
{
- struct cxa_thread_dtor *new_dtor;
-
- new_dtor = malloc(sizeof(*new_dtor));
- if (new_dtor == NULL) {
- errno = ENOMEM; /* forcibly override malloc(3) error */
- return (-1);
- }
-
- new_dtor->obj = obj;
- new_dtor->func = dtor_func;
- new_dtor->dso = dso_symbol;
- LIST_INSERT_HEAD(&dtors, new_dtor, entry);
- return (0);
-}
-
-static void
-walk_cb_call(struct cxa_thread_dtor *dtor)
-{
- struct dl_phdr_info phdr_info;
-
- if (_rtld_addr_phdr(dtor->dso, &phdr_info) &&
- __elf_phdr_match_addr(&phdr_info, dtor->func))
- dtor->func(dtor->obj);
- else
- fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from "
- "unloaded dso, skipping\n", (void *)(dtor->func));
-}
-
-static void
-walk_cb_nocall(struct cxa_thread_dtor *dtor __unused)
-{
-}
-
-static void
-cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *))
-{
- struct cxa_thread_dtor *dtor, *tdtor;
-
- LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) {
- LIST_REMOVE(dtor, entry);
- cb(dtor);
- free(dtor);
- }
-}
-
-/*
- * This is the callback function we use to call destructors, once for
- * each thread. It is called in exit(3) in libc/stdlib/exit.c and
- * before exit_thread() in libthr/thread/thr_exit.c.
- */
-void
-__cxa_thread_call_dtors(void)
-{
- int i;
-
- for (i = 0; i < CXA_DTORS_ITERATIONS && !LIST_EMPTY(&dtors); i++)
- cxa_thread_walk(walk_cb_call);
- if (!LIST_EMPTY(&dtors)) {
- fprintf(stderr, "Thread %p is exiting with more "
- "thread-specific dtors created after %d iterations "
- "of destructor calls\n",
- _pthread_self(), i);
- cxa_thread_walk(walk_cb_nocall);
- }
+ return (__cxa_thread_atexit_hidden(dtor_func, obj, dso_symbol));
}
diff --git a/lib/libc/stdlib/cxa_thread_atexit_impl.c b/lib/libc/stdlib/cxa_thread_atexit_impl.c
new file mode 100644
index 000000000000..0f0a7a314fa9
--- /dev/null
+++ b/lib/libc/stdlib/cxa_thread_atexit_impl.c
@@ -0,0 +1,153 @@
+/*-
+ * Copyright (c) 2016 Mahdi Mokhtari <mokhi64@gmail.com>
+ * Copyright (c) 2016, 2017 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/queue.h>
+#include "namespace.h"
+#include <errno.h>
+#include <link.h>
+#include <pthread.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "un-namespace.h"
+#include "libc_private.h"
+
+/*
+ * C++11 introduces the thread_local scope (like __thread with some
+ * additions). As a key-feature it should support non-trivial
+ * destructors, registered with __cxa_thread_atexit() to be executed
+ * at the thread termination.
+ *
+ * The implemention keeps a _Thread_local list of destructors per each
+ * thread, and calls __cxa_thread_call_dtors() on each thread's exit
+ * to do cleanup. For a thread calling exit(3), in particular, for
+ * the initial thread returning from main(), we call
+ * __cxa_thread_call_dtors() inside exit().
+ *
+ * It could be possible that a dynamically loaded library, use
+ * thread_local variable but is dlclose()'d before thread exit. The
+ * destructor of this variable will then try to access the address,
+ * for calling it but it's unloaded, so it'll crash. We're using
+ * __elf_phdr_match_addr() to detect and prevent such cases and so
+ * prevent the crash.
+ */
+
+#define CXA_DTORS_ITERATIONS 4
+
+struct cxa_thread_dtor {
+ void *obj;
+ void (*func)(void *);
+ void *dso;
+ LIST_ENTRY(cxa_thread_dtor) entry;
+};
+static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors =
+ LIST_HEAD_INITIALIZER(dtors);
+
+int
+__cxa_thread_atexit_impl(void (*dtor_func)(void *), void *obj,
+ void *dso_symbol)
+{
+
+ return (__cxa_thread_atexit_hidden(dtor_func, obj, dso_symbol));
+}
+
+int
+__cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj,
+ void *dso_symbol)
+{
+ struct cxa_thread_dtor *new_dtor;
+
+ new_dtor = malloc(sizeof(*new_dtor));
+ if (new_dtor == NULL) {
+ errno = ENOMEM; /* forcibly override malloc(3) error */
+ return (-1);
+ }
+
+ new_dtor->obj = obj;
+ new_dtor->func = dtor_func;
+ new_dtor->dso = dso_symbol;
+ LIST_INSERT_HEAD(&dtors, new_dtor, entry);
+ return (0);
+}
+
+static void
+walk_cb_call(struct cxa_thread_dtor *dtor)
+{
+ struct dl_phdr_info phdr_info;
+
+ if (_rtld_addr_phdr(dtor->dso, &phdr_info) &&
+ __elf_phdr_match_addr(&phdr_info, dtor->func))
+ dtor->func(dtor->obj);
+ else
+ fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from "
+ "unloaded dso, skipping\n", (void *)(dtor->func));
+}
+
+static void
+walk_cb_nocall(struct cxa_thread_dtor *dtor __unused)
+{
+}
+
+static void
+cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *))
+{
+ struct cxa_thread_dtor *dtor, *tdtor;
+
+ LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) {
+ LIST_REMOVE(dtor, entry);
+ cb(dtor);
+ free(dtor);
+ }
+}
+
+/*
+ * This is the callback function we use to call destructors, once for
+ * each thread. It is called in exit(3) in libc/stdlib/exit.c and
+ * before exit_thread() in libthr/thread/thr_exit.c.
+ */
+void
+__cxa_thread_call_dtors(void)
+{
+ int i;
+
+ for (i = 0; i < CXA_DTORS_ITERATIONS && !LIST_EMPTY(&dtors); i++)
+ cxa_thread_walk(walk_cb_call);
+
+ if (!LIST_EMPTY(&dtors)) {
+ fprintf(stderr, "Thread %p is exiting with more "
+ "thread-specific dtors created after %d iterations "
+ "of destructor calls\n",
+ _pthread_self(), i);
+ cxa_thread_walk(walk_cb_nocall);
+ }
+}
diff --git a/lib/libcam/scsi_cmdparse.c b/lib/libcam/scsi_cmdparse.c
index 4a322ba549e1..8b43066bfa62 100644
--- a/lib/libcam/scsi_cmdparse.c
+++ b/lib/libcam/scsi_cmdparse.c
@@ -100,10 +100,11 @@ __FBSDID("$FreeBSD$");
*/
static int
-do_buff_decode(u_int8_t *databuf, size_t len,
+do_buff_decode(u_int8_t *buff, size_t len,
void (*arg_put)(void *, int , void *, int, char *),
void *puthook, const char *fmt, va_list *ap)
{
+ int ind = 0;
int assigned = 0;
int width;
int suppress;
@@ -112,21 +113,17 @@ do_buff_decode(u_int8_t *databuf, size_t len,
static u_char mask[] = {0, 0x01, 0x03, 0x07, 0x0f,
0x1f, 0x3f, 0x7f, 0xff};
int value;
- u_char *base = databuf;
char *intendp;
char letter;
char field_name[80];
-# define ARG_PUT(ARG) \
- do \
- { \
- if (!suppress) \
- { \
+#define ARG_PUT(ARG) \
+ do { \
+ if (!suppress) { \
if (arg_put) \
- (*arg_put)(puthook, (letter == 't' ? \
- 'b' : letter), \
- (void *)((long)(ARG)), width, \
- field_name); \
+ (*arg_put)(puthook, (letter == 't' ? 'b' : \
+ letter), (void *)((long)(ARG)), width, \
+ field_name); \
else \
*(va_arg(*ap, int *)) = (ARG); \
assigned++; \
@@ -187,7 +184,11 @@ do_buff_decode(u_int8_t *databuf, size_t len,
done = 1;
else {
if (shift <= 0) {
- bits = *databuf++;
+ if (ind >= len) {
+ done = 1;
+ break;
+ }
+ bits = buff[ind++];
shift = 8;
}
value = (bits >> (shift - width)) &
@@ -209,29 +210,31 @@ do_buff_decode(u_int8_t *databuf, size_t len,
fmt++;
width = strtol(fmt, &intendp, 10);
fmt = intendp;
+ if (ind + width > len) {
+ done = 1;
+ break;
+ }
switch(width) {
case 1:
- ARG_PUT(*databuf);
- databuf++;
+ ARG_PUT(buff[ind]);
+ ind++;
break;
case 2:
- ARG_PUT((*databuf) << 8 | *(databuf + 1));
- databuf += 2;
+ ARG_PUT(buff[ind] << 8 | buff[ind + 1]);
+ ind += 2;
break;
case 3:
- ARG_PUT((*databuf) << 16 |
- (*(databuf + 1)) << 8 | *(databuf + 2));
- databuf += 3;
+ ARG_PUT(buff[ind] << 16 |
+ buff[ind + 1] << 8 | buff[ind + 2]);
+ ind += 3;
break;
case 4:
- ARG_PUT((*databuf) << 24 |
- (*(databuf + 1)) << 16 |
- (*(databuf + 2)) << 8 |
- *(databuf + 3));
- databuf += 4;
+ ARG_PUT(buff[ind] << 24 | buff[ind + 1] << 16 |
+ buff[ind + 2] << 8 | buff[ind + 3]);
+ ind += 4;
break;
default:
@@ -242,32 +245,35 @@ do_buff_decode(u_int8_t *databuf, size_t len,
break;
case 'c': /* Characters (i.e., not swapped) */
- case 'z': /* Characters with zeroed trailing
- spaces */
+ case 'z': /* Characters with zeroed trailing spaces */
shift = 0;
fmt++;
width = strtol(fmt, &intendp, 10);
fmt = intendp;
+ if (ind + width > len) {
+ done = 1;
+ break;
+ }
if (!suppress) {
if (arg_put)
(*arg_put)(puthook,
- (letter == 't' ? 'b' : letter),
- databuf, width, field_name);
+ (letter == 't' ? 'b' : letter),
+ &buff[ind], width, field_name);
else {
char *dest;
dest = va_arg(*ap, char *);
- bcopy(databuf, dest, width);
+ bcopy(&buff[ind], dest, width);
if (letter == 'z') {
char *p;
for (p = dest + width - 1;
- (p >= (char *)dest)
- && (*p == ' '); p--)
+ p >= dest && *p == ' ';
+ p--)
*p = 0;
}
}
assigned++;
}
- databuf += width;
+ ind += width;
field_name[0] = 0;
suppress = 0;
break;
@@ -295,9 +301,9 @@ do_buff_decode(u_int8_t *databuf, size_t len,
}
if (plus)
- databuf += width; /* Relative seek */
+ ind += width; /* Relative seek */
else
- databuf = base + width; /* Absolute seek */
+ ind = width; /* Absolute seek */
break;
diff --git a/lib/libprocstat/cd9660.c b/lib/libprocstat/cd9660.c
index ab95e2a04c33..cc3c363f7bed 100644
--- a/lib/libprocstat/cd9660.c
+++ b/lib/libprocstat/cd9660.c
@@ -53,10 +53,10 @@ __FBSDID("$FreeBSD$");
#include <err.h>
-#include <isofs/cd9660/cd9660_node.h>
#define _KERNEL
#include <isofs/cd9660/iso.h>
#undef _KERNEL
+#include <isofs/cd9660/cd9660_node.h>
#include <kvm.h>
#include <stdio.h>
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 0c48748ddd1a..0bd37b17780a 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -62,8 +62,6 @@ __FBSDID("$FreeBSD$");
struct in_addr servip;
-static n_long nmask, smask;
-
static time_t bot;
static char vm_rfc1048[4] = VM_RFC1048;
@@ -223,30 +221,19 @@ bootp(sock, flag)
bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile));
bootfile[sizeof(bootfile) - 1] = '\0';
- if (IN_CLASSA(ntohl(myip.s_addr)))
- nmask = htonl(IN_CLASSA_NET);
- else if (IN_CLASSB(ntohl(myip.s_addr)))
- nmask = htonl(IN_CLASSB_NET);
- else
- nmask = htonl(IN_CLASSC_NET);
-#ifdef BOOTP_DEBUG
- if (debug)
- printf("'native netmask' is %s\n", intoa(nmask));
-#endif
-
- /* Check subnet mask against net mask; toss if bogus */
- if ((nmask & smask) != nmask) {
+ if (!netmask) {
+ if (IN_CLASSA(ntohl(myip.s_addr)))
+ netmask = htonl(IN_CLASSA_NET);
+ else if (IN_CLASSB(ntohl(myip.s_addr)))
+ netmask = htonl(IN_CLASSB_NET);
+ else
+ netmask = htonl(IN_CLASSC_NET);
#ifdef BOOTP_DEBUG
if (debug)
- printf("subnet mask (%s) bad\n", intoa(smask));
+ printf("'native netmask' is %s\n", intoa(netmask));
#endif
- smask = 0;
}
- /* Get subnet (or natural net) mask */
- netmask = nmask;
- if (smask)
- netmask = smask;
#ifdef BOOTP_DEBUG
if (debug)
printf("mask: %s\n", intoa(netmask));
@@ -385,7 +372,7 @@ vend_rfc1048(cp, len)
break;
if (tag == TAG_SUBNET_MASK) {
- bcopy(cp, &smask, sizeof(smask));
+ bcopy(cp, &netmask, sizeof(netmask));
}
if (tag == TAG_GATEWAY) {
bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr));
@@ -445,7 +432,7 @@ vend_cmu(cp)
vp = (struct cmu_vend *)cp;
if (vp->v_smask.s_addr != 0) {
- smask = vp->v_smask.s_addr;
+ netmask = vp->v_smask.s_addr;
}
if (vp->v_dgate.s_addr != 0) {
gateip = vp->v_dgate;
diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables
index 563bd187b1a9..6c44a0541071 100644
--- a/lib/libsysdecode/mktables
+++ b/lib/libsysdecode/mktables
@@ -142,7 +142,7 @@ gen_table "seekwhence" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/
gen_table "fcntlcmd" "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+" "sys/fcntl.h" "F_CANCEL|F_..LCK"
gen_table "mmapflags" "MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"
gen_table "rtpriofuncs" "RTP_[A-Z]+[[:space:]]+[0-9]+" "sys/rtprio.h"
-gen_table "msgflags" "MSG_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" "MSG_SOCALLBCK"
+gen_table "msgflags" "MSG_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" "MSG_SOCALLBCK|MSG_MORETOCOME"
gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?" "sys/signal.h"
gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h"
gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h"