New sentence, new line; limit to 80 chars lines.

This commit is contained in:
wiz 2003-07-04 12:48:30 +00:00
parent 1dbe2d9b38
commit 988b927344
1 changed files with 63 additions and 45 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ifwatchd.8,v 1.18 2003/07/04 12:44:12 wiz Exp $ .\" $NetBSD: ifwatchd.8,v 1.19 2003/07/04 12:48:30 wiz Exp $
.\" .\"
.\" Copyright (c) 2001-2003 The NetBSD Foundation, Inc. .\" Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -50,9 +50,10 @@
.Ar ifname(s) .Ar ifname(s)
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
is used to monitor dynamic interfaces (for example PPP interfaces) for address is used to monitor dynamic interfaces (for example PPP interfaces)
changes. Sometimes these interfaces are accompanied by a daemon program, which for address changes.
can take care of running any necessary scripts (like Sometimes these interfaces are accompanied by a daemon program,
which can take care of running any necessary scripts (like
.Xr pppd 8 .Xr pppd 8
or or
.Xr isdnd 8 ) , .Xr isdnd 8 ) ,
@ -60,22 +61,25 @@ but sometimes the interfaces run completely autonomously (like
.Xr pppoe 4 ) . .Xr pppoe 4 ) .
.Pp .Pp
.Nm .Nm
provides a generic way to watch this type of changes. It works by monitoring provides a generic way to watch this type of changes.
the routing socket and interpreting It works by monitoring the routing socket and interpreting
.Ql RTM_NEWADDR .Ql RTM_NEWADDR
.Pq address added .Pq address added
and and
.Ql RTM_DELADDR .Ql RTM_DELADDR
.Pq address deleted .Pq address deleted
messages. It does not need special privileges to do this. The scripts called messages.
for up or down events are run with the same user id as It does not need special privileges to do this.
The scripts called for up or down events are run with the same user
id as
.Nm .Nm
is run. is run.
.Pp .Pp
The following options are available: The following options are available:
.Bl -tag -width indent .Bl -tag -width indent
.It Fl A Ar arrival-script .It Fl A Ar arrival-script
Specify the command to invoke on arrival of new interfaces (like PCMCIA cards). Specify the command to invoke on arrival of new interfaces (like
PCMCIA cards).
.It Fl D Ar departure-script .It Fl D Ar departure-script
Specify the command to invoke when an interface departs (for example Specify the command to invoke when an interface departs (for example
a PCMCIA card is removed.) a PCMCIA card is removed.)
@ -87,29 +91,36 @@ events (or: deletion of an address from an interface).
Show the synopsis. Show the synopsis.
.It Fl i .It Fl i
Inhibit a call to the up-script on startup for all watched interfaces Inhibit a call to the up-script on startup for all watched interfaces
already marked up. If this option is not given, already marked up.
If this option is not given,
.Nm .Nm
will check all watched interfaces on startup whether they are already marked will check all watched interfaces on startup whether they are
up and, if they are, call the up-script with appropriate parameters. already marked up and, if they are, call the up-script with
appropriate parameters.
.Pp .Pp
Since ifwatchd typically is started late in the system boot sequence, some Since ifwatchd typically is started late in the system boot sequence,
of the monitored interfaces may already have come up when it finally starts, some of the monitored interfaces may already have come up when it
but their up-scripts have not been called. By default finally starts, but their up-scripts have not been called.
By default
.Nm .Nm
calls them on startup to account for this (and make the scripts easier.) calls them on startup to account for this (and make the scripts
easier.)
.It Fl q .It Fl q
Be quiet and don't log non-error messages to syslog. Be quiet and don't log non-error messages to syslog.
.It Ar ifname(s) .It Ar ifname(s)
The name of the interface to watch. Multiple interfaces may be specified. The name of the interface to watch.
Multiple interfaces may be specified.
Events for other interfaces are ignored. Events for other interfaces are ignored.
.It Fl u Ar up-script .It Fl u Ar up-script
Specify the command to invoke on Specify the command to invoke on
.Dq interface up .Dq interface up
events (or: addition of an address to an interface). events (or: addition of an address to an interface).
.It Fl v .It Fl v
Run in verbose debug mode and do not detach from the controlling terminal. Run in verbose debug mode and do not detach from the controlling
Output verbose progress messages and flag errors ignored during normal terminal.
operation. Adding more Output verbose progress messages and flag errors ignored during
normal operation.
Adding more
.Fl v .Fl v
increases the verbosity. increases the verbosity.
.Em You do not want to use this option in .Em You do not want to use this option in
@ -118,30 +129,33 @@ increases the verbosity.
.Sh EXAMPLES .Sh EXAMPLES
.Bd -literal -offset indent .Bd -literal -offset indent
# ifwatchd -u /etc/ppp/ip-up -d /etc/ppp/ip-down pppoe0 # ifwatchd -u /etc/ppp/ip-up -d /etc/ppp/ip-down pppoe0
.Ed .Ed
If your pppoe0 interface is your main connection to the internet, the typical .Pp
use of the up/down scripts is to add and remove a default route. This is If your pppoe0 interface is your main connection to the internet,
an example for an up script doing this: the typical use of the up/down scripts is to add and remove a
default route.
This is an example for an up script doing this:
.Bd -literal -offset indent .Bd -literal -offset indent
#! /bin/sh #! /bin/sh
/sbin/route add default $5 /sbin/route add default $5
.Ed .Ed
As described below the fifth command line parameter will contain the peer .Pp
address of the pppoe link. The corresponding ip-down script is: As described below the fifth command line parameter will contain
the peer address of the pppoe link.
The corresponding ip-down script is:
.Bd -literal -offset indent .Bd -literal -offset indent
#! /bin/sh #! /bin/sh
/sbin/route delete default $5 /sbin/route delete default $5
.Ed .Ed
Note that this is not a good idea if you have pppoe0 configured to connect .Pp
only on demand (via the link1 flag), but works well for all permanent connected Note that this is not a good idea if you have pppoe0 configured to
cases. Use connect only on demand (via the link1 flag), but works well for
all permanent connected cases.
Use
.Bd -literal -offset indent .Bd -literal -offset indent
! /sbin/route add default -iface 0.0.0.1 ! /sbin/route add default -iface 0.0.0.1
.Ed .Ed
.Pp
in your in your
.Pa /etc/ifconfig.pppoe0 .Pa /etc/ifconfig.pppoe0
file in the on-demand case. file in the on-demand case.
@ -149,9 +163,9 @@ file in the on-demand case.
The invoked scripts get passed these parameters: The invoked scripts get passed these parameters:
.Bl -tag -width destination .Bl -tag -width destination
.It Ar ifname .It Ar ifname
The name of the interface this change is for (this allows to share the same The name of the interface this change is for (this allows to share
script for multiple interfaces watched and dispatching on the interface name the same script for multiple interfaces watched and dispatching on
in the script). the interface name in the script).
.It Ar tty .It Ar tty
Dummy parameter for compatibility with Dummy parameter for compatibility with
.Xr pppd 8 .Xr pppd 8
@ -163,13 +177,15 @@ Dummy parameter for compatibility with
which will always be which will always be
.Em 9600 . .Em 9600 .
.It Ar address .It Ar address
The new address if this is an up event, or the no longer valid old address The new address if this is an up event, or the no longer valid old
if this is a down event. address if this is a down event.
.Pp .Pp
The format of the address depends on the address family, for IPv4 it is the The format of the address depends on the address family, for IPv4
usual dotted quad notation, for IPv6 the colon separated standard notation. it is the usual dotted quad notation, for IPv6 the colon separated
standard notation.
.It Ar destination .It Ar destination
For point to point interfaces, this is the remote address of the interface. For point to point interfaces, this is the remote address of the
interface.
For other interfaces it is the broadcast address. For other interfaces it is the broadcast address.
.El .El
.Sh ERRORS .Sh ERRORS
@ -194,8 +210,10 @@ The program was written by
.An Martin Husemann .An Martin Husemann
.Aq martin@NetBSD.org . .Aq martin@NetBSD.org .
.Sh CAVEATS .Sh CAVEATS
Due to the nature of the program a lot of stupid errors can not easily be Due to the nature of the program a lot of stupid errors can not
caught in advance without removing the provided facility for advanced uses. easily be caught in advance without removing the provided facility
For example typing errors in the interface name can not be detected by for advanced uses.
checking against the list of installed interfaces, because For example typing errors in the interface name can not be detected
it is possible for a pcmcia card with the name given to be inserted later. by checking against the list of installed interfaces, because it
is possible for a pcmcia card with the name given to be inserted
later.