olsrd.git
4 years agomain: call olsr_exit when writing the PID file fails
Ferry Huberts [Tue, 10 Nov 2015 08:57:00 +0000 (09:57 +0100)]
main: call olsr_exit when writing the PID file fails

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: initialise IPC a bit earlier
Ferry Huberts [Tue, 10 Nov 2015 08:54:38 +0000 (09:54 +0100)]
main: initialise IPC a bit earlier

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: minor update
Ferry Huberts [Tue, 10 Nov 2015 08:41:04 +0000 (09:41 +0100)]
main: minor update

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: invoke olsr_exit at the end of main
Ferry Huberts [Mon, 9 Nov 2015 22:48:36 +0000 (23:48 +0100)]
main: invoke olsr_exit at the end of main

To make it explicit that that is the only proper way to exit.
exit() calls are now in the only 2 allowed places in olsrd (not
counting olsrd_switch).

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: limit the scope of 2 variables to where they are needed
Ferry Huberts [Mon, 9 Nov 2015 22:37:05 +0000 (23:37 +0100)]
main: limit the scope of 2 variables to where they are needed

Very limited scope.
The main function now has 'no' more local variables

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move conf_file_name variable into cfgparser
Ferry Huberts [Wed, 11 Nov 2015 11:21:27 +0000 (12:21 +0100)]
main: move conf_file_name variable into cfgparser

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move lock file creation into the lock_file file
Ferry Huberts [Mon, 9 Nov 2015 22:24:44 +0000 (23:24 +0100)]
main: move lock file creation into the lock_file file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopid: move pid file handling into its own file
Ferry Huberts [Mon, 9 Nov 2015 22:07:20 +0000 (23:07 +0100)]
pid: move pid file handling into its own file

And refactor it to not invoke olsr_shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: move loadConfig function here from main
Ferry Huberts [Wed, 11 Nov 2015 11:16:20 +0000 (12:16 +0100)]
conf: move loadConfig function here from main

And refactor it to not invoke olsr_exit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: remove an unneeded printf
Ferry Huberts [Mon, 9 Nov 2015 20:23:54 +0000 (21:23 +0100)]
conf: remove an unneeded printf

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: minor improvements
Ferry Huberts [Mon, 9 Nov 2015 20:23:36 +0000 (21:23 +0100)]
main: minor improvements

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: process olsrd options in a block
Ferry Huberts [Mon, 9 Nov 2015 20:21:43 +0000 (21:21 +0100)]
main: process olsrd options in a block

To limit the scope of the default_ifcnf variable.

Also fixes a memory leak of an exit path.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: initialise timers after processing the configuration
Ferry Huberts [Mon, 9 Nov 2015 20:16:56 +0000 (21:16 +0100)]
main: initialise timers after processing the configuration

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: minor improvements to loadConfig
Ferry Huberts [Wed, 11 Nov 2015 11:00:11 +0000 (12:00 +0100)]
main: minor improvements to loadConfig

And add some comments

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move loading the config into the loadConfig function
Ferry Huberts [Wed, 11 Nov 2015 11:03:41 +0000 (12:03 +0100)]
main: move loading the config into the loadConfig function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move printing of version into a function
Ferry Huberts [Mon, 9 Nov 2015 08:34:26 +0000 (09:34 +0100)]
main: move printing of version into a function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: remove the lock file in olsr_shutdown
Ferry Huberts [Mon, 9 Nov 2015 14:54:02 +0000 (15:54 +0100)]
main: remove the lock file in olsr_shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolock_file: add olsr_remove_lock_file function
Ferry Huberts [Mon, 9 Nov 2015 14:49:11 +0000 (15:49 +0100)]
lock_file: add olsr_remove_lock_file function

And use it in the error paths during creation

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move olsr_create_lock_file into its own file
Ferry Huberts [Mon, 9 Nov 2015 14:39:32 +0000 (15:39 +0100)]
main: move olsr_create_lock_file into its own file

