Merge ^/head r317281 through r317502.

This commit is contained in:
Dimitry Andric 2017-04-27 12:59:14 +00:00
commit af3f36025b
295 changed files with 2943 additions and 80474 deletions

View File

@ -150,6 +150,50 @@ OLD_FILES+=usr/lib/clang/4.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_
OLD_DIRS+=usr/lib/clang/4.0.0/lib/freebsd
OLD_DIRS+=usr/lib/clang/4.0.0/lib
OLD_DIRS+=usr/lib/clang/4.0.0
# 20170426: Remove cy(4)
OLD_FILES+=usr/share/man/man4/cy.4.gz
# 20170425: NATM configuration support removed
OLD_FILES+=etc/rc.d/atm1
OLD_FILES+=etc/rc.d/atm2
OLD_FILES+=etc/rc.d/atm3
# 20170424: NATM support removed
OLD_FILES+=rescue/atmconfig
OLD_FILES+=sbin/atmconfig
OLD_FILES+=usr/include/bsnmp/snmp_atm.h
OLD_FILES+=usr/include/dev/utopia/idtphy.h
OLD_FILES+=usr/include/dev/utopia/suni.h
OLD_FILES+=usr/include/dev/utopia/utopia.h
OLD_FILES+=usr/include/dev/utopia/utopia_priv.h
OLD_DIRS+=usr/include/dev/utopia
OLD_FILES+=usr/include/net/if_atm.h
OLD_FILES+=usr/include/netgraph/atm/ng_atm.h
OLD_FILES+=usr/include/netinet/if_atm.h
OLD_FILES+=usr/include/netnatm/natm.h
OLD_FILES+=usr/lib/debug/sbin/atmconfig.debug
OLD_FILES+=usr/lib/debug/usr/lib/snmp_atm.so.6.debug
OLD_FILES+=usr/lib/snmp_atm.so
OLD_FILES+=usr/lib/snmp_atm.so.6
OLD_FILES+=usr/share/doc/atm/atmconfig.help
OLD_FILES+=usr/share/doc/atm/atmconfig_device.help
OLD_DIRS+=usr/share/doc/atm
OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz
OLD_FILES+=usr/share/man/man4/en.4.gz
OLD_FILES+=usr/share/man/man4/fatm.4.gz
OLD_FILES+=usr/share/man/man4/hatm.4.gz
OLD_FILES+=usr/share/man/man4/if_en.4.gz
OLD_FILES+=usr/share/man/man4/if_fatm.4.gz
OLD_FILES+=usr/share/man/man4/if_hatm.4.gz
OLD_FILES+=usr/share/man/man4/if_patm.4.gz
OLD_FILES+=usr/share/man/man4/natm.4.gz
OLD_FILES+=usr/share/man/man4/natmip.4.gz
OLD_FILES+=usr/share/man/man4/ng_atm.4.gz
OLD_FILES+=usr/share/man/man4/patm.4.gz
OLD_FILES+=usr/share/man/man4/utopia.4.gz
OLD_FILES+=usr/share/man/man8/atmconfig.8.gz
OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def
OLD_FILES+=usr/share/snmp/defs/atm_tree.def
OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM-FREEBSD-MIB.txt
OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM.txt
# 20170420: remove GNU diff
OLD_FILES+=usr/share/man/man7/diff.7.gz
# 20170322: rename <x> to <x>_test to match the FreeBSD test suite name scheme
@ -2176,8 +2220,12 @@ OLD_FILES+=usr/share/info/am-utils.info.gz
OLD_FILES+=usr/share/info/as.info.gz
OLD_FILES+=usr/share/info/binutils.info.gz
OLD_FILES+=usr/share/info/com_err.info.gz
OLD_FILES+=usr/share/info/cpp.info.gz
OLD_FILES+=usr/share/info/cppinternals.info.gz
OLD_FILES+=usr/share/info/diff.info.gz
OLD_FILES+=usr/share/info/dir
OLD_FILES+=usr/share/info/gcc.info.gz
OLD_FILES+=usr/share/info/gccint.info.gz
OLD_FILES+=usr/share/info/gdb.info.gz
OLD_FILES+=usr/share/info/gdbint.info.gz
OLD_FILES+=usr/share/info/gperf.info.gz

View File

@ -56,6 +56,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
Please see the 20141231 entry below for information about prerequisites
and upgrading, if you are not already using clang 3.5.0 or higher.
20170424:
The NATM framework including the en(4), fatm(4), hatm(4), and
patm(4) devices has been removed. Consumers should plan a
migration before the end-of-life date for FreeBSD 11.
20170420:
GNU diff has been replaced by a BSD licensed diff. Some features of GNU
diff has not been implemented, if those are needed a newer version of
@ -76,6 +81,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
installed. To continue using aarch64-binutils, set
CROSS_BINUTILS_PREFIX=/usr/local/aarch64-freebsd/bin .
20170405:
The UDP optimization in entry 20160818 that added the sysctl
net.inet.udp.require_l2_bcast has been reverted. L2 broadcast
packets will no longer be treated as L3 broadcast packets.
20170331:
Binds and sends to the loopback addresses, IPv6 and IPv4, will now
use any explicitly assigned loopback address available in the jail

View File

@ -131,7 +131,7 @@ procargs(int argc, char **argv)
void
optschanged(void)
{
setinteractive(iflag);
setinteractive();
#ifndef NO_HISTORY
histedit();
#endif

View File

@ -45,6 +45,7 @@ ${PACKAGE}FILES+= cmdsubst20.0
${PACKAGE}FILES+= cmdsubst21.0
${PACKAGE}FILES+= cmdsubst22.0
${PACKAGE}FILES+= cmdsubst23.0
${PACKAGE}FILES+= cmdsubst24.0
${PACKAGE}FILES+= export1.0
${PACKAGE}FILES+= export2.0
${PACKAGE}FILES+= export3.0

View File

@ -0,0 +1,24 @@
# $FreeBSD$
# POSIX leaves the effect of NUL bytes in command substitution output
# unspecified but we have always discarded them.
failures=0
check() {
if [ "$2" != "$3" ]; then
printf "Failed at line %s: got \"%s\" expected \"%s\"\n" "$1" "$2" "$3"
: $((failures += 1))
fi
}
fmt='\0a\0 \0b\0c d\0'
assign_builtin=$(printf "$fmt")
check "$LINENO" "$assign_builtin" "a bc d"
assign_pipeline=$(printf "$fmt" | cat)
check "$LINENO" "$assign_pipeline" "a bc d"
set -- $(printf "$fmt") $(printf "$fmt" | cat) "$(printf "$fmt")" "$(printf "$fmt" | cat)"
IFS=@
splits="$*"
check "$LINENO" "$splits" "a@bc@d@a@bc@d@a bc d@a bc d"
[ "$failures" = 0 ]

View File

@ -478,19 +478,14 @@ dotrap(void)
/*
* Controls whether the shell is interactive or not.
* Controls whether the shell is interactive or not based on iflag.
*/
void
setinteractive(int on)
setinteractive(void)
{
static int is_interactive = -1;
if (on == is_interactive)
return;
setsignal(SIGINT);
setsignal(SIGQUIT);
setsignal(SIGTERM);
is_interactive = on;
}

View File

@ -43,6 +43,6 @@ void ignoresig(int);
int issigchldtrapped(void);
void onsig(int);
void dotrap(void);
void setinteractive(int);
void setinteractive(void);
void exitshell(int) __dead2;
void exitshell_savedstatus(void) __dead2;

View File

@ -180,12 +180,12 @@
.Ar bookmark
.Nm
.Cm send
.Op Fl DnPpRveL
.Op Fl DLPRcenpv
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Nm
.Cm send
.Op Fl eL
.Op Fl Lce
.Op Fl i Ar snapshot Ns | Ns bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
@ -2535,7 +2535,7 @@ feature.
.It Xo
.Nm
.Cm send
.Op Fl DnPpRveL
.Op Fl DLPRcenpv
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Xc
@ -2580,7 +2580,7 @@ The incremental
source may be specified as with the
.Fl i
option.
.It Fl R
.It Fl R, -replicate
Generate a replication stream package, which will replicate the specified
filesystem, and all descendent file systems, up to the named snapshot. When
received, all properties, snapshots, descendent file systems, and clones are
@ -2598,7 +2598,7 @@ is received. If the
.Fl F
flag is specified when this stream is received, snapshots and file systems that
do not exist on the sending side are destroyed.
.It Fl D
.It Fl D, -dedup
Generate a deduplicated stream. Blocks which would have been sent multiple
times in the send stream will only be sent once. The receiving system must
also support this feature to receive a deduplicated stream. This flag can
@ -2607,7 +2607,7 @@ be used regardless of the dataset's
property, but performance will be much better if the filesystem uses a
dedup-capable checksum (eg.
.Sy sha256 ) .
.It Fl L
.It Fl L, -large-block
Generate a stream which may contain blocks larger than 128KB.
This flag
has no effect if the
@ -2623,7 +2623,7 @@ See
for details on ZFS feature flags and the
.Sy large_blocks
feature.
.It Fl e
.It Fl e, -embed
Generate a more compact stream by using WRITE_EMBEDDED records for blocks
which are stored more compactly on disk by the
.Sy embedded_data
@ -2646,11 +2646,25 @@ See
for details on ZFS feature flags and the
.Sy embedded_data
feature.
.It Fl p
.It Fl c, -compressed
Generate a more compact stream by using compressed WRITE records for blocks
which are compressed on disk and in memory (see the
.Sy compression property for details). If the
.Sy lz4_compress
feature is active on the sending system, then the receiving system must have that
feature enabled as well. If the
.Sy large_blocks
feature is enabled on the sending system but the
.Fl L
option is not supplied in conjunction with
.Fl c
then the data will be decompressed before sending so it can be split
into smaller block sizes.
.It Fl p, -props
Include the dataset's properties in the stream. This flag is implicit when
.Fl R
is specified. The receiving system must also support this feature.
.It Fl n
.It Fl n, -dryrun
Do a dry-run ("No-op") send. Do not generate any actual send data. This is
useful in conjunction with the
.Fl v
@ -2660,9 +2674,9 @@ flags to determine what data will be sent.
In this case, the verbose output will be written to
standard output (contrast with a non-dry-run, where the stream is written
to standard output and the verbose output goes to standard error).
.It Fl P
.It Fl P, -parsable
Print machine-parsable verbose information about the stream package generated.
.It Fl v
.It Fl v, -verbose
Print verbose information about the stream package generated.
This information includes a per-second report of how much data has been sent.
.El
@ -2673,7 +2687,7 @@ on future versions of
.It Xo
.Nm
.Cm send
.Op Fl eL
.Op Fl Lce
.Op Fl i Ar snapshot Ns | Ns Ar bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
@ -2699,7 +2713,7 @@ specified as the last component of the name
If the incremental target is a clone, the incremental source can
be the origin snapshot, or an earlier snapshot in the origin's filesystem,
or the origin's origin, etc.
.It Fl L
.It Fl L, -large-block
Generate a stream which may contain blocks larger than 128KB.
This flag
has no effect if the
@ -2715,7 +2729,22 @@ See
for details on ZFS feature flags and the
.Sy large_blocks
feature.
.It Fl e
.It Fl c, -compressed
Generate a more compact stream by using compressed WRITE records for blocks
which are compressed on disk and in memory (see the
.Sy compression
property for details). If the
.Sy lz4_compress
feature is active on the sending system, then the receiving system must have
that feature enabled as well. If the
.Sy large_blocks
feature is enabled on the sending system but the
.Fl L
option is not supplied in conjunction with
.Fl c
then the data will be decompressed before sending so it can be split
into smaller block sizes.
.It Fl e, -embed
Generate a more compact stream by using WRITE_EMBEDDED records for blocks
which are stored more compactly on disk by the
.Sy embedded_data

View File

@ -35,6 +35,7 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <libgen.h>
#include <libintl.h>
#include <libuutil.h>
@ -278,7 +279,7 @@ get_usage(zfs_help_t idx)
case HELP_ROLLBACK:
return (gettext("\trollback [-rRf] <snapshot>\n"));
case HELP_SEND:
return (gettext("\tsend [-DnPpRvLe] [-[iI] snapshot] "
return (gettext("\tsend [-DnPpRvLec] [-[iI] snapshot] "
"<snapshot>\n"
"\tsend [-Le] [-i snapshot|bookmark] "
"<filesystem|volume|snapshot>\n"
@ -3771,8 +3772,23 @@ zfs_do_send(int argc, char **argv)
nvlist_t *dbgnv = NULL;
boolean_t extraverbose = B_FALSE;
struct option long_options[] = {
{"replicate", no_argument, NULL, 'R'},
{"props", no_argument, NULL, 'p'},
{"parsable", no_argument, NULL, 'P'},
{"dedup", no_argument, NULL, 'D'},
{"verbose", no_argument, NULL, 'v'},
{"dryrun", no_argument, NULL, 'n'},
{"large-block", no_argument, NULL, 'L'},
{"embed", no_argument, NULL, 'e'},
{"resume", required_argument, NULL, 't'},
{"compressed", no_argument, NULL, 'c'},
{0, 0, 0, 0}
};
/* check options */
while ((c = getopt(argc, argv, ":i:I:RDpvnPLet:")) != -1) {
while ((c = getopt_long(argc, argv, ":i:I:RbDpvnPLet:c", long_options,
NULL)) != -1) {
switch (c) {
case 'i':
if (fromname)
@ -3816,12 +3832,17 @@ zfs_do_send(int argc, char **argv)
case 't':
resume_token = optarg;
break;
case 'c':
flags.compress = B_TRUE;
break;
case ':':
(void) fprintf(stderr, gettext("missing argument for "
"'%c' option\n"), optopt);
usage(B_FALSE);
break;
case '?':
/*FALLTHROUGH*/
default:
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
usage(B_FALSE);
@ -3892,6 +3913,8 @@ zfs_do_send(int argc, char **argv)
lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK;
if (flags.embed_data)
lzc_flags |= LZC_SEND_FLAG_EMBED_DATA;
if (flags.compress)
lzc_flags |= LZC_SEND_FLAG_COMPRESS;
if (fromname != NULL &&
(fromname[0] == '#' || fromname[0] == '@')) {

View File

@ -25,8 +25,8 @@
*/
/*
* Copyright (c) 2013, 2014 by Delphix. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
* Copyright (c) 2013, 2015 by Delphix. All rights reserved.
*/
#include <ctype.h>
@ -39,6 +39,7 @@
#include <sys/dmu.h>
#include <sys/zfs_ioctl.h>
#include <sys/zio.h>
#include <zfs_fletcher.h>
/*
@ -251,6 +252,7 @@ main(int argc, char *argv[])
(void) fprintf(stderr, "invalid option '%c'\n",
optopt);
usage();
break;
}
}
@ -453,38 +455,50 @@ main(int argc, char *argv[])
drrw->drr_object = BSWAP_64(drrw->drr_object);
drrw->drr_type = BSWAP_32(drrw->drr_type);
drrw->drr_offset = BSWAP_64(drrw->drr_offset);
drrw->drr_length = BSWAP_64(drrw->drr_length);
drrw->drr_logical_size =
BSWAP_64(drrw->drr_logical_size);
drrw->drr_toguid = BSWAP_64(drrw->drr_toguid);
drrw->drr_key.ddk_prop =
BSWAP_64(drrw->drr_key.ddk_prop);
drrw->drr_compressed_size =
BSWAP_64(drrw->drr_compressed_size);
}
uint64_t payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw);
/*
* If this is verbose and/or dump output,
* print info on the modified block
*/
if (verbose) {
(void) printf("WRITE object = %llu type = %u "
"checksum type = %u\n"
" offset = %llu length = %llu "
"checksum type = %u compression type = %u\n"
" offset = %llu logical_size = %llu "
"compressed_size = %llu "
"payload_size = %llu "
"props = %llx\n",
(u_longlong_t)drrw->drr_object,
drrw->drr_type,
drrw->drr_checksumtype,
drrw->drr_compressiontype,
(u_longlong_t)drrw->drr_offset,
(u_longlong_t)drrw->drr_length,
(u_longlong_t)drrw->drr_logical_size,
(u_longlong_t)drrw->drr_compressed_size,
(u_longlong_t)payload_size,
(u_longlong_t)drrw->drr_key.ddk_prop);
}
/*
* Read the contents of the block in from STDIN to buf
*/
(void) ssread(buf, drrw->drr_length, &zc);
(void) ssread(buf, payload_size, &zc);
/*
* If in dump mode
*/
if (dump) {
print_block(buf, drrw->drr_length);
print_block(buf, payload_size);
}
total_write_size += drrw->drr_length;
total_write_size += payload_size;
break;
case DRR_WRITE_BYREF:

View File

@ -616,6 +616,9 @@ typedef struct sendflags {
/* WRITE_EMBEDDED records of type DATA are permitted */
boolean_t embed_data;
/* compressed WRITE records are permitted */
boolean_t compress;
} sendflags_t;
typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);

View File

@ -354,8 +354,10 @@ cksummer(void *arg)
{
struct drr_write *drrw = &drr->drr_u.drr_write;
dataref_t dataref;
uint64_t payload_size;
(void) ssread(buf, drrw->drr_length, ofp);
payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw);
(void) ssread(buf, payload_size, ofp);
/*
* Use the existing checksum if it's dedup-capable,
@ -369,7 +371,7 @@ cksummer(void *arg)
zio_cksum_t tmpsha256;
SHA256Init(&ctx);
SHA256Update(&ctx, buf, drrw->drr_length);
SHA256Update(&ctx, buf, payload_size);
SHA256Final(&tmpsha256, &ctx);
drrw->drr_key.ddk_cksum.zc_word[0] =
BE_64(tmpsha256.zc_word[0]);
@ -399,7 +401,7 @@ cksummer(void *arg)
wbr_drrr->drr_object = drrw->drr_object;
wbr_drrr->drr_offset = drrw->drr_offset;
wbr_drrr->drr_length = drrw->drr_length;
wbr_drrr->drr_length = drrw->drr_logical_size;
wbr_drrr->drr_toguid = drrw->drr_toguid;
wbr_drrr->drr_refguid = dataref.ref_guid;
wbr_drrr->drr_refobject =
@ -421,7 +423,7 @@ cksummer(void *arg)
goto out;
} else {
/* block not previously seen */
if (dump_record(drr, buf, drrw->drr_length,
if (dump_record(drr, buf, payload_size,
&stream_cksum, outfd) != 0)
goto out;
}
@ -924,7 +926,7 @@ typedef struct send_dump_data {
uint64_t prevsnap_obj;
boolean_t seenfrom, seento, replicate, doall, fromorigin;
boolean_t verbose, dryrun, parsable, progress, embed_data, std_out;
boolean_t large_block;
boolean_t large_block, compress;
int outfd;
boolean_t err;
nvlist_t *fss;
@ -940,7 +942,7 @@ typedef struct send_dump_data {
static int
estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_obj,
boolean_t fromorigin, uint64_t *sizep)
boolean_t fromorigin, enum lzc_send_flags flags, uint64_t *sizep)
{
zfs_cmd_t zc = { 0 };
libzfs_handle_t *hdl = zhp->zfs_hdl;
@ -953,6 +955,7 @@ estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_obj,
zc.zc_sendobj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID);
zc.zc_fromobj = fromsnap_obj;
zc.zc_guid = 1; /* estimate flag */
zc.zc_flags = flags;
if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND, &zc) != 0) {
char errbuf[1024];
@ -1192,6 +1195,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
progress_arg_t pa = { 0 };
pthread_t tid;
char *thissnap;
enum lzc_send_flags flags = 0;
int err;
boolean_t isfromsnap, istosnap, fromorigin;
boolean_t exclude = B_FALSE;
@ -1220,6 +1224,13 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
if (istosnap)
sdd->seento = B_TRUE;
if (sdd->large_block)
flags |= LZC_SEND_FLAG_LARGE_BLOCK;
if (sdd->embed_data)
flags |= LZC_SEND_FLAG_EMBED_DATA;
if (sdd->compress)
flags |= LZC_SEND_FLAG_COMPRESS;
if (!sdd->doall && !isfromsnap && !istosnap) {
if (sdd->replicate) {
char *snapname;
@ -1266,7 +1277,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
if (sdd->verbose) {
uint64_t size = 0;
(void) estimate_ioctl(zhp, sdd->prevsnap_obj,
fromorigin, &size);
fromorigin, flags, &size);
send_print_verbose(fout, zhp->zfs_name,
sdd->prevsnap[0] ? sdd->prevsnap : NULL,
@ -1291,12 +1302,6 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
}
}
enum lzc_send_flags flags = 0;
if (sdd->large_block)
flags |= LZC_SEND_FLAG_LARGE_BLOCK;
if (sdd->embed_data)
flags |= LZC_SEND_FLAG_EMBED_DATA;
err = dump_ioctl(zhp, sdd->prevsnap, sdd->prevsnap_obj,
fromorigin, sdd->outfd, flags, sdd->debugnv);
@ -1602,8 +1607,12 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
fromguid = 0;
(void) nvlist_lookup_uint64(resume_nvl, "fromguid", &fromguid);
if (flags->largeblock || nvlist_exists(resume_nvl, "largeblockok"))
lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK;
if (flags->embed_data || nvlist_exists(resume_nvl, "embedok"))
lzc_flags |= LZC_SEND_FLAG_EMBED_DATA;
if (flags->compress || nvlist_exists(resume_nvl, "compressok"))
lzc_flags |= LZC_SEND_FLAG_COMPRESS;
if (guid_to_name(hdl, toname, toguid, B_FALSE, name) != 0) {
if (zfs_dataset_exists(hdl, toname, ZFS_TYPE_DATASET)) {
@ -1636,7 +1645,8 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
if (flags->verbose) {
uint64_t size = 0;
error = lzc_send_space(zhp->zfs_name, fromname, &size);
error = lzc_send_space(zhp->zfs_name, fromname,
lzc_flags, &size);
if (error == 0)
size = MAX(0, (int64_t)(size - bytes));
send_print_verbose(stderr, zhp->zfs_name, fromname,
@ -1866,6 +1876,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
sdd.dryrun = flags->dryrun;
sdd.large_block = flags->largeblock;
sdd.embed_data = flags->embed_data;
sdd.compress = flags->compress;
sdd.filter_cb = filter_func;
sdd.filter_cb_arg = cb_arg;
if (debugnvp)
@ -2960,11 +2971,17 @@ recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byteswap)
case DRR_WRITE:
if (byteswap) {
drr->drr_u.drr_write.drr_length =
BSWAP_64(drr->drr_u.drr_write.drr_length);
drr->drr_u.drr_write.drr_logical_size =
BSWAP_64(
drr->drr_u.drr_write.drr_logical_size);
drr->drr_u.drr_write.drr_compressed_size =
BSWAP_64(
drr->drr_u.drr_write.drr_compressed_size);
}
uint64_t payload_size =
DRR_WRITE_PAYLOAD_SIZE(&drr->drr_u.drr_write);
(void) recv_read(hdl, fd, buf,
drr->drr_u.drr_write.drr_length, B_FALSE, NULL);
payload_size, B_FALSE, NULL);
break;
case DRR_SPILL:
if (byteswap) {

View File

@ -534,6 +534,8 @@ lzc_send_resume(const char *snapname, const char *from, int fd,
fnvlist_add_boolean(args, "largeblockok");
if (flags & LZC_SEND_FLAG_EMBED_DATA)
fnvlist_add_boolean(args, "embedok");
if (flags & LZC_SEND_FLAG_COMPRESS)
fnvlist_add_boolean(args, "compressok");
if (resumeobj != 0 || resumeoff != 0) {
fnvlist_add_uint64(args, "resume_object", resumeobj);
fnvlist_add_uint64(args, "resume_offset", resumeoff);
@ -559,7 +561,8 @@ lzc_send_resume(const char *snapname, const char *from, int fd,
* an equivalent snapshot.
*/
int
lzc_send_space(const char *snapname, const char *from, uint64_t *spacep)
lzc_send_space(const char *snapname, const char *from,
enum lzc_send_flags flags, uint64_t *spacep)
{
nvlist_t *args;
nvlist_t *result;
@ -568,6 +571,12 @@ lzc_send_space(const char *snapname, const char *from, uint64_t *spacep)
args = fnvlist_alloc();
if (from != NULL)
fnvlist_add_string(args, "from", from);
if (flags & LZC_SEND_FLAG_LARGE_BLOCK)
fnvlist_add_boolean(args, "largeblockok");
if (flags & LZC_SEND_FLAG_EMBED_DATA)
fnvlist_add_boolean(args, "embedok");
if (flags & LZC_SEND_FLAG_COMPRESS)
fnvlist_add_boolean(args, "compressok");
err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result);
nvlist_free(args);
if (err == 0)

View File

@ -62,13 +62,14 @@ int lzc_get_holds(const char *, nvlist_t **);
enum lzc_send_flags {
LZC_SEND_FLAG_EMBED_DATA = 1 << 0,
LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1
LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1,
LZC_SEND_FLAG_COMPRESS = 1 << 2
};
int lzc_send(const char *, const char *, int, enum lzc_send_flags);
int lzc_send_resume(const char *, const char *, int,
enum lzc_send_flags, uint64_t, uint64_t);
int lzc_send_space(const char *, const char *, uint64_t *);
int lzc_send_space(const char *, const char *, enum lzc_send_flags, uint64_t *);
struct dmu_replay_record;

View File

@ -1285,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, const char *fn, unsigned int op)
err(EXIT_FAILURE, "can not open %s", fn);
if ((data = malloc(sb.st_size + 1)) == NULL)
err(EXIT_FAILURE, "malloc failed");
if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp))
err(EXIT_FAILURE, "fread failed");
if (sb.st_size > 0)
if (fread(data, sb.st_size, 1, fp) != 1)
err(EXIT_FAILURE, "fread failed");
fclose(fp);
data[sb.st_size] = '\0';

View File

@ -159,12 +159,6 @@ context_head()
}
context_body()
{
# Begin FreeBSD
grep_type
if [ $? -eq $GREP_TYPE_BSD ]; then
atf_expect_fail "this test doesn't pass with BSD grep yet"
fi
# End FreeBSD
cp $(atf_get_srcdir)/d_context_*.* .
atf_check -o file:d_context_a.out grep -C2 bamboo d_context_a.in
@ -226,12 +220,6 @@ context2_head()
}
context2_body()
{
# Begin FreeBSD
grep_type
if [ $? -eq $GREP_TYPE_BSD ]; then
atf_expect_fail "this test doesn't pass with BSD grep yet"
fi
# End FreeBSD
printf "haddock\000cod\000plaice\000" > test1
printf "mackeral\000cod\000crab\000" > test2
@ -391,6 +379,66 @@ zerolen_body()
atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1
}
atf_test_case fgrep_sanity
fgrep_sanity_head()
{
atf_set "descr" "Check for fgrep sanity, literal expressions only"
}
fgrep_sanity_body()
{
printf "Foo" > test1
atf_check -o inline:"Foo\n" fgrep -e "Foo" test1
atf_check -s exit:1 -o empty fgrep -e "Fo." test1
}
atf_test_case egrep_sanity
egrep_sanity_head()
{
atf_set "descr" "Check for egrep sanity, EREs only"
}
egrep_sanity_body()
{
printf "Foobar(ed)" > test1
printf "M{1}" > test2
atf_check -o inline:"Foo\n" egrep -o -e "F.." test1
atf_check -o inline:"Foobar\n" egrep -o -e "F[a-z]*" test1
atf_check -o inline:"Fo\n" egrep -o -e "F(o|p)" test1
atf_check -o inline:"(ed)\n" egrep -o -e "\(ed\)" test1
atf_check -o inline:"M\n" egrep -o -e "M{1}" test2
atf_check -o inline:"M{1}\n" egrep -o -e "M\{1\}" test2
}
atf_test_case grep_sanity
grep_sanity_head()
{
atf_set "descr" "Check for basic grep sanity, BREs only"
}
grep_sanity_body()
{
printf "Foobar(ed)" > test1
printf "M{1}" > test2
atf_check -o inline:"Foo\n" grep -o -e "F.." test1
atf_check -o inline:"Foobar\n" grep -o -e "F[a-z]*" test1
atf_check -o inline:"Fo\n" grep -o -e "F\(o\)" test1
atf_check -o inline:"(ed)\n" grep -o -e "(ed)" test1
atf_check -o inline:"M{1}\n" grep -o -e "M{1}" test2
atf_check -o inline:"M\n" grep -o -e "M\{1\}" test2
}
# End FreeBSD
atf_init_test_cases()
@ -419,5 +467,8 @@ atf_init_test_cases()
atf_add_test_case escmap
atf_add_test_case egrep_empty_invalid
atf_add_test_case zerolen
atf_add_test_case fgrep_sanity
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity
# End FreeBSD
}

View File

@ -1085,9 +1085,9 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
/*
* Return an error for our caller to handle.
*/
pcap_close(pc);
snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s\n(%s)",
device, pcap_statustostr(status), cp);
pcap_close(pc);
return (NULL);
} else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0')
error("%s: %s\n(%s)", device,

View File

@ -408,7 +408,6 @@ defaultrouter="NO" # Set to default gateway (or NO).
static_arp_pairs="" # Set to static ARP list (or leave empty).
static_ndp_pairs="" # Set to static NDP list (or leave empty).
static_routes="" # Set to static route list (or leave empty).
natm_static_routes="" # Set to static route list for NATM (or leave empty).
gateway_enable="NO" # Set to YES if this host will be a gateway.
routed_enable="NO" # Set to YES to enable a routing daemon.
routed_program="/sbin/routed" # Name of routing daemon to use if enabled.
@ -417,17 +416,6 @@ arpproxy_all="NO" # replaces obsolete kernel option ARP_PROXYALL.
forward_sourceroute="NO" # do source routing (only if gateway_enable is set to "YES")
accept_sourceroute="NO" # accept source routed packets to us
### ATM interface options: ###
atm_enable="NO" # Configure ATM interfaces (or NO).
#atm_netif_hea0="atm 1" # Network interfaces for physical interface.
#atm_sigmgr_hea0="uni31" # Signalling manager for physical interface.
#atm_prefix_hea0="ILMI" # NSAP prefix (UNI interfaces only) (or ILMI).
#atm_macaddr_hea0="NO" # Override physical MAC address (or NO).
#atm_arpserver_atm0="0x47.0005.80.999999.9999.9999.9999.999999999999.00" # ATMARP server address (or local).
#atm_scsparp_atm0="NO" # Run SCSP/ATMARP on network interface (or NO).
atm_pvcs="" # Set to PVC list (or leave empty).
atm_arps="" # Set to permanent ARP list (or leave empty).
### Bluetooth ###
hcsecd_enable="NO" # Enable hcsecd(8) (or NO)
hcsecd_config="/etc/bluetooth/hcsecd.conf" # hcsecd(8) configuration file

View File

@ -189,8 +189,6 @@
..
atf
..
atm
..
legal
..
llvm

View File

@ -44,9 +44,6 @@ _start=quietstart
/etc/rc.d/ipnat ${_start}
/etc/rc.d/ipfs ${_start}
/etc/rc.d/sppp ${_start}
# /etc/rc.d/atm1 ${_start}
# . /etc/rc.d/atm2.sh ${_start}
# . /etc/rc.d/atm3.sh ${_start}
/etc/rc.d/netif ${_start}
/etc/rc.d/ipsec ${_start}
/etc/rc.d/ppp ${_start}

View File

@ -489,13 +489,6 @@ afexists()
inet|inet6)
check_kern_features ${_af}
;;
atm)
if [ -x /sbin/atmconfig ]; then
/sbin/atmconfig diag list > /dev/null 2>&1
else
return 1
fi
;;
link|ether)
return 0
;;

View File

@ -159,14 +159,6 @@ APM+= apmd
APMPACKAGE= apm
.endif
.if ${MK_ATM} != "no"
FILESGROUPS+= ATM
ATM+= atm1
ATM+= atm2
ATM+= atm3
ATMPACKAGE= atm
.endif
.if ${MK_AUTOFS} != "no"
FILES+= automount
FILES+= automountd

View File

@ -1,176 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2000 The FreeBSD Project
# 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$
#
# PROVIDE: atm1
# REQUIRE: root
# BEFORE: netif
# KEYWORD: nojail
. /etc/rc.subr
name="atm"
rcvar="atm_enable"
start_cmd="atm_start"
stop_cmd=":"
# ATM networking startup script
#
# Initial interface configuration.
# N.B. /usr is not mounted.
#
atm_start()
{
if [ -n "${natm_interfaces}" ] ; then
# Load the HARP pseudo interface
load_kld if_harp || return 1
# Load all the NATM drivers that we need
for natm in ${natm_interfaces} ; do
ifconfig ${natm} up
done
fi
# Load loadable HARP drivers
for dev in ${atm_load} ; do
load_kld ${dev} || return 1
done
# Locate all probed ATM adapters
atmdev=`atm sh stat int | while read dev junk; do
case ${dev} in
hea[0-9] | hea[0-9][0-9])
echo "${dev} "
;;
hfa[0-9] | hfa[0-9][0-9])
echo "${dev} "
;;
idt[0-9] | idt[0-9][0-9])
echo "${dev} "
;;
# NATM interfaces per pseudo driver
en[0-9] | en[0-9][0-9])
echo "${dev} "
;;
fatm[0-9] | fatm[0-9][0-9])
echo "${dev} "
;;
hatm[0-9] | hatm[0-9][0-9])
echo "${dev} "
;;
patm[0-9] | patm[0-9][0-9])
echo "${dev} "
;;
*)
continue
;;
esac
done`
if [ -z "${atmdev}" ]; then
echo 'No ATM adapters found'
return 0
fi
# Load microcode into FORE adapters (if needed)
if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
fore_dnld
fi
# Configure physical interfaces
ilmid=0
for phy in ${atmdev}; do
echo -n "Configuring ATM device ${phy}:"
# Define network interfaces
eval netif_args=\$atm_netif_${phy}
if [ -n "${netif_args}" ]; then
atm set netif ${phy} ${netif_args} || continue
else
echo ' missing network interface definition'
continue
fi
# Override physical MAC address
eval macaddr_args=\$atm_macaddr_${phy}
if [ -n "${macaddr_args}" ]; then
case ${macaddr_args} in
[Nn][Oo] | '')
;;
*)
atm set mac ${phy} ${macaddr_args} || continue
;;
esac
fi
# Configure signalling manager
eval sigmgr_args=\$atm_sigmgr_${phy}
if [ -n "${sigmgr_args}" ]; then
atm attach ${phy} ${sigmgr_args} || continue
else
echo ' missing signalling manager definition'
continue
fi
# Configure UNI NSAP prefix
eval prefix_args=\$atm_prefix_${phy}
if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
if [ -z "${prefix_args}" ]; then
echo ' missing NSAP prefix for UNI interface'
continue
fi
case ${prefix_args} in
ILMI)
ilmid=1
;;
*)
atm set prefix ${phy} ${prefix_args} || continue
;;
esac
fi
atm_phy="${atm_phy} ${phy}"
echo '.'
done
echo -n 'Starting initial ATM daemons:'
# Start ILMI daemon (if needed)
case ${ilmid} in
1)
echo -n ' ilmid'
ilmid
;;
esac
echo '.'
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,97 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2000 The FreeBSD Project
# 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$
#
# PROVIDE: atm2
# REQUIRE: atm1 netif
# BEFORE: routing
# KEYWORD: nojail
#
# Additional ATM interface configuration
#
. /etc/rc.subr
name="atm2"
rcvar="atm_enable"
start_cmd="atm2_start"
stop_cmd=":"
atm2_start()
{
# Configure network interfaces
# get a list of physical interfaces
atm_phy=`atm show stat int | { read junk ; read junk ; \
while read dev junk ; do
case ${dev} in
en[0-9] | en[0-9][0-9])
;;
*)
echo "${dev} "
;;
esac
done ; }`
for phy in ${atm_phy}; do
eval netif_args=\$atm_netif_${phy}
set -- ${netif_args}
# skip unused physical interfaces
if [ $# -lt 2 ] ; then
continue
fi
netname=$1
netcnt=$2
netindx=0
while [ ${netindx} -lt ${netcnt} ]; do
net="${netname}${netindx}"
netindx=$((${netindx} + 1))
echo -n " ${net}"
# Configure atmarp server
eval atmarp_args=\$atm_arpserver_${net}
if [ -n "${atmarp_args}" ]; then
atm set arpserver ${net} ${atmarp_args} ||
continue
fi
done
done
echo '.'
# Define any permanent ARP entries.
if [ -n "${atm_arps}" ]; then
for i in ${atm_arps}; do
eval arp_args=\$atm_arp_${i}
atm add arp ${arp_args}
done
fi
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,93 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2000 The FreeBSD Project
# 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$
#
# Start ATM daemons
# PROVIDE: atm3
# REQUIRE: atm2
# BEFORE: DAEMON
# KEYWORD: nojail
. /etc/rc.subr
name="atm3"
rcvar="atm_enable"
start_cmd="atm3_start"
stop_cmd=":"
atm3_start()
{
echo -n 'Starting ATM daemons:'
# Get a list of network interfaces
atm_nif=`atm sh netif | { read junk ; \
while read dev junk ; do
echo "${dev} "
done
}`
for net in ${atm_nif} ; do
eval atmarp_args=\$atm_arpserver_${net}
eval scsparp_args=\$atm_scsparp_${net}
case ${scsparp_args} in
[Yy][Ee][Ss])
case ${atmarp_args} in
local)
;;
*)
warn "${net}: local arpserver required for SCSP"
continue
;;
esac
atm_atmarpd="${atm_atmarpd} ${net}"
atm_scspd=1
;;
esac
done
# Start SCSP daemon (if needed)
case ${atm_scspd} in
1)
echo -n ' scspd'
scspd
;;
esac
# Start ATMARP daemon (if needed)
if [ -n "${atm_atmarpd}" ]; then
echo -n ' atmarpd'
atmarpd ${atm_atmarpd}
fi
echo '.'
}
load_rc_config $name
run_rc_command "$1"

