Update man page to allow adding address_family when -l is used (this is a no op

for now). Correct use of .Nm. Short usage string (see man page for full list).
Spelling.  Use err(3).
This commit is contained in:
Philippe Charnier 1998-07-06 06:53:43 +00:00
parent d98b16689b
commit e333b9445f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37416
2 changed files with 54 additions and 62 deletions

View File

@ -10,7 +10,7 @@
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" must display the following acknowledgment:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $Id: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\" $Id: ifconfig.8,v 1.17 1998/06/08 02:00:45 danny Exp $
.\"
.Dd February 13, 1996
.Dt IFCONFIG 8
@ -50,28 +50,28 @@
.Fl a
.Op Fl d
.Op Fl u
.Op Ar protocol_family
.Op Ar address_family
.Nm ifconfig
.Fl l
.Op Fl d
.Op Fl u
.Op Ar address_family
.Sh DESCRIPTION
.Nm
.Nm Ifconfig
is used to assign an address
to a network interface and/or configure
network interface parameters.
.Nm
.Nm Ifconfig
must be used at boot time to define the network address
of each interface present on a machine; it may also be used at
a later time to redefine an interface's address
or other operating parameters.
.Pp
Available operands for
.Nm ifconfig :
.Bl -tag -width Ds
.It Ar Address
The following options are available:
.Bl -tag -width indent
.It Ar address
For the
.Tn DARPA-Internet
.Tn DARPA Ns -Internet
family,
the address is either a host name present in the host name data
base,
@ -101,8 +101,8 @@ Internet address expressed in the Internet standard
.\" byte, and the dots are optional, if the user wishes to (carefully)
.\" count out long strings of digits in network byte order.
.It Ar address_family
Specifies the
.Ar address family
Specify the
.Ar "address family"
which affects interpretation of the remaining parameters.
Since an interface can receive transmissions in differing protocols
with different naming schemes, specifying the address family is recommended.
@ -115,18 +115,20 @@ and
.Dq ipx .
.\" and
.\" .Dq ns .
.It Ar Interface
The
.Ar interface
.It Ar dest_address
Specify the address of the correspondent on the other end
of a point to point link.
.It Ar interface
This
parameter is a string of the form
.Dq name unit ,
for example,
.Dq en0
.Dq en0 .
.El
.Pp
The following parameters may be set with
.Nm ifconfig :
.Bl -tag -width dest_addressxx
.Bl -tag -width indent
.It Cm alias
Establish an additional network address for this interface.
This is sometimes useful when changing network numbers, and
@ -157,9 +159,6 @@ was no longer needed.
If you have incorrectly set an NS address having the side effect
of specifying the host portion, removing all NS addresses will
allow you to respecify the host portion.
.It Cm dest_address
Specify the address of the correspondent on the other end
of a point to point link.
.It Cm down
Mark an interface ``down''. When an interface is
marked ``down'', the system will not attempt to
@ -194,7 +193,7 @@ available types.
.It Cm mediaopt Ar opts
If the driver supports the media selection system, set the specified
media options on the interface.
.Ar opts
.Ar Opts
is a comma delimited list of options to apply to the interface.
Refer to the interfaces' driver specific man page for a complete
list of available options.
@ -266,7 +265,9 @@ portion.
Under appletalk, set the interface to respond to a
.Em netrange.
of the form startnet-endnet. Appletalk uses this scheme instead of
netmasks though FreeBSD implements it internally as a set of netmasks.
netmasks though
.Bx Free
implements it internally as a set of netmasks.
.It Cm phase
The argument following this specifies the version (phase) of the
Appletalk network attached to the interface. Values of 1 or 2 are permitted.
@ -275,23 +276,26 @@ Enable special processing of the link level of the interface.
These three options are interface specific in actual effect, however,
they are in general used to select special modes of operation. An example
of this is to enable SLIP compression, or to select the connector type
for some ethernet cards. Refer to the man page for the specific driver
for some Ethernet cards. Refer to the man page for the specific driver
for more information.
.It Fl link[0-2]
Disable special processing at the link level with the specified interface.
.It Cm up
Mark an interface ``up''.
This may be used to enable an interface after an ``ifconfig down.''
Mark an interface
.Dq up .
This may be used to enable an interface after an
.Dq ifconfig down .
It happens automatically when setting the first address on an interface.
If the interface was reset when previously marked down,
the hardware will be re-initialized.
.El
.Pp
.Nm
.Nm Ifconfig
displays the current configuration for a network interface
when no optional parameters are supplied.
If a protocol family is specified,
Ifconfig will report only the details specific to that protocol family.
.Nm
will report only the details specific to that protocol family.
.Pp
If the driver does supports the media selection system, the supported
media list will be included in the output.
@ -301,8 +305,9 @@ Optionally, the
flag may be used instead of an interface name. This flag instructs
.Nm
to display information about all interfaces in the system.
The
.Fl d
limits this to interfaces that are down, and
flag limits this to interfaces that are down, and
.Fl u
limits this to interfaces that are up.
.Pp