And refactor it to not use olsr_exit.
And close the lock file on error paths.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolock_file: move olsrd_get_default_lockfile into its own file
Ferry Huberts [Mon, 9 Nov 2015 13:44:55 +0000 (14:44 +0100)]
lock_file: move olsrd_get_default_lockfile into its own file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: use olsr_cnf->lock_file directly
Ferry Huberts [Mon, 9 Nov 2015 13:26:34 +0000 (14:26 +0100)]
main: use olsr_cnf->lock_file directly

No need to use the intermediate storage of lock_file_name

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: no need to re-determine lock_file; already setup by set_derived_cnf
Ferry Huberts [Mon, 9 Nov 2015 13:20:21 +0000 (14:20 +0100)]
main: no need to re-determine lock_file; already setup by set_derived_cnf

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: fix determining the lock file, mirror what main does
Ferry Huberts [Mon, 9 Nov 2015 13:12:57 +0000 (14:12 +0100)]
conf: fix determining the lock file, mirror what main does

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agorandom: remove pointless olsr_init_random, only invoked in main
Ferry Huberts [Mon, 9 Nov 2015 12:57:32 +0000 (13:57 +0100)]
random: remove pointless olsr_init_random, only invoked in main

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: always store argv
Ferry Huberts [Mon, 9 Nov 2015 13:04:17 +0000 (14:04 +0100)]
main: always store argv

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move some initialisation to the beginning of main
Ferry Huberts [Mon, 9 Nov 2015 20:29:56 +0000 (21:29 +0100)]
main: move some initialisation to the beginning of main

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: make sure all variables are initialised
Ferry Huberts [Mon, 9 Nov 2015 20:29:08 +0000 (21:29 +0100)]
main: make sure all variables are initialised

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: remove pointless type size asserts
Ferry Huberts [Mon, 9 Nov 2015 08:15:54 +0000 (09:15 +0100)]
main: remove pointless type size asserts

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: remove unused copyright_string
Ferry Huberts [Mon, 9 Nov 2015 10:07:32 +0000 (11:07 +0100)]
main: remove unused copyright_string

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: remove unused copyright_string
Ferry Huberts [Mon, 9 Nov 2015 10:07:45 +0000 (11:07 +0100)]
conf: remove unused copyright_string

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agohttpinfo: remove unused copyright_string
Ferry Huberts [Mon, 9 Nov 2015 10:07:40 +0000 (11:07 +0100)]
httpinfo: remove unused copyright_string

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: clean up olsr_exit messages
Ferry Huberts [Fri, 6 Nov 2015 15:13:55 +0000 (16:13 +0100)]
main: clean up olsr_exit messages

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoipc_frontend: clean up olsr_exit messages
Ferry Huberts [Thu, 5 Nov 2015 23:15:08 +0000 (00:15 +0100)]
ipc_frontend: clean up olsr_exit messages

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolinux: clean up olsr_exit messages
Ferry Huberts [Thu, 5 Nov 2015 22:51:52 +0000 (23:51 +0100)]
linux: clean up olsr_exit messages

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoquagga: clean up olsr_exit messages
Ferry Huberts [Thu, 5 Nov 2015 22:50:56 +0000 (23:50 +0100)]
quagga: clean up olsr_exit messages

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoparser: clean up invocation of olsr_exit
Ferry Huberts [Fri, 6 Nov 2015 15:06:53 +0000 (16:06 +0100)]
parser: clean up invocation of olsr_exit

olsr_exit already prints the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr: clean up invocation of olsr_exit
Ferry Huberts [Thu, 5 Nov 2015 23:14:15 +0000 (00:14 +0100)]
olsr: clean up invocation of olsr_exit

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: clean up invocation of olsr_exit
Ferry Huberts [Fri, 6 Nov 2015 15:05:23 +0000 (16:05 +0100)]
main: clean up invocation of olsr_exit

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolq_plugin: clean up invocation of olsr_exit
Ferry Huberts [Thu, 5 Nov 2015 22:53:45 +0000 (23:53 +0100)]
lq_plugin: clean up invocation of olsr_exit

