summaryrefslogtreecommitdiff
path: root/usr.sbin/ifstated/ifstated.c
AgeCommit message (Collapse)Author
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-01-22PF_ROUTE -> AF_ROUTE in the scattered sock()/setsockopt() callsKenneth R Westerback
where the "wrong" #define was used. ok dlg@
2018-10-31ifstated(8) needs to load configfile from within the main loop, but also toRicardo Mestre
reload it on SIGHUP so unveil(2) it with read permissions. Additionally all commands are exec'ed through /bin/sh instead of directly so we can just unveil(2) /bin/sh with x perms. OK deraadt@
2017-08-30Add support for interface departure and arrival.rob
Ok jca@, benno@
2017-08-20Stop tracking interface indexes. Suggested by deraadt.rob
Tweaks and ok jca@ "just get it in" deraadt@
2017-08-14Remove some dead logging code that was never used.rob
Ok benno@
2017-08-08Consistent use of log.c, and removal of err.h include. Makes ifstatedrob
configtest output the same as other networking daemons. Ok jca@
2017-08-06Improve error checking during processing of routing messages. Handling ofrob
RTM_DESYNC encouraged by deraadt. ok jca@ benno@
2017-07-24Use pledge(2)Jeremie Courreges-Anglas
Simple promises proposed by Rob Pierce after exploring more complicated privsep schemes. ok benno@
2017-07-23Don't bother initializing global variables to 0, since they will be in BSS.Theo de Raadt
ok jca
2017-07-23use ssize_t; ok jcaTheo de Raadt
2017-07-22No need for sys/ioctl.h any moreJeremie Courreges-Anglas
2017-07-21Add a newlineJeremie Courreges-Anglas
2017-07-21No need for ioctl(SIOCGIFDATA), getifaddrs(3) gives us the link stateJeremie Courreges-Anglas
Noticed while reviewing a pledge(2) diff from Rob Pierce. ok florian@
2017-07-04rename fetch_state() to fetch_ifstate(). The word "state" is a bitSebastian Benoit
overloaded in this daemon. From Rob Pierce
2017-07-03Remove obvious clear_config() comments and misleading state_change() comments.Sebastian Benoit
Also relocate do_action() calls for the init block from change_state() to occur with the corresponding do_action() calls for the body block. From Rob Pierce ok stsp@ and i
2017-07-02Second diff to rename additional "always" variable in struct ifsd_config.Sebastian Benoit
from Rob Pierce. Requested by stsp@
2017-07-02Remove variable assignment in declaration and add whitespace to improveSebastian Benoit
readability. No functional change. from Rob Pierce. ok stsp@ and me
2017-07-02Rename one of the "always" variables to "body" for improved readability.Sebastian Benoit
No functional change. from Rob Pierce. ok stsp@ and me
2017-06-28whitespace fixes, from Rob Pierce and meSebastian Benoit
2017-06-28usage() gets __dead attribute, from Rob PierceSebastian Benoit
2017-06-27Hoist some privileged code in preparation for future work.Sebastian Benoit
Based on an approach in vmd with mc146818/ns8250. diff by Rob Pierce <rob -AT- 2keys -DOT- ca> ok deraadt@
2017-06-18update log.c in ifstated to the same used in bgpd etc.Sebastian Benoit
Done by Rob Pierce <rob AT 2keys DOT ca>, thanks
2013-05-30setsockopt to see messages for interfaces in all routing domains againHenning Brauer
instead of just the primary one. problem reported along with the right idea on how to fix it by Sean Gallagher (sean at teletech.com.au), actual fix by yours truly. Thanks Sean! ok ryan claudio
2011-07-04LINK_STATE_IS_UP() cleanup userland part. There is no need to specialClaudio Jeker
case carp(4) interfaces anymore. LINK_STATE_IS_UP() almost always does the right job. OK deraadt@ henning@ This needs a -current kernel or link state may be not reported correctly.
2011-03-15use appropriate timerclear macro - from Christiano F. HaesbaertOkan Demirmen
ok mcbride@
2010-07-07Make ifstated cause a little less noise in /var/log/daemon.Stefan Sperling
State transitions are still logged, but commands run are now printed only in debug mode (ifstated -d). ok deraadt
2010-06-07setproctitle(NULL) is not needed, Michael Lechtermann; ok mpfTheo de Raadt
2010-02-04remove assumption that internal IFSD_LINK* defines are the same asKevin Steves
LINK_STATE* defines in <net/if.h>, which were changed Sep 14. this fixes link state down being treated as up. ok claudio@ henning@
2009-06-25fix the function name in log_warn() text, it was borrowed from someStuart Henderson
previous test code of mine.
2009-06-25Teach ifstated to use ROUTE_FILTER. Requested by claudio@.Stuart Henderson
ok claudio@ henning@
2008-05-12Error out with usage line if additional arguments are given after thePierre-Yves Ritschard
option parsing. Found out the hard way by jdixon on ifstated. ok sobrado@, jdixon@, millert@
2007-11-27remove some unneeded #includes; ok mcbride@Kevin Steves
2007-10-25sync logging with most other daemons.Pierre-Yves Ritschard
ok mcbride@, mpf@
2006-11-28handle the new link states as UPReyk Floeter
2006-03-16Kill useless arguments to libevent *_set() functions.Ryan Thomas McBride
ok mpf@
2006-02-08- configuration file can have relative pathCamiel Dobbelaar
- do not suppress logging if there is no configuration yet, otherwise we cannot log that configuration parsing failed ok mpf@ mcbride@
2006-02-01Simplify expression code. Patch from markus@.Marco Pfatschbacher
ok mcbride@
2006-02-01Run external tests synchronous at state changes andMarco Pfatschbacher
call adjust_external_expressions() which updates the expressions for all states. Address similar state caching problems for external tests as in previous commit. Don't ignore set-state actions if they are happening right after a state change. (Based on a patch from Holger Mikolon). ok markus@, testing sturm@, ok mcbride@.
2006-02-01If we reenter a state, it still has the old link state values cached.Marco Pfatschbacher
Therefore, if it enters a state without calling scan_ifstate() (e.g. through an external-test) ifstated will do the wrong thing (tm). Change scan_ifstate() to first walk over all states and update the expressions _before_ they are evaluated. Help and ok markus@, testing sturm@, ok mcbride@.
2006-01-25Remove gratuitous fetch_state() calls in state_change().Marco Pfatschbacher
It could race with a second incoming routing message, which would not trigger any action, because of the already updated status cache. Found by markus@. OK markus@ mcbride@
2006-01-23Open the routing socket before load_config() calls fetch_state().Marco Pfatschbacher
Otherwise we could loose routing messages that arrive in between. OK markus@, mcbride@
2005-07-28Fix two situations where ifstated was leaking zombies.Marco Pfatschbacher
Tested by sturm@ OK henning@
2005-02-07Fix protos, and a KNF nit. From Andrey Matveev <andrushock@korovino.net>Ryan Thomas McBride
2004-10-05Use priority instead of facility in vsyslog()Marco Pfatschbacher
Pointed out by Peter Philipp. ok mcbride@
2004-09-21Start external tests and init commands also in the initial state.Marco Pfatschbacher
Log the pid when killing an external program. Avoid a possible NULL dereference. ok mcbride@
2004-06-15knfTheo de Raadt
2004-04-27various small fixes;Jason McIntyre
ok mcbride@
2004-03-15call daemon(3) early; from tholo@; ok mcbride@Markus Friedl
2004-03-10Plug memory leak on SIGHUP. From Patrick Latifi.Ryan Thomas McBride