This commit was manufactured by cvs2svn to create branch 'RELENG_6'.

This commit is contained in:
cvs2svn 2005-12-11 23:15:25 +00:00
parent 8deec4803d
commit 878f552269
10 changed files with 764 additions and 0 deletions

View File

@ -0,0 +1,75 @@
.\" Copyright (c) 2005 Christian Brueffer
.\" All rights reserved.
.\"
.\" 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$
.\"
.Dd December 10, 2005
.Dt PADLOCK 4 i386
.Os
.Sh NAME
.Nm padlock
.Nd "driver for the cryptographic functions and RNG in VIA C3 and Eden processors"
.Sh SYNOPSIS
.Cd "device crypto"
.Cd "device cryptodev"
.Cd "device padlock"
.Sh DESCRIPTION
The C3 and Eden processor series from VIA include hardware acceleration for
AES, as well as a hardware random number generator.
.Pp
The
.Nm
driver registers itself to accelerate AES operations for
.Xr crypto 4 .
.Pp
The hardware random number generator supplies data for the kernel
.Xr random 4
subsystem.
.Sh HISTORY
The
.Nm
driver first appeared in
.Ox .
The first
.Fx
release to include it was
.Fx 6.0 .
.Sh SEE ALSO
.Xr crypt 3 ,
.Xr crypto 4 ,
.Xr intro 4 ,
.Xr random 4 ,
.Xr crypto 9
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Jason Wright Aq jason@OpenBSD.org .
It was ported to
.Fx
by
.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
This manual page was written by
.An Christian Brueffer Aq brueffer@FreeBSD.org .

View File

@ -0,0 +1,29 @@
/****************************************************************** \
|* *|
|* *|
|* (c) NVIDIA Corporation. All rights reserved *|
|* *|
|* THE INFORMATION CONTAINED HEREIN IS PROPRIETARY AND *|
|* CONFIDENTIAL *|
|* TO NVIDIA, CORPORATION. USE, REPORDUCTION OR DISCLOSURE TO ANY *|
|* THIRD PARTY IS SUBJECT TO WRITTEN PRE-APPROVAL BY NVIDIA CORP. *|
|* *|
|* THE INFORMATION CONTAINED HEREIN IS PROVIDED "AS IS" WITHOUT *|
|* EXPRESS OR IMPLIED WARRANTY OF ANY KIND, INCLUDING ALL IMPLIED *|
|* WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS *|
|* FOR A PARTICULAR PURPOSE. *|
|* *|
********************************************************************/
#ifndef __NVENET_VERSION_H__
#define __NVENET_VERSION_H__
#define DRIVER_VERSION_MAJOR "1"
#define DRIVER_VERSION_MINOR "0"
#define DRIVER_VERSION_PATCH "13"
#define DRIVER_VERSION DRIVER_VERSION_MAJOR"."\
DRIVER_VERSION_MINOR"-"\
DRIVER_VERSION_PATCH
#endif

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PROG = athdebug
BINDIR = /usr/local/bin
NO_MAN = noman
.include <bsd.prog.mk>

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PROG = athstats
BINDIR = /usr/local/bin
NO_MAN = noman
.include <bsd.prog.mk>

View File

@ -0,0 +1,5 @@
# $FreeBSD$
SUBDIR= wlanstats wlandebug wlanwatch
.include <bsd.subdir.mk>

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PROG = wlandebug
BINDIR = /usr/local/bin
NO_MAN = noman
.include <bsd.prog.mk>

View File