olsr_exit already prints the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agointerfaces: clean up invocation of olsr_exit
Ferry Huberts [Thu, 5 Nov 2015 23:13:51 +0000 (00:13 +0100)]
interfaces: clean up invocation of olsr_exit

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agocookie: clean up invocation of olsr_exit
Ferry Huberts [Thu, 5 Nov 2015 22:57:30 +0000 (23:57 +0100)]
cookie: clean up invocation of olsr_exit

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agobuild_msg: clean up invocation of olsr_exit
Ferry Huberts [Thu, 5 Nov 2015 23:00:15 +0000 (00:00 +0100)]
build_msg: clean up invocation of olsr_exit

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoquagga: clean up invocation of olsr_exit
Ferry Huberts [Thu, 5 Nov 2015 22:50:45 +0000 (23:50 +0100)]
quagga: clean up invocation of olsr_exit

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoplugin_loader: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:58:12 +0000 (23:58 +0100)]
plugin_loader: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 23:07:05 +0000 (00:07 +0100)]
olsr: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agowin32: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:44:22 +0000 (23:44 +0100)]
win32: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agounix: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:44:45 +0000 (23:44 +0100)]
unix: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolinux: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:51:37 +0000 (23:51 +0100)]
linux: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosecure: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:21:50 +0000 (23:21 +0100)]
secure: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopgraph: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:21:18 +0000 (23:21 +0100)]
pgraph: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agohttpinfo: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:19:56 +0000 (23:19 +0100)]
httpinfo: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agodyngw: call olsr_exit() instead of exit()
Ferry Huberts [Thu, 5 Nov 2015 22:18:00 +0000 (23:18 +0100)]
dyngw: call olsr_exit() instead of exit()

olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.

According to the man page of raise():
  If the signal causes a handler to be called, raise() will return
  only after the signal handler has returned.

And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agop2pd: update a comment about exit
Ferry Huberts [Thu, 5 Nov 2015 22:20:27 +0000 (23:20 +0100)]
p2pd: update a comment about exit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomdns: update a comment about exit
Ferry Huberts [Thu, 5 Nov 2015 22:20:12 +0000 (23:20 +0100)]
mdns: update a comment about exit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr: make sure olsr_cnf is initialised
Ferry Huberts [Thu, 5 Nov 2015 22:11:18 +0000 (23:11 +0100)]
olsr: make sure olsr_cnf is initialised

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr_exit: clarify why the explicit exit is needed
Ferry Huberts [Fri, 6 Nov 2015 14:22:32 +0000 (15:22 +0100)]
olsr_exit: clarify why the explicit exit is needed

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr_exit: also flush stderr on exit
Ferry Huberts [Fri, 6 Nov 2015 14:22:20 +0000 (15:22 +0100)]
olsr_exit: also flush stderr on exit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr_exit: protect against a NULL message
Ferry Huberts [Fri, 6 Nov 2015 14:22:10 +0000 (15:22 +0100)]
olsr_exit: protect against a NULL message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoolsr_exit: protect against a NULL olsr_cnf
Ferry Huberts [Fri, 6 Nov 2015 14:21:53 +0000 (15:21 +0100)]
olsr_exit: protect against a NULL olsr_cnf

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: also output SmartGatewayInstanceId
Ferry Huberts [Thu, 5 Nov 2015 16:35:14 +0000 (17:35 +0100)]
jsoninfo: also output SmartGatewayInstanceId

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: invoke the cleanup mode of the policy script on start and stop
Ferry Huberts [Thu, 5 Nov 2015 21:01:26 +0000 (22:01 +0100)]
sgw: invoke the cleanup mode of the policy script on start and stop

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: log invocations and add cleanup mode
Ferry Huberts [Thu, 5 Nov 2015 18:05:44 +0000 (19:05 +0100)]
sgw: policy script: log invocations and add cleanup mode