View File

@ -38,11 +38,11 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
/*
#if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
*/
#endif
static const char rcsid[] =
"$Id: ifconfig.c,v 1.34 1997/12/26 23:28:04 imp Exp $";
"$Id$";
#endif /* not lint */
#include <sys/param.h>
@ -278,20 +278,11 @@ rt_xaddrs(cp, cplim, rtinfo)
void
usage()
{
fputs("usage: ifconfig -a [ -d ] [ -u ] [ af ]\n", stderr);
fputs(" ifconfig -l [ -d ] [ -u ]\n", stderr);
fputs(" [ af [ address [ dest_addr ] ] [ netmask mask ] [ broadcast addr ]\n", stderr);
fputs(" [ alias ] [ delete ] ]\n", stderr);
fputs(" [ up ] [ down ]\n", stderr);
fputs(" [ metric n ]\n", stderr);
fputs(" [ mtu n ]\n", stderr);
fputs(" [ arp | -arp ]\n", stderr);
fputs(" [ link0 | -link0 ] [ link1 | -link1 ] [ link2 | -link2 ]\n", stderr);
#ifdef USE_IF_MEDIA
fputs(" [ media mtype ]\n", stderr);
fputs(" [ mediaopt mopts ]\n", stderr);
fputs(" [ -mediaopt mopts ]\n", stderr);
#endif
fprintf(stderr, "%s\n%s\n%s\n%s\n",
"usage: ifconfig interface address_family [address [dest_address]]",
" [parameters]",
" ifconfig -a [-d] [-u] [address_family]",
" ifconfig -l [-d] [-u] [address_family]");
exit(1);
}
@ -331,7 +322,7 @@ main(argc, argv)
uponly++;
break;
case 'm': /* show media choices in status */
/* ignored for compatability */
/* ignored for compatibility */
break;
default:
usage();
@ -365,7 +356,7 @@ main(argc, argv)
/* leave with afp non-zero */
}
} else {
/* not listsing, need an argument */
/* not listing, need an argument */
if (argc < 1)
usage();
@ -501,10 +492,8 @@ ifconfig(argc, argv, afp)
ifr.ifr_addr.sa_family = afp->af_af;
strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0) {
perror("ifconfig: socket");
exit(1);
}
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
while (argc > 0) {
register const struct cmd *p;
@ -708,7 +697,7 @@ setifmetric(val, dummy, s, afp)
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_metric = atoi(val);
if (ioctl(s, SIOCSIFMETRIC, (caddr_t)&ifr) < 0)
perror("ioctl (set metric)");
warn("ioctl (set metric)");
}
void
@ -721,7 +710,7 @@ setifmtu(val, dummy, s, afp)
strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
ifr.ifr_mtu = atoi(val);
if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) < 0)
perror("ioctl (set mtu)");
warn("ioctl (set mtu)");
}
#ifdef ISO
@ -764,10 +753,8 @@ status(afp, addrcount, sdl, ifm, ifam)
ifr.ifr_addr.sa_family = afp->af_af;
strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0) {
perror("ifconfig: socket");
exit(1);
}
if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
/*
* XXX is it we are doing a SIOCGIFMETRIC etc for one family.
@ -776,12 +763,12 @@ status(afp, addrcount, sdl, ifm, ifam)
* metric and mtu is printed on the global the flags line.
*/
if (ioctl(s, SIOCGIFMETRIC, (caddr_t)&ifr) < 0)
perror("ioctl (SIOCGIFMETRIC)");
warn("ioctl (SIOCGIFMETRIC)");
else
metric = ifr.ifr_metric;
if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0)
perror("ioctl (SIOCGIFMTU)");
warn("ioctl (SIOCGIFMTU)");
else
mtu = ifr.ifr_mtu;
@ -1111,7 +1098,7 @@ at_getaddr(addr, which)
sat->sat_family = AF_APPLETALK;
sat->sat_len = sizeof(*sat);
if (which == MASK)
errx(1, "AppleTalk does not use netmasks\n");
errx(1, "AppleTalk does not use netmasks");
if (sscanf(addr, "%u.%u", &net, &node) != 2
|| net > 0xffff || node > 0xfe)
errx(1, "%s: illegal address", addr);
@ -1221,9 +1208,9 @@ setnsellength(val)
{
nsellength = atoi(val);
if (nsellength < 0)
errx(1, "Negative NSEL length is absurd");
errx(1, "negative NSEL length is absurd");
if (afp == 0 || afp->af_af != AF_ISO)
errx(1, "Setting NSEL length valid only for iso");
errx(1, "setting NSEL length valid only for iso");
}
void