Commit Graph

43 Commits

Author SHA1 Message Date
roy
1914784e96 Remove case labels we will never trigger due to filtering. 2018-03-07 10:06:41 +00:00
roy
f2128fd5cf Use RO_MSGFILTER. 2017-04-11 14:15:08 +00:00
christos
ec9f40cce0 CID 1373516: Missing breaks
Also delete perror, fix fprintf to be syslog.
2016-10-07 15:49:58 +00:00
roy
bfbe23745b Inhibit initial up should only apply at program start, not for hot plugged interfaces while it's running. 2016-10-06 11:13:57 +00:00
roy
5bf9473939 Remove rescan_interfaces as the interface announcement message
contains the interface index.
2016-10-06 11:08:55 +00:00
roy
10e2b68c80 Simplify logic - invoke script when address is added and ready or
when removed.
2016-10-06 10:33:05 +00:00
roy
ef126e0d1a We already know the interface name, so don't bother calling if_indextoname
to work it out again.
2016-10-06 10:30:31 +00:00
roy
06a737b41a Sprinkle some RCSID loving. 2016-09-29 15:25:28 +00:00
roy
18cd17b80a Now that sppp announces address additions and removals with state
flags, we no longer need the custom sppp code to detect if we are
connected or not.

Add commentary on if we really need to handle RTM_DELADDR only when
detached.
2016-09-29 15:21:09 +00:00
roy
547a909ccc Don't invoke scripts for INADDR_ANY or INADDR_BROADCAST addresses. 2016-09-29 13:36:30 +00:00
roy
ebe6b5a845 Check address is not tentative, duplicated or detached before running
scripts.

XXX Do we want new script actions for detached or duplicated addresses?
2016-09-21 21:07:29 +00:00
roy
f095b6732c We should always know the interface the address message was for. 2016-09-21 20:31:31 +00:00
roy
3281aec338 Add some consistency for dispatching .... always send the whole message. 2016-09-21 18:18:10 +00:00
roy
4ed3a4f995 Sprinkle some const. 2016-09-21 16:47:35 +00:00
roy
4862748bc4 Skip message if not our RTM_VERSION and silently ignore old message types. 2016-09-21 14:50:48 +00:00
roy
af543597d1 Use recvmsg to ensure we get every message rather than potentially overflowing our buffer. 2016-09-21 14:46:55 +00:00
riastradh
8248001c7f Use unsigned, not signed, int for shifting 1 left until zero.
Signed shift into sign bit and beyond is undefined behaviour.

From Michael McConville.
2016-01-27 18:55:51 +00:00
joerg
6bd0ed17f2 static + __dead 2011-08-30 18:57:38 +00:00
martin
82fe9809af Use RT_ROUNDUP() and friends from sys/route.h instead of homegrown
variants.
2011-02-04 14:31:23 +00:00
lukem
a35a433358 Fix -Wshadow and 'setjmp clobber' warnings. 2009-04-15 08:33:04 +00:00
joerg
bbdb057767 Just ignore a bunch of well-known routing socket messages ifwatchd
doesn't care about to make verbose mode less noisy.  When it does print
an unknown header type, also say which one it doesn't like.
2008-05-24 17:45:14 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
dyoung
1b8630a278 Cosmetic: KNF. Shorten staircases. Delete some whitespace at line
ends (makes navigation with vi more reliable).
2007-12-22 00:57:15 +00:00
martin
59ca47f545 In the initial interface scan at start time, query the link status of
the interfaces and call the CARRIER script if a link is already there.
This allows me to boot my notebook with the cable pluged and
fixes PR bin/26830.
2004-11-25 06:57:38 +00:00
martin
06eb7200cc Add support to call scripts at carrier detect/drop time (on network
interfaces that report this).
Basically from Brian Grayson, fixes his PR bin/23191.
2004-01-04 22:19:51 +00:00
martin
25943be498 Use the new SPPPGETSTATUSNCP ioctl, if supported, to avoid reporting
intermitent changes on "volatile" interfaces based on if_spppsubr.c.
This interfaces used to cause ifwatchd to call the up and down scripts
with 0.0.0.0 addresses between entering PPP phase network and IPCP
completition.
2003-12-27 00:05:46 +00:00
grant
cacf2d0f45 s/netbsd.org/NetBSD.org/i 2003-11-12 13:31:07 +00:00
abs
e364b78d41 Fix typo in last change (misplaced ');') 2003-07-04 14:11:36 +00:00
wiz
1dbe2d9b38 Sync usage with man page. 2003-07-04 12:45:05 +00:00
martin
3088b1239b Improve diagnostics a bit, log to syslog. 2003-06-23 21:50:12 +00:00
itojun
84e2880efb KNF 2003-05-17 19:14:25 +00:00
wiz
064e896cda Sync usage with man page. 2003-04-16 09:09:52 +00:00
martin
5005fdb656 Run "arrival" scripts too in the inital pass on startup.
Open the routing socket before this pass to close a small window where
we would miss messages at startup (and get state kept by the scripts
out of sync).
Patch supplied by KOIE Hidetaka in private mail.
2003-03-06 13:33:29 +00:00
martin
549d82b84d Add support for watching coming/going pccard interfaces.
Patch from KOIE Hidetaka in PR bin/20584.
2003-03-05 09:03:49 +00:00
tron
0f55b8bb08 Use vfork(2) and exec(2) instead of system for performance and security
reasons.
2002-04-15 21:08:41 +00:00
tron
7b03e17cb9 Don't invoke the up- and down-script for link local IPv6 addresses. 2002-04-15 20:42:37 +00:00
tron
c28d45defe Invoke "ip-up" and "ip-down" script with parameters exactly matching
those used by pppd(8).
2002-04-15 17:32:18 +00:00
martin
573dfcd430 Fix copyright notice, sprinkle some $NetBSD$. 2002-04-14 11:41:42 +00:00
martin
7b6f872d11 Add, #ifdef SPPP_IF_SUPPORT, special case treatment for sys/net/if_spppsubr.c
based interfaces. Note: all other interface types work the same as before,
and no names are hardcoded.

When a if_spppsubr.c based interface is marked IFF_UP, but has not yet
reached phase NETWORK (i.e. it didn't connect yet or authentication has not
yet completed) do not call the ip-up script for it on the initial pass
over all IFF_UP interfaces.

This fixes a race condition on startup when ip-up/ip-down are statefull
and need to be called pairwise (for example if ip-up adds and ip-down
removes a default route).
2002-01-10 20:21:50 +00:00
martin
0f93714245 Pass the remote address (or broadcast addres) to the up/down scripts as
well. This is very usefull for setting up the right routes ;-)

Thanks to Bjoern Labitzke for pointing out this missing feature.
2002-01-10 19:38:51 +00:00
martin
136813d385 Call up-scripts for interface already up on startup to account for the
late start of this daemon on system boot.
Add and document an option to prevent this.
2001-12-10 14:54:09 +00:00
martin
b44ac684a5 Add $NetBSD$, remove unneeded includes. 2001-11-19 10:20:34 +00:00
martin
c8b09ee080 New utility: ifwatchd.
Monitors the routing socket for address changes of autonomous (kernel only)
interfaces (like PPPoE) and runs up/down scripts similar to what pppd
does for its interfaces.
2001-11-19 09:43:03 +00:00