All non-cleanup invocations with addMode 'add' are logged into a log file.

In addMode 'add' the cleanup mode walks the invocations in the log file
in reverse order in order to undo them.

In addMode 'del' the cleanup mode just removes the log file.

In a later patch olsrd will invoke the cleanup mode before starting
installation of multi-gateway iptables and ip rules and after
removing multi-gateway iptables and ip rules.

This is useful when olsrd crashes and leaves behind multi-gateway
iptables and ip rules: the next start of olsrd will first cleanup
those before configuring new multi-gateway iptables and ip rules.
Also, manually invoking the cleanup mode will obviously do the
same.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: add the instance id to the script
Ferry Huberts [Thu, 5 Nov 2015 17:49:18 +0000 (18:49 +0100)]
sgw: policy script: add the instance id to the script

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: add SmartGatewayInstanceId setting
Ferry Huberts [Thu, 5 Nov 2015 16:46:32 +0000 (17:46 +0100)]
sgw: add SmartGatewayInstanceId setting

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agocfg: fix printing of a few <not set> settings
Ferry Huberts [Fri, 6 Nov 2015 11:08:37 +0000 (12:08 +0100)]
cfg: fix printing of a few <not set> settings

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agodyn_gw: fix a mistake in 36111ca
Ferry Huberts [Fri, 6 Nov 2015 10:25:48 +0000 (11:25 +0100)]
dyn_gw: fix a mistake in 36111ca

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agocfg: minor fixup to printing of SmartGatewayPolicyRoutingScript
Ferry Huberts [Thu, 5 Nov 2015 16:37:19 +0000 (17:37 +0100)]
cfg: minor fixup to printing of SmartGatewayPolicyRoutingScript

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: fix cosmetic rebase issue of the previous commit
Ferry Huberts [Thu, 5 Nov 2015 17:24:30 +0000 (18:24 +0100)]
sgw: policy script: fix cosmetic rebase  issue of the previous commit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: minor improvement
Ferry Huberts [Thu, 5 Nov 2015 15:08:52 +0000 (16:08 +0100)]
sgw: policy script: minor improvement

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: move some declarations
Ferry Huberts [Thu, 5 Nov 2015 12:14:35 +0000 (13:14 +0100)]
sgw: policy script: move some declarations

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: fix some comparisons
Ferry Huberts [Thu, 5 Nov 2015 12:11:38 +0000 (13:11 +0100)]
sgw: policy script: fix some comparisons

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: policy script: fix error reports when too many arguments
Ferry Huberts [Thu, 5 Nov 2015 10:36:08 +0000 (11:36 +0100)]
sgw: policy script: fix error reports when too many arguments

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: do not program routes on interfaces that are not up
Ferry Huberts [Wed, 4 Nov 2015 14:36:32 +0000 (15:36 +0100)]
sgw: do not program routes on interfaces that are not up

This doesn't work and then spams the log.
Discovered when the best (selected) egress interface was brought
down and olsrd tried to remove the routes on that interface

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoMerge branch 'release-0.9.0'
Ferry Huberts [Sun, 18 Oct 2015 18:17:58 +0000 (20:17 +0200)]
Merge branch 'release-0.9.0'

* release-0.9.0:
  quagga: restore socket status on error paths in zclient_read function
  quagga: zero-out the extra allocated buffer size
  cookie: fix loop invariant assert and exit on cookie exhaustion
  conf: clean up interface names on config file read failure

