2001-12-10 17:54:09 +03:00
|
|
|
.\" $NetBSD: ifwatchd.8,v 1.3 2001/12/10 14:54:09 martin Exp $
|
2001-11-19 13:10:45 +03:00
|
|
|
.\"
|
2001-11-19 12:43:03 +03:00
|
|
|
.\" Copyright (C) 2001 by Martin Husemann
|
|
|
|
.\" 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(S) ``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(S) 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.
|
|
|
|
.\"
|
|
|
|
.Dd September 2, 2001
|
|
|
|
.Os
|
|
|
|
.Dt IFWATCHD 8
|
|
|
|
.Sh NAME
|
|
|
|
.Nm ifwatchd
|
2001-11-19 13:10:45 +03:00
|
|
|
.Nd watch for addresses added to or deleted from interfaces and call up/down scripts for them
|
2001-11-19 12:43:03 +03:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl h
|
|
|
|
.Op Fl v
|
2001-12-10 17:54:09 +03:00
|
|
|
.Op Fl i
|
2001-11-19 12:43:03 +03:00
|
|
|
.Op Fl d Ar down-script
|
|
|
|
.Op Fl u Ar up-script
|
|
|
|
.Ar ifname(s)
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm Ifwatchd
|
|
|
|
is used to monitor dynamic interfaces (for example PPP interfaces) for address
|
2001-11-19 13:10:45 +03:00
|
|
|
changes. Sometimes these interfaces are accompanied by a daemon program, which
|
|
|
|
can take care of running any necessary scripts (like
|
|
|
|
.Xr pppd 8
|
|
|
|
or
|
|
|
|
.Xr isdnd 8 ) ,
|
|
|
|
but sometimes the interfaces run completely autonomously (like
|
|
|
|
.Xr pppoe 8 ) .
|
2001-11-19 12:43:03 +03:00
|
|
|
.Pp
|
|
|
|
.Nm Ifwatchd
|
2001-11-19 13:10:45 +03:00
|
|
|
provides a generic way to watch this type of changes. It works by monitoring
|
2001-11-19 12:43:03 +03:00
|
|
|
the routing socket and interpreting
|
|
|
|
.Ql RTM_NEWADDR
|
|
|
|
.Pq address added
|
|
|
|
and
|
|
|
|
.Ql RTM_DELADDR
|
|
|
|
.Pq address deleted
|
2001-11-19 13:10:45 +03:00
|
|
|
messages. It does not need special privileges to do this. The scripts called
|
2001-11-19 12:43:03 +03:00
|
|
|
for up or down events are run with the same user id as
|
|
|
|
.Nm
|
|
|
|
is run.
|
|
|
|
.Pp
|
|
|
|
The following options are available:
|
|
|
|
.Bl -tag -width indent
|
2001-11-19 13:10:45 +03:00
|
|
|
.It Fl d Ar down-script
|
|
|
|
Specify the command to invoke on
|
|
|
|
.Dq interface down
|
|
|
|
events (or: deletion of an address from an interface).
|
2001-11-19 12:43:03 +03:00
|
|
|
.It Fl h
|
|
|
|
Show the synopsis.
|
|
|
|
.It Fl u Ar up-script
|
|
|
|
Specify the command to invoke on
|
|
|
|
.Dq interface up
|
|
|
|
events (or: addition of an address to an interface).
|
2001-11-19 13:10:45 +03:00
|
|
|
.It Fl v
|
|
|
|
Output verbose progress messages and flag errors ignored during normal
|
|
|
|
operation.
|
|
|
|
.It Ar ifname(s)
|
|
|
|
The name of the interface to watch. Multiple interfaces may be specified.
|
2001-11-19 12:43:03 +03:00
|
|
|
Events for other interfaces are ignored.
|
2001-12-10 17:54:09 +03:00
|
|
|
.It Fl i
|
|
|
|
Inhibit a call to the up-script on startup for all watched interfaces
|
|
|
|
already marked up. If this option is not given,
|
|
|
|
.Nm
|
|
|
|
will check all watched interfaces on startup whether they are already marked
|
|
|
|
up and, if they are, call the up script with appropriate parameters.
|
|
|
|
.Pp
|
|
|
|
Since ifwatchd typically is started late in the system boot sequence, some
|
|
|
|
of the monitored interfaces may already have come up when it finaly starts,
|
|
|
|
but their up scripts have not been called. By default
|
|
|
|
.Nm
|
|
|
|
calls them on startup to account for this (and make the scripts easier.)
|
2001-11-19 12:43:03 +03:00
|
|
|
.El
|
|
|
|
.Sh EXAMPLES
|
2001-11-19 13:10:45 +03:00
|
|
|
.Bd -literal -offset indent
|
2001-11-19 12:43:03 +03:00
|
|
|
# ifwatchd -u /etc/ppp/ip-up -d /etc/ppp/ip-down pppoe0
|
|
|
|
.Ed
|
|
|
|
.Sh PARAMETERS PASSED TO SCRIPTS
|
|
|
|
The invoked scripts get three parameters passed:
|
2001-11-19 13:10:45 +03:00
|
|
|
.Bl -tag -width address
|
2001-11-19 12:43:03 +03:00
|
|
|
.It Ar ifname
|
|
|
|
The name of the interface this change is for (this allows to share the same
|
2001-11-19 13:10:45 +03:00
|
|
|
script for multiple interfaces watched and dispatching on the interface name
|
2001-11-19 12:43:03 +03:00
|
|
|
in the script).
|
|
|
|
.It Ar up/down
|
|
|
|
Verbatim
|
|
|
|
.Em up
|
|
|
|
or
|
|
|
|
.Em down ,
|
|
|
|
which allows for the sharing of up and down scripts.
|
|
|
|
.It Ar address
|
2001-11-19 13:10:45 +03:00
|
|
|
The new address if this is an up event, or the no longer valid old address
|
2001-11-19 12:43:03 +03:00
|
|
|
if this is a down event.
|
|
|
|
.Pp
|
|
|
|
The format of the address depends on the address family, for IPv4 it is the
|
|
|
|
usual dotted quad notation, for IPv6 the colon separated standard notation.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr route 4 ,
|
|
|
|
.Xr ifconfig.if 5 ,
|
|
|
|
.Xr pppoe 8 ,
|
|
|
|
.Xr rc.d 8 ,
|
|
|
|
.Xr route 8
|
|
|
|
.Sh HISTORY
|
2001-11-19 13:10:45 +03:00
|
|
|
The
|
2001-11-19 12:43:03 +03:00
|
|
|
.Nm
|
|
|
|
utility appeared in
|
|
|
|
.Nx 1.6 .
|
2001-11-19 13:10:45 +03:00
|
|
|
.Sh AUTHORS
|
2001-11-19 12:43:03 +03:00
|
|
|
The program was written by
|
2001-11-19 13:10:45 +03:00
|
|
|
.An Martin Husemann Aq martin@netbsd.org .
|