View File

@ -36,7 +36,7 @@ routing_start()
case $_af in
""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
for _a in inet inet6 atm; do
for _a in inet inet6; do
afexists $_a || continue
setroutes $_cmd $_a $_if || _ret=1
done
@ -65,7 +65,7 @@ routing_stop()
case $_af in
""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
for _a in inet inet6 atm; do
for _a in inet inet6; do
afexists $_a || continue
eval static_${_a} delete $_if
# When $_if is specified, do not flush routes.
@ -126,11 +126,6 @@ routing_stop_inet6()
done
}
routing_stop_atm()
{
return 0
}
get_fibmod()
{
local _fibs
@ -289,23 +284,6 @@ static_inet6()
sysctl net.inet6.ip6.use_defaultzone=1
}
static_atm()
{
local _action i route_args
_action=$1
if [ -n "${natm_static_routes}" ]; then
for i in ${natm_static_routes}; do
route_args=`get_if_var $i route_IF`
if [ -n "$route_args" ]; then
atmconfig natm ${_action} ${route_args}
else
warn "route_${i} not found."
fi
done
fi
}
ropts_init()
{
if [ -z "${_ropts_initdone}" ]; then
@ -391,12 +369,5 @@ options_inet6()
[ -n "${_ropts_initdone}" ] && echo '.'
}
options_atm()
{
_ropts_initdone=
[ -n "${_ropts_initdone}" ] && echo '.'
}
load_rc_config $name
run_rc_command "$@"

View File

@ -1,9 +1,15 @@
# $FreeBSD$
SUBDIR= libgdb gdb gdbtui kgdb
.include <src.opts.mk>
SUBDIR= libgdb gdb kgdb
.if ${MK_GDB_LIBEXEC} == "no"
SUBDIR+= gdbtui
.if exists(${.CURDIR}/gdbserver/reg-${MACHINE_CPUARCH}.c)
SUBDIR+=gdbserver
.endif
.endif
.include <bsd.subdir.mk>

View File

@ -1,5 +1,7 @@
# $FreeBSD$
.include <src.opts.mk>
VERSION= "6.1.1 [FreeBSD]"
VENDOR= marcel
@ -53,6 +55,9 @@ GENSRCS+= nm.h tm.h
CFLAGS+= -DCROSS_DEBUGGER -I${BMAKE_ROOT:H:H}
GDB_SUFFIX= -${TARGET_ARCH}
MAN=
.elif ${MK_GDB_LIBEXEC} != "no"
BINDIR?= /usr/libexec
MAN=
.endif
.include "${TARGET_SUBDIR}/Makefile"

View File

@ -40,14 +40,14 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
syslog.h ucontext.h
LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \
netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
netipsec netsmb nfs nfsclient nfsserver sys vm
LSUBDIRS= cam/ata cam/nvme cam/scsi \
dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
dev/hwpmc dev/hyperv \
dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \
dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
dev/speaker dev/utopia dev/vkbd dev/wi \
dev/speaker dev/vkbd dev/wi \
fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
fs/procfs fs/smbfs fs/udf fs/unionfs \
geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \

View File

@ -72,7 +72,6 @@ MLINKS+= bsnmpagent.3 snmp_make_errresp.3
MLINKS+= bsnmpagent.3 snmp_op_t.3
MLINKS+= bsnmpagent.3 snmp_set.3
MLINKS+= bsnmpagent.3 snmp_trace.3
MLINKS+= bsnmpagent.3 tree.3
MLINKS+= bsnmpagent.3 tree_size.3
MLINKS+= bsnmpclient.3 snmp_add_binding.3

View File

@ -28,7 +28,7 @@
.\" @(#)getpagesize.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd June 4, 1993
.Dd April 26, 2017
.Dt GETPAGESIZE 3
.Os
.Sh NAME

View File

@ -69,7 +69,7 @@ getpagesize(void)
mib[1] = HW_PAGESIZE;
size = sizeof value;
if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1)
return (-1);
return (PAGE_SIZE);
return (value);
}

View File