4 years agoquagga: restore socket status on error paths in zclient_read function
Ferry Huberts [Sat, 17 Oct 2015 20:41:29 +0000 (22:41 +0200)]
quagga: restore socket status on error paths in zclient_read function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoquagga: zero-out the extra allocated buffer size
Ferry Huberts [Thu, 15 Oct 2015 17:57:47 +0000 (19:57 +0200)]
quagga: zero-out the extra allocated buffer size

Might fix a Coverity warning

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agocookie: fix loop invariant assert and exit on cookie exhaustion
Ferry Huberts [Sun, 18 Oct 2015 18:10:09 +0000 (20:10 +0200)]
cookie: fix loop invariant assert and exit on cookie exhaustion

Fixes a Coverity warning

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: clean up interface names on config file read failure
Ferry Huberts [Thu, 15 Oct 2015 12:41:59 +0000 (14:41 +0200)]
conf: clean up interface names on config file read failure

==12076==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x499bba in __interceptor_malloc (/home/ferry/vcs/nbs/nbsolsrd/olsrd+0x499bba)
    #1 0x5784cd in get_string_token src/cfgparser/oscan.lex:92
    #2 0x578ef7 in yylex src/cfgparser/oscan.lex:185
    #3 0x5699c4 in yyparse src/cfgparser/oparse.c:1686
    #4 0x55e322 in olsrd_parse_cnf src/cfgparser/olsrd_conf.c:158
    #5 0x4edf56 in olsrmain_load_config src/main.c:281
    #6 0x4ee5e6 in main src/main.c:386
    #7 0x7fd24079757f in __libc_start_main (/lib64/libc.so.6+0x2057f)

SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s).

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoquagga: zero-out the extra allocated buffer size
Ferry Huberts [Thu, 15 Oct 2015 17:57:47 +0000 (19:57 +0200)]
quagga: zero-out the extra allocated buffer size

Might fix a Coverity warning

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoMerge branch 'release-0.9.0'
Ferry Huberts [Thu, 15 Oct 2015 17:28:35 +0000 (19:28 +0200)]
Merge branch 'release-0.9.0'

* release-0.9.0:
  sgw: fix EOL stripping of the egress file
  sgwdynspeed: let the out block close the file

4 years agosgw: fix EOL stripping of the egress file
Ferry Huberts [Thu, 15 Oct 2015 17:28:03 +0000 (19:28 +0200)]
sgw: fix EOL stripping of the egress file

Fixes a Coverity warning

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgwdynspeed: let the out block close the file
Ferry Huberts [Thu, 15 Oct 2015 17:15:49 +0000 (19:15 +0200)]
sgwdynspeed: let the out block close the file

Fixes a Coverity warning

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoMerge branch 'release-0.9.0'
Ferry Huberts [Thu, 15 Oct 2015 12:59:08 +0000 (14:59 +0200)]
Merge branch 'release-0.9.0'

* release-0.9.0:
  sgw: properly open and stat the egress file
  sgw: do not clear egress data in the read race
  sgw: properly close the egress file
  sgw: remove unneeded check against 0 for cached timestamp
  sgw: cache the correct timestamp
  sgw: cache timestamp of egress file earlier
  sgwdynspeed: cache the correct timestamp
  sgwdynspeed: properly close the speed file
  sgwdynspeed: increase the resolution of the cached timestamp
  sgwdynspeed: clear the cached timestamp when the speed file can't be read
  pud: cache the correct timestamp
  pud: minor fix in the function reading the position file
  pud: increase the resolution of the cached timestamp of the position file
  pud: clear the cached timestamp when the position file can't be read
  egressFile: use a define for the line length

4 years agosgw: properly open and stat the egress file
Ferry Huberts [Thu, 15 Oct 2015 10:49:05 +0000 (12:49 +0200)]
sgw: properly open and stat the egress file

Makes the handling the same as pud and sgwdynspeed handle their files.
Also fixes a Coverity warning.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: do not clear egress data in the read race
Ferry Huberts [Thu, 15 Oct 2015 10:24:15 +0000 (12:24 +0200)]
sgw: do not clear egress data in the read race