@ -0,0 +1,237 @@
/*-
* Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
* All rights reserved.
*
* 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,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
* redistribution must be conditioned upon including a substantially
* similar Disclaimer requirement for further binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
*
* $FreeBSD$
*/
/*
* wlandebug [-i interface] flags
* (default interface is wlan.0).
*/
#include <sys/types.h>
#include <stdio.h>
#include <ctype.h>
#include <getopt.h>
#include <string.h>
#define N(a) (sizeof(a)/sizeof(a[0]))
const char *progname;
#define IEEE80211_MSG_DEBUG 0x40000000 /* IFF_DEBUG equivalent */
#define IEEE80211_MSG_DUMPPKTS 0x20000000 /* IFF_LINK2 equivalant */
#define IEEE80211_MSG_CRYPTO 0x10000000 /* crypto work */
#define IEEE80211_MSG_INPUT 0x08000000 /* input handling */
#define IEEE80211_MSG_XRATE 0x04000000 /* rate set handling */
#define IEEE80211_MSG_ELEMID 0x02000000 /* element id parsing */
#define IEEE80211_MSG_NODE 0x01000000 /* node handling */
#define IEEE80211_MSG_ASSOC 0x00800000 /* association handling */
#define IEEE80211_MSG_AUTH 0x00400000 /* authentication handling */
#define IEEE80211_MSG_SCAN 0x00200000 /* scanning */
#define IEEE80211_MSG_OUTPUT 0x00100000 /* output handling */
#define IEEE80211_MSG_STATE 0x00080000 /* state machine */
#define IEEE80211_MSG_POWER 0x00040000 /* power save handling */
#define IEEE80211_MSG_DOT1X 0x00020000 /* 802.1x authenticator */
#define IEEE80211_MSG_DOT1XSM 0x00010000 /* 802.1x state machine */
#define IEEE80211_MSG_RADIUS 0x00008000 /* 802.1x radius client */
#define IEEE80211_MSG_RADDUMP 0x00004000 /* dump 802.1x radius packets */
#define IEEE80211_MSG_RADKEYS 0x00002000 /* dump 802.1x keys */
#define IEEE80211_MSG_WPA 0x00001000 /* WPA/RSN protocol */
#define IEEE80211_MSG_ACL 0x00000800 /* ACL handling */
#define IEEE80211_MSG_WME 0x00000400 /* WME protocol */
#define IEEE80211_MSG_SUPERG 0x00000200 /* Atheros SuperG protocol */
#define IEEE80211_MSG_DOTH 0x00000100 /* 802.11h support */
#define IEEE80211_MSG_INACT 0x00000080 /* inactivity handling */
#define IEEE80211_MSG_ROAM 0x00000040 /* sta-mode roaming */
static struct {
const char *name;
u_int bit;
} flags[] = {
{ "debug", IEEE80211_MSG_DEBUG },
{ "dumppkts", IEEE80211_MSG_DUMPPKTS },
{ "crypto", IEEE80211_MSG_CRYPTO },
{ "input", IEEE80211_MSG_INPUT },
{ "xrate", IEEE80211_MSG_XRATE },
{ "elemid", IEEE80211_MSG_ELEMID },
{ "node", IEEE80211_MSG_NODE },
{ "assoc", IEEE80211_MSG_ASSOC },
{ "auth", IEEE80211_MSG_AUTH },
{ "scan", IEEE80211_MSG_SCAN },
{ "output", IEEE80211_MSG_OUTPUT },
{ "state", IEEE80211_MSG_STATE },
{ "power", IEEE80211_MSG_POWER },
{ "dotx1", IEEE80211_MSG_DOT1X },
{ "dot1xsm", IEEE80211_MSG_DOT1XSM },
{ "radius", IEEE80211_MSG_RADIUS },
{ "raddump", IEEE80211_MSG_RADDUMP },
{ "radkeys", IEEE80211_MSG_RADKEYS },
{ "wpa", IEEE80211_MSG_WPA },
{ "acl", IEEE80211_MSG_ACL },
{ "wme", IEEE80211_MSG_WME },
{ "superg", IEEE80211_MSG_SUPERG },
{ "doth", IEEE80211_MSG_DOTH },
{ "inact", IEEE80211_MSG_INACT },
{ "roam", IEEE80211_MSG_ROAM },
};
static u_int
getflag(const char *name, int len)
{
int i;
for (i = 0; i < N(flags); i++)
if (strncasecmp(flags[i].name, name, len) == 0)
return flags[i].bit;
return 0;
}
static const char *
getflagname(u_int flag)
{
int i;
for (i = 0; i < N(flags); i++)
if (flags[i].bit == flag)
return flags[i].name;
return "???";
}
static void
usage(void)
{
int i;
fprintf(stderr, "usage: %s [-i device] [flags]\n", progname);
fprintf(stderr, "where flags are:\n");
for (i = 0; i < N(flags); i++)
printf("%s\n", flags[i].name);
exit(-1);
}
int
main(int argc, char *argv[])
{
const char *ifname = "ath0";
const char *cp, *tp;
const char *sep;
int c, op, i, unit;
u_int32_t debug, ndebug;
size_t debuglen, parentlen;
char oid[256], parent[256];
progname = argv[0];
if (argc > 1) {
if (strcmp(argv[1], "-i") == 0) {
if (argc < 2)
errx(1, "missing interface name for -i option");
ifname = argv[2];
argc -= 2, argv += 2;
} else if (strcmp(argv[1], "-?") == 0)
usage();
}
for (unit = 0; unit < 10; unit++) {
#ifdef __linux__
snprintf(oid, sizeof(oid), "net.wlan%d.%%parent", unit);
#else
snprintf(oid, sizeof(oid), "net.wlan.%d.%%parent", unit);
#endif
parentlen = sizeof(parent);
if (sysctlbyname(oid, parent, &parentlen, NULL, 0) >= 0 &&
strncmp(parent, ifname, parentlen) == 0)
break;
}
if (unit == 10)
errx(1, "%s: cannot locate wlan sysctl node.", ifname);
#ifdef __linux__
snprintf(oid, sizeof(oid), "net.wlan%d.debug", unit);
#else
snprintf(oid, sizeof(oid), "net.wlan.%d.debug", unit);
#endif
debuglen = sizeof(debug);
if (sysctlbyname(oid, &debug, &debuglen, NULL, 0) < 0)
err(1, "sysctl-get(%s)", oid);
ndebug = debug;
for (; argc > 1; argc--, argv++) {
cp = argv[1];
do {
u_int bit;
if (*cp == '-') {
cp++;
op = -1;
} else if (*cp == '+') {
cp++;
op = 1;
} else
op = 0;
for (tp = cp; *tp != '\0' && *tp != '+' && *tp != '-';)
tp++;
bit = getflag(cp, tp-cp);
if (op < 0)
ndebug &= ~bit;
else if (op > 0)
ndebug |= bit;
else {
if (bit == 0) {
if (isdigit(*cp))
bit = strtoul(cp, NULL, 0);
else
errx(1, "unknown flag %.*s",
tp-cp, cp);
}
ndebug = bit;
}
} while (*(cp = tp) != '\0');
}
if (debug != ndebug) {
printf("%s: 0x%x => ", oid, debug);
if (sysctlbyname(oid, NULL, NULL, &ndebug, sizeof(ndebug)) < 0)
err(1, "sysctl-set(%s)", oid);
printf("0x%x", ndebug);
debug = ndebug;
} else
printf("%s: 0x%x", oid, debug);
sep = "<";
for (i = 0; i < N(flags); i++)
if (debug & flags[i].bit) {
printf("%s%s", sep, flags[i].name);
sep = ",";
}
printf("%s\n", *sep != '<' ? ">" : "");
return 0;
}

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PROG = wlanstats
BINDIR = /usr/local/bin
NO_MAN = noman
.include <bsd.prog.mk>