@ -82,8 +82,7 @@ scandir(const char *dirname, struct dirent ***namelist,
#endif
{
struct dirent *d, *p, **names = NULL;
size_t numitems;
long arraysz;
size_t arraysz, numitems;
DIR *dirp;
if ((dirp = opendir(dirname)) == NULL)

View File

@ -455,7 +455,6 @@ getnameinfo_link(const struct afd *afd,
host, hostlen);
/*
* The following have zero-length addresses.
* IFT_ATM (net/if_atmsubr.c)
* IFT_GIF (net/if_gif.c)
* IFT_LOOP (net/if_loop.c)
* IFT_PPP (net/if_ppp.c, net/if_spppsubr.c)

View File

@ -36,7 +36,7 @@
/* character-name table */
static struct cname {
char *name;
const char *name;
char code;
} cnames[] = {
{"NUL", '\0'},

View File

@ -66,8 +66,8 @@ __FBSDID("$FreeBSD$");
* other clumsinesses
*/
struct parse {
char *next; /* next character in RE */
char *end; /* end of string (-> NUL normally) */
const char *next; /* next character in RE */
const char *end; /* end of string (-> NUL normally) */
int error; /* has an error been seen? */
sop *strip; /* malloced strip */
sopno ssize; /* malloced strip size (allocated) */
@ -207,7 +207,7 @@ regcomp(regex_t * __restrict preg,
return(REG_INVARG);
len = preg->re_endp - pattern;
} else
len = strlen((char *)pattern);
len = strlen(pattern);
/* do the mallocs early so failure handling is easy */
g = (struct re_guts *)malloc(sizeof(struct re_guts));
@ -239,7 +239,7 @@ regcomp(regex_t * __restrict preg,
/* set things up */
p->g = g;
p->next = (char *)pattern; /* convenience; we do not modify it */
p->next = pattern; /* convenience; we do not modify it */
p->end = p->next + len;
p->error = 0;
p->ncsalloc = 0;
@ -840,7 +840,7 @@ p_b_term(struct parse *p, cset *cs)
static void
p_b_cclass(struct parse *p, cset *cs)
{
char *sp = p->next;
const char *sp = p->next;
size_t len;
wctype_t wct;
char clname[16];
@ -903,12 +903,11 @@ static wint_t /* value of collating element */
p_b_coll_elem(struct parse *p,
wint_t endc) /* name ended by endc,']' */
{
char *sp = p->next;
const char *sp = p->next;
struct cname *cp;
int len;
mbstate_t mbs;
wchar_t wc;
size_t clen;
size_t clen, len;
while (MORE() && !SEETWO(endc, ']'))
NEXT();
@ -955,8 +954,8 @@ othercase(wint_t ch)
static void
bothcases(struct parse *p, wint_t ch)
{
char *oldnext = p->next;
char *oldend = p->end;
const char *oldnext = p->next;
const char *oldend = p->end;
char bracket[3 + MB_LEN_MAX];
size_t n;
mbstate_t mbs;
@ -1009,8 +1008,8 @@ ordinary(struct parse *p, wint_t ch)
static void
nonnewline(struct parse *p)
{
char *oldnext = p->next;
char *oldend = p->end;
const char *oldnext = p->next;
const char *oldend = p->end;
char bracket[4];
p->next = bracket;

View File

@ -54,7 +54,7 @@ extern "C" {
#endif
/* === regerror.c === */
static char *regatoi(const regex_t *preg, char *localbuf);
static const char *regatoi(const regex_t *preg, char *localbuf);
#ifdef __cplusplus
}
@ -83,8 +83,8 @@ static char *regatoi(const regex_t *preg, char *localbuf);
*/
static struct rerr {
int code;
char *name;
char *explain;
const char *name;
const char *explain;
} rerrs[] = {
{REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
{REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
@ -120,7 +120,7 @@ regerror(int errcode,
struct rerr *r;
size_t len;
int target = errcode &~ REG_ITOA;
char *s;
const char *s;
char convbuf[50];
if (errcode == REG_ATOI)
@ -158,7 +158,7 @@ regerror(int errcode,
- regatoi - internal routine to implement REG_ATOI
== static char *regatoi(const regex_t *preg, char *localbuf);
*/
static char *
static const char *
regatoi(const regex_t *preg, char *localbuf)
{
struct rerr *r;

View File

@ -73,7 +73,7 @@
* immediately *preceding* "execution" of that operator.
*/
typedef unsigned long sop; /* strip operator */
typedef long sopno;
typedef unsigned long sopno;
#define OPRMASK 0xf8000000L
#define OPDMASK 0x07ffffffL
#define OPSHIFT ((unsigned)27)
@ -113,11 +113,11 @@ typedef struct {
typedef struct {
unsigned char bmp[NC / 8];
wctype_t *types;
int ntypes;
unsigned int ntypes;
wint_t *wides;
int nwides;
unsigned int nwides;
crange *ranges;
int nranges;
unsigned int nranges;
int invert;
int icase;
} cset;
@ -125,7 +125,7 @@ typedef struct {
static int
CHIN1(cset *cs, wint_t ch)
{
int i;
unsigned int i;
assert(ch >= 0);
if (ch < NC)
@ -165,7 +165,7 @@ struct re_guts {
int magic;
# define MAGIC2 ((('R'^0200)<<8)|'E')
sop *strip; /* malloced area for strip */
int ncsets; /* number of csets in use */
unsigned int ncsets; /* number of csets in use */
cset *sets; /* -> cset [ncsets] */
int cflags; /* copy of regcomp() cflags argument */
sopno nstates; /* = number of sops */

View File

@ -225,9 +225,9 @@ regexec(const regex_t * __restrict preg,
eflags = GOODFLAGS(eflags);
if (MB_CUR_MAX > 1)
return(mmatcher(g, (char *)string, nmatch, pmatch, eflags));
return(mmatcher(g, string, nmatch, pmatch, eflags));
else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
return(smatcher(g, string, nmatch, pmatch, eflags));
else
return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
return(lmatcher(g, string, nmatch, pmatch, eflags));
}

View File

@ -58,7 +58,7 @@ void
regfree(regex_t *preg)
{
struct re_guts *g;
int i;
unsigned int i;
if (preg->re_magic != MAGIC1) /* oops */
return; /* nice to complain, but hard */

View File

@ -29,23 +29,22 @@
* $FreeBSD$
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <fcntl.h>
#include <errno.h>
#include <stdint.h>
#include <sys/types.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <paths.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define GCTL_TABLE 1
#include <libgeom.h>
/*
/*
* Global pointer to a string that is used to avoid an errorneous free in
* gctl_free.
*/
@ -172,7 +171,7 @@ gctl_param_add(struct gctl_req *req, const char *name, int len, void *value,
ap->len = len;
else if (len < 0) {
ap->flag |= GCTL_PARAM_ASCII;
ap->len = strlen(value) + 1;
ap->len = strlen(value) + 1;
}
}

View File

@ -29,23 +29,21 @@
* $FreeBSD$
*/
#include <paths.h>
#include <sys/types.h>
#include <sys/devicestat.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libgeom.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/devicestat.h>
/************************************************************/
static uint npages, pagesize, spp;
static int statsfd = -1;
static uint npages, spp;
static int pagesize, statsfd = -1;
static u_char *statp;
void
@ -67,7 +65,7 @@ geom_stats_resync(void)
if (statsfd == -1)
return;
for (;;) {
p = mmap(statp, (npages + 1) * pagesize,
p = mmap(statp, (npages + 1) * pagesize,
PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED)
break;
@ -89,6 +87,8 @@ geom_stats_open(void)
if (statsfd < 0)
return (errno);
pagesize = getpagesize();
if (pagesize == -1)
return (errno);
spp = pagesize / sizeof(struct devstat);
p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED) {

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 4, 2010
.Dd April 22, 2017
.Dt LIBGEOM 3
.Os
.Sh NAME
@ -63,6 +63,10 @@
.Sh LIBRARY
.Lb libgeom
.Sh SYNOPSIS
.Bd -literal
/* stdio.h is only required for `gctl_dump` */
.Ed
.In stdio.h
.In libgeom.h
.Ss "Statistics Functions"
.Ft void
@ -324,8 +328,8 @@ The
.Fn g_device_path
function returns the full path to a provider given a partial or full path to the
device node.
If the device can not be found or is not a valid geom provider, NULL is
returned.
.Dv NULL
is returned if the device cannot be found or is not a valid geom provider.
.Pp
The
.Fn g_get_ident
@ -344,20 +348,19 @@ string.
.Pp
The
.Fn g_open_by_ident
function opens provider using its ident, unlike
function opens provider using its identification, unlike
.Fn g_open
which uses provider's name.
If the
which uses the provider's name.
The function will store the provider's name in the
.Fa name
argument is not
.Dv NULL ,
the function will store provider's name there.
parameter if it is not
.Dv NULL .
.Pp
The
.Fn g_providername
function returns the provider name of an open file descriptor.
If the file descriptor does not point to a valid geom provider, NULL is
returned.
.Dv NULL
is returned the file descriptor does not point to a valid geom provider.
.Pp
All functions except
.Fn g_providername

View File

@ -913,7 +913,9 @@ svc_rpc_gss_update_seq(struct svc_rpc_gss_client *client, uint32_t seq)
{
int offset, i, word, bit;
uint32_t carry, newcarry;
uint32_t* maskp;
maskp = client->cl_seqmask;
if (seq > client->cl_seqlast) {
/*
* This request has a sequence number greater
@ -923,28 +925,29 @@ svc_rpc_gss_update_seq(struct svc_rpc_gss_client *client, uint32_t seq)
* number)
*/
offset = seq - client->cl_seqlast;
while (offset > 32) {
while (offset >= 32) {
for (i = (SVC_RPC_GSS_SEQWINDOW / 32) - 1;
i > 0; i--) {
client->cl_seqmask[i] = client->cl_seqmask[i-1];
maskp[i] = maskp[i-1];
}
client->cl_seqmask[0] = 0;
maskp[0] = 0;
offset -= 32;
}
carry = 0;
for (i = 0; i < SVC_RPC_GSS_SEQWINDOW / 32; i++) {
newcarry = client->cl_seqmask[i] >> (32 - offset);
client->cl_seqmask[i] =
(client->cl_seqmask[i] << offset) | carry;
carry = newcarry;
if (offset > 0) {
carry = 0;
for (i = 0; i < SVC_RPC_GSS_SEQWINDOW / 32; i++) {
newcarry = maskp[i] >> (32 - offset);
maskp[i] = (maskp[i] << offset) | carry;
carry = newcarry;
}
}
client->cl_seqmask[0] |= 1;
maskp[0] |= 1;
client->cl_seqlast = seq;
} else {
offset = client->cl_seqlast - seq;
word = offset / 32;
bit = offset % 32;
client->cl_seqmask[word] |= (1 << bit);
maskp[word] |= (1 << bit);
}
}

View File

@ -6,7 +6,7 @@
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/

View File

@ -24,6 +24,7 @@ shells/bash
shells/zsh
security/sudo
sysutils/screen
sysutils/tmux
www/firefox
www/links
x11-drivers/xf86-video-vmware

View File

@ -101,10 +101,6 @@ CRUNCH_PROGS_sbin= badsect \
restore rcorder route savecore \
shutdown spppcontrol swapon sysctl tunefs umount
.if ${MK_ATM} != "no"
CRUNCH_PROGS_sbin+= atmconfig
.endif
.if ${MK_CCD} != "no"
CRUNCH_PROGS_sbin+= ccdconfig
.endif
@ -160,9 +156,6 @@ CRUNCH_PROGS_sbin+= bsdlabel fdisk
CRUNCH_ALIAS_bsdlabel= disklabel
.endif
CRUNCH_SRCDIR_atm= ${SRCTOP}/sbin/atm/atm
CRUNCH_SRCDIR_atmconfig= ${SRCTOP}/sbin/atm/atmconfig
CRUNCH_SRCDIR_fore_dnld= ${SRCTOP}/sbin/atm/fore_dnld
CRUNCH_SRCDIR_ilmid= ${SRCTOP}/sbin/atm/ilmid
CRUNCH_SRCDIR_rtquery= ${SRCTOP}/sbin/routed/rtquery
CRUNCH_SRCDIR_ipf= ${SRCTOP}/sbin/ipf/ipf

View File

@ -70,7 +70,6 @@ SUBDIR=adjkerntz \
tunefs \
umount
SUBDIR.${MK_ATM}+= atm
SUBDIR.${MK_CCD}+= ccdconfig
SUBDIR.${MK_CXX}+= devd
SUBDIR.${MK_HAST}+= hastctl

View File

@ -1,28 +0,0 @@
# ===================================
# HARP | Host ATM Research Platform
# ===================================
#
# This Host ATM Research Platform ("HARP") file (the "Software") is
# made available by Network Computing Services, Inc. ("NetworkCS")
# "AS IS". NetworkCS does not provide maintenance, improvements or
# support of any kind.
#
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
# In no event shall NetworkCS be responsible for any damages, including
# but not limited to consequential damages, arising from or relating to
# any use of the Software or related support.
#
# Copyright 1994-1998 Network Computing Services, Inc.
#
# Copies of this Software may be made, however, the above copyright
# notice must be reproduced on all copies.
#
# @(#) $Id: Makefile,v 1.5 1998/07/10 16:01:58 jpt Exp $
# $FreeBSD$
SUBDIR= atmconfig
.include <bsd.subdir.mk>

View File

@ -1,26 +0,0 @@
# ===================================
# HARP | Host ATM Research Platform
# ===================================
#
# This Host ATM Research Platform ("HARP") file (the "Software") is
# made available by Network Computing Services, Inc. ("NetworkCS")
# "AS IS". NetworkCS does not provide maintenance, improvements or
# support of any kind.
#
# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
# In no event shall NetworkCS be responsible for any damages, including
# but not limited to consequential damages, arising from or relating to
# any use of the Software or related support.
#
# Copyright 1994-1998 Network Computing Services, Inc.
#
# Copies of this Software may be made, however, the above copyright
# notice must be reproduced on all copies.
#
# @(#) $Id: Makefile.inc,v 1.5 1998/07/10 16:01:58 jpt Exp $
# $FreeBSD$
.include "../Makefile.inc"

View File

@ -1,44 +0,0 @@
# Copyright (c) 2001-2003
# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
# All rights reserved.
# Author: Harti Brandt <brandt@fokus.gmd.de>
#
# $FreeBSD$
.include <src.opts.mk>
PACKAGE=atm
PROG= atmconfig
SRCS= main.c diag.c natm.c
MAN= atmconfig.8
# CFLAGS+= -DPATH_HELP='".:${SHAREDIR}/doc/atm:/usr/local/share/doc/atm"'
CFLAGS+= -I${.OBJDIR}
.if !defined(RESCUE) && ${MK_BSNMP} != "no"
CFLAGS+= -DWITH_BSNMP
SRCS+= oid.h atmconfig_device.c
LIBADD+= bsnmp
. if ${MK_DYNAMICROOT} == "no" && ${MK_OPENSSL} != "no"
LIBADD+= crypto
. endif
.endif
CLEANFILES+= oid.h
# XXX - this is verboten
.if ${MACHINE_CPUARCH} == "arm"
WARNS?= 3
.endif
FILES= atmconfig.help atmconfig_device.help
FILESDIR= ${SHAREDIR}/doc/atm
SNMP_ATM_DEF= ${SRCTOP}/contrib/ngatm/snmp_atm/atm_tree.def \
${SRCTOP}/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def
oid.h: atm_oid.list ${SNMP_ATM_DEF}
cat ${SNMP_ATM_DEF} | gensnmptree -e `tail -n +2 ${.CURDIR}/atm_oid.list` \
> ${.TARGET}
.include <bsd.prog.mk>

View File

@ -1,22 +0,0 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/arpa \
include/xlocale \
lib/${CSU_DIR} \
lib/libbsnmp/libbsnmp \
lib/libc \
lib/libcompiler_rt \
lib/libnetgraph \
secure/lib/libcrypto \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -1,20 +0,0 @@
# $FreeBSD$
begemotAtmIfTable
begemotAtmIfName
begemotAtmIfNodeId
begemotAtmIfPcr
begemotAtmIfMedia
begemotAtmIfVpiBits
begemotAtmIfVciBits
begemotAtmIfMaxVpcs
begemotAtmIfMaxVccs
begemotAtmIfEsi
begemotAtmIfCarrierStatus
begemotAtmIfMode
begemotAtmIfTableLastChange
begemotAtmHWTable
begemotAtmHWVendor
begemotAtmHWDevice
begemotAtmHWSerial
begemotAtmHWVersion
begemotAtmHWSoftVersion

View File

@ -1,323 +0,0 @@
.\"
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" 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.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.Dd October 5, 2016
.Dt ATMCONFIG 8
.Os
.Sh NAME
.Nm atmconfig
.Nd "ATM configuration tool"
.Sh SYNOPSIS
.Nm
.Op Fl htv
.Op Ar command Op Ar sub-command Op ...
.Op Ar options
.Op Ar arg ...
.Sh DESCRIPTION
The
.Nm
tool is used to configure the Netgraph ATM network sub-system.
.Pp
The command line of
.Nm
generally consists of common options followed by a command string, optionally
followed by sub-command strings, optional command specific options and
command specific arguments.
Commands and sub-commands as well as command
specific options may be abbreviated as
long as there is only one match possible.
.Ss Common Options
The following common options change the overall behaviour of
.Nm :
.Bl -tag -width indent
.It Fl h
Print a very short usage info and exit.
.It Fl t
Several show-type commands output a header and then several lines
of information.
If this option is given, the header is omitted, simplifying the parsing
of the output.
.It Fl v
Be more verbose.
.El
.Ss Obtaining Help
The
.Ic help
command has a number of useful sub-commands.
.Pp
To get general help use:
.D1 Nm Ic help
.Pp
To get a list of available commands use:
.D1 Nm Ic help Cm commands
.Pp
To get a list of available sub-commands use:
.D1 Nm Ic help Ar command
.Pp
or (if there are deeper levels of sub-commands):
.D1 Nm Ic help Ar command sub-command ...
.Pp
To get a list of options and arguments for a command use:
.D1 Nm Ic help Ar command sub-command ...
(given that there are no further sub-command levels).
.Pp
To get a list of common options use:
.D1 Nm Ic help Cm options
.Ss The Ic diag Command
The
.Ic diag
command allows the inspection of the ATM interfaces on the local host
and the modification of device parameters.
Sub-commands are:
.Cm list
(print a list of interfaces),
.Cm config
(print hardware configuration),
.Cm phy
(access PHY chip),
.Cm stats
(print statistics) and
.Cm vcc
(print list of VCCs).
.Bl -tag -width indent
.\"----------------------------------------
.It Nm Ic diag Cm list
This sub-command lists all ATM interfaces in the system.
It takes no options or arguments.
.\"----------------------------------------
.It Xo
.Nm Ic diag Cm config
.Op Fl atm
.Op Fl hardware
.Op Ar device ...
.Xc
This command prints the configuration of ATM interfaces.
If no
.Ar device
is given, all devices are listed, otherwise only the specified devices.
The option
.Fl atm
instructs the command to print ATM layer configuration parameters like
the number of VCI and VPI bits, whereas the
.Fl hardware
option requests card specific information like the vendor or the serial
number.
If none of the options is given, the defaults is to assume
.Fl atm .
.\"----------------------------------------
.It Xo
.Nm Ic diag Cm phy print
.Op Fl numeric
.Ar device
.Xc
This command prints the PHY registers in a (potential)
human comprehensible format.
If
.Fl numeric
is given, the format is hex bytes.
Otherwise, textual representation will be printed.
.\"----------------------------------------
.It Nm Ic diag Cm phy show Op Ar device ...
This sub-command prints static information about the PHY device used
in the ATM card like the type of the PHY and the media.
.\"----------------------------------------
.It Xo
.Nm Ic diag Cm phy set
.Ar device
.Ar reg
.Ar mask
.Ar val
.Xc
This sub-command allows one to change bits in PHY registers.
This should be used with great care.
The bits of the given PHY chip register for which the corresponding bit in
.Ar mask
is one are set to the values of the corresponding bits in
.Ar val .
All register bits that have a zero in
.Ar mask
are written back with their original value.
.\"----------------------------------------
.It Xo
.Nm Ic diag Cm phy stats
.Op Fl clear
.Ar device
.Xc
Print the PHY statistics for the given
.Ar device .
When the optional
.Fl clear
is given, the statistics are cleared atomically.
.\"----------------------------------------
.It Xo
.Nm Ic diag Cm vcc
.Op Fl abr
.Op Fl channel
.Op Fl traffic
.Op Ar device
.Xc
Retrieve the list of currently active channels on either all
or the specified interfaces.
For each channel, the following information is printed depending
on the options (default is
.Fl channel ) .
.Bl -tag -width ".Fl traffic"
.It Fl abr
Print ABR specific traffic parameters: ICR, TBE, NRM, TRM, ADTF, RIF, RDF,
CDF.
.It Fl channel
Print basic information: VPI, VCI, AAL, traffic type, MTU and flags.
.It Fl traffic
Print traffic parameters: PCR, SCR, MBS, MCR.
.El
.\"----------------------------------------
.It Nm Ic diag Cm stats Ar device
Print driver specific statistics.
.El
.Ss The Ic natm Command
The
.Ic natm
command is used to change
.Xr natmip 4
routes on the local host.
The sub-commands for the routing table are:
.Cm add
(to add a new route),
.Cm delete
(to delete an existing route) and
.Cm show
(to print the currently installed NATM routes).
.Pp
.Bl -tag -width indent -compact
.\"----------------------------------------
.It Xo
.Nm Ic natm Cm add
.Ar dest
.Ar device
.Ar vpi
.Ar vci
.Ar encaps
.Xc
.It Xo
.Nm Ic natm Cm add
.Ar dest
.Ar device
.Ar vpi
.Ar vci
.Ar encaps
.Cm ubr Op Ar pcr
.Xc
.It Xo
.Nm Ic natm Cm add
.Ar dest
.Ar device
.Ar vpi
.Ar vci
.Ar encaps
.Cm cbr Ar pcr
.Xc
.It Xo
.Nm Ic natm Cm add
.Ar dest
.Ar device
.Ar vpi
.Ar vci
.Ar encaps
.Cm vbr Ar pcr scr mbs
.Xc
.It Xo
.Nm Ic natm Cm add
.Ar dest
.Ar device
.Ar vpi
.Ar vci
.Ar encaps
.Cm abr Ar pcr mcr icr tbe nrm trm adtf rif rdf cdf
.Xc
Add a new route to the routing table.
The destination address (the address
on the other end of the link) is given in
.Ar dest .
The
.Ar device ,
.Ar vpi
and
.Ar vci
arguments
are the name of the ATM device and the VPI and VCI values for the link.
The
.Ar encaps
argument
may be either
.Cm AAL5
or
.Cm LLC/SNAP
both of which specify AAL5 encapsulation, the first one without additional
encapsulation, the second one with LLC/SNAP headers.
The first two forms of the command add an UBR (unspecified bit rate) channel,
where the second form allows the optional specification of a peak cell
rate (PCR).
The third form adds a CBR (constant bit rate) channel where a PCR
must be given.
The fourth form adds a VBR (variable bit rate) channel.
The arguments are the peak cell rate, the sustainable cell rate and the
maximum bursts size.
The last form of the command adds an ABR (available bit rate) channel.
.\"----------------------------------------
.Pp
.It Nm Ic natm Cm delete Ar dest
.It Xo
.Nm Ic natm Cm delete
.Ar device
.Ar vpi
.Ar vci
.Xc
This commands deletes an NATM route.
The route may be specified either by the destination address or
by the
.Ar device , vpi
and
.Ar vci
triple.
.\"----------------------------------------
.Pp
.It Nm Ic natm Cm show
List all NATM routes.
.El
.Sh SEE ALSO
.Xr natm 4 ,
.Xr natmip 4
.Sh HISTORY
An
.Nm
command appeared in
.Fx 3.0 .
.Sh AUTHORS
.An Hartmut Brandt Aq Mt harti@FreeBSD.org

View File

@ -1,102 +0,0 @@
/*
* Copyright (c) 2001-2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* 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.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $FreeBSD$
*/
#ifndef _ATMCONFIG_H
#define _ATMCONFIG_H
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/queue.h>
#include <netgraph/ng_message.h>
#define DEFAULT_INTERFACE "hatm0"
struct cmdtab {
const char *string;
const struct cmdtab *sub;
void (*func)(int, char *[]);
};
/*
* client configuration info
*/
struct amodule {
const struct cmdtab *cmd;
};
#define DEF_MODULE(CMDTAB) \
struct amodule amodule_1 = { CMDTAB }
/* for compiled-in modules */
void register_module(const struct amodule *);
/* print a message if we are verbose */
void verb(const char *, ...) __printflike(1, 2);
/* print heading */
void heading(const char *, ...) __printflike(1, 2);
/* before starting output */
void heading_init(void);
/* stringify an enumerated value */
struct penum {
int32_t value;
const char *str;
};
const char *penum(int32_t value, const struct penum *strtab, char *buf);
int pparse(int32_t *, const struct penum *, const char *);
enum {
OPT_NONE,
OPT_UINT,
OPT_INT,
OPT_UINT32,
OPT_INT32,
OPT_UINT64,
OPT_INT64,
OPT_FLAG,
OPT_VCI,
OPT_STRING,
OPT_SIMPLE,
};
struct option {
const char *optstr;
int opttype;
void *optarg;
};
int parse_options(int *_pargc, char ***_pargv,
const struct option *_opts);
/* XXX while this is compiled in */
void device_register(void);
#endif /* _ATMCONFIG_H */

View File

@ -1,223 +0,0 @@
#
# Copyright (c) 2001-2003
# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
# All rights reserved.
# Copyright (c) 2004
# Hartmut Brandt.
# All rights reserved.
#
# Author: Hartmut Brandt <harti@freebsd.org>
#
# 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.
#
# Help file for the atmconfig utility
#
# $FreeBSD$
#
^0 intro
ATM configuration utility.
usage:
atmconfig [common-options] command [subcommand] [options]
Use 'atmconfig help' for general help or 'atmconfig help <command>' for
help on 'command' or 'atmconfig help commands' for a list of commands.
^0 help
^^ help show help information
Use one of the following commands to get help on atmconfig:
atmconfig help options
gives you help on common command line options
atmconfig help commands
prints a list of available commands (and help items)
atmconfig help <command>
prints help on the given command (including a list of subcommands)
atmconfig help <command> <subcommand>
gives help on the given subcommand
^0 options
^^ help options list common options
Common command line options can be specified for all commands. They
are written immediately before the command. The following options are
available:
-h print short help
-t don't print headings for 'show'-type commands
-v be verbose about all actions.
^0 commands
^^ help commands show available commands
The following commands are available:
$MAIN
^0 diag
^^ diag show/modify ATM hardware interfaces
This command shows information about the ATM hardware interfaces in the
system. A list of ATM devices is obtained by:
atmconfig [common-options] diag list
Information about the hardware configuration of the ATM interfaces is
reported by:
atmconfig [common-options] diag config [options] [<device> ...]
The phy chip can be access with:
atmconfig [common-options] diag phy print [options] <device>
atmconfig [common-options] diag phy show <device>
atmconfig [common-options] diag phy set <device> <reg> <msk> <val>
atmconfig [common-options] diag phy set stats [options] <device>
A list of open VCCs can be obtained with:
atmconfig [common-options] diag vcc [<device> ...]
Driver internal statistics are printed with
atmconfig [common-options] diag stats <device>
^1 list
usage: atmconfig [common-options] diag list
List all known ATM devices in the system.
^1 config
usage: atmconfig [common-options] diag config [-hardware] [-atm] [device ...]
options:
-hardware print hardware related information
-atm print ATM related information
If now device is given as argument information about all devices is shown.
The default is to print only ATM related information.
^1 phy
To show the type of the PHY and its state:
atmconfig [common-options] diag phy show <device>
Change a PHY register (use with care):
atmconfig [common-options] diag phy set <device> <reg> <msk> <val>
Print the PHY registers in a human readable form:
atmconfig [common-options] diag phy print [-numeric] <device>
The PHY statistics can be printed with:
atmconfig [common-options] diag phy stats [-clear] <device>
^2 show
usage: atmconfig [common-options] diag phy show <device>
Show configuration and state information about the PHY chip on the given
ATM interface.
^2 set
usage: atmconfig [common-options] diag phy set <device> <reg> <msk> <val>
Set the bits of given PHY chip register for which the corresponding bit in
<msk> is one to the value of the corresponding bit in <val>. All register
bits that have a zero in <msk> are written back with there original value.
^2 print
usage: atmconfig [common-options] diag phy print [-numeric] <device>
options:
-numeric print registers in hex
Print the registers of the PHY chip in a human readable format.
^2 stats
usage: atmconfig [common-options] diag phy stats [-clear] <device>
options:
-clear clear the statistics atomically after reading them
Prints the PHY layer statistics of the PHY chip and optionally clears them.
^1 vcc
usage: atmconfig [common-options] diag vcc [-abr] [-channel] [-traffic]
[<device> ...]
options:
-abr print ABR specific traffic parameters
-channel print VPI, VCI, AAL, traffic type and flags (default)
-traffic print traffic parameters
Prints a list of all open vccs. The default output is -channel.
^1 stats
usage: atmconfig [common-options] diag stats <device>
Prints the driver-internal statistics.
^0 natm
^^ natm simple IP over ATM management (see natmip(4))
The group of CLIP commands is used to manage classical IP over ATM
networking via NATM (see natm(4) and natmip(4)). A new PVC is added
to a CLIP via:
atmconfig [common-options] natm add <dest> <device> <vpi> <vci>
<encaps> [<traffic> [<params> ...]]
The PVC can be deleted with:
atmconfig [common-options] natm del <device> <vpi> <vci>
The list of PVC that are currently active is retrieved with:
atmconfig [common-options] natm show
^1 add
usage: atmconfig [common-options] natm add [-printonly] <dest> <device>
<vpi> <vci> <encaps> [<traffic> [<params> ...]]
options:
-printonly don't execute, print the route(8) command
This subcommand adds a new CLIP PVC on the ATM interface <device>. The
host on the other end of the PVC has IP address <addr>. <encaps> is one
of llc/snap (LLC/SNAP encapsulated frames in AAL5) or aal5 (AAL5 frames
without LLC/SNAP). <traffic> specifies the traffic type of the PVC
and is one of UBR, CBR, VBR or ABR. If not given UBR is assumed. Depending
on the traffic type none or more parameters can follow:
ubr [<pcr>]
cbr <pcr>
vbr <pcr> <scr> <mbs>
abr <pcr> <mcr> <icr> <tbe> <nrm> <trm> <adtf> <rif> <rdf> <cdf>
^1 delete
usage: atmconfig [common-options] natm delete [-printonly] <dest>
or: atmconfig [common-options] natm delete [-printonly] <device> <vpi> <vci>
options:
-printonly don't execute, print the route(8) command
This subcommand deletes and existing CLIP PVC that can bei either identified
by the destination address or by the <device><vpi><vci> triple.
^1 show
usage: atmconfig [common-options] natm show [-abr] [-numeric]
options:
-abr show ABR parameters for ABR connections
-numeric print IP addresses numerically
This subcommand prints all ATM routes.

View File

@ -1,444 +0,0 @@
/*
* Copyright (c) 2001-2002
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* All rights reserved.
* Copyright (c) 2003-2004
* Hartmut Brandt.
* All rights reserved.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* 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 "atmconfig.h"
#include "atmconfig_device.h"
#include "private.h"
#include "oid.h"
#include <bsnmp/asn1.h>
#include <bsnmp/snmp.h>
#include <bsnmp/snmpclient.h>
/*
* Description of the begemotAtmIfTable
*/
static const struct snmp_table atmif_table = {
OIDX_begemotAtmIfTable,
OIDX_begemotAtmIfTableLastChange, 2,
sizeof(struct atmif),
1, 0x7ffULL,
{
{ 0,
SNMP_SYNTAX_INTEGER, offsetof(struct atmif, index) },
{ OID_begemotAtmIfName,
SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmif, ifname) },
{ OID_begemotAtmIfPcr,
SNMP_SYNTAX_GAUGE, offsetof(struct atmif, pcr) },
{ OID_begemotAtmIfMedia,
SNMP_SYNTAX_INTEGER, offsetof(struct atmif, media) },
{ OID_begemotAtmIfVpiBits,
SNMP_SYNTAX_GAUGE, offsetof(struct atmif, vpi_bits) },
{ OID_begemotAtmIfVciBits,
SNMP_SYNTAX_GAUGE, offsetof(struct atmif, vci_bits) },
{ OID_begemotAtmIfMaxVpcs,
SNMP_SYNTAX_GAUGE, offsetof(struct atmif, max_vpcs) },
{ OID_begemotAtmIfMaxVccs,
SNMP_SYNTAX_GAUGE, offsetof(struct atmif, max_vccs) },
{ OID_begemotAtmIfEsi,
SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmif, esi) },
{ OID_begemotAtmIfCarrierStatus,
SNMP_SYNTAX_INTEGER, offsetof(struct atmif, carrier) },
{ OID_begemotAtmIfMode,
SNMP_SYNTAX_INTEGER, offsetof(struct atmif, mode) },
{ 0, SNMP_SYNTAX_NULL, 0 }
}
};
/* List of all ATM interfaces */
struct atmif_list atmif_list = TAILQ_HEAD_INITIALIZER(atmif_list);
/*
* ATM hardware table
*/
struct atmhw {
TAILQ_ENTRY(atmhw) link;
uint64_t found;
int32_t index;
u_char *vendor;
size_t vendorlen;
u_char *device;
size_t devicelen;
uint32_t serial;
uint32_t version;
uint32_t soft_version;
};
TAILQ_HEAD(atmhw_list, atmhw);
/* list of ATM hardware */
static struct atmhw_list atmhw_list;
/*
* Read ATM hardware table
*/
static const struct snmp_table atmhw_table = {
OIDX_begemotAtmHWTable,
OIDX_begemotAtmIfTableLastChange, 2,
sizeof(struct atmhw),
1, 0x3fULL,
{
{ 0,
SNMP_SYNTAX_INTEGER, offsetof(struct atmhw, index) },
{ OID_begemotAtmHWVendor,
SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmhw, vendor) },
{ OID_begemotAtmHWDevice,
SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmhw, device) },
{ OID_begemotAtmHWSerial,
SNMP_SYNTAX_GAUGE, offsetof(struct atmhw, serial) },
{ OID_begemotAtmHWVersion,
SNMP_SYNTAX_GAUGE, offsetof(struct atmhw, version) },
{ OID_begemotAtmHWSoftVersion,
SNMP_SYNTAX_GAUGE, offsetof(struct atmhw, soft_version) },
{ 0, SNMP_SYNTAX_NULL, 0 }
}
};
static void device_status(int, char *[]);
static void device_hardware(int, char *[]);
static void device_modify(int, char *[]);
static const struct cmdtab device_tab[] = {
{ "hardware", NULL, device_hardware },
{ "status", NULL, device_status },
{ "modify", NULL, device_modify },
{ NULL, NULL, NULL }
};
static const struct cmdtab entry =
{ "device", device_tab, NULL };
static DEF_MODULE(&entry);
/*
* Carrier state to string
*/
static const struct penum strcarrier[] = {
{ 1, "on" },
{ 2, "off" },
{ 3, "unknown" },
{ 4, "none" },
{ 0, NULL }
};
/*
* SUNI mode to string
*/
static const struct penum strsunimode[] = {
{ 1, "sonet" },
{ 2, "sdh" },
{ 3, "unknown" },
{ 0, NULL }
};
/*
* OIDs
*/
static const struct asn_oid
oid_begemotAtmIfMode = OIDX_begemotAtmIfMode;
/*
* Print 1st status line
*/
static void
dev_status1(const struct atmif *aif)
{
char buf[100];
printf("%-5u %-8s %-6u %-4u %-5u %-4u %-5u "
"%02x:%02x:%02x:%02x:%02x:%02x %s\n", aif->index,
aif->ifname, aif->pcr,
(1 << aif->vpi_bits) - 1, (1 << aif->vci_bits) - 1,
aif->max_vpcs, aif->max_vccs, aif->esi[0],
aif->esi[1], aif->esi[2], aif->esi[3], aif->esi[4], aif->esi[5],
penum(aif->carrier, strcarrier, buf));
}
/*
* Print 2nd status line
*/
static void
dev_status2(const struct atmif *aif)
{
char buf[100];
printf("%-5u %-8s %s\n", aif->index, aif->ifname,
penum(aif->mode, strsunimode, buf));
}
/*
* Implement the 'device status' command
*/
static void
device_status(int argc, char *argv[])
{
int opt, i;
struct atmif *aif;
static const struct option opts[] = {
{ NULL, 0, NULL }
};
const char dev1[] =
"Interface Max Max\n"
"Index Name PCR VPI VCI VPCs VCCs ESI Carrier\n";
const char dev2[] =
"Interface\n"
"Index Name Mode\n";
while ((opt = parse_options(&argc, &argv, opts)) != -1)
switch (opt) {
}
snmp_open(NULL, NULL, NULL, NULL);
atexit(snmp_close);
atmif_fetchtable();
if (TAILQ_EMPTY(&atmif_list))
errx(1, "no ATM interfaces found");
if (argc > 0) {
heading_init();
for (i = 0; i < argc; i++) {
if ((aif = atmif_find_name(argv[i])) == NULL) {
warnx("%s: no such ATM interface", argv[i]);
continue;
}
heading(dev1);
dev_status1(aif);
}
heading_init();
for (i = 0; i < argc; i++) {
if ((aif = atmif_find_name(argv[i])) == NULL)
continue;
heading(dev2);
dev_status2(aif);
}
} else {
heading_init();
TAILQ_FOREACH(aif, &atmif_list, link) {
heading(dev1);
dev_status1(aif);
}
heading_init();
TAILQ_FOREACH(aif, &atmif_list, link) {
heading(dev2);
dev_status2(aif);
}
}
}
/*
* Print hardware info line
*/
static void
dev_hardware(const struct atmif *aif)
{
const struct atmhw *hw;
TAILQ_FOREACH(hw, &atmhw_list, link)
if (aif->index == hw->index)
break;
if (hw == NULL) {
warnx("hardware info not found for '%s'", aif->ifname);
return;
}
printf("%-5u %-8s %-16s%-10s %-10u %-10u %u\n", aif->index,
aif->ifname, hw->vendor, hw->device, hw->serial,
hw->version, hw->soft_version);
}
/*
* Show hardware configuration
*/
static void
device_hardware(int argc, char *argv[])
{
int opt, i;
struct atmif *aif;
static const struct option opts[] = {
{ NULL, 0, NULL }
};
static const char headline[] =
"Interface \n"
"Index Name Vendor Card Serial HW SW\n";
while ((opt = parse_options(&argc, &argv, opts)) != -1)
switch (opt) {
}
snmp_open(NULL, NULL, NULL, NULL);
atexit(snmp_close);
atmif_fetchtable();
if (snmp_table_fetch(&atmhw_table, &atmhw_list) != 0)
errx(1, "AtmHW table: %s", snmp_client.error);
if (argc > 0) {
heading_init();
for (i = 0; i < argc; i++) {
if ((aif = atmif_find_name(argv[i])) == NULL) {
warnx("interface not found '%s'", argv[i]);
continue;
}
heading(headline);
dev_hardware(aif);
}
} else {
heading_init();
TAILQ_FOREACH(aif, &atmif_list, link) {
heading(headline);
dev_hardware(aif);
}
}
}
/*
* Change device parameters
*/
static void
device_modify(int argc, char *argv[])
{
int opt;
struct atmif *aif;
int mode = 0;
int n;
struct snmp_pdu pdu, resp;
static const struct option opts[] = {
#define MODIFY_MODE 0
{ "mode", OPT_STRING, NULL },
{ NULL, 0, NULL }
};
while ((opt = parse_options(&argc, &argv, opts)) != -1)
switch (opt) {
case MODIFY_MODE:
if (pparse(&mode, strsunimode, optarg) == -1 ||
mode == 3)
errx(1, "illegal mode for -m '%s'", optarg);
break;
}
if (argc != 1)
errx(1, "device modify needs one argument");
snmp_open(NULL, NULL, NULL, NULL);
atexit(snmp_close);
atmif_fetchtable();
if ((aif = atmif_find_name(argv[0])) == NULL)
errx(1, "%s: no such ATM interface", argv[0]);
snmp_pdu_create(&pdu, SNMP_PDU_SET);
if (mode != 0) {
n = snmp_add_binding(&pdu,
&oid_begemotAtmIfMode, SNMP_SYNTAX_INTEGER,
NULL);
snmp_oid_append(&pdu.bindings[n + 0].var, "i",
(asn_subid_t)aif->index);
pdu.bindings[n + 0].v.integer = mode;
}
if (pdu.nbindings == 0)
errx(1, "must specify something to modify");
if (snmp_dialog(&pdu, &resp))
errx(1, "No response from '%s': %s", snmp_client.chost,
snmp_client.error);
if (snmp_pdu_check(&pdu, &resp) <= 0)
errx(1, "Error modifying device");
snmp_pdu_free(&resp);
snmp_pdu_free(&pdu);
}
/* XXX while this is compiled in */
void
device_register(void)
{
register_module(&amodule_1);
}
/*
* Fetch the ATM interface table
*/
void
atmif_fetchtable(void)
{
struct atmif *aif;
while ((aif = TAILQ_FIRST(&atmif_list)) != NULL) {
free(aif->ifname);
free(aif->esi);
TAILQ_REMOVE(&atmif_list, aif, link);
free(aif);
}
if (snmp_table_fetch(&atmif_table, &atmif_list) != 0)
errx(1, "AtmIf table: %s", snmp_client.error);
}
/*
* Find a named ATM interface
*/
struct atmif *
atmif_find_name(const char *ifname)
{
struct atmif *atmif;
TAILQ_FOREACH(atmif, &atmif_list, link)
if (strcmp(atmif->ifname, ifname) == 0)
return (atmif);
return (NULL);
}
/*
* find an ATM interface by index
*/
struct atmif *
atmif_find(u_int idx)
{
struct atmif *atmif;
TAILQ_FOREACH(atmif, &atmif_list, link)
if (atmif->index == (int32_t)idx)
return (atmif);
return (NULL);
}

View File

@ -1,75 +0,0 @@
/*
* Copyright (c) 2001-2002
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* All rights reserved.
* Copyright (c) 2003-2004
* Hartmut Brandt.
* All rights reserved.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* 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$
*/
#ifndef ATMCONFIG_DEVICE_H_
#define ATMCONFIG_DEVICE_H_
#include <sys/types.h>
#include <sys/queue.h>
#include <stdint.h>
/*
* ATM interface table
*/
struct atmif {
TAILQ_ENTRY(atmif) link;
uint64_t found;
int32_t index;
char *ifname;
size_t ifnamelen;
uint32_t pcr;
int32_t media;
uint32_t vpi_bits;
uint32_t vci_bits;
uint32_t max_vpcs;
uint32_t max_vccs;
u_char *esi;
size_t esilen;
int32_t carrier;
int32_t mode;
};
TAILQ_HEAD(atmif_list, atmif);
/* list of all ATM interfaces */
extern struct atmif_list atmif_list;
/* fetch this table */
void atmif_fetchtable(void);
/* find an ATM interface by name */
struct atmif *atmif_find_name(const char *);
/* find an ATM interface by index */
struct atmif *atmif_find(u_int);
#endif

View File

@ -1,62 +0,0 @@
# Copyright (c) 2003-2004
# Hartmut Brandt.
# All rights reserved.
#
# Author: Hartmut Brandt <harti@freebsd.org>
#
# 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.
#
# Help file for the atmconfig utility
#
# $FreeBSD$
#
^0 device
^^ device show information about ATM hardware interfaces
This command shows information about the ATM hardware interfaces on the
system. Status information can be obtained by:
atmconfig [common-options] device status [options] [device ...]
Information about the hardware of the ATM interfaces is reported by:
atmconfig [common-options] device hardware [options] [device ...]
The parameters of the a device can be changed by:
atmconfig [common-options] device modify [options] <device>
^1 status
usage: atmconfig [common-options] device status [device ...]
If no device is given as argument information about all devices is shown.
^1 hardware
usage: atmconfig [common-options] device hardware [device ...]
If now device is given as argument information about all devices is shown.
^1 modify
usage: atmconfig [common-options] device modify [-mode mode] <device>
options:
-mode switch the SUNI mode to either 'sonet' or 'sdh'.

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 2001-2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* 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.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $FreeBSD$
*/
struct diagif {
TAILQ_ENTRY(diagif) link;
char ifname[IFNAMSIZ];
u_int index;
struct ifatm_mib mib;
int phy_present : 1;
u_int phy_type;
u_int phy_loopback;
char phy_name[100];
u_int phy_state;
u_int phy_carrier;
struct atmio_vcctable *vtab;
};
TAILQ_HEAD(diagif_list, diagif);
extern struct diagif_list diagif_list;
void diagif_fetch(void);
void diagif_fetch_vcc(struct diagif *aif, int fd);

View File

@ -1,880 +0,0 @@
/*
* Copyright (c) 2001-2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* 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.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/sysctl.h>
#include <netdb.h>
#include <stdarg.h>
#include <ctype.h>
#include <limits.h>
#include <stdint.h>
#include <fnmatch.h>
#include <dirent.h>
#ifdef WITH_BSNMP
#include <bsnmp/asn1.h>
#include <bsnmp/snmp.h>
#include <bsnmp/snmpclient.h>
#endif
#include "atmconfig.h"
#include "private.h"
/* verbosity level */
static int verbose;
/* notitle option */
static int notitle;
/* need to put heading before next output */
static int need_heading;
/*
* TOP LEVEL commands
*/
static void help_func(int argc, char *argv[]) __dead2;
static const struct cmdtab static_main_tab[] = {
{ "help", NULL, help_func },
{ "options", NULL, NULL },
{ "commands", NULL, NULL },
{ "diag", diag_tab, NULL },
{ "natm", natm_tab, NULL },
{ NULL, NULL, NULL }
};
static struct cmdtab *main_tab = NULL;
static size_t main_tab_size = sizeof(static_main_tab) /
sizeof(static_main_tab[0]);
static int
substr(const char *s1, const char *s2)
{
return (strlen(s1) <= strlen(s2) && strncmp(s1, s2, strlen(s1)) == 0);
}
/*
* Current help file state
*/
struct help_file {
int file_state; /* 0:looking for main file, 1:found, 2:other */
const char *p_start; /* current path pointer */
const char *p_end; /* end of current path in path */
char *dirname; /* directory name */
DIR *dir; /* open directory */
char *fname; /* current filename */
FILE *fp; /* open file */
char line[LINE_MAX]; /* current line */
u_int fcnt; /* count of files found */
};
struct help_pos {
off_t pos; /* file position */
u_int fcnt; /* number of file */
char *fname; /* name of file */
const char *p_start; /* current path pointer */
const char *p_end; /* end of current path in path */
};
static int
help_next_file(struct help_file *hp)
{
const char *fpat;
struct dirent *ent;
if (hp->file_state == 3)
return (-1);
if (hp->file_state == 0)
fpat = FILE_HELP;
else
fpat = FILE_HELP_OTHERS;
if (hp->file_state == 0 || hp->file_state == 1) {
/* start from beginning */
hp->p_start = PATH_HELP;
hp->file_state++;
}
try_file:
if (hp->dir != NULL) {
/* directory open (must be state 2) */
while ((ent = readdir(hp->dir)) != NULL) {
if (fnmatch(fpat, ent->d_name, FNM_NOESCAPE) != 0)
continue;
if (asprintf(&hp->fname, "%s/%s", hp->dirname,
ent->d_name) == -1)
err(1, NULL);
if ((hp->fp = fopen(hp->fname, "r")) != NULL) {
hp->fcnt++;
return (0);
}
free(hp->fname);
}
/* end of directory */
closedir(hp->dir);
hp->dir = NULL;
free(hp->dirname);
goto next_path;
}
/* nothing open - advanc to new path element */
try_path:
for (hp->p_end = hp->p_start; *hp->p_end != '\0' &&
*hp->p_end != ':'; hp->p_end++)
;
if (asprintf(&hp->dirname, "%.*s", (int)(hp->p_end - hp->p_start),
hp->p_start) == -1)
err(1, NULL);
if (hp->file_state == 1) {
/* just try to open */
if (asprintf(&hp->fname, "%s/%s", hp->dirname, fpat) == -1)
err(1, NULL);
if ((hp->fp = fopen(hp->fname, "r")) != NULL) {
hp->fcnt++;
return (0);
}
free(hp->fname);
goto next_path;
}
/* open directory */
if ((hp->dir = opendir(hp->dirname)) != NULL)
goto try_file;
free(hp->dirname);
next_path:
hp->p_start = hp->p_end;
if (*hp->p_start == '\0') {
/* end of path */
if (hp->file_state == 1)
errx(1, "help file not found");
return (-1);
}
hp->p_start++;
goto try_path;
}
/*
* Save current file position
*/
static void
help_file_tell(struct help_file *hp, struct help_pos *pos)
{
if (pos->fname != NULL)
free(pos->fname);
if ((pos->fname = strdup(hp->fname)) == NULL)
err(1, NULL);
pos->fcnt = hp->fcnt;
pos->p_start = hp->p_start;
pos->p_end = hp->p_end;
if ((pos->pos = ftello(hp->fp)) == -1)
err(1, "%s", pos->fname);
}
/*
* Go to that position
*
* We can go either to the original help file or back in the current file.
*/
static void
help_file_seek(struct help_file *hp, struct help_pos *pos)
{
hp->p_start = pos->p_start;
hp->p_end = pos->p_end;
hp->fcnt = pos->fcnt;
if (hp->dir != NULL) {
free(hp->dirname);
closedir(hp->dir);
hp->dir = NULL;
}
if (hp->fp != NULL &&strcmp(hp->fname, pos->fname) != 0) {
free(hp->fname);
fclose(hp->fp);
hp->fp = NULL;
}
if (hp->fp == NULL) {
if ((hp->fname = strdup(pos->fname)) == NULL)
err(1, NULL);
if ((hp->fp = fopen(hp->fname, "r")) == NULL)
err(1, "reopen %s", hp->fname);
}
if (fseeko(hp->fp, pos->pos, SEEK_SET) == -1)
err(1, "seek %s", hp->fname);
if (pos->fcnt == 1)
/* go back to state 1 */
hp->file_state = 1;
else
/* lock */
hp->file_state = 3;
}
/*
* Rewind to position 0
*/
static void
help_file_rewind(struct help_file *hp)
{
if (hp->file_state == 1) {
if (fseeko(hp->fp, (off_t)0, SEEK_SET) == -1)
err(1, "rewind help file");
return;
}
if (hp->dir != NULL) {
free(hp->dirname);
closedir(hp->dir);
hp->dir = NULL;
}
if (hp->fp != NULL) {
free(hp->fname);
fclose(hp->fp);
hp->fp = NULL;
}
memset(hp, 0, sizeof(*hp));
}
/*
* Get next line from a help file
*/
static const char *
help_next_line(struct help_file *hp)
{
for (;;) {
if (hp->fp != NULL) {
if (fgets(hp->line, sizeof(hp->line), hp->fp) != NULL)
return (hp->line);
if (ferror(hp->fp))
err(1, "%s", hp->fname);
free(hp->fname);
fclose(hp->fp);
hp->fp = NULL;
}
if (help_next_file(hp) == -1)
return (NULL);
}
}
/*
* This function prints the available 0-level help topics from all
* other help files by scanning the files. It assumes, that this is called
* only from the main help file.
*/
static void
help_get_0topics(struct help_file *hp)
{
struct help_pos save;
const char *line;
memset(&save, 0, sizeof(save));
help_file_tell(hp, &save);
help_file_rewind(hp);
while ((line = help_next_line(hp)) != NULL) {
if (line[0] == '^' && line[1] == '^')
printf("%s", line + 2);
}
help_file_seek(hp, &save);
}
/*
* Function to print help. The help argument is in argv[0] here.
*/
static void
help_func(int argc, char *argv[])
{
struct help_file hfile;
struct help_pos match, last_match;
const char *line;
char key[100];
int level;
int i, has_sub_topics;
memset(&hfile, 0, sizeof(hfile));
memset(&match, 0, sizeof(match));
memset(&last_match, 0, sizeof(last_match));
if (argc == 0) {
/* only 'help' - show intro */
if ((argv[0] = strdup("intro")) == NULL)
err(1, NULL);
argc = 1;
}
optind = 0;
match.pos = -1;
last_match.pos = -1;
for (;;) {
/* read next line */
if ((line = help_next_line(&hfile)) == NULL) {
/* EOF */
level = 999;
goto stop;
}
if (line[0] != '^' || line[1] == '^')
continue;
if (sscanf(line + 1, "%d%99s", &level, key) != 2)
errx(1, "error in help file '%s'", line);
if (level < optind) {
stop:
/* next higher level entry - stop this level */
if (match.pos == -1) {
/* not found */
goto not_found;
}
/* go back to the match */
help_file_seek(&hfile, &match);
last_match = match;
memset(&match, 0, sizeof(match));
match.pos = -1;
/* go to next key */
if (++optind >= argc)
break;
}
if (level == optind) {
if (substr(argv[optind], key)) {
if (match.pos != -1) {
printf("Ambiguous topic.");
goto list_topics;
}
help_file_tell(&hfile, &match);
}
}
}
/* before breaking above we have seeked back to the matching point */
for (;;) {
if ((line = help_next_line(&hfile)) == NULL)
break;
if (line[0] == '#')
continue;
if (line[0] == '^') {
if (line[1] == '^')
continue;
break;
}
if (strncmp(line, "$MAIN", 5) == 0) {
help_get_0topics(&hfile);
continue;
}
printf("%s", line);
}
exit(0);
not_found:
printf("Topic not found.");
list_topics:
printf(" Use one of:\natmconfig help");
for (i = 0; i < optind; i++)
printf(" %s", argv[i]);
printf(" [");
/* list all the keys at this level */
if (last_match.pos == -1)
/* go back to start of help */
help_file_rewind(&hfile);
else
help_file_seek(&hfile, &last_match);
has_sub_topics = 0;
while ((line = help_next_line(&hfile)) != NULL) {
if (line[0] == '#' || line[0] != '^' || line[1] == '^')
continue;
if (sscanf(line + 1, "%d%99s", &level, key) != 2)
errx(1, "error in help file '%s'", line);
if (level < optind)
break;
if (level == optind) {
has_sub_topics = 1;
printf(" %s", key);
}
}
printf(" ].");
if (!has_sub_topics)
printf(" No sub-topics found.");
printf("\n");
exit(1);
}
#ifdef WITH_BSNMP
/*
* Parse a server specification
*
* syntax is [trans::][community@][server][:port]
*/
static void
parse_server(char *name)
{
char *p, *s = name;
/* look for a double colon */
for (p = s; *p != '\0'; p++) {
if (*p == '\\' && p[1] != '\0') {
p++;
continue;
}
if (*p == ':' && p[1] == ':')
break;
}
if (*p != '\0') {
if (p > s) {
if (p - s == 3 && strncmp(s, "udp", 3) == 0)
snmp_client.trans = SNMP_TRANS_UDP;
else if (p - s == 6 && strncmp(s, "stream", 6) == 0)
snmp_client.trans = SNMP_TRANS_LOC_STREAM;
else if (p - s == 5 && strncmp(s, "dgram", 5) == 0)
snmp_client.trans = SNMP_TRANS_LOC_DGRAM;
else
errx(1, "unknown SNMP transport '%.*s'",
(int)(p - s), s);
}
s = p + 2;
}
/* look for a @ */
for (p = s; *p != '\0'; p++) {
if (*p == '\\' && p[1] != '\0') {
p++;
continue;
}
if (*p == '@')
break;
}
if (*p != '\0') {
if (p - s > SNMP_COMMUNITY_MAXLEN)
err(1, "community string too long");
strncpy(snmp_client.read_community, s, p - s);
snmp_client.read_community[p - s] = '\0';
strncpy(snmp_client.write_community, s, p - s);
snmp_client.write_community[p - s] = '\0';
s = p + 1;
}
/* look for a colon */
for (p = s; *p != '\0'; p++) {
if (*p == '\\' && p[1] != '\0') {
p++;
continue;
}
if (*p == ':')
break;
}
if (*p == ':') {
if (p > s) {
*p = '\0';
snmp_client_set_host(&snmp_client, s);
*p = ':';
}
snmp_client_set_port(&snmp_client, p + 1);
} else if (p > s)
snmp_client_set_host(&snmp_client, s);
}
#endif
int
main(int argc, char *argv[])
{
int opt, i;
const struct cmdtab *match, *cc, *tab;
#ifdef WITH_BSNMP
snmp_client_init(&snmp_client);
snmp_client.trans = SNMP_TRANS_LOC_STREAM;
snmp_client_set_host(&snmp_client, PATH_ILMI_SOCK);
#endif
#ifdef WITH_BSNMP
#define OPTSTR "htvs:"
#else
#define OPTSTR "htv"
#endif
while ((opt = getopt(argc, argv, OPTSTR)) != -1)
switch (opt) {
case 'h':
help_func(0, argv);
#ifdef WITH_BSNMP
case 's':
parse_server(optarg);
break;
#endif
case 'v':
verbose++;
break;
case 't':
notitle = 1;
break;
}
if (argv[optind] == NULL)
help_func(0, argv);
argc -= optind;
argv += optind;
if ((main_tab = malloc(sizeof(static_main_tab))) == NULL)
err(1, NULL);
memcpy(main_tab, static_main_tab, sizeof(static_main_tab));
#ifdef WITH_BSNMP
/* XXX while this is compiled in */
device_register();
#endif
cc = main_tab;
i = 0;
for (;;) {
/*
* Scan the table for a match
*/
tab = cc;
match = NULL;
while (cc->string != NULL) {
if (substr(argv[i], cc->string)) {
if (match != NULL) {
printf("Ambiguous option '%s'",
argv[i]);
cc = tab;
goto subopts;
}
match = cc;
}
cc++;
}
if ((cc = match) == NULL) {
printf("Unknown option '%s'", argv[i]);
cc = tab;
goto subopts;
}
/*
* Have a match. If there is no subtable, there must
* be either a handler or the command is only a help entry.
*/
if (cc->sub == NULL) {
if (cc->func != NULL)
break;
printf("Unknown option '%s'", argv[i]);
cc = tab;
goto subopts;
}
/*
* Look at the next argument. If it doesn't exist or it
* looks like a switch, terminate the scan here.
*/
if (argv[i + 1] == NULL || argv[i + 1][0] == '-') {
if (cc->func != NULL)
break;
printf("Need sub-option for '%s'", argv[i]);
cc = cc->sub;
goto subopts;
}
cc = cc->sub;
i++;
}
argc -= i + 1;
argv += i + 1;
(*cc->func)(argc, argv);
return (0);
subopts:
printf(". Select one of:\n");
while (cc->string != NULL) {
if (cc->func != NULL || cc->sub != NULL)
printf("%s ", cc->string);
cc++;
}
printf("\n");
return (1);
}
void
verb(const char *fmt, ...)
{
va_list ap;
if (verbose) {
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
}
void
heading(const char *fmt, ...)
{
va_list ap;
if (need_heading) {
need_heading = 0;
if (!notitle) {
va_start(ap, fmt);
fprintf(stdout, fmt, ap);
va_end(ap);
}
}
}
void
heading_init(void)
{
need_heading = 1;
}
/*
* stringify an enumerated value
*/
const char *
penum(int32_t value, const struct penum *strtab, char *buf)
{
while (strtab->str != NULL) {
if (strtab->value == value) {
strcpy(buf, strtab->str);
return (buf);
}
strtab++;
}
warnx("illegal value for enumerated variable '%d'", value);
strcpy(buf, "?");
return (buf);
}
/*
* And the other way 'round
*/
int
pparse(int32_t *val, const struct penum *tab, const char *str)
{
while (tab->str != NULL) {
if (strcmp(tab->str, str) == 0) {
*val = tab->value;
return (0);
}
tab++;
}
return (-1);
}
/*
* Parse command line options
*/
int
parse_options(int *pargc, char ***pargv, const struct option *opts)
{
const struct option *o, *m;
char *arg;
u_long ularg, ularg1;
long larg;
char *end;
if (*pargc == 0)
return (-1);
arg = (*pargv)[0];
if (arg[0] != '-' || arg[1] == '\0')
return (-1);
if (arg[1] == '-' && arg[2] == '\0') {
(*pargv)++;
(*pargc)--;
return (-1);
}
m = NULL;
for (o = opts; o->optstr != NULL; o++) {
if (strlen(arg + 1) <= strlen(o->optstr) &&
strncmp(arg + 1, o->optstr, strlen(arg + 1)) == 0) {
if (m != NULL)
errx(1, "ambiguous option '%s'", arg);
m = o;
}
}
if (m == NULL)
errx(1, "unknown option '%s'", arg);
(*pargv)++;
(*pargc)--;
if (m->opttype == OPT_NONE)
return (m - opts);
if (m->opttype == OPT_SIMPLE) {
*(int *)m->optarg = 1;
return (m - opts);
}
if (*pargc == 0)
errx(1, "option requires argument '%s'", arg);
optarg = *(*pargv)++;
(*pargc)--;
switch (m->opttype) {
case OPT_UINT:
ularg = strtoul(optarg, &end, 0);
if (*end != '\0')
errx(1, "bad unsigned integer argument for '%s'", arg);
if (ularg > UINT_MAX)
errx(1, "argument to large for option '%s'", arg);
*(u_int *)m->optarg = (u_int)ularg;
break;
case OPT_INT:
larg = strtol(optarg, &end, 0);
if (*end != '\0')
errx(1, "bad integer argument for '%s'", arg);
if (larg > INT_MAX || larg < INT_MIN)
errx(1, "argument out of range for option '%s'", arg);
*(int *)m->optarg = (int)larg;
break;
case OPT_UINT32:
ularg = strtoul(optarg, &end, 0);
if (*end != '\0')
errx(1, "bad unsigned integer argument for '%s'", arg);
if (ularg > UINT32_MAX)
errx(1, "argument to large for option '%s'", arg);
*(uint32_t *)m->optarg = (uint32_t)ularg;
break;
case OPT_INT32:
larg = strtol(optarg, &end, 0);
if (*end != '\0')
errx(1, "bad integer argument for '%s'", arg);
if (larg > INT32_MAX || larg < INT32_MIN)
errx(1, "argument out of range for option '%s'", arg);
*(int32_t *)m->optarg = (int32_t)larg;
break;
case OPT_UINT64:
*(uint64_t *)m->optarg = strtoull(optarg, &end, 0);
if (*end != '\0')
errx(1, "bad unsigned integer argument for '%s'", arg);
break;
case OPT_INT64:
*(int64_t *)m->optarg = strtoll(optarg, &end, 0);
if (*end != '\0')
errx(1, "bad integer argument for '%s'", arg);
break;
case OPT_FLAG:
if (strcasecmp(optarg, "enable") == 0 ||
strcasecmp(optarg, "yes") == 0 ||
strcasecmp(optarg, "true") == 0 ||
strcasecmp(optarg, "on") == 0 ||
strcmp(optarg, "1") == 0)
*(int *)m->optarg = 1;
else if (strcasecmp(optarg, "disable") == 0 ||
strcasecmp(optarg, "no") == 0 ||
strcasecmp(optarg, "false") == 0 ||
strcasecmp(optarg, "off") == 0 ||
strcmp(optarg, "0") == 0)
*(int *)m->optarg = 0;
else
errx(1, "bad boolean argument to '%s'", arg);
break;
case OPT_VCI:
ularg = strtoul(optarg, &end, 0);
if (*end == '.') {
ularg1 = strtoul(end + 1, &end, 0);
} else {
ularg1 = ularg;
ularg = 0;
}
if (*end != '\0')
errx(1, "bad VCI value for option '%s'", arg);
if (ularg > 0xff)
errx(1, "VPI value too large for option '%s'", arg);
if (ularg1 > 0xffff)
errx(1, "VCI value too large for option '%s'", arg);
((u_int *)m->optarg)[0] = ularg;
((u_int *)m->optarg)[1] = ularg1;
break;
case OPT_STRING:
if (m->optarg != NULL)
*(const char **)m->optarg = optarg;
break;
default:
errx(1, "(internal) bad option type %u for '%s'",
m->opttype, arg);
}
return (m - opts);
}
/*
* for compiled-in modules
*/
void
register_module(const struct amodule *mod)
{
main_tab_size++;
if ((main_tab = realloc(main_tab, main_tab_size * sizeof(main_tab[0])))
== NULL)
err(1, NULL);
main_tab[main_tab_size - 2] = *mod->cmd;
memset(&main_tab[main_tab_size - 1], 0, sizeof(main_tab[0]));
}

View File

@ -1,680 +0,0 @@
/*
* Copyright (c) 2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* 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.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if_atm.h>
#include <net/if_dl.h>
#include <net/route.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "atmconfig.h"
#include "private.h"
#include "diag.h"
static void natm_add(int, char *[]);
static void natm_delete(int, char *[]);
static void natm_show(int, char *[]);
const struct cmdtab natm_tab[] = {
{ "add", NULL, natm_add },
{ "delete", NULL, natm_delete },
{ "show", NULL, natm_show },
{ NULL, NULL, NULL }
};
/*
* Structure to hold a route
*/
struct natm_route {
TAILQ_ENTRY(natm_route) link;
struct in_addr host;
struct diagif *aif;
u_int flags;
int llcsnap;
u_int vpi, vci;
u_int traffic;
u_int pcr, scr, mbs, icr, mcr;
u_int tbe, nrm, trm, adtf, rif, rdf, cdf;
};
static TAILQ_HEAD(, natm_route) natm_route_list =
TAILQ_HEAD_INITIALIZER(natm_route_list);
static void
store_route(struct rt_msghdr *rtm)
{
u_int i;
struct natm_route *r;
char *cp;
struct sockaddr *sa;
struct sockaddr_in *sain;
struct sockaddr_dl *sdl;
struct diagif *aif;
u_int n;
r = malloc(sizeof(*r));
if (r == NULL)
err(1, "allocate route");
r->flags = rtm->rtm_flags;
cp = (char *)(rtm + 1);
for (i = 1; i != 0; i <<= 1) {
if (rtm->rtm_addrs & i) {
sa = (struct sockaddr *)cp;
cp += roundup(sa->sa_len, sizeof(long));
switch (i) {
case RTA_DST:
if (sa->sa_family != AF_INET) {
warnx("RTA_DST not AF_INET %u", sa->sa_family);
goto fail;
}
sain = (struct sockaddr_in *)(void *)sa;
if (sain->sin_len < 4)
r->host.s_addr = INADDR_ANY;
else
r->host = sain->sin_addr;
break;
case RTA_GATEWAY:
if (sa->sa_family != AF_LINK) {
warnx("RTA_GATEWAY not AF_LINK");
goto fail;
}
sdl = (struct sockaddr_dl *)(void *)sa;
TAILQ_FOREACH(aif, &diagif_list, link)
if (strlen(aif->ifname) ==
sdl->sdl_nlen &&
strncmp(aif->ifname, sdl->sdl_data,
sdl->sdl_nlen) == 0)
break;
if (aif == NULL) {
warnx("interface '%.*s' not found",
sdl->sdl_nlen, sdl->sdl_data);
goto fail;
}
r->aif = aif;
/* parse ATM stuff */
#define GET3() (((sdl->sdl_data[n] & 0xff) << 16) | \
((sdl->sdl_data[n + 1] & 0xff) << 8) | \
((sdl->sdl_data[n + 2] & 0xff) << 0))
#define GET2() (((sdl->sdl_data[n] & 0xff) << 8) | \
((sdl->sdl_data[n + 1] & 0xff) << 0))
#define GET1() (((sdl->sdl_data[n] & 0xff) << 0))
n = sdl->sdl_nlen;
if (sdl->sdl_alen < 4) {
warnx("RTA_GATEWAY alen too short");
goto fail;
}
r->llcsnap = GET1() & ATM_PH_LLCSNAP;
n++;
r->vpi = GET1();
n++;
r->vci = GET2();
n += 2;
if (sdl->sdl_alen == 4) {
/* old address */
r->traffic = ATMIO_TRAFFIC_UBR;
r->pcr = 0;
break;
}
/* new address */
r->traffic = GET1();
n++;
switch (r->traffic) {
case ATMIO_TRAFFIC_UBR:
if (sdl->sdl_alen >= 5 + 3) {
r->pcr = GET3();
n += 3;
} else
r->pcr = 0;
break;
case ATMIO_TRAFFIC_CBR:
if (sdl->sdl_alen < 5 + 3) {
warnx("CBR address too short");
goto fail;
}
r->pcr = GET3();
n += 3;
break;
case ATMIO_TRAFFIC_VBR:
if (sdl->sdl_alen < 5 + 3 * 3) {
warnx("VBR address too short");
goto fail;
}
r->pcr = GET3();
n += 3;
r->scr = GET3();
n += 3;
r->mbs = GET3();
n += 3;
break;
case ATMIO_TRAFFIC_ABR:
if (sdl->sdl_alen < 5 + 4 * 3 + 2 +
1 * 2 + 3) {
warnx("ABR address too short");
goto fail;
}
r->pcr = GET3();
n += 3;
r->mcr = GET3();
n += 3;
r->icr = GET3();
n += 3;
r->tbe = GET3();
n += 3;
r->nrm = GET1();
n++;
r->trm = GET1();
n++;
r->adtf = GET2();
n += 2;
r->rif = GET1();
n++;
r->rdf = GET1();
n++;
r->cdf = GET1();
n++;
break;
default:
goto fail;
}
break;
}
}
}
TAILQ_INSERT_TAIL(&natm_route_list, r, link);
return;
fail:
free(r);
}
/*
* Fetch the INET routes that a ours
*/
static void
natm_route_fetch(void)
{
int name[6];
size_t needed;
u_char *buf, *next;
struct rt_msghdr *rtm;
name[0] = CTL_NET;
name[1] = PF_ROUTE;
name[2] = 0;
name[3] = AF_INET;
name[4] = NET_RT_DUMP;
name[5] = 0;
if (sysctl(name, 6, NULL, &needed, NULL, 0) == -1)
err(1, "rtable estimate");
needed *= 2;
if ((buf = malloc(needed)) == NULL)
err(1, "rtable buffer (%zu)", needed);
if (sysctl(name, 6, buf, &needed, NULL, 0) == -1)
err(1, "rtable get");
next = buf;
while (next < buf + needed) {
rtm = (struct rt_msghdr *)(void *)next;
next += rtm->rtm_msglen;
if (rtm->rtm_type == RTM_GET) {
if ((rtm->rtm_flags & (RTF_UP | RTF_HOST |
RTF_STATIC)) == (RTF_UP | RTF_HOST | RTF_STATIC) &&
(rtm->rtm_addrs & (RTA_DST | RTA_GATEWAY |
RTA_IFP)) == (RTA_DST | RTA_GATEWAY | RTA_IFP))
store_route(rtm);
}
}
}
static u_long
parse_num(const char *arg, const char *name, u_long limit)
{
u_long res;
char *end;
errno = 0;
res = strtoul(arg, &end, 10);
if (*end != '\0' || end == arg || errno != 0)
errx(1, "cannot parse %s '%s'", name, arg);
if (res > limit)
errx(1, "%s out of range (0...%lu)", name, limit);
return (res);
}
static void
do_route(u_int type, u_int flags, const struct sockaddr_in *sain,
const struct sockaddr_dl *sdl)
{
struct {
struct rt_msghdr h;
char space[512];
} msg;
char *ptr;
int s;
ssize_t rlen;
/* create routing message */
bzero(&msg, sizeof(msg));
msg.h.rtm_msglen = sizeof(msg.h);
msg.h.rtm_version = RTM_VERSION;
msg.h.rtm_type = type;
msg.h.rtm_index = 0;
msg.h.rtm_flags = flags;
msg.h.rtm_addrs = RTA_DST | (sdl != NULL ? RTA_GATEWAY : 0);
msg.h.rtm_pid = getpid();
ptr = (char *)&msg + sizeof(msg.h);
memcpy(ptr, sain, sain->sin_len);
ptr += roundup(sain->sin_len, sizeof(long));
msg.h.rtm_msglen += roundup(sain->sin_len, sizeof(long));
if (sdl != NULL) {
memcpy(ptr, sdl, sdl->sdl_len);
ptr += roundup(sdl->sdl_len, sizeof(long));
msg.h.rtm_msglen += roundup(sdl->sdl_len, sizeof(long));
}
/* open socket */
s = socket(PF_ROUTE, SOCK_RAW, AF_INET);
if (s == -1)
err(1, "cannot open routing socket");
rlen = write(s, &msg, msg.h.rtm_msglen);
if (rlen == -1)
err(1, "writing to routing socket");
if ((size_t)rlen != msg.h.rtm_msglen)
errx(1, "short write to routing socket: %zu %u",
(size_t)rlen, msg.h.rtm_msglen);
close(s);
}
/*
* Add a new NATM route
*/
static void
natm_add(int argc, char *argv[])
{
int opt;
struct hostent *hp;
struct sockaddr_in sain;
struct sockaddr_dl sdl;
struct diagif *aif;
u_long num, num1;
u_int idx;
static int printonly;
static const struct option opts[] = {
{ "printonly", OPT_SIMPLE, &printonly },
{ NULL, 0, NULL }
};
while ((opt = parse_options(&argc, &argv, opts)) != -1)
switch (opt) {
}
if (argc < 5)
errx(1, "missing arguments for 'natm add'");
memset(&sdl, 0, sizeof(sdl));
sdl.sdl_len = sizeof(sdl);
sdl.sdl_family = AF_LINK;
/* get the IP address for <dest> */
memset(&sain, 0, sizeof(sain));
hp = gethostbyname(argv[0]);
if (hp == NULL)
errx(1, "bad hostname %s: %s", argv[0], hstrerror(h_errno));
if (hp->h_addrtype != AF_INET)
errx(1, "bad address type for %s", argv[0]);
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
memcpy(&sain.sin_addr, hp->h_addr, sizeof(sain.sin_addr));
/* find interface */
diagif_fetch();
TAILQ_FOREACH(aif, &diagif_list, link)
if (strcmp(aif->ifname, argv[1]) == 0)
break;
if (aif == NULL)
errx(1, "unknown ATM interface '%s'", argv[1]);
sdl.sdl_index = aif->index;
strcpy(sdl.sdl_data, aif->ifname);
idx = sdl.sdl_nlen = strlen(aif->ifname);
idx++;
/* verify VPI/VCI */
num = parse_num(argv[2], "VPI", (1U << aif->mib.vpi_bits));
sdl.sdl_data[idx++] = num & 0xff;
num = parse_num(argv[3], "VCI", (1U << aif->mib.vci_bits));
if (num == 0)
errx(1, "VCI may not be 0");
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = num & 0xff;
/* encapsulation */
if (strcasecmp(argv[4], "llc/snap") == 0) {
sdl.sdl_data[sdl.sdl_nlen] = ATM_PH_LLCSNAP;
} else if (strcasecmp(argv[4], "aal5") == 0) {
sdl.sdl_data[sdl.sdl_nlen] = 0;
} else
errx(1, "bad encapsulation type '%s'", argv[4]);
/* look at the traffic */
argc -= 5;
argv += 5;
if (argc != 0) {
if (strcasecmp(argv[0], "ubr") == 0) {
sdl.sdl_data[idx++] = ATMIO_TRAFFIC_UBR;
if (argc == 1)
/* ok */;
else if (argc == 2) {
num = parse_num(argv[1], "PCR", aif->mib.pcr);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
} else
errx(1, "too many parameters for UBR");
} else if (strcasecmp(argv[0], "cbr") == 0) {
sdl.sdl_data[idx++] = ATMIO_TRAFFIC_CBR;
if (argc == 1)
errx(1, "missing PCR for CBR");
if (argc > 2)
errx(1, "too many parameters for CBR");
num = parse_num(argv[1], "PCR", aif->mib.pcr);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
} else if (strcasecmp(argv[0], "vbr") == 0) {
sdl.sdl_data[idx++] = ATMIO_TRAFFIC_VBR;
if (argc < 4)
errx(1, "missing arg(s) for VBR");
if (argc > 4)
errx(1, "too many parameters for VBR");
num = parse_num(argv[1], "PCR", aif->mib.pcr);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[2], "SCR", num);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[3], "MBS", 0xffffffLU);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
} else if (strcasecmp(argv[0], "abr") == 0) {
sdl.sdl_data[idx++] = ATMIO_TRAFFIC_ABR;
if (argc < 11)
errx(1, "missing arg(s) for ABR");
if (argc > 11)
errx(1, "too many parameters for ABR");
num = parse_num(argv[1], "PCR", aif->mib.pcr);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num1 = parse_num(argv[2], "MCR", num);
sdl.sdl_data[idx++] = (num1 >> 16) & 0xff;
sdl.sdl_data[idx++] = (num1 >> 8) & 0xff;
sdl.sdl_data[idx++] = (num1 >> 0) & 0xff;
num = parse_num(argv[3], "ICR", num);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
if (num < num1)
errx(1, "ICR must be >= MCR");
num = parse_num(argv[4], "TBE", 0xffffffUL);
sdl.sdl_data[idx++] = (num >> 16) & 0xff;
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[5], "NRM", 0x7UL);
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[6], "TRM", 0x7UL);
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[7], "ADTF", 0x3ffUL);
sdl.sdl_data[idx++] = (num >> 8) & 0xff;
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[8], "RIF", 0xfUL);
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[9], "RDF", 0xfUL);
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
num = parse_num(argv[10], "CDF", 0x7UL);
sdl.sdl_data[idx++] = (num >> 0) & 0xff;
} else
errx(1, "bad traffic type '%s'", argv[0]);
} else
sdl.sdl_data[idx++] = ATMIO_TRAFFIC_UBR;
sdl.sdl_alen = idx - sdl.sdl_nlen;
sdl.sdl_len += sdl.sdl_nlen + sdl.sdl_alen;
if (printonly) {
printf("route add -iface %s -link %.*s",
inet_ntoa(sain.sin_addr), sdl.sdl_nlen, sdl.sdl_data);
for (idx = 0; idx < sdl.sdl_alen; idx++)
printf("%c%x", ".:"[idx == 0],
(u_int)sdl.sdl_data[sdl.sdl_nlen + idx] & 0xffU);
printf("\n");
exit(0);
}
do_route(RTM_ADD, RTF_HOST | RTF_STATIC | RTF_UP, &sain, &sdl);
}
/*
* Delete an NATM route
*/
static void
natm_delete(int argc, char *argv[])
{
int opt;
struct hostent *hp;
struct sockaddr_in sain;
u_int vpi, vci;
struct diagif *aif;
struct natm_route *r;
static int printonly;
static const struct option opts[] = {
{ "printonly", OPT_SIMPLE, &printonly },
{ NULL, 0, NULL }
};
while ((opt = parse_options(&argc, &argv, opts)) != -1)
switch (opt) {
}
diagif_fetch();
natm_route_fetch();
memset(&sain, 0, sizeof(sain));
sain.sin_len = sizeof(sain);
sain.sin_family = AF_INET;
if (argc == 1) {
/* get the IP address for <dest> */
hp = gethostbyname(argv[0]);
if (hp == NULL)
errx(1, "bad hostname %s: %s", argv[0],
hstrerror(h_errno));
if (hp->h_addrtype != AF_INET)
errx(1, "bad address type for %s", argv[0]);
memcpy(&sain.sin_addr, hp->h_addr, sizeof(sain.sin_addr));
TAILQ_FOREACH(r, &natm_route_list, link)
if (r->host.s_addr == sain.sin_addr.s_addr)
break;
if (r == NULL)
errx(1, "no NATM route to host '%s' (%s)", argv[0],
inet_ntoa(sain.sin_addr));
} else if (argc == 3) {
TAILQ_FOREACH(aif, &diagif_list, link)
if (strcmp(aif->ifname, argv[0]) == 0)
break;
if (aif == NULL)
errx(1, "no such interface '%s'", argv[0]);
vpi = parse_num(argv[1], "VPI", 0xff);
vci = parse_num(argv[2], "VCI", 0xffff);
TAILQ_FOREACH(r, &natm_route_list, link)
if (r->aif == aif && r->vpi == vpi && r->vci == vci)
break;
if (r == NULL)
errx(1, "no such NATM route %s %u %u", argv[0],
vpi, vci);
sain.sin_addr = r->host;
} else
errx(1, "bad number of arguments for 'natm delete'");
if (printonly) {
printf("route delete %s\n", inet_ntoa(r->host));
exit(0);
}
do_route(RTM_DELETE, r->flags, &sain, NULL);
}
/*
* Show NATM routes
*/
static void
natm_show(int argc, char *argv[])
{
int opt;
struct natm_route *r;
struct hostent *hp;
static const char *const traffics[] = {
[ATMIO_TRAFFIC_UBR] = "UBR",
[ATMIO_TRAFFIC_CBR] = "CBR",
[ATMIO_TRAFFIC_VBR] = "VBR",
[ATMIO_TRAFFIC_ABR] = "ABR"
};
static int numeric, abr;
static const struct option opts[] = {
{ "abr", OPT_SIMPLE, &abr },
{ "numeric", OPT_SIMPLE, &numeric },
{ NULL, 0, NULL }
};
static const char head[] =
"Destination Iface VPI VCI Encaps Trf PCR "
"SCR/MCR MBS/ICR\n";
static const char head_abr[] =
"Destination Iface VPI VCI Encaps Trf PCR "
"SCR/MCR MBS/ICR TBE NRM TRM ADTF RIF RDF CDF\n";
while ((opt = parse_options(&argc, &argv, opts)) != -1)
switch (opt) {
}
diagif_fetch();
natm_route_fetch();
heading_init();
TAILQ_FOREACH(r, &natm_route_list, link) {
heading(abr ? head_abr : head);
if (numeric)
printf("%-20s", inet_ntoa(r->host));
else if (r->host.s_addr == INADDR_ANY)
printf("%-20s", "default");
else {
hp = gethostbyaddr((char *)&r->host, sizeof(r->host),
AF_INET);
if (hp != NULL)
printf("%-20s", hp->h_name);
else
printf("%-20s", inet_ntoa(r->host));
}
printf("%-12s%-4u%-6u%-9s%-4s", r->aif->ifname, r->vpi, r->vci,
r->llcsnap ? "LLC/SNAP" : "AAL5", traffics[r->traffic]);
switch (r->traffic) {
case ATMIO_TRAFFIC_UBR:
case ATMIO_TRAFFIC_CBR:
printf("%-8u", r->pcr);
break;
case ATMIO_TRAFFIC_VBR:
printf("%-8u%-8u%-8u", r->pcr, r->scr, r->mbs);
break;
case ATMIO_TRAFFIC_ABR:
printf("%-8u%-8u%-8u", r->pcr, r->mcr, r->icr);
if (abr)
printf("%-8u%-4u%-4u%-5u%-4u%-4u%-4u",
r->tbe, r->nrm, r->trm, r->adtf,
r->rif, r->rdf, r->cdf);
break;
}
printf("\n");
}
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 2001-2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* 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.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $FreeBSD$
*/
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/queue.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include <errno.h>
#include <netgraph.h>
#include <net/if.h>
#include <netinet/in.h>
#ifndef PATH_HELP
#define PATH_HELP "/usr/share/doc/atm:/usr/local/share/doc/atm"
#endif
#ifndef FILE_HELP
#define FILE_HELP "atmconfig.help"
#endif
#ifndef FILE_HELP_OTHERS
#define FILE_HELP_OTHERS "atmconfig_*.help"
#endif
#ifndef PATH_ILMI_SOCK
#define PATH_ILMI_SOCK "/var/run/ilmid.sock"
#endif
/*
* Builtin commands
*/
extern const struct cmdtab diag_tab[];
extern const struct cmdtab natm_tab[];

View File

@ -282,7 +282,8 @@ struct inoinfo {
u_int i_numblks; /* size of block array in bytes */
ufs2_daddr_t i_blks[1]; /* actually longer */
} **inphead, **inpsort;
extern long numdirs, dirhash, listmax, inplast;
extern long dirhash, inplast;
extern unsigned long numdirs, listmax;
extern long countdirs; /* number of directories we actually found */
#define MIBSIZE 3 /* size of fsck sysctl MIBs */

View File

@ -56,7 +56,8 @@ struct bufarea sblk; /* file system superblock */
struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */
ino_t cursnapshot;
long numdirs, dirhash, listmax, inplast;
long dirhash, inplast;
unsigned long numdirs, listmax;
long countdirs; /* number of directories we actually found */
int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */
int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */
@ -123,7 +124,7 @@ fsckinit(void)
pdirbp = NULL;
pbp = NULL;
cursnapshot = 0;
numdirs = dirhash = listmax = inplast = 0;
listmax = numdirs = dirhash = inplast = 0;
countdirs = 0;
bzero(adjrefcnt, sizeof(int) * MIBSIZE);
bzero(adjblkcnt, sizeof(int) * MIBSIZE);

View File

@ -472,8 +472,8 @@ cacheino(union dinode *dp, ino_t inumber)
inp->i_blks[UFS_NDADDR + i] = DIP(dp, di_ib[i]);
if (inplast == listmax) {
listmax += 100;
inpsort = (struct inoinfo **)realloc((char *)inpsort,
(unsigned)listmax * sizeof(struct inoinfo *));
inpsort = (struct inoinfo **)reallocarray((char *)inpsort,
listmax, sizeof(struct inoinfo *));
if (inpsort == NULL)
errx(EEXIT, "cannot increase directory list");
}

View File

@ -268,8 +268,7 @@ setup(char *dev)
(unsigned)bmapsize);
goto badsb;
}
inostathead = Calloc((unsigned)(sblock.fs_ncg),
sizeof(struct inostatlist));
inostathead = Calloc(sblock.fs_ncg, sizeof(struct inostatlist));
if (inostathead == NULL) {
printf("cannot alloc %u bytes for inostathead\n",
(unsigned)(sizeof(struct inostatlist) * (sblock.fs_ncg)));
@ -279,10 +278,8 @@ setup(char *dev)
dirhash = numdirs;
inplast = 0;
listmax = numdirs + 10;
inpsort = (struct inoinfo **)Calloc((unsigned)listmax,
sizeof(struct inoinfo *));
inphead = (struct inoinfo **)Calloc((unsigned)numdirs,
sizeof(struct inoinfo *));
inpsort = (struct inoinfo **)Calloc(listmax, sizeof(struct inoinfo *));
inphead = (struct inoinfo **)Calloc(numdirs, sizeof(struct inoinfo *));
if (inpsort == NULL || inphead == NULL) {
printf("cannot alloc %ju bytes for inphead\n",
(uintmax_t)numdirs * sizeof(struct inoinfo *));

View File

@ -339,6 +339,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate)
{
int len = 0;
struct in6_addr *d = &(cmd->addr6);
char *oav;
/*
* Needed for multiple address.
* Note d[1] points to struct in6_add r mask6 of cmd
@ -365,7 +366,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate)
return (1);
}
av = strdup(av);
oav = av = strdup(av);
while (av) {
/*
* After the address we can have '/' indicating a mask,
@ -446,7 +447,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate)
if (len + 1 > F_LEN_MASK)
errx(EX_DATAERR, "address list too long");
cmd->o.len |= len+1;
free(av);
free(oav);
return (1);
}

View File

@ -118,7 +118,6 @@ MAN= aac.4 \
cxgb.4 \
cxgbe.4 \
cxgbev.4 \
cy.4 \
cyapa.4 \
da.4 \
dc.4 \
@ -144,7 +143,6 @@ MAN= aac.4 \
edsc.4 \
ehci.4 \
em.4 \
en.4 \
enc.4 \
epair.4 \
esp.4 \
@ -153,7 +151,6 @@ MAN= aac.4 \
etherswitch.4 \
eventtimers.4 \
exca.4 \
fatm.4 \
fd.4 \
fdc.4 \
fdt.4 \
@ -181,7 +178,6 @@ MAN= aac.4 \
gpioled.4 \
gre.4 \
h_ertt.4 \
hatm.4 \
hifn.4 \
hme.4 \
hpet.4 \
@ -307,8 +303,6 @@ MAN= aac.4 \
my.4 \
nand.4 \
nandsim.4 \
natm.4 \
natmip.4 \
ncr.4 \
ncv.4 \
${_ndis.4} \
@ -320,7 +314,6 @@ MAN= aac.4 \
${_nfe.4} \
${_nfsmb.4} \
ng_async.4 \
ng_atm.4 \
ngatmbase.4 \
ng_atmllc.4 \
ng_bpf.4 \
@ -397,7 +390,6 @@ MAN= aac.4 \
owc.4 \
${_padlock.4} \
pass.4 \
patm.4 \
pccard.4 \
pccbb.4 \
pcf.4 \
@ -627,11 +619,9 @@ MLINKS+=disc.4 if_disc.4
MLINKS+=ed.4 if_ed.4
MLINKS+=edsc.4 if_edsc.4
MLINKS+=em.4 if_em.4
MLINKS+=en.4 if_en.4
MLINKS+=enc.4 if_enc.4
MLINKS+=epair.4 if_epair.4
MLINKS+=et.4 if_et.4
MLINKS+=fatm.4 if_fatm.4
MLINKS+=fd.4 stderr.4 \
fd.4 stdin.4 \
fd.4 stdout.4
@ -645,7 +635,6 @@ MLINKS+=geom.4 GEOM.4
MLINKS+=gif.4 if_gif.4
MLINKS+=gpio.4 gpiobus.4
MLINKS+=gre.4 if_gre.4
MLINKS+=hatm.4 if_hatm.4
MLINKS+=hme.4 if_hme.4
MLINKS+=hpet.4 acpi_hpet.4
MLINKS+=${_hptrr.4} ${_rr232x.4}
@ -695,7 +684,6 @@ MLINKS+=nge.4 if_nge.4
MLINKS+=${_ntb_hw.4} ${_ntb.4}
MLINKS+=${_nxge.4} ${_if_nxge.4}
MLINKS+=ow.4 onewire.4
MLINKS+=patm.4 if_patm.4
MLINKS+=pccbb.4 cbb.4
MLINKS+=pcm.4 snd.4 \
pcm.4 sound.4
@ -966,7 +954,6 @@ MAN+= \
usb_template.4 \
usfs.4 \
uslcom.4 \
utopia.4 \
uvisor.4 \
uvscom.4 \
zyd.4

View File

@ -1,257 +0,0 @@
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the Systems Programming Group of the University of Utah Computer
.\" Science Department.
.\" 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.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
.\"
.\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91
.\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
.\" from: sio.4,v 1.16 1995/06/26 06:05:30 bde Exp $
.\" $FreeBSD$
.\"
.Dd May 24, 2004
.Dt CY 4
.Os
.Sh NAME
.Nm cy
.Nd Cyclades Cyclom-Y serial driver
.Sh SYNOPSIS
For one ISA card:
.Bd -ragged -offset indent -compact
.Cd "device cy"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.cy.0.at="isa"
.Cd hint.cy.0.irq="10"
.Cd hint.cy.0.maddr="0xd4000"
.Cd hint.cy.0.msize="0x2000"
.Ed
.Pp
For two ISA cards:
.Bd -ragged -offset indent -compact
.Cd "device cy"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.cy.0.at="isa"
.Cd hint.cy.0.irq="10"
.Cd hint.cy.0.maddr="0xd4000"
.Cd hint.cy.0.msize="0x2000"
.Cd hint.cy.1.at="isa"
.Cd hint.cy.1.irq="11"
.Cd hint.cy.1.maddr="0xd6000"
.Cd hint.cy.1.msize="0x2000"
.Ed
.Pp
For PCI cards:
.Bd -ragged -offset indent -compact
.Cd "device cy"
.Cd "options CY_PCI_FASTINTR"
.Pp
No lines are required in
.Pa /boot/device.hints
for PCI cards.
.Ed
.Pp
Minor numbering:
.Bd -literal -offset indent -compact
0b\fIMMMMMMMMMMMMMMMMxxxxxxxxOLIMMMMM\fR
call\fBO\fRut
\fBL\fRock
\fBI\fRnitial
\fBMMMMMMMMMMMMMMMM MMMMMM\fRinor
.Ed
.Sh DESCRIPTION
The
.Nm
driver provides support for Cirrus Logic CD1400-based
.Tn EIA
.Tn RS-232C
.Pf ( Tn CCITT
.Tn V.24 )
communications interfaces (ports) on Cyclades Cyclom-Y boards.
Each CD1400 provides 4 ports.
Cyclom-Y boards with various numbers of CD1400's are available.
This driver supports up to 8 CD1400's (32 ports) per board.
.Pp
Input and output for each line may set independently
to the following speeds:
50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
19200, 38400, 57600, or 115200 bps.
Other speeds of up to 150000 are supported by the termios interface
but not by the sgttyb compatibility interface.
The CD1400 is not fast enough to handle speeds above 115200 bps
effectively.
It can transmit on a single line at slightly more than 115200 bps,
but when 4 lines are active in both directions its limit is about
90000 bps on each line.
.\" XXX the following should be true for all serial drivers and
.\" should not be repeated in the man pages for all serial drivers.
.\" It was copied from sio.4. The only change was s/sio/cy/g.
.Pp
Serial ports controlled by the
.Nm
driver can be used for both `callin' and `callout'.
For each port there is a callin device and a callout device.
The minor number of the callout device is 128 higher
than that of the corresponding callin port.
The callin device is general purpose.
Processes opening it normally wait for carrier
and for the callout device to become inactive.
The callout device is used to steal the port from
processes waiting for carrier on the callin device.
Processes opening it do not wait for carrier
and put any processes waiting for carrier on the callin device into
a deeper sleep so that they do not conflict with the callout session.
The callout device is abused for handling programs that are supposed
to work on general ports and need to open the port without waiting
but are too stupid to do so.
.Pp
The
.Nm
driver also supports an initial-state and a lock-state control
device for each of the callin and the callout "data" devices.
The minor number of the initial-state device is 32 higher
than that of the corresponding data device.
The minor number of the lock-state device is 64 higher
than that of the corresponding data device.
The termios settings of a data device are copied
from those of the corresponding initial-state device
on first opens and are not inherited from previous opens.
Use
.Xr stty 1
in the normal way on the initial-state devices to program
initial termios states suitable for your setup.
.Pp
The lock termios state acts as flags to disable changing
the termios state.
E.g., to lock a flag variable such as
CRTSCTS, use
.Em "stty crtscts"
on the lock-state device.
Speeds and special characters
may be locked by setting the corresponding value in the lock-state
device to any nonzero value.
.Pp
Correct programs talking to correctly wired external devices
work with almost arbitrary initial states and almost no locking,
but other setups may benefit from changing some of the default
initial state and locking the state.
In particular, the initial states for non (POSIX) standard flags
should be set to suit the devices attached and may need to be
locked to prevent buggy programs from changing them.
E.g., CRTSCTS should be locked on for devices that support
RTS/CTS handshaking at all times and off for devices that do not
support it at all.
CLOCAL should be locked on for devices
that do not support carrier.
HUPCL may be locked off if you do not
want to hang up for some reason.
In general, very bad things happen
if something is locked to the wrong state, and things should not
be locked for devices that support more than one setting.
The
CLOCAL flag on callin ports should be locked off for logins
to avoid certain security holes, but this needs to be done by
getty if the callin port is used for anything else.
.Ss Kernel Configuration Options
The
.Em CY_PCI_FASTINTR
option should be used to avoid suboptimal interrupt handling for
PCI Cyclades boards.
The PCI BIOS must be configured with the
.Nm
interrupt not shared with any other active device
for this option to work.
This option is not the default because it is currently harmful in
certain cases where it does not work.
.Sh FILES
.\" XXX more cloning: s/d/c/g and add a ? for the card number.
.Bl -tag -width /dev/ttyic?? -compact
.It Pa /dev/ttyc??
for callin ports
.It Pa /dev/ttyic??
.It Pa /dev/ttylc??
corresponding callin initial-state and lock-state devices
.Pp
.\" XXX more cloning: s/a/c/g. No consistency :-(.
.It Pa /dev/cuac??
for callout ports
.It Pa /dev/cuaic??
.It Pa /dev/cualc??
corresponding callout initial-state and lock-state devices
.El
.Pp
.Bl -tag -width /etc/rc.serial -compact
.It Pa /etc/rc.serial
examples of setting the initial-state and lock-state devices
.El
.Pp
The first question mark in these device names is short for the
card number
(a decimal number between 0 and 65535 inclusive).
The second question mark is short for the port number
(a letter in the range [0-9a-v]).
.Sh DIAGNOSTICS
.Bl -diag
.\" XXX back to s/sio/cy/g.
.It cy%d: silo overflow.
Problem in the interrupt handler.
.El
.Bl -diag
.It cy%d: interrupt-level buffer overflow.
Problem in the bottom half of the driver.
.El
.Bl -diag
.It cy%d: tty-level buffer overflow.
Problem in the application.
Input has arrived faster than the given module could process it
and some has been lost.
.El
.\" .Bl -diag
.\" .It sio%d: reduced fifo trigger level to %d.
.\" Attempting to avoid further silo overflows.
.\" .El
.Sh SEE ALSO
.Xr stty 1 ,
.Xr termios 4 ,
.Xr tty 4 ,
.Xr comcontrol 8 ,
.Xr pstat 8
.Sh HISTORY
The
.Nm
driver is derived from the
.Nm sio
driver and the
.Nx
.Nm
driver and is
.Ud
.Sh BUGS
Serial consoles are not implemented.

View File

@ -1,78 +0,0 @@
.\" $FreeBSD$
.\"
.Dd July 16, 2005
.Dt EN 4
.Os
.Sh NAME
.Nm en
.Nd "device driver for Midway-based ATM interfaces"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following lines in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device en"
.Cd "device atm"
.Cd "device utopia"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
if_en_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
device driver supports Midway-based ATM interfaces including the
Efficient Networks, Inc.\& ENI-155 and Adaptec ANA-59x0.
Midway is an AAL5 SAR (Segmentation and Reassembly) chip.
.Pp
For configuring the card for IP see
.Xr natmip 4 .
.Pp
The following sysctls are recognized by the driver additionally to those
handled by
.Xr utopia 4 :
.Bl -tag -width indent
.It Va hw.atm.enX.istats
Contains an array of
.Vt uint32_t
with internal driver statistics.
.It Va hw.atm.enX.debug
This is a bit map of debugging options.
This variable is only available when the driver is compiled with debugging
support.
.El
.Pp
The driver supports the media options
.Cm sdh ,
.Cm noscramb
and
.Cm unassigned
(see
.Xr utopia 4 ) .
.Sh DIAGNOSTICS
.Bd -literal
en0 <Efficient Networks ENI-155p> rev 0 int a irq 5 on pci0:16
en0: ATM midway v0, board IDs 6.0, Utopia (pipelined), 512KB on-board RAM
en0: maximum DMA burst length = 64 bytes
en0: 7 32KB receive buffers, 8 32KB transmit buffers allocated
.Ed
.Sh SEE ALSO
.Xr natm 4 ,
.Xr natmip 4 ,
.Xr utopia 4 ,
.Xr ifconfig 8 ,
.Xr route 8
.Sh AUTHORS
.An Chuck Cranor
of Washington University implemented
.Nm
driver in 1996 for
.Nx .
.Sh CAVEATS
The driver extensively uses DMA on PCI.
The first
generation PCI chipsets do not work or exhibit poor performance.

View File

@ -1,115 +0,0 @@
.\"
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" 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.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.\" fatm(4) man page
.\"
.Dd May 15, 2003
.Dt FATM 4
.Os
.Sh NAME
.Nm fatm
.Nd "device driver for Fore PCA200E ATM interfaces"
.Sh SYNOPSIS
.Cd device fatm
.Cd device utopia
.Cd device atm
.Pp
.Cd options NATM
.Sh DESCRIPTION
The
.Nm
device driver supports the FORE (now Marconi) PCA200E ATM interface cards.
The driver interfaces with the
.Xr natm 4
framework,
.Xr netgraph 4
and HARP.
It provides only PVC services.
Signalling, ATMARP, ILMI and other
higher layer protocols are implemented using
.Xr netgraph 4
or HARP.
.Pp
For configuring the card for IP see
.Xr natmip 4 .
The following sysctls are recognized by the driver additionally to those
handled by
.Xr utopia 4 :
.Bl -tag -width indent
.It Va hw.atm.fatm Ns Ar N Ns Va .stats
Returns a device specific statistic list of
.Vt uint32_t
statistic counters.
.It Va hw.atm.fatm Ns Ar N Ns Va .istats
Returns a list of
.Vt uint32_t
with internal driver statistics.
.It Va hw.atm.fatm Ns Ar N Ns Va .retry_tx
If this is set packets are stuffed back into the interface's send queue when
the cards transmit queue is found to be full.
They are transmitted later.
If this is not set the packets are dropped.
It may be useful to set this
if only UBR traffic is sent.
.It Va hw.atm.fatm Ns Ar N Ns Va .debug
.Bf Em
(Only if debugging enabled.)
.Ef
These are debugging flags.
See
.Pa src/sys/dev/fatm/if_fatmvar.h
for the possible flags.
.El
.Pp
The driver supports the media options
.Cm sdh , noscramb
and
.Cm unassigned
(see
.Xr utopia 4 ) .
.Sh DIAGNOSTICS
.Bd -literal
fatm0: <FORE PCA200E> mem 0xd5800000-0xd59fffff irq 9 at device 9.0 on pci0
.Ed
.Sh SEE ALSO
.Xr natm 4 ,
.Xr natmip 4 ,
.Xr utopia 4
.Sh AUTHORS
.An Harti Brandt Aq Mt harti@FreeBSD.org
.Sh BUGS
These cards can CBR shape a single VCC only.
It is currently possible to
request more than one CBR connection.
In this case all the timing will be
wrong.
See
.Xr hatm 4
for a better card.

View File

@ -1,282 +0,0 @@
.\"
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" 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.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.\" hatm(4) man page
.\"
.Dd May 15, 2003
.Dt HATM 4
.Os
.Sh NAME
.Nm hatm
.Nd "device driver for Fore/Marconi HE155 and HE622 ATM interfaces"
.Sh SYNOPSIS
.Cd device hatm
.Cd device utopia
.Cd device atm
.Pp
.Cd options NATM
.Sh DESCRIPTION
The
.Nm
device driver supports the FORE (now Marconi) HE155 and HE622 ATM interface
cards.
The driver interfaces with the
.Xr natm 4
framework,
.Xr netgraph 4
and the HARP ATM stack.
It provides only PVC services.
Signalling, ATMARP, ILMI and other
higher layer protocols are implemented using
.Xr netgraph 4
or HARP.
.Pp
For configuring the card for IP see
.Xr natmip 4 .
.Pp
The following sysctls are recognized by the driver additionally to those
handled by
.Xr utopia 4 :
.Bl -tag -width indent
.It Va hw.atm.hatm.natm_traffic
This is the traffic type to be used for NATM pvc connections.
The type of
this variable is integer and it must have one of the values 0 (UBR) or 1 (CBR).
.It Va hw.atm.hatm.natm_pcr
This is the peak cell rate to be used for NATM CBR connections.
.It Va hw.atm.hatm Ns Ar N Ns Va .stats
Contains an array of
.Vt uint32_t
with device specific statistics.
.It Va hw.atm.hatm Ns Ar N Ns Va .istats
Contains an array of
.Vt uint32_t
with internal driver statistics.
.It Va hw.atm.hatm Ns Ar N Ns Va .debug
.Bf Em
(Only if debugging enabled.)
.Ef
These are the debugging flags.
See
.Pa src/sys/dev/hatm/if_hatmvar.h
for the possible flags.
.It Va hw.atm.hatm Ns Ar N Ns Va .tsr
.Bf Em
(Only if debugging enabled.)
.Ef
This is an array containing all transmission status registers.
For each of the
4096 possible VCCs there are 15 32-bit registers.
.It Va hw.atm.hatm Ns Ar N Ns Va .tpd
.Bf Em
(Only if debugging enabled.)
.Ef
This is an array containing all on card current transmission packet descriptors.
For each of the 4096 possible VCCs there are 16 32-bit registers.
.It Va hw.atm.hatm Ns Ar N Ns Va .mbox
.Bf Em
(Only if debugging enabled.)
.Ef
This is an array containing the mbox registers.
.It Va hw.atm.hatm Ns Ar N Ns Va .cm
.Bf Em
(Only if debugging enabled.)
.Ef
This is an array containing all connection memory registers.
The first 32-bit integer of this array is the ABR base address.
.It Va hw.atm.hatm Ns Ar N Ns Va .heregs
.Bf Em
(Only if debugging enabled.)
.Ef
This is an array containing all card registers including SUNI and the FLASH ROM.
.It Va hw.atm.hatm Ns Ar N Ns Va .lbmem
.Bf Em
(Only if debugging enabled.)
.Ef
Returns the contents of the local memory.
.El
.Pp
The driver supports the media options
.Cm sdh , noscramb
and
.Cm unassigned
(see
.Xr utopia 4 ) .
.Sh ENVIRONMENT
When attaching to a device the driver checks the kernel environment
(see
.Xr kenv 1 )
to see if the default queues sizes should be overwritten or not.
The
following variables are checked and interpreted as unsigned integer
values (in either radix):
.Bl -tag -width indent
.It Va hw.hatm Ns Ar N Ns Va .rbps0_size
Size of the small receive buffer pool 0.
This pool is used for all
except raw AAL connections.
The pool size must be a power of two between
4 and 8192 inclusive.
When attaching the driver allocates this number
of mbufs.
.It Va hw.hatm Ns Ar N Ns Va .rbps0_thresh
Interrupt threshold for small receive buffer pool 0.
When the number of free
buffers in the pool falls below this threshold it generates an interrupt
so that the driver can refill the pool.
.It Va hw.hatm Ns Ar N Ns Va .rbpl0_thresh
Size of the large receive buffer pool 0.
This pool is used for all
except raw AAL connections.
The pool size must be a power of two between
4 and 8192 inclusive.
When attaching the driver allocates this number
of mbufs with clusters.
.It Va hw.hatm Ns Ar N Ns Va .rbpl0_thresh
Interrupt threshold for large receive buffer pool 0.
When the number of free
buffers in the pool falls below this threshold it generates an interrupt
so that the driver can refill the pool.
.It Va hw.hatm Ns Ar N Ns Va .rbrq0_size
Size of receive buffer return queue 0.
This queue is used to return buffers
filled with received frames to the driver.
The size must be a power of 2
between 1 and 16384 inclusive.
.It Va hw.hatm Ns Ar N Ns Va .rbrq0_thresh
Interrupt threshold for receive buffer return queue 0.
This threshold
should only be triggered in exceptional cases.
.It Va hw.hatm Ns Ar N Ns Va .rbrq0_tout
Interrupt timeout for receive buffer return queue 0.
An interrupt is generated
after this time if the queue is not empty.
The number is in internal card
ticks.
.It Va hw.hatm Ns Ar N Ns Va .rbrq0_pcnt
Packet count threshold for receive buffer return queue 0.
An interrupt
is generated if this number of packets is in the queue.
.It Va hw.hatm Ns Ar N Ns Va .rbps1_size
Size of the small receive buffer pool 1.
This pool is used for all
raw AAL connections.
The pool size must be a power of two between
4 and 8192 inclusive.
When attaching the driver allocates this number
of mbufs.
.It Va hw.hatm Ns Ar N Ns Va .rbps1_thresh
Interrupt threshold for small receive buffer pool 1.
When the number of free
buffers in the pool falls below this threshold it generates an interrupt
so that the driver can refill the pool.
.It Va hw.hatm Ns Ar N Ns Va .rbrq1_size
Size of receive buffer return queue 1.
This queue is used to return buffers
filled with received cells to the driver.
The size must be a power of 2
between 1 and 16384 inclusive.
.It Va hw.hatm Ns Ar N Ns Va .rbrq1_thresh
Interrupt threshold for receive buffer return queue 1.
This threshold
should only be triggered in exceptional cases.
.It Va hw.hatm Ns Ar N Ns Va .rbrq1_tout
Interrupt timeout for receive buffer return queue 1.
An interrupt is generated
after this time if the queue is not empty.
The number is in internal card
ticks.
.It Va hw.hatm Ns Ar N Ns Va .rbrq1_pcnt
Packet count threshold for receive buffer return queue 0.
An interrupt
is generated if this number of cells is in the queue.
.It Va hw.hatm Ns Ar N Ns Va .irq0_size
Size of interrupt queue 0.
This must be a number between 1 and 1023 inclusive.
.It Va hw.hatm Ns Ar N Ns Va .irq0_thresh
Interrupt retrigger threshold of interrupt queue 0.
A new interrupt is trigger
if the queue fill state reaches this threshold and the interrupt was no
served.
.It Va hw.hatm Ns Ar N Ns Va .tbrq0_size
Transmit buffer return queue 0 size.
This queue is used to feed back empty
buffers of transmitted frames back to the driver.
It must be a power of 2
between 1 and 4096 inclusive.
.It Va hw.hatm Ns Ar N Ns Va .tbrq0_thresh
Transmit buffer return queue 0 threshold.
An interrupt is generated if the
queue fill state reaches this point.
.It Va hw.hatm Ns Ar N Ns Va .tpdrq_size
Transmit descriptor ready queue size.
This queue is used by the driver
to feed transmit descriptors into the card.
The size must be a power of 2
between 1 and 16384 inclusive.
.It Va hw.hatm Ns Ar N Ns Va .tpdmax
Maximum number of active TPDs per connection.
This controls the maximum
number of outstanding packet chunks per connection and thus the maximum
delay packets can have because of queueing on the adapter.
If set to 0,
a connection can eat up all available TPDs.
.It Va hw.hatm Ns Ar N Ns Va .mbuf_max_pages
Maximum number of memory pages allocated to small external mbufs.
This must not be zero and not larger than 65536.
.El
.Sh DIAGNOSTICS
.Bd -literal
hatm0: <FORE HE> mem 0xd2600000-0xd26fffff irq 9 at device 15.0 on pci2
hatm0: ForeRunnerHE 622, Rev. D, S/N 2949834, MAC=00:20:48:2d:02:ca
.Ed
.Sh SEE ALSO
.Xr natm 4 ,
.Xr natmip 4 ,
.Xr utopia 4 ,
.Xr ifconfig 8 ,
.Xr route 8
.Sh AUTHORS
.An Harti Brandt Aq Mt harti@FreeBSD.org
.Sh CAVEATS
When putting a HE155 into a 64-bit 66MHz PCI slot the machine may hang.
This occurs very early in the POST so that even the display does not turn on.
The HE155 runs only in 33MHz slots (either 32 or 64-bit).
HE622 cards work just fine in 64-bit slots.
.Pp
The driver may not work with bounce buffer, because of
.Xr bus_dmamap_sync 9
missing the
.Fa offset
and
.Fa len
arguments the
.Nx
function has.

View File

@ -1,102 +0,0 @@
.\" $FreeBSD$
.\"
.Dd December 29, 1997
.Dt NATM 4
.Os
.Sh NAME
.Nm natm
.Nd Native Mode ATM protocol layer
.Sh DESCRIPTION
The
.Bx
ATM software comes with a
.Em native mode ATM protocol layer
which provides socket level access to AAL0 and AAL5 virtual circuits.
To enable this protocol layer, add
.Dl options NATM
.Dl device atm
to your kernel configuration file and re-make the kernel (do not forget
to do
.Dq make clean ) .
.Sh NATM API
The NATM layer uses a
.Vt struct sockaddr_natm
to specify a virtual circuit:
.Bd -literal -offset indent
struct sockaddr_natm {
uint8_t snatm_len; /* length */
uint8_t snatm_family; /* AF_NATM */
char snatm_if[IFNAMSIZ]; /* interface name */
uint16_t snatm_vci; /* vci */
uint8_t snatm_vpi; /* vpi */
};
.Ed
.Pp
To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201
one would use the following:
.Bd -literal -offset indent
struct sockaddr_natm snatm;
int s, r;
s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5);
/* note: PROTO_NATMAAL0 is AAL0 */
if (s < 0) { perror("socket"); exit(1); }
bzero(&snatm, sizeof(snatm));
snatm.snatm_len = sizeof(snatm);
snatm.snatm_family = AF_NATM;
sprintf(snatm.snatm_if, "en0");
snatm.snatm_vci = 201;
snatm.snatm_vpi = 0;
r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm));
if (r < 0) { perror("connect"); exit(1); }
/* s now connected to ATM! */
.Ed
.Pp
The
.Fn socket
call simply creates an unconnected NATM socket.
The
.Fn connect
call associates an unconnected NATM socket with a
virtual circuit and tells the driver to enable that virtual circuit
for receiving data.
After the
.Fn connect
call one can
.Fn read
or
.Fn write
to the socket to perform ATM I/O.
.Sh Internal NATM operation
Internally, the NATM protocol layer keeps a list of all active virtual
circuits on the system in
.Dv natm_pcbs .
This includes circuits currently being used for IP to prevent NATM and
IP from clashing over virtual circuit usage.
.Pp
When a virtual circuit is enabled for receiving data, the NATM
protocol layer passes the address of the protocol control block down
to the driver as a receive
.Dq handle .
When inbound data arrives, the driver passes the data back with the
appropriate receive handle.
The NATM layer uses this to avoid the
overhead of a protocol control block lookup.
This allows us to take
advantage of the fact that ATM has already demultiplexed the data for
us.
.Sh SEE ALSO
.Xr en 4 ,
.Xr fatm 4 ,
.Xr hatm 4 ,
.Xr natmip 4 ,
.Xr patm 4
.Sh AUTHORS
.An Chuck Cranor
of Washington University implemented the NATM protocol layer
along with the EN ATM driver in 1996 for
.Nx .
.Sh CAVEATS
The NATM protocol support is subject to change as
the ATM protocols develop.
Users should not depend on details of the current implementation, but rather
the services exported.

View File

@ -1,248 +0,0 @@
.\"
.\" Copyright (c) 2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" All rights reserved.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" 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 August 11, 2003
.Dt NATMIP 4
.Os
.Sh NAME
.Nm natmip
.Nd IP over ATM PVCs
.Sh SYNOPSIS
.Cd "device atm"
.Cd "options NATM"
.Sh DESCRIPTION
The NATM protocol stack includes support for IP over ATM.
Without any
additional signalling stacks or other modules it is possible to build
a CLIP (classical IP over ATM) network based on PVCs.
.Pp
An ATM network card
.Li ( en0
in this example) is configured for IP by something
like:
.Pp
.Dl "ifconfig en0 128.252.200.1 netmask 0xffffff00 up"
.Pp
IP routing is done with special interface routes (routes with directly
reachable destinations) with a link layer gateway address.
The link layer address specifies the ATM interface through which the
destination can be reached, the virtual channel that connects to the
destination and the ATM characteristics of this channel.
The address part of the link layer address (see
.Xr link_addr 3 )
consists of a fixed part (the first 5 bytes) and a part that
depends on the kind of the PVC (UBR, CBR, VBR, ABR).
Multi-byte values
are big-endian encoded: the bytes with the lower numbers contain the
higher order bits.
.Bl -tag -width "bytes 12...12" -offset indent
.It byte 0
Is a flag byte.
Currently only flag 0x20 is used.
When set, all IP frames are LLC/SNAP encapsulated before putting them into
an AAL5 frame.
Setting this flag is recommended and allows interoperability with other
CLIP implementations.
Note that BPF works only with LLC/SNAP encapsulation.
.It byte 1
This is the VPI of the channel.
.It bytes 2...3
VCI of the channel.
Must not be zero.
.It byte 4
Traffic type.
One of 0 (UBR), 1 (CBR), 2 (ABR), 3 (VBR).
.El
.Pp
The variable part for UBR connections may be either empty or three bytes:
.Bl -tag -width "bytes 12...12" -offset indent
.It bytes 5...7
Specifies the peak cell rate for UBR.
.El
.Pp
The variable part for CBR connections must be three bytes:
.Bl -tag -width "bytes 12...12" -offset indent
.It bytes 5...7
Specifies the peak cell rate for CBR.
.El
.Pp
The variable part for VBR connections must be 9 bytes long and specifies three
values:
.Bl -tag -width "bytes 12...12" -offset indent
.It bytes 5...7
Specifies the peak cell rate for VBR.
.It bytes 8...10
This is the sustainable cell rate.
.It bytes 11...13
The maximum burst size.
.El
.Pp
The variable part for ABR connections must be 19 bytes long and specifies the
following values:
.Bl -tag -width "bytes 12...12" -offset indent
.It bytes 5...7
Specifies the peak cell rate for ABR.
.It bytes 8...10
The minimum cell rate.
.It bytes 11...13
The initial cell rate.
.It bytes 14...16
The transient buffer exposure.
.It byte 17
The NRM value.
.It byte 18
The TRM value.
.It bytes 19...20
The ADTF value.
.It byte 21
The rate increase factor (RIF).
.It byte 22
The rate decrease factor (RDF).
.It byte 23
The cutoff decrease factor (CDF).
.El
.Pp
To add a PVC the
.Xr route 8
utility can be used:
.Bd -ragged -offset indent
.Nm route Cm add
.Fl iface Aq Ar "remote\ IP\ address"
.Fl link Ao Ar iface Ac : Ns Aq Ar lladdr
.Ed
.Pp
The
.Ar iface
is the ATM interface through which
.Ar "remote\ IP\ address"
can be reached and
.Ar lladdr
is the link layer address as a string of dot-separated, hexadecimal bytes.
.Pp
NATM also supports the old, original format.
This consists of 4 byte
link layer addresses (and the channels are implicit UBR):
.Bl -tag -width "bytes 12...12" -offset indent
.It byte 0
Flags:
.Bl -tag -width "0x02" -offset indent -compact
.It 0x01
use AAL5.
.It 0x02
if using AAL5, use an LLC/SNAP header.
.El
.Pp
Thus, parameter 3 means AAL5 and LLC/SNAP encapsulation (this is the required
setting for interworking with other CLIP clients).
Note that BPF works only with LLC/SNAP encapsulation.
.It byte 1
VPI for the channel
.It bytes 2...3
VCI for the channel
.El
.Sh EXAMPLES
Suppose you have 3 hosts 128.252.200.1, 128.252.200.2 and
128.252.200.3 connected by ATM through PVCs:
.Pp
.Bl -item -offset indent -compact
.It
between 128.252.200.1 and 128.252.200.2: 0xc9 UBR
.It
between 128.252.200.1 and 128.252.200.3: 0xca VBR
.It
between 128.252.200.2 and 128.252.200.3: 0xcb CBR
.El
.Pp
The parameters for the VBR channel are: PCR 50000, SCR 10000, MBS 10.
The peak cell rate for the CBR channel is 100000.
.Pp
To enable the links use the following commands:
.Pp
on host 128.252.200.1:
.Bd -literal -offset indent -compact
ifconfig en0 128.252.200.1 netmask 0xffffff00 up
route add -iface 128.252.200.2 -link en0:3.0.0.c9.0
route add -iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a
.Ed
.Pp
on host 128.252.200.2:
.Bd -literal -offset indent -compact
ifconfig en0 128.252.200.2 netmask 0xffffff00 up
route add -iface 128.252.200.1 -link en0:3.0.0.c9.0
route add -iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0
.Ed
.Pp
on host 128.252.200.3:
.Bd -literal -offset indent -compact
ifconfig en0 128.252.200.3 netmask 0xffffff00 up
route add -iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a
route add -iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0
.Ed
.Pp
This can also be done in
.Xr rc.conf 5 :
.Pp
on host 128.252.200.1:
.Bd -literal -offset indent -compact
network_interfaces="lo0 en0"
ifconfig_en0="inet 128.252.200.1 netmask 255.255.255.0"
static_routes="host2 host3"
route_host2="-iface 128.252.200.2 -link en0:3.0.0.c9.0"
route_host3="-iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a"
.Ed
.Pp
on host 128.252.200.2:
.Bd -literal -offset indent -compact
network_interfaces="lo0 en0"
ifconfig_en0="inet 128.252.200.2 netmask 255.255.255.0"
static_routes="host1 host3"
route_host1="-iface 128.252.200.1 -link en0:3.0.0.c9.0"
route_host3="-iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0"
.Ed
.Pp
on host 128.252.200.3:
.Bd -literal -offset indent -compact
network_interfaces="lo0 en0"
ifconfig_en0="inet 128.252.200.3 netmask 255.255.255.0"
static_routes="host1 host2"
route_host1="-iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a"
route_host2="-iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0"
.Ed
.Sh SEE ALSO
.Xr en 4 ,
.Xr fatm 4 ,
.Xr hatm 4 ,
.Xr natm 4 ,
.Xr patm 4
.Sh AUTHORS
.An Chuck Cranor
of Washington University implemented the NATM protocol layer
along with the EN ATM driver in 1996 for
.Nx .

View File

@ -1,406 +0,0 @@
.\"
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" 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.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.\" ng_atm(4) man page
.\"
.Dd November 2, 2012
.Dt NG_ATM 4
.Os
.Sh NAME
.Nm ng_atm
.Nd netgraph ATM node type
.Sh SYNOPSIS
.In sys/types.h
.In net/if_atm.h
.In netgraph.h
.In netgraph/atm/ng_atm.h
.Sh DESCRIPTION
The
.Nm atm
netgraph node type allows
.Xr natm 4
ATM drivers to be connected to the
.Xr netgraph 4
networking subsystem.
When the
.Nm
module is loaded a node is automatically created for each
.Xr natm 4
ATM interface.
The nodes are named with the same name as the
interface.
Nodes are also created if a driver for an ATM
card is loaded after
.Nm
was loaded.
.Pp
The
.Nm atm
nodes are persistent.
They are removed when the interface is removed.
.Dv NGM_SHUTDOWN
messages are ignored by the node.
.Sh HOOKS
Four special hooks with fixed names and an unlimited number of hooks with user
defined names are supported.
Three of the fixed hooks are attached to
strategic points in the information flow in the
.Xr natm 4
system and support only reading.
The fourth fixed hook behaves like the other
user hooks, but a number of management messages are sent along the hook.
The other hooks can be attached to VCIs dynamically by means of
control messages to the
.Nm atm
node and can be written and read.
.Pp
The four fixed hooks are:
.Bl -tag -width ".Va orphans"
.It Va input
This is a connection to the raw input stream from the network.
If this hook is connected, all incoming packets are delivered out to
this hook.
Note that this redirects ALL input.
Neither
.Xr natm 4
nor the user hooks will see any input if
.Va input
is connected.
An
.Vt atm_pseudohdr
(see
.Xr natm 4 )
is prepended to the actual data.
.It Va output
This is a connection to the raw output stream to the network device.
If this hook is connected, all outgoing packets are handed over to
the netgraph system and delivered to the hook instead of being delivered
to the ATM driver.
An
.Vt atm_pseudohdr
(see
.Xr natm 4 )
is prepended to the actual data.
.It Va orphans
This hook receives all packets that are unrecognized, i.e., do not belong to
either a
.Xr natm 4
socket, a
.Nm
VCI or
.Xr natm 4
IP.
Because ATM is connection oriented and packets are received on a given VCI only
when someone initiates this VCI, packets should never be orphaned.
There is
however one exception: if you use
.Xr natm 4
IP with LLC/SNAP encapsulation packets with do not have the IP protocol
indicated in the packet header are delivered out of this hook.
An
.Vt atm_pseudohdr
(see
.Xr natm 4 )
is prepended to the actual data send out to the hook.
.It Va manage
This hook behaves exactly like a normal user hook (see below) except that
the node at the other hand will receive management messages.
.El
.Pp
Hooks for dynamically initiated VCIs can have whatever name is allowed by
.Xr netgraph 4
as long as the name does not collide with one of the three predefined names.
.Pp
To initiate packet sending and receiving on a dynamic hook, one has to issue
a
.Dv NGM_ATM_CPCS_INIT
control message.
To terminate sending and receiving one must send a
.Dv NGM_ATM_CPCS_TERM
message (see
.Sx CONTROL MESSAGES ) .
The data sent and received on these hooks has no additional
headers.
.Sh CONTROL MESSAGES
This node type supports the generic messages plus the following:
.Bl -tag -width 4n
.It Dv NGM_ATM_GET_IFNAME Pq Ic getifname
Return the name of the interface as a
.Dv NUL Ns
-terminated string.
This is normally the same name as that of the node.
.It Dv NGM_ATM_GET_CONFIG Pq Ic getconfig
Returns a structure defining the configuration of the interface:
.Bd -literal
struct ngm_atm_config {
uint32_t pcr; /* peak cell rate */
uint32_t vpi_bits; /* number of active VPI bits */
uint32_t vci_bits; /* number of active VCI bits */
uint32_t max_vpcs; /* maximum number of VPCs */
uint32_t max_vccs; /* maximum number of VCCs */
};
.Ed
.It Dv NGM_ATM_GET_VCCS Pq Ic getvccs
Returns the table of open VCCs from the driver.
This table consists of
a header and a variable sized array of entries, one for each open VCC:
.Bd -literal
struct atmio_vcctable {
uint32_t count; /* number of vccs */
struct atmio_vcc vccs[0]; /* array of VCCs */
};
struct atmio_vcc {
uint16_t flags; /* flags */
uint16_t vpi; /* VPI */
uint16_t vci; /* VCI */
uint16_t rmtu; /* Receive maximum CPCS size */
uint16_t tmtu; /* Transmit maximum CPCS size */
uint8_t aal; /* aal type */
uint8_t traffic; /* traffic type */
struct atmio_tparam tparam; /* traffic parameters */
};
struct atmio_tparam {
uint32_t pcr; /* 24bit: Peak Cell Rate */
uint32_t scr; /* 24bit: VBR Sustainable Cell Rate */
uint32_t mbs; /* 24bit: VBR Maximum burst size */
uint32_t mcr; /* 24bit: ABR/VBR/UBR+MCR MCR */
uint32_t icr; /* 24bit: ABR ICR */
uint32_t tbe; /* 24bit: ABR TBE (1...2^24-1) */
uint8_t nrm; /* 3bit: ABR Nrm */
uint8_t trm; /* 3bit: ABR Trm */
uint16_t adtf; /* 10bit: ABR ADTF */
uint8_t rif; /* 4bit: ABR RIF */
uint8_t rdf; /* 4bit: ABR RDF */
uint8_t cdf; /* 3bit: ABR CDF */
};
.Ed
.Pp
Note that this is the driver's table, so all VCCs opened via
.Xr natm 4
sockets and IP are also shown.
They can, however, be distinguished by
their flags.
The
.Va flags
field contains the following flags:
.Pp
.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact
.It Dv ATM_PH_AAL5
use AAL5 instead of AAL0
.It Dv ATM_PH_LLCSNAP
if AAL5 use LLC SNAP encapsulation
.It Dv ATM_FLAG_NG
this is a netgraph VCC
.It Dv ATM_FLAG_HARP
this is a HARP VCC
.It Dv ATM_FLAG_NORX
transmit only VCC
.It Dv ATM_FLAG_NOTX
receive only VCC
.It Dv ATMIO_FLAG_PVC
treat channel as a PVC
.El
.Pp
If the
.Dv ATM_FLAG_NG
flag is set, then
.Va traffic
and
.Va tparam
contain meaningful information.
.Pp
The
.Va aal
field
contains one of the following values:
.Pp
.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact
.It Dv ATMIO_AAL_0
AAL 0 (raw cells)
.It Dv ATMIO_AAL_34
AAL 3 or AAL 4
.It Dv ATMIO_AAL_5
AAL 5
.It Dv ATMIO_AAL_RAW
device specific raw cells
.El
.Pp
The
.Va traffic
field
can have one of the following values (not all drivers support
all traffic types however):
.Pp
.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact
.It Dv ATMIO_TRAFFIC_UBR
.It Dv ATMIO_TRAFFIC_CBR
.It Dv ATMIO_TRAFFIC_ABR
.It Dv ATMIO_TRAFFIC_VBR
.El
.It Dv NGM_ATM_CPCS_INIT Pq Ic cpcsinit
Initialize a VCC for sending and receiving.
The argument is a structure:
.Bd -literal
struct ngm_atm_cpcs_init {
char name[NG_HOOKSIZ];
uint32_t flags; /* flags. (if_atm.h) */
uint16_t vci; /* VCI to open */
uint16_t vpi; /* VPI to open */
uint16_t rmtu; /* receive maximum PDU */
uint16_t tmtu; /* transmit maximum PDU */
uint8_t aal; /* AAL type (if_atm.h) */
uint8_t traffic; /* traffic type (if_atm.h) */
uint32_t pcr; /* Peak cell rate */
uint32_t scr; /* VBR: Sustainable cell rate */
uint32_t mbs; /* VBR: Maximum burst rate */
uint32_t mcr; /* UBR+: Minimum cell rate */
uint32_t icr; /* ABR: Initial cell rate */
uint32_t tbe; /* ABR: Transmit buffer exposure */
uint8_t nrm; /* ABR: Nrm */
uint8_t trm; /* ABR: Trm */
uint16_t adtf; /* ABR: ADTF */
uint8_t rif; /* ABR: RIF */
uint8_t rdf; /* ABR: RDF */
uint8_t cdf; /* ABR: CDF */
};
.Ed
.Pp
The
.Va name
field
is the name of the hook for which sending and receiving should be enabled.
This hook must already be connected.
The
.Va vpi
and
.Va vci
fields
are the respective VPI and VCI values to use for the ATM cells.
They must be
within the range, given by the
.Va maxvpi
and
.Va maxvci
fields of the
.Vt ng_atm_config
structure.
The
.Va flags
field
contains the flags (see above) and the other fields describe the
type of traffic.
.It Dv NGM_ATM_CPCS_TERM Pq Ic cpcsterm
Stop sending and receiving on the indicated hook.
The argument is a
.Bd -literal
struct ngm_atm_cpcs_term {
char name[NG_HOOKSIZ];
};
.Ed
.It Dv NGM_ATM_GET_STATS Pq Ic getstats
This command returns a message, containing node statistics.
The structure of the message is:
.Bd -literal
struct ngm_atm_stats {
uint64_t in_packets;
uint64_t in_errors;
uint64_t out_packets;
uint64_t out_errors;
};
.Ed
.El
.Sh MANAGEMENT MESSAGES
If the
.Va manage
hook is connected, certain messages are sent along the hook.
They are
received by the peer node with a cookie of
.Dv NG_ATM_COOKIE .
.Bl -tag -width 4n
.It Dv NGM_ATM_VCC_CHANGE Pq Ic vcc_change
A permanent VCC has been added, deleted or changed.
This is used by
.Xr ilmid 8
to generate the appropriate ILMI traps.
The structure of the message is:
.Bd -literal
struct ngm_atm_vcc_change {
uint32_t node;
uint16_t vci;
uint8_t vpi;
uint8_t state;
};
.Ed
Where
.Va state
is 0 if the PVC was deleted, and 1 if it was added or modified.
.El
.Sh FLOW CONTROL
If the hardware driver supports it, the node can emit flow control messages
along a user hook.
The format of these messages is described in
.In netgraph/ng_message.h .
The
.Nm atm
node may generate
.Dv NGM_HIGH_WATER_PASSED
and
.Dv NGM_LOW_WATER_PASSED
messages.
The first one indicates that the hardware driver has stopped output
on the channel and drops new packets, the second one reports that
output was reenabled.
Currently, the structures are not filled with
information.
.Sh SHUTDOWN
The nodes are persistent as long as the corresponding interface exists.
Upon receipt of a
.Dv NGM_SHUTDOWN
messages, all hooks are disconnected and the node is reinitialized.
All
VCCs opened via
.Xr netgraph 4
are closed.
When the ATM interface is unloaded,
the node disappears.
If the node is compiled with
.Dv NGATM_DEBUG
there is a sysctl
.Va net.graph.atm.allow_shutdown
which, when set to a non-zero value, allows the nodes to shut down.
Note that this is intended for development only and may lead to kernel
panics if set.
.Sh SEE ALSO
.Xr natm 4 ,
.Xr netgraph 4 ,
.Xr ng_ether 4 ,
.Xr ngctl 8
.Sh AUTHORS
.An Harti Brandt Aq Mt harti@FreeBSD.org

View File

@ -1,192 +0,0 @@
.\"
.\" Copyright (c) 2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" 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.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.\" patm(4) man page
.\"
.Dd July 15, 2003
.Dt PATM 4
.Os
.Sh NAME
.Nm patm
.Nd "device driver for IDT77252 based ATM interfaces (ProSum and IDT)"
.Sh SYNOPSIS
.Cd device patm
.Cd device utopia
.Cd device atm
.Pp
.Cd options NATM
.Cd options LIBMBPOOL
.Sh DESCRIPTION
The
.Nm
device driver supports ATM cards based on the IDT77252 chip.
It has been tested with ProSum's ProATM-155 cards and with IDT's evaluation
boards.
The driver interfaces with the
.Xr natm 4
framework,
.Xr netgraph 4
and HARP.
It provides only PVC services.
Signalling, ATMARP, ILMI and other
higher layer protocols are implemented using
.Xr netgraph 4
or HARP.
.Pp
For configuring the card for IP see
.Xr natmip 4 .
.Pp
The driver supports UBR, CBR, VBR and ABR traffic.
Supported AALs are:
AAL0 (cell payloads), AAL5 and raw AAL.
The driver supports opening of VCI/VPI 0/0 in RX, raw AAL-mode.
This VC will receive all incoming cells (even those with non-zero GFC
fields and VPI/VCI values outside the allowed range) that are not
claimed by other open connections.
This may be used for monitoring purposes.
.Pp
The following sysctls are recognized by the driver additionally to those
handled by
.Xr utopia 4 :
.Bl -tag -width indent
.It Va hw.atm.patm Ns Ar N Ns Va .istats
Returns a list of
.Vt uint32_t
statistic counters with internal driver statistics.
.It Va hw.atm.patm Ns Ar N Ns Va .eeprom
This is a read-only variable containing the contents of the on-board EEPROM
device.
.It Va hw.atm.patm Ns Ar N Ns Va .lbuf_max
This puts an upper limit on the number of large receive buffers the
driver will allocate.
This is a read-only variable that can be set via a
.Xr loader 8
tunable.
.It Va hw.atm.patm Ns Ar N Ns Va .tx_maxmaps
This is the upper limit of transmission DMA maps the driver will allocate.
This is read-only but may be set via a
.Xr loader 8
tunable.
.It Va hw.atm.patm Ns Ar N Ns Va .debug
.Bf Em
(Only if debugging enabled.)
.Ef
These are debugging flags.
See
.Pa src/sys/dev/patm/if_patmvar.h
for the possible flags.
This may be initialized via a
.Xr loader 8
tunable.
.It Va hw.atm.patm Ns Ar N Ns Va .regs
.Bf Em
(Only if debugging enabled.)
.Ef
Returns the current values of the card's registers.
.It Va hw.atm.patm Ns Ar N Ns Va .tsq
Returns the transmit status queue.
.El
.Pp
When loaded, the driver initializes several variables from
.Xr loader 8
tunables:
.Bl -tag -width indent
.It Va hw.patm Ns Ar N Ns Va .lbuf_max
This initializes the corresponding
.Xr sysctl 8
variable and defines an upper
limit on the number of large receive buffers (mbuf clusters).
.It Va hw.patm Ns Ar N Ns Va .tx_maxmaps
This initializes the corresponding
.Xr sysctl 8
variable and is the maximum
number of DMA maps for transmission that the driver will allocated.
.It Va hw.patm Ns Ar N Ns Va .debug
.Bf Em
(Only if debugging enabled.)
.Ef
Initializes the debugging flags.
.El
.Pp
The driver supports the media options
.Cm sdh , noscramb
and
.Cm unassigned
(see
.Xr utopia 4 )
when the card is a 155MBit card.
Both PMC-Sierra S/UNI and IDT77155 PHY chips are supported for these cards.
For 25MBit cards the IDT77105 is supported.
.Sh DIAGNOSTICS
.Bd -literal
patm1: <NICStAR (77222/77252) ATM adapter> port 0xc000-0xc0ff mem 0xf8000000-0xf83fffff,0xf4000000-0xf4000fff irq 11 at device 8.0 on pci2
patm1: IDT77252 155MBit interface; idt77252 Rev. G; IDT77155 PHY
patm1: 128K x 32 SRAM; 4096 connections
.Ed
.Sh SEE ALSO
.Xr natm 4 ,
.Xr natmip 4 ,
.Xr utopia 4
.Sh ACKNOWLEDGEMENTS
Thanks to Christian Bucari from ProSum for lending two of these cards to enable
the development of this driver.
Thanks also for answering my questions.
.Sh AUTHORS
.An Harti Brandt Aq Mt harti@FreeBSD.org
.Sh CAVEATS
The card fails to generate an interrupt if a cell is received in AAL0 mode
that has the MSB of the PTI field cleared.
Therefore cells will be delivered on the next receive interrupt which can happen
either when the receive status queue is full, or a cell with the last bit of
the PTI set is received.
.Pp
Although the card supports AAL3/4 the driver does not.
.Pp
The rate tables used by this driver are not the tables recommended by IDT
(they are wrong anyway).
The driver's tables are slightly more aggressive than IDT's.
That means, that the actual cell rate can be slightly higher than the
specified.
This is in contrast to the IDT tables where cell rates 5% less than the
allowed one have been observed.
This can be changed by changing the program that generates these tables,
found in
.Pa /usr/src/sys/dev/patm/genrtab ,
and regenerating them.
.Pp
The reported media for the 155MBit cards will always be OC3/MM, because
there is no (known to me) way to figure out the actual medium.
The medium should really be coded in the EEPROM by the manufacturer.
.Pp
The Tx cell counter in the utopia statistics is wrong, because the chip
uses idle cells for spacing and the PHY counts these cells.
While there is a configuration option for the chip to switch of these cells
and, according to the documentation, this should not influence cell spacing,
it does, so the driver lets the chip generate idle cells.

View File

@ -18,7 +18,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 26, 2013
.Dd April 26, 2017
.Dt U3G 4
.Os
.Sh NAME
@ -97,6 +97,20 @@ See
.Xr usbconfig 8
and
.Xr usb_quirk 4 .
.Sh FILES
.Bl -tag -width "/dev/ttyU?.?.init" -compact
.It Pa /dev/ttyU?.?
for callin ports
.It Pa /dev/ttyU?.?.init
.It Pa /dev/ttyU?.?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?.?
for callout ports
.It Pa /dev/cuaU?.?.init
.It Pa /dev/cuaU?.?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -16,7 +16,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UARK 4
.Os
.Sh NAME
@ -57,6 +57,20 @@ KQ-U8A Data Cable
.It
Skymaster USB to RS232
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 9, 2015
.Dd April 26, 2017
.Dt UART 4
.Os
.Sh NAME
@ -226,14 +226,14 @@ level signal at up to 12 volts.
A connection to header pins or an edge-connector on an embedded board
is typically a TTL signal at 3.3 or 5 volts.
.Sh FILES
.Bl -tag -width ".Pa /dev/ttyu?.init" -compact
.Bl -tag -width "/dev/ttyu?.init" -compact
.It Pa /dev/ttyu?
for callin ports
.It Pa /dev/ttyu?.init
.It Pa /dev/ttyu?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuau?
.It Pa /dev/cuau*
for callout ports
.It Pa /dev/cuau?.init
.It Pa /dev/cuau?.lock

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UBSA 4
.Os
.Sh NAME
@ -81,6 +81,20 @@ GoHubs GoCOM232
.It
Peracom single port serial adapter
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UBSER 4
.Os
.Sh NAME
@ -55,11 +55,22 @@ The
.Nm
driver provides support for the BWCT console management serial adapters.
.Sh FILES
.Bl -tag -width ".Pa /dev/ttyy??" -compact
.It Pa /dev/ttyy??
.Bl -tag -width "/dev/ttyU?.?.init" -compact
.It Pa /dev/ttyU?.?
for callin ports
.It Pa /dev/ttyU?.?.init
.It Pa /dev/ttyU?.?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?.?
for callout ports
.It Pa /dev/cuaU?.?.init
.It Pa /dev/cuaU?.?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,
.Xr usb 4
.Sh HISTORY
The

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UCHCOM 4
.Os
.Sh NAME
@ -70,6 +70,20 @@ driver supports the following adapters:
.It
HL USB-RS232
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd March 11, 2015
.Dd April 26, 2017
.Dt UCOM 4
.Os
.Sh NAME
@ -92,15 +92,31 @@ Capture pulses on the CTS line.
Capture pulses on the DCD line.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/cuaU?"
.It Pa /dev/cuaU?
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr uark 4 ,
.Xr ubsa 4 ,
.Xr ubser 4 ,
.Xr uchcom 4 ,
.Xr ucycom 4 ,
.Xr ufoma 4 ,
.Xr uftdi 4 ,
.Xr uhso 4 ,
.\".Xr ugensa 4 ,
.Xr uipaq 4 ,
.Xr umcs 4 ,
.Xr umct 4 ,
.Xr umodem 4 ,

View File

@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UCYCOM 4
.Os
.Sh NAME
@ -71,8 +71,23 @@ Cypress USB to RS232 bridge chips:
.It
DeLorme Earthmate USB GPS receiver
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,
.Xr usb 4
.Sh HISTORY
The

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 6, 2015
.Dd April 26, 2017
.Dt UFTDI 4
.Os
.Sh NAME
@ -242,6 +242,20 @@ Buffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote
.It
Prologix GPIB-USB Controller
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UIPAQ 4
.Os
.Sh NAME
@ -79,10 +79,23 @@ The device is accessed through the
.Xr ucom 4
driver which makes it behave like a
.Xr tty 4 .
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,
.Xr uhub 4 ,
.Xr usb 4
.Sh HISTORY
The

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 25, 2012
.Dd April 26, 2017
.Dt UMCS 4
.Os
.Sh NAME
@ -80,6 +80,20 @@ ST Lab U-360 two-port serial USB adapter
.It
ST Lab U-400 four-port serial USB adapter
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.?.init" -compact
.It Pa /dev/ttyU?.?
for callin ports
.It Pa /dev/ttyU?.?.init
.It Pa /dev/ttyU?.?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?.?
for callout ports
.It Pa /dev/cuaU?.?.init
.It Pa /dev/cuaU?.?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UMCT 4
.Os
.Sh NAME
@ -78,6 +78,20 @@ Magic Control Technology USB-232
.It
Sitecom USB-232
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 6, 2012
.Dd April 26, 2017
.Dt UMODEM 4
.Os
.Sh NAME
@ -95,6 +95,20 @@ Sony Ericsson W810i phone
.It
Sonim XP5300 Force
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd March 18, 2014
.Dd April 26, 2017
.Dt UMOSCOM 4
.Os
.Sh NAME
@ -56,6 +56,20 @@ The device is accessed through the
.Xr ucom 4
driver which makes it behave like a
.Xr tty 4 .
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 25, 2012
.Dd April 26, 2017
.Dt UPLCOM 4
.Os
.Sh NAME
@ -180,6 +180,20 @@ YC-Cable USB-Serial Adapter
.It
Zeagle N2iTion3 Diving Computer
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -16,7 +16,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 2012
.Dd April 26, 2017
.Dt USLCOM 4
.Os
.Sh NAME
@ -192,6 +192,20 @@ WMR RIGblaster Plug&Play and RIGtalk RT1
.It
Zephyr Bioharness
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -1,196 +0,0 @@
.\" Copyright (c) 2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" 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.
.\"
.\" Author: Hartmut Brandt <harti@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.Dd November 22, 2006
.Dt UTOPIA 4
.Os
.Sh NAME
.Nm utopia
.Nd "driver module for ATM PHY chips"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device utopia"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
utopia_load="YES"
.Ed
.Sh DESCRIPTION
This module is used by all ATM drivers for cards that use
PMC-Sierra S/Uni and IDT77105/IDT77155
chips to provide uniform functionality.
The module implements status monitoring
in either interrupt or polling mode, media option handling and application
access to chip registers.
.Pp
The driver implements several sysctls that are accessible under the
.Va hw.atm. Ns Ao Ar iface Ac Ns Va .\&
tree, where
.Ar iface
is the name of the ATM interface:
.Bl -tag -width indent
.It Va phy_regs
When reading this sysctl an array of 8-bit unsigned integers is returned
containing all accessible chip registers starting at register 0.
A register can be written by writing three 8-bit unsigned integers to the
sysctl: the register number, the new value and a bit mask.
This changes all bits in the register for which the corresponding bit in the
mask is one to the bit values from value.
Note that not all registers may
be writeable.
.It Va phy_loopback
allows to put the interface in one of several loopback modes.
Not all modes and all combinations of modes are supported on all chips.
The possible modes are:
.Bl -tag -width indent
.It Dv UTP_LOOP_NONE Pq No 0x00
No loopback, normal operation.
.It Dv UTP_LOOP_TIME Pq No 0x01
Timing source loopback.
When this is set the transmitter's clock is
derived from the receiver's clock.
.It Dv UTP_LOOP_DIAG Pq No 0x02
Diagnostic loopback.
In this mode the receiver's input is connected to the
transmitter's output.
The receiver gets back everything that is sent.
The
transmitter operates normally.
.It Dv UTP_LOOP_LINE Pq No 0x04
Serial line loopback.
This connects the line receiver to the line transmitter.
The chip transmits all cells back that it receives.
The receiver operates
normally.
.It Dv UTP_LOOP_PARAL Pq No 0x08
Parallel diagnostic loopback.
This feeds back all transmitted cells into the
receiver between the parallel/serial converters.
The transmitter
operates normally.
.It Dv UTP_LOOP_TWIST Pq No 0x10
Twisted pair diagnostic loopback.
Connects the high speed receive data to the
high speed transmit data.
All received data is sent back.
The receiver
operates normally.
.It Dv UTP_LOOP_PATH Pq No 0x20
Diagnostic path loopback.
This connects the receiver input to the transmitter
output just between the path overhead processor and the byte mux.
The
transmitter operates normally.
.El
.It Va phy_type
This is the detected type of the phy chip.
Currently the following chips are
supported:
.Bl -tag -width indent
.It Dv UTP_TYPE_UNKNOWN Pq No 0
The module could not determine the type of the PHY chip.
.It Dv UTP_TYPE_SUNI_LITE Pq No 1
PMC-5346 (S/Uni-Lite)
.It Dv UTP_TYPE_SUNI_ULTRA Pq No 2
PMC-5350 (S/Uni-Ultra)
.It Dv UTP_TYPE_SUNI_622 Pq No 3
PMC-5355 (S/Uni-622)
.It Dv UTP_TYPE_IDT77105 Pq No 4
IDT77105 (25.6MBit UTP interface)
.It Dv UTP_TYPE_IDT77155 Pq No 5
IDT77155 (155MBit interface)
.El
.It Va phy_name
This is a string describing the type of the PHY chip.
.It Va phy_stats
Physical and some ATM layer statistics.
These are the statistics usually
provided by the chip.
The data is a returned in the following structure:
.Bd -literal
struct utopia_stats1 {
uint32_t version; /* version of this struct */
uint32_t fill;
uint64_t rx_sbip; /* rx section BIP errors */
uint64_t rx_lbip; /* rx line BIP errors */
uint64_t rx_lfebe; /* rx line far end block errors */
uint64_t rx_pbip; /* rx path BIP errors */
uint64_t rx_pfebe; /* rx path far end block errors */
uint64_t rx_cells; /* received cells */
uint64_t rx_corr; /* correctable cell errors */
uint64_t rx_uncorr; /* uncorrectable cell errors */
uint64_t rx_symerr; /* symbol errors */
uint64_t tx_cells; /* transmitted cells */
};
.Ed
.Pp
The current version is 1.
The statistics are updated from the chip once
a second.
On overflow the counters wrap to zero.
Note that not all counters
are meaningful for all PHY chips.
The statistics are cleared by writing an
arbitrary new value (the value is ignored).
.El
.Pp
The
.Nm
module also interfaces with the ifmedia system.
The module reports the current state of the carrier and will issue a
warning message when the carrier state changes.
While the physical media itself cannot be changed, several media options can:
.Bl -tag -width indent
.It Cm SDH
If the PHY is a Sonet/SDH chip this flag switches the interface into SDH mode.
If this option is not set (the default) the interface is in Sonet mode.
.It Cm noscramb
If the PHY is a Sonet/SDH chip disable scrambling.
This may be useful for debugging purposes.
.It Cm unassigned
Normally the interface emits idle cells when there are no other cells to
transmit.
This changes the default cell type to unassigned cells.
This
may be needed for interworking with public networks.
.El
.Sh SEE ALSO
.Xr en 4 ,
.Xr fatm 4 ,
.Xr hatm 4 ,
.Xr patm 4 ,
.Xr utopia 9
.Sh AUTHORS
.An Harti Brandt Aq Mt harti@FreeBSD.org

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UVISOR 4
.Os
.Sh NAME
@ -118,6 +118,20 @@ Sony Clie S360
.It
Sony Clie TJ37
.El
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.El
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 20, 2011
.Dd April 26, 2017
.Dt UVSCOM 4
.Os
.Sh NAME
@ -77,6 +77,19 @@ The device is accessed through the
.Xr ucom 4
driver which makes it behave like a
.Xr tty 4 .
.Sh FILES
.Bl -tag -width "/dev/ttyU?.init" -compact
.It Pa /dev/ttyU?
for callin ports
.It Pa /dev/ttyU?.init
.It Pa /dev/ttyU?.lock
corresponding callin initial-state and lock-state devices
.Pp
.It Pa /dev/cuaU?
for callout ports
.It Pa /dev/cuaU?.init
.It Pa /dev/cuaU?.lock
corresponding callout initial-state and lock-state devices
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,

View File

@ -2753,19 +2753,6 @@ variable is assumed to exist
whose contents will later be passed to a
.Dq Nm route Cm add Fl inet6
operation.
.It Va natm_static_routes
.Pq Vt str
The
.Xr natmip 4
equivalent of
.Va static_routes .
If not empty then for each whitespace separated
.Ar element
in the value, a
.Va route_ Ns Aq Ar element
variable is assumed to exist whose contents will later be passed to a
.Dq Nm atmconfig Cm natm Cm add
operation.
.It Va gateway_enable
.Pq Vt bool
If set to
@ -2946,136 +2933,6 @@ is mutually exclusive to
.Va rtsol_flags ;
.Va rtsold_enable
takes precedence.
.It Va atm_enable
.Pq Vt bool
Set to
.Dq Li YES
to enable the configuration of ATM interfaces at system boot time.
For all of the ATM variables described below, please refer to the
.Xr atm 8
manual page for further details on the available command parameters.
Also refer to the files in
.Pa /usr/share/examples/atm
for more detailed configuration information.
.It Va atm_load
.Pq Vt str
This is a list of physical ATM interface drivers to load.
Typical values are
.Dq Li hfa_pci
and/or
.Dq Li hea_pci .
.It Va atm_netif_ Ns Aq Ar intf
.Pq Vt str
For the ATM physical interface
.Ar intf ,
this variable defines the name prefix and count for the ATM network
interfaces to be created.
The value will be passed as the parameters of an
.Dq Nm atm Cm "set netif" Ar intf
command.
.It Va atm_sigmgr_ Ns Aq Ar intf
.Pq Vt str
For the ATM physical interface
.Ar intf ,
this variable defines the ATM signalling manager to be used.
The value will be passed as the parameters of an
.Dq Nm atm Cm attach Ar intf
command.
.It Va atm_prefix_ Ns Aq Ar intf
.Pq Vt str
For the ATM physical interface
.Ar intf ,
this variable defines the NSAP prefix for interfaces using a UNI signalling
manager.
If set to
.Dq Li ILMI ,
the prefix will automatically be set via the
.Xr ilmid 8
daemon.
Otherwise, the value will be passed as the parameters of an
.Dq Nm atm Cm "set prefix" Ar intf
command.
.It Va atm_macaddr_ Ns Aq Ar intf
.Pq Vt str
For the ATM physical interface
.Ar intf ,
this variable defines the MAC address for interfaces using a UNI signalling
manager.
If set to
.Dq Li NO ,
the hardware MAC address contained in the ATM interface card will be used.
Otherwise, the value will be passed as the parameters of an
.Dq Nm atm Cm "set mac" Ar intf
command.
.It Va atm_arpserver_ Ns Aq Ar netif
.Pq Vt str
For the ATM network interface
.Ar netif ,
this variable defines the ATM address for a host which is to provide ATMARP
service.
This variable is only applicable to interfaces using a UNI signalling
manager.
If set to
.Dq Li local ,
this host will become an ATMARP server.
The value will be passed as the parameters of an
.Dq Nm atm Cm "set arpserver" Ar netif
command.
.It Va atm_scsparp_ Ns Aq Ar netif
.Pq Vt bool
If set to
.Dq Li YES ,
SCSP/ATMARP service for the network interface
.Ar netif
will be initiated using the
.Xr scspd 8
and
.Xr atmarpd 8
daemons.
This variable is only applicable if
.Va atm_arpserver_ Ns Aq Ar netif
is set to
.Dq Li local .
.It Va atm_pvcs
.Pq Vt str
Set to the list of ATM PVCs to be added at system
boot time.
For each whitespace separated
.Ar element
in the value, an
.Va atm_pvc_ Ns Aq Ar element
variable is assumed to exist.
The value of each of these variables
will be passed as the parameters of an
.Dq Nm atm Cm "add pvc"
command.
.It Va atm_arps
.Pq Vt str
Set to the list of permanent ATM ARP entries to be added
at system boot time.
For each whitespace separated
.Ar element
in the value, an
.Va atm_arp_ Ns Aq Ar element
variable is assumed to exist.
The value of each of these variables
will be passed as the parameters of an
.Dq Nm atm Cm "add arp"
command.
.It Va natm_interfaces
.Pq Vt str
Set to the list of
.Xr natm 4
interfaces that will also be used for HARP through
.Xr harp 4 .
If this list is not empty all interfaces in the list will be brought up
with
.Xr ifconfig 8
and
.Xr harp 4
will be loaded.
For this to work the interface drivers must be either compiled into the
kernel or must reside on the root partition.
.It Va keybell
.Pq Vt str
The keyboard bell sound.
@ -4592,7 +4449,6 @@ configuration file.
.Xr accton 8 ,
.Xr amd 8 ,
.Xr apm 8 ,
.Xr atm 8 ,
.Xr bsdinstall 8 ,
.Xr bthidd 8 ,
.Xr chkprintcap 8 ,

View File

@ -293,21 +293,6 @@ see
kernel key-management service;
see
.Xr ipsec 4
.It Pa netnatm/
NATM include files;
see
.Xr natm 4
.Bl -tag -width "kerberos5/" -compact
.It Pa api/
include files for the signalling API
.It Pa msg/
include files that describe signalling messages and
declare associated functions
.It Pa saal/
include files for the signalling AAL layer
.It Pa sig/
include files for the UNI signalling protocol
.El
.It Pa netsmb/
SMB/CIFS requester
.It Pa nfs/

View File

@ -1994,7 +1994,6 @@ MLINKS+=vrele.9 vput.9 \
vrele.9 vunref.9
MLINKS+=vslock.9 vsunlock.9
MLINKS+=zone.9 uma.9 \
zone.9 uma_find_refcnt.9 \
zone.9 uma_zalloc.9 \
zone.9 uma_zalloc_arg.9 \
zone.9 uma_zcreate.9 \

Some files were not shown because too many files have changed in this diff Show More