This section of code can race but we'll just try again in the next
cycle, so there is no need to clear the egress data.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: properly close the egress file
Ferry Huberts [Thu, 15 Oct 2015 10:47:11 +0000 (12:47 +0200)]
sgw: properly close the egress file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: remove unneeded check against 0 for cached timestamp
Ferry Huberts [Thu, 15 Oct 2015 10:44:00 +0000 (12:44 +0200)]
sgw: remove unneeded check against 0 for cached timestamp

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: cache the correct timestamp
Ferry Huberts [Thu, 15 Oct 2015 09:58:44 +0000 (11:58 +0200)]
sgw: cache the correct timestamp

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: cache timestamp of egress file earlier
Ferry Huberts [Thu, 15 Oct 2015 09:53:36 +0000 (11:53 +0200)]
sgw: cache timestamp of egress file earlier

Before we go into the reading loop, because we assume that the
contents of the valid is valid. And when it's not valid then the
timestamp of the file has to change before we should try to read
it again.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgwdynspeed: cache the correct timestamp
Ferry Huberts [Thu, 15 Oct 2015 09:58:17 +0000 (11:58 +0200)]
sgwdynspeed: cache the correct timestamp

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgwdynspeed: properly close the speed file
Ferry Huberts [Thu, 15 Oct 2015 08:39:12 +0000 (10:39 +0200)]
sgwdynspeed: properly close the speed file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgwdynspeed: increase the resolution of the cached timestamp
Ferry Huberts [Thu, 15 Oct 2015 10:40:13 +0000 (12:40 +0200)]
sgwdynspeed: increase the resolution of the cached timestamp

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgwdynspeed: clear the cached timestamp when the speed file can't be read
Ferry Huberts [Wed, 14 Oct 2015 11:28:19 +0000 (13:28 +0200)]
sgwdynspeed: clear the cached timestamp when the speed file can't be read

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopud: cache the correct timestamp
Ferry Huberts [Thu, 15 Oct 2015 09:57:39 +0000 (11:57 +0200)]
pud: cache the correct timestamp

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopud: minor fix in the function reading the position file
Ferry Huberts [Thu, 15 Oct 2015 08:38:26 +0000 (10:38 +0200)]
pud: minor fix in the function reading the position file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopud: increase the resolution of the cached timestamp of the position file
Ferry Huberts [Thu, 15 Oct 2015 10:38:29 +0000 (12:38 +0200)]
pud: increase the resolution of the cached timestamp of the position file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopud: clear the cached timestamp when the position file can't be read
Ferry Huberts [Wed, 14 Oct 2015 11:16:12 +0000 (13:16 +0200)]
pud: clear the cached timestamp when the position file can't be read

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoegressFile: use a define for the line length
Ferry Huberts [Wed, 14 Oct 2015 10:16:21 +0000 (12:16 +0200)]
egressFile: use a define for the line length

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoMerge branch 'release-0.9.0'
Ferry Huberts [Thu, 15 Oct 2015 12:45:03 +0000 (14:45 +0200)]
Merge branch 'release-0.9.0'

* release-0.9.0:
  sgw: add SmartGatewayMaxCostMaxEtx configuration setting
  files: minor improvement to config file generation script
  files: regenerate the generated default full configuration

4 years agosgw: add SmartGatewayMaxCostMaxEtx configuration setting
Ferry Huberts [Tue, 13 Oct 2015 10:42:21 +0000 (12:42 +0200)]
sgw: add SmartGatewayMaxCostMaxEtx configuration setting

SmartGatewayMaxCostMaxEtx: When a node advertises the maximum bandwidth
and its ETX is below the value of this setting then the resulting gateway
costs are equal to the ETX, otherwise the normal calculation of the
gateway costs applies (default is 2560).

This avoids instability in the mesh when a far-away node advertises
maximum bandwidth.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>