View File

@ -0,0 +1,7 @@
# $FreeBSD$
PROG = wlanwatch
BINDIR = /usr/local/bin
NO_MAN = noman
.include <bsd.prog.mk>

View File

@ -0,0 +1,383 @@
/*-
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
* All rights reserved.
*
* 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,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
* redistribution must be conditioned upon including a substantially
* similar Disclaimer requirement for further binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
*
* $FreeBSD$
*/
/*
* Monitor 802.11 events using a routing socket.
* Code liberaly swiped from route(8).
*/
#include <sys/param.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <net/if.h>
#include <net/route.h>
#include <net/if_dl.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netatalk/at.h>
#include <net80211/ieee80211_freebsd.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include <ifaddrs.h>
static void print_rtmsg(struct rt_msghdr *rtm, int msglen);
int nflag = 0;
int
main(int argc, char *argv[])
{
int n, s;
char msg[2048];
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s < 0)
err(EX_OSERR, "socket");
for(;;) {
n = read(s, msg, 2048);
print_rtmsg((struct rt_msghdr *)msg, n);
}
return 0;
}
static void
bprintf(fp, b, s)
FILE *fp;
int b;
u_char *s;
{
int i;
int gotsome = 0;
if (b == 0)
return;
while ((i = *s++) != 0) {
if (b & (1 << (i-1))) {
if (gotsome == 0)
i = '<';
else
i = ',';
(void) putc(i, fp);
gotsome = 1;
for (; (i = *s) > 32; s++)
(void) putc(i, fp);
} else
while (*s > 32)
s++;
}
if (gotsome)
putc('>', fp);
}
char metricnames[] =
"\011pksent\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire\2hopcount"
"\1mtu";
char routeflags[] =
"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT"
"\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016b016"
"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024CHAINDELETE"
"\025PINNED\026LOCAL\027BROADCAST\030MULTICAST";
char ifnetflags[] =
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6b6\7RUNNING\010NOARP"
"\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1"
"\017LINK2\020MULTICAST";
char addrnames[] =
"\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD";
const char *
routename(sa)
struct sockaddr *sa;
{
char *cp;
static char line[MAXHOSTNAMELEN + 1];
struct hostent *hp;
static char domain[MAXHOSTNAMELEN + 1];
static int first = 1, n;
if (first) {
first = 0;
if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
(cp = strchr(domain, '.'))) {
domain[MAXHOSTNAMELEN] = '\0';
(void) strcpy(domain, cp + 1);
} else
domain[0] = 0;
}
if (sa->sa_len == 0)
strcpy(line, "default");
else switch (sa->sa_family) {
case AF_INET:
{ struct in_addr in;
in = ((struct sockaddr_in *)sa)->sin_addr;
cp = 0;
if (in.s_addr == INADDR_ANY || sa->sa_len < 4)
cp = "default";
if (cp == 0 && !nflag) {
hp = gethostbyaddr((char *)&in, sizeof (struct in_addr),
AF_INET);
if (hp) {
if ((cp = strchr(hp->h_name, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = hp->h_name;
}
}
if (cp) {
strncpy(line, cp, sizeof(line) - 1);
line[sizeof(line) - 1] = '\0';
} else
(void) sprintf(line, "%s", inet_ntoa(in));
break;
}
#ifdef INET6
case AF_INET6:
{
struct sockaddr_in6 sin6; /* use static var for safety */
int niflags = 0;
#ifdef NI_WITHSCOPEID
niflags = NI_WITHSCOPEID;
#endif
memset(&sin6, 0, sizeof(sin6));
memcpy(&sin6, sa, sa->sa_len);
sin6.sin6_len = sizeof(struct sockaddr_in6);
sin6.sin6_family = AF_INET6;
#ifdef __KAME__
if (sa->sa_len == sizeof(struct sockaddr_in6) &&
(IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) &&
sin6.sin6_scope_id == 0) {
sin6.sin6_scope_id =
ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
sin6.sin6_addr.s6_addr[2] = 0;
sin6.sin6_addr.s6_addr[3] = 0;
}
#endif
if (nflag)
niflags |= NI_NUMERICHOST;
if (getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len,
line, sizeof(line), NULL, 0, niflags) != 0)
strncpy(line, "invalid", sizeof(line));
return(line);
}
#endif
case AF_LINK:
return (link_ntoa((struct sockaddr_dl *)sa));
default:
{ u_short *s = (u_short *)sa;
u_short *slim = s + ((sa->sa_len + 1) >> 1);
char *cp = line + sprintf(line, "(%d)", sa->sa_family);
char *cpe = line + sizeof(line);
while (++s < slim && cp < cpe) /* start with sa->sa_data */
if ((n = snprintf(cp, cpe - cp, " %x", *s)) > 0)
cp += n;
else
*cp = '\0';
break;
}
}
return (line);
}
static void
pmsg_addrs(char *cp, int addrs)
{
struct sockaddr *sa;
int i;
if (addrs == 0) {
(void) putchar('\n');
return;
}
printf("\nsockaddrs: ");
bprintf(stdout, addrs, addrnames);
putchar('\n');
for (i = 1; i; i <<= 1)
if (i & addrs) {
sa = (struct sockaddr *)cp;
printf(" %s", routename(sa));
cp += SA_SIZE(sa);
}
putchar('\n');
fflush(stdout);
}
static const char *
ether_sprintf(const uint8_t mac[6])
{
static char buf[32];
snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return buf;
}
static void
print_rtmsg(struct rt_msghdr *rtm, int msglen)
{
struct if_msghdr *ifm;
struct if_announcemsghdr *ifan;
char *state;
time_t now = time(NULL);
char *cnow = ctime(&now);
if (rtm->rtm_version != RTM_VERSION) {
(void) printf("routing message version %d not understood\n",
rtm->rtm_version);
return;
}
switch (rtm->rtm_type) {
case RTM_IFINFO:
ifm = (struct if_msghdr *)rtm;
printf("%.19s RTM_IFINFO: if# %d, ",
cnow, ifm->ifm_index);
switch (ifm->ifm_data.ifi_link_state) {
case LINK_STATE_DOWN:
state = "down";
break;
case LINK_STATE_UP:
state = "up";
break;
default:
state = "unknown";
break;
}
printf("link: %s, flags:", state);
bprintf(stdout, ifm->ifm_flags, ifnetflags);
pmsg_addrs((char *)(ifm + 1), ifm->ifm_addrs);
break;
case RTM_IFANNOUNCE:
ifan = (struct if_announcemsghdr *)rtm;
printf("%.19s RTM_IFANNOUNCE: if# %d, what: ",
cnow, ifan->ifan_index);
switch (ifan->ifan_what) {
case IFAN_ARRIVAL:
printf("arrival");
break;
case IFAN_DEPARTURE:
printf("departure");
break;
default:
printf("#%d", ifan->ifan_what);
break;
}
printf("\n");
break;
case RTM_IEEE80211:
#define V(type) ((struct type *)(&ifan[1]))
ifan = (struct if_announcemsghdr *)rtm;
printf("%.19s RTM_IEEE80211: ", cnow);
switch (ifan->ifan_what) {
case RTM_IEEE80211_ASSOC:
printf("associate with %s",
ether_sprintf(V(ieee80211_join_event)->iev_addr));
break;
case RTM_IEEE80211_REASSOC:
printf("reassociate with %s",
ether_sprintf(V(ieee80211_join_event)->iev_addr));
break;
case RTM_IEEE80211_DISASSOC:
printf("disassociate");
break;
case RTM_IEEE80211_JOIN:
case RTM_IEEE80211_REJOIN:
printf("%s station %sjoin",
ifan->ifan_what == RTM_IEEE80211_REJOIN ? "re" : "",
ether_sprintf(V(ieee80211_join_event)->iev_addr));
break;
case RTM_IEEE80211_LEAVE:
printf("%s station leave",
ether_sprintf(V(ieee80211_leave_event)->iev_addr));
break;
case RTM_IEEE80211_SCAN:
printf("scan complete");
break;
case RTM_IEEE80211_REPLAY:
printf("replay failure: src %s "
, ether_sprintf(V(ieee80211_replay_event)->iev_src)
);
printf("dst %s cipher %u keyix %u keyrsc %llu rsc %llu"
, ether_sprintf(V(ieee80211_replay_event)->iev_dst)
, V(ieee80211_replay_event)->iev_cipher
, V(ieee80211_replay_event)->iev_keyix
, V(ieee80211_replay_event)->iev_keyrsc
, V(ieee80211_replay_event)->iev_rsc
);
break;
case RTM_IEEE80211_MICHAEL:
printf("michael failure: src %s "
, ether_sprintf(V(ieee80211_michael_event)->iev_src)
);
printf("dst %s cipher %u keyix %u"
, ether_sprintf(V(ieee80211_michael_event)->iev_dst)
, V(ieee80211_michael_event)->iev_cipher
, V(ieee80211_michael_event)->iev_keyix
);
break;
default:
printf("if# %d, what: #%d",
ifan->ifan_index, ifan->ifan_what);
break;
}
printf("\n");
break;
#undef V
}
}