summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
committergjb <gjb@FreeBSD.org>2016-04-04 23:55:32 +0000
commit1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f (patch)
treea027fe5a27446f32854d6a07b34b5f2a992bf283 /sbin
parent3669a0dced7e344be71d234ffc3a71530ef0ae08 (diff)
parent589cedfe0cde2b49d5f47fc240de37c8bf307abd (diff)
downloadFreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.zip
FreeBSD-src-1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sbin')
-rw-r--r--sbin/atm/atmconfig/atmconfig.83
-rw-r--r--sbin/casperd/Makefile18
-rw-r--r--sbin/casperd/Makefile.depend23
-rw-r--r--sbin/devd/devd.cc21
-rw-r--r--sbin/devd/devd.conf.511
-rw-r--r--sbin/ifconfig/ifieee80211.c95
-rw-r--r--sbin/ifconfig/sfp.c28
-rw-r--r--sbin/kldstat/Makefile.depend1
-rw-r--r--sbin/kldstat/kldstat.84
-rw-r--r--sbin/kldstat/kldstat.c30
-rw-r--r--sbin/ping/ping.c4
-rw-r--r--sbin/restore/tape.c1
12 files changed, 158 insertions, 81 deletions
diff --git a/sbin/atm/atmconfig/atmconfig.8 b/sbin/atm/atmconfig/atmconfig.8
index dc765ca..3a03b0a 100644
--- a/sbin/atm/atmconfig/atmconfig.8
+++ b/sbin/atm/atmconfig/atmconfig.8
@@ -313,7 +313,6 @@ List all NATM routes.
.El
.Sh SEE ALSO
.Xr natm 4 ,
-.Xr natmip 4 ,
-.Xr atm 8
+.Xr natmip 4
.Sh AUTHORS
.An Hartmut Brandt Aq Mt harti@FreeBSD.org
diff --git a/sbin/casperd/Makefile b/sbin/casperd/Makefile
deleted file mode 100644
index 698263c..0000000
--- a/sbin/casperd/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# $FreeBSD$
-
-PACKAGE=casper
-PROG= casperd
-
-SRCS= casperd.c zygote.c
-
-LIBADD= casper nv pjdlog util
-
-MAN= casperd.8
-
-CFLAGS+=-I${.CURDIR}
-CFLAGS+=-I${.CURDIR}/../../lib/libcapsicum
-CFLAGS+=-I${.CURDIR}/../../lib/libcasper
-CFLAGS+=-I${.CURDIR}/../../lib/libnv
-CFLAGS+=-I${.CURDIR}/../../lib/libpjdlog
-
-.include <bsd.prog.mk>
diff --git a/sbin/casperd/Makefile.depend b/sbin/casperd/Makefile.depend
deleted file mode 100644
index aa79c09..0000000
--- a/sbin/casperd/Makefile.depend
+++ /dev/null
@@ -1,23 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- gnu/lib/csu \
- gnu/lib/libgcc \
- include \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcapsicum \
- lib/libcasper \
- lib/libcompiler_rt \
- lib/libnv \
- lib/libpjdlog \
- lib/libutil \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index 203d750..b2aea19 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -648,8 +648,8 @@ config::expand_one(const char *&src, string &dst)
return;
}
- // $[^A-Za-z] -> $\1
- if (!isalpha(*src)) {
+ // $[^-A-Za-z_*] -> $\1
+ if (!isalpha(*src) && *src != '_' && *src != '-' && *src != '*') {
dst += '$';
dst += *src++;
return;
@@ -788,15 +788,30 @@ process_event(char *buffer)
{
char type;
char *sp;
+ struct timeval tv;
+ char *timestr;
sp = buffer + 1;
devdlog(LOG_INFO, "Processing event '%s'\n", buffer);
type = *buffer++;
cfg.push_var_table();
- // No match doesn't have a device, and the format is a little
+ // $* is the entire line
+ cfg.set_variable("*", buffer - 1);
+ // $_ is the entire line without the initial character
+ cfg.set_variable("_", buffer);
+
+ // Save the time this happened (as approximated by when we got
+ // around to processing it).
+ gettimeofday(&tv, NULL);
+ asprintf(&timestr, "%jd.%06ld", (uintmax_t)tv.tv_sec, tv.tv_usec);
+ cfg.set_variable("timestamp", timestr);
+ free(timestr);
+
+ // Match doesn't have a device, and the format is a little
// different, so handle it separately.
switch (type) {
case notify:
+ //! (k=v)*
sp = cfg.set_vars(sp);
break;
case nomatch:
diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5
index 86570fb..83c4c76 100644
--- a/sbin/devd/devd.conf.5
+++ b/sbin/devd/devd.conf.5
@@ -41,7 +41,7 @@
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\"
-.Dd July 11, 2015
+.Dd March 28, 2016
.Dt DEVD.CONF 5
.Os
.Sh NAME
@@ -234,10 +234,19 @@ A partial list of variables and their possible values that can be used together
with the
.Ic match
statement.
+The variables are published by the bus based on characteristics of the device
+that generated the event (for device events).
+Variables for other classes of events are dependent on those events.
.Pp
.Bl -tag -width ".Li manufacturer" -compact
.It Ic Variable
.Ic Description
+.It Li *
+The entire message from the current event
+.It Li _
+The entire message from the current event, after the initial type character
+.It Li timestamp
+The time this event was processed, in seconds since 1970 dot fraction
.It Li bus
Device name of parent bus.
.It Li cdev
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 5ababf3..84daec9 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -2534,6 +2534,45 @@ printwmeinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
}
static void
+printvhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+{
+ printf("%s", tag);
+ if (verbose) {
+ const struct ieee80211_ie_vhtcap *vhtcap =
+ (const struct ieee80211_ie_vhtcap *) ie;
+ uint32_t vhtcap_info = LE_READ_4(&vhtcap->vht_cap_info);
+
+ printf("<cap 0x%08x", vhtcap_info);
+ printf(" rx_mcs_map 0x%x",
+ LE_READ_2(&vhtcap->supp_mcs.rx_mcs_map));
+ printf(" rx_highest %d",
+ LE_READ_2(&vhtcap->supp_mcs.rx_highest) & 0x1fff);
+ printf(" tx_mcs_map 0x%x",
+ LE_READ_2(&vhtcap->supp_mcs.tx_mcs_map));
+ printf(" tx_highest %d",
+ LE_READ_2(&vhtcap->supp_mcs.tx_highest) & 0x1fff);
+
+ printf(">");
+ }
+}
+
+static void
+printvhtinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+{
+ printf("%s", tag);
+ if (verbose) {
+ const struct ieee80211_ie_vht_operation *vhtinfo =
+ (const struct ieee80211_ie_vht_operation *) ie;
+
+ printf("<chw %d freq1_idx %d freq2_idx %d basic_mcs_set 0x%04x>",
+ vhtinfo->chan_width,
+ vhtinfo->center_freq_seg1_idx,
+ vhtinfo->center_freq_seg2_idx,
+ LE_READ_2(&vhtinfo->basic_mcs_set));
+ }
+}
+
+static void
printhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
{
printf("%s", tag);
@@ -2674,6 +2713,40 @@ do { \
#undef MATCHOUI
}
+static void
+printbssload(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
+{
+ printf("%s", tag);
+ if (verbose) {
+ const struct ieee80211_bss_load_ie *bssload =
+ (const struct ieee80211_bss_load_ie *) ie;
+ printf("<sta count %d, chan load %d, aac %d>",
+ LE_READ_2(&bssload->sta_count),
+ bssload->chan_load,
+ bssload->aac);
+ }
+}
+
+static void
+printapchanrep(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+{
+ printf("%s", tag);
+ if (verbose) {
+ const struct ieee80211_ap_chan_report_ie *ap =
+ (const struct ieee80211_ap_chan_report_ie *) ie;
+ const char *sep = "";
+ int i;
+
+ printf("<class %u, chan:[", ap->i_class);
+
+ for (i = 3; i < ielen; i++) {
+ printf("%s%u", sep, ie[i]);
+ sep = ",";
+ }
+ printf("]>");
+ }
+}
+
static const char *
wpa_cipher(const u_int8_t *sel)
{
@@ -3018,14 +3091,6 @@ printcountry(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
printf(">");
}
-/* unaligned little endian access */
-#define LE_READ_4(p) \
- ((u_int32_t) \
- ((((const u_int8_t *)(p))[0] ) | \
- (((const u_int8_t *)(p))[1] << 8) | \
- (((const u_int8_t *)(p))[2] << 16) | \
- (((const u_int8_t *)(p))[3] << 24)))
-
static __inline int
iswpaoui(const u_int8_t *frm)
{
@@ -3084,9 +3149,9 @@ iename(int elemid)
case IEEE80211_ELEMID_MEASREP: return " MEASREP";
case IEEE80211_ELEMID_QUIET: return " QUIET";
case IEEE80211_ELEMID_IBSSDFS: return " IBSSDFS";
- case IEEE80211_ELEMID_APCHANREP:return " APCHANREP";
case IEEE80211_ELEMID_TPC: return " TPC";
case IEEE80211_ELEMID_CCKM: return " CCKM";
+ case IEEE80211_ELEMID_VHT_PWR_ENV: return " VHTPWRENV";
}
return " ???";
}
@@ -3151,6 +3216,18 @@ printies(const u_int8_t *vp, int ielen, int maxcols)
case IEEE80211_ELEMID_MESHCONF:
printmeshconf(" MESHCONF", vp, 2+vp[1], maxcols);
break;
+ case IEEE80211_ELEMID_VHT_CAP:
+ printvhtcap(" VHTCAP", vp, 2+vp[1], maxcols);
+ break;
+ case IEEE80211_ELEMID_VHT_OPMODE:
+ printvhtinfo(" VHTOPMODE", vp, 2+vp[1], maxcols);
+ break;
+ case IEEE80211_ELEMID_BSSLOAD:
+ printbssload(" BSSLOAD", vp, 2+vp[1], maxcols);
+ break;
+ case IEEE80211_ELEMID_APCHANREP:
+ printapchanrep(" APCHANREP", vp, 2+vp[1], maxcols);
+ break;
default:
if (verbose)
printie(iename(vp[0]), vp, 2+vp[1], maxcols);
diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c
index 306140a..d92ee2c 100644
--- a/sbin/ifconfig/sfp.c
+++ b/sbin/ifconfig/sfp.c
@@ -625,14 +625,17 @@ get_sfp_voltage(struct i2c_info *ii, char *buf, size_t size)
convert_sff_voltage(buf, size, xbuf);
}
-static void
+static int
get_qsfp_temp(struct i2c_info *ii, char *buf, size_t size)
{
uint8_t xbuf[2];
memset(xbuf, 0, sizeof(xbuf));
read_i2c(ii, SFF_8436_BASE, SFF_8436_TEMP, 2, xbuf);
+ if ((xbuf[0] == 0xFF && xbuf[1] == 0xFF) || (xbuf[0] == 0 && xbuf[1] == 0))
+ return (-1);
convert_sff_temp(buf, size, xbuf);
+ return (0);
}
static void
@@ -779,22 +782,9 @@ static void
print_qsfp_status(struct i2c_info *ii, int verbose)
{
char buf[80], buf2[40], buf3[40];
- uint8_t diag_type;
uint32_t bitrate;
int i;
- /* Read diagnostic monitoring type */
- read_i2c(ii, SFF_8436_BASE, SFF_8436_DIAG_TYPE, 1, (caddr_t)&diag_type);
- if (ii->error != 0)
- return;
-
- /*
- * Read monitoring data it is supplied.
- * XXX: It is not exactly clear from standard
- * how one can specify lack of measurements (passive cables case).
- */
- if (diag_type != 0)
- ii->do_diag = 1;
ii->qsfp = 1;
/* Transceiver type */
@@ -817,9 +807,13 @@ print_qsfp_status(struct i2c_info *ii, int verbose)
printf("\tnominal bitrate: %u Mbps\n", bitrate);
}
- /* Request current measurements if they are provided: */
- if (ii->do_diag != 0) {
- get_qsfp_temp(ii, buf, sizeof(buf));
+ /*
+ * The standards in this area are not clear when the
+ * additional measurements are present or not. Use a valid
+ * temperature reading as an indicator for the presence of
+ * voltage and TX/RX power measurements.
+ */
+ if (get_qsfp_temp(ii, buf, sizeof(buf)) == 0) {
get_qsfp_voltage(ii, buf2, sizeof(buf2));
printf("\tmodule temperature: %s voltage: %s\n", buf, buf2);
for (i = 1; i <= 4; i++) {
diff --git a/sbin/kldstat/Makefile.depend b/sbin/kldstat/Makefile.depend
index 0f77a15..58f9a33 100644
--- a/sbin/kldstat/Makefile.depend
+++ b/sbin/kldstat/Makefile.depend
@@ -5,6 +5,7 @@ DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
+ include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8
index 2ea9ca4..0091826 100644
--- a/sbin/kldstat/kldstat.8
+++ b/sbin/kldstat/kldstat.8
@@ -36,10 +36,12 @@
.Op Fl h
.Op Fl q
.Op Fl v
+.Op Fl d
.Op Fl i Ar id
.Op Fl n Ar filename
.Nm
.Op Fl q
+.Op Fl d
.Op Fl m Ar modname
.Sh DESCRIPTION
The
@@ -54,6 +56,8 @@ Display the size field in a human-readable form, using unit suffixes
instead of hex values.
.It Fl v
Be more verbose.
+.It Fl d
+Show the module specific data (as int, unsigned int and unsigned long)
.It Fl i Ar id
Display the status of only the file with this ID.
.It Fl n Ar filename
diff --git a/sbin/kldstat/kldstat.c b/sbin/kldstat/kldstat.c
index c48024f..3ae7518 100644
--- a/sbin/kldstat/kldstat.c
+++ b/sbin/kldstat/kldstat.c
@@ -36,19 +36,28 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/module.h>
#include <sys/linker.h>
+#include <strings.h>
#define POINTER_WIDTH ((int)(sizeof(void *) * 2 + 2))
+static int showdata = 0;
+
static void
printmod(int modid)
{
struct module_stat stat;
+ bzero(&stat, sizeof(stat));
stat.version = sizeof(struct module_stat);
if (modstat(modid, &stat) < 0)
warn("can't stat module id %d", modid);
else
- printf("\t\t%2d %s\n", stat.id, stat.name);
+ if (showdata) {
+ printf("\t\t%2d %s (%d, %u, 0x%lx)\n", stat.id, stat.name,
+ stat.data.intval, stat.data.uintval, stat.data.ulongval);
+ } else {
+ printf("\t\t%2d %s\n", stat.id, stat.name);
+ }
}
static void
@@ -88,8 +97,8 @@ printfile(int fileid, int verbose, int humanized)
static void
usage(void)
{
- fprintf(stderr, "usage: kldstat [-h] [-q] [-v] [-i id] [-n filename]\n");
- fprintf(stderr, " kldstat [-q] [-m modname]\n");
+ fprintf(stderr, "usage: kldstata[-d] [-h] [-q] [-v] [-i id] [-n filename]\n");
+ fprintf(stderr, " kldstat [-d] [-q] [-m modname]\n");
exit(1);
}
@@ -105,8 +114,11 @@ main(int argc, char** argv)
char* modname = NULL;
char* p;
- while ((c = getopt(argc, argv, "hi:m:n:qv")) != -1)
+ while ((c = getopt(argc, argv, "dhi:m:n:qv")) != -1)
switch (c) {
+ case 'd':
+ showdata = 1;
+ break;
case 'h':
humanized = 1;
break;
@@ -152,8 +164,14 @@ main(int argc, char** argv)
if (modstat(modid, &stat) < 0)
warn("can't stat module id %d", modid);
else {
- printf("Id Refs Name\n");
- printf("%3d %4d %s\n", stat.id, stat.refs, stat.name);
+ if (showdata) {
+ printf("Id Refs Name data..(int, uint, ulong)\n");
+ printf("%3d %4d %s (%d, %u, 0x%lx)\n", stat.id, stat.refs, stat.name,
+ stat.data.intval, stat.data.uintval, stat.data.ulongval);
+ } else {
+ printf("Id Refs Name\n");
+ printf("%3d %4d %s\n", stat.id, stat.refs, stat.name);
+ }
}
return 0;
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index a5f8602..e7df6ca 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -794,7 +794,7 @@ main(int argc, char *const *argv)
#endif
if (sweepmax) {
if (sweepmin > sweepmax)
- errx(EX_USAGE, "Maximum packet size must be no less than the minimum packet size");
+ errx(EX_USAGE, "Maximum packet size must be no less than the minimum packet size");
if (datalen != DEFDATALEN)
errx(EX_USAGE, "Packet size and ping sweep are mutually exclusive");
@@ -1201,7 +1201,7 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from, struct timeval *tv)
if (options & F_MASK) {
/* Just prentend this cast isn't ugly */
(void)printf(" mask=%s",
- pr_addr(*(struct in_addr *)&(icp->icmp_mask)));
+ inet_ntoa(*(struct in_addr *)&(icp->icmp_mask)));
}
if (options & F_TIME) {
(void)printf(" tso=%s", pr_ntime(icp->icmp_otime));
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index 7a60cf4..2f97231 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -340,6 +340,7 @@ getvol(long nextvol)
}
if (volno == 1)
return;
+ newvol = 0;
goto gethdr;
}
again:
OpenPOWER on IntegriCloud