olsrd.git
4 years agojsoninfo: remove personal copyrights, just check the git log
Ferry Huberts [Thu, 26 Nov 2015 19:21:24 +0000 (20:21 +0100)]
jsoninfo: remove personal copyrights, just check the git log

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: fix content type of http headers for /olsr.conf
Ferry Huberts [Thu, 26 Nov 2015 19:14:44 +0000 (20:14 +0100)]
jsoninfo: fix content type of http headers for /olsr.conf

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: more formatting
Ferry Huberts [Thu, 26 Nov 2015 19:05:47 +0000 (20:05 +0100)]
jsoninfo: more formatting

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: rename a function
Ferry Huberts [Thu, 26 Nov 2015 19:05:35 +0000 (20:05 +0100)]
jsoninfo: rename a function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: limit the number of in-flight connection to 3, like txtinfo
Ferry Huberts [Thu, 26 Nov 2015 19:05:10 +0000 (20:05 +0100)]
jsoninfo: limit the number of in-flight connection to 3, like txtinfo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use a smaller (2 CPU pages) initial buffer
Ferry Huberts [Thu, 26 Nov 2015 19:04:27 +0000 (20:04 +0100)]
jsoninfo: use a smaller (2 CPU pages) initial buffer

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use the plugin name in a malloc call
Ferry Huberts [Thu, 26 Nov 2015 19:04:03 +0000 (20:04 +0100)]
jsoninfo: use the plugin name in a malloc call

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: move some functions around
Ferry Huberts [Thu, 26 Nov 2015 18:59:37 +0000 (19:59 +0100)]
jsoninfo: move some functions around

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: update some comments
Ferry Huberts [Thu, 26 Nov 2015 18:52:12 +0000 (19:52 +0100)]
jsoninfo: update some comments

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: initialise outbuffer_count
Ferry Huberts [Thu, 26 Nov 2015 18:51:15 +0000 (19:51 +0100)]
jsoninfo: initialise outbuffer_count

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use the set_plugin_boolean function
Ferry Huberts [Thu, 26 Nov 2015 18:49:52 +0000 (19:49 +0100)]
jsoninfo: use the set_plugin_boolean function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use a define to rename TXTINFO_ALLOW_LOCALHOST
Ferry Huberts [Thu, 26 Nov 2015 18:35:46 +0000 (19:35 +0100)]
jsoninfo: use a define to rename TXTINFO_ALLOW_LOCALHOST

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use defines for some variables
Ferry Huberts [Thu, 26 Nov 2015 18:32:15 +0000 (19:32 +0100)]
jsoninfo: use defines for some variables

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use a define for the plugin name
Ferry Huberts [Thu, 26 Nov 2015 17:46:55 +0000 (18:46 +0100)]
jsoninfo: use a define for the plugin name

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: remove personal copyrights, just check the git log
Ferry Huberts [Thu, 26 Nov 2015 19:21:36 +0000 (20:21 +0100)]
txtinfo: remove personal copyrights, just check the git log

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: expand SIW_RUNTIME_ALL to include all runtime information
Ferry Huberts [Thu, 26 Nov 2015 18:48:01 +0000 (19:48 +0100)]
txtinfo: expand SIW_RUNTIME_ALL to include all runtime information

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: remove superfluous forward declarations
Ferry Huberts [Thu, 26 Nov 2015 18:43:27 +0000 (19:43 +0100)]
txtinfo: remove superfluous forward declarations

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: some more formatting
Ferry Huberts [Thu, 26 Nov 2015 17:43:15 +0000 (18:43 +0100)]
txtinfo: some more formatting

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: send everything on an unknown option
Ferry Huberts [Thu, 26 Nov 2015 17:41:01 +0000 (18:41 +0100)]
txtinfo: send everything on an unknown option

Instead of all runtime information

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: the configuration is a special case
Ferry Huberts [Thu, 26 Nov 2015 17:38:51 +0000 (18:38 +0100)]
txtinfo: the configuration is a special case

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: renumber SIW_x defines and put them in 'groups'
Ferry Huberts [Thu, 26 Nov 2015 17:28:58 +0000 (18:28 +0100)]
txtinfo: renumber SIW_x defines and put them in 'groups'

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use a bigger (2 CPU pages) initial buffer
Ferry Huberts [Thu, 26 Nov 2015 14:26:33 +0000 (15:26 +0100)]
txtinfo: use a bigger (2 CPU pages) initial buffer

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use HTTP/1.1
Ferry Huberts [Thu, 26 Nov 2015 14:24:29 +0000 (15:24 +0100)]
txtinfo: use HTTP/1.1

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: http headers must use \r\n line endings
Ferry Huberts [Thu, 26 Nov 2015 14:23:23 +0000 (15:23 +0100)]
txtinfo: http headers must use \r\n line endings

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: add httpheaders configuration parameter
Ferry Huberts [Thu, 26 Nov 2015 14:20:51 +0000 (15:20 +0100)]
txtinfo: add httpheaders configuration parameter

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify some comparisons
Ferry Huberts [Thu, 26 Nov 2015 14:07:48 +0000 (15:07 +0100)]
txtinfo: simplify some comparisons

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: re-order the sent information
Ferry Huberts [Thu, 26 Nov 2015 14:04:15 +0000 (15:04 +0100)]
txtinfo: re-order the sent information

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use the plugin name in a malloc call
Ferry Huberts [Thu, 26 Nov 2015 14:00:22 +0000 (15:00 +0100)]
txtinfo: use the plugin name in a malloc call

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: rename txtinfo_write_data function
Ferry Huberts [Thu, 26 Nov 2015 13:58:59 +0000 (14:58 +0100)]
txtinfo: rename txtinfo_write_data function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: move ipc_print_version function up a bit
Ferry Huberts [Thu, 26 Nov 2015 13:55:20 +0000 (14:55 +0100)]
txtinfo: move ipc_print_version function up a bit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: move ipc_print_gateways function up a bit
Ferry Huberts [Thu, 26 Nov 2015 13:53:49 +0000 (14:53 +0100)]
txtinfo: move ipc_print_gateways function up a bit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: move ipc_print_mid function up a bit
Ferry Huberts [Thu, 26 Nov 2015 13:51:09 +0000 (14:51 +0100)]
txtinfo: move ipc_print_mid function up a bit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: rename some SIW_x flags
Ferry Huberts [Thu, 26 Nov 2015 13:45:34 +0000 (14:45 +0100)]
txtinfo: rename some SIW_x flags

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use a define to rename TXTINFO_ALLOW_LOCALHOST
Ferry Huberts [Thu, 26 Nov 2015 13:43:35 +0000 (14:43 +0100)]
txtinfo: use a define to rename TXTINFO_ALLOW_LOCALHOST

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use defines for some variables
Ferry Huberts [Thu, 26 Nov 2015 13:40:07 +0000 (14:40 +0100)]
txtinfo: use defines for some variables

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: rename some functions
Ferry Huberts [Thu, 26 Nov 2015 13:35:01 +0000 (14:35 +0100)]
txtinfo: rename some functions

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use a define for the plugin name
Ferry Huberts [Thu, 26 Nov 2015 13:48:15 +0000 (14:48 +0100)]
txtinfo: use a define for the plugin name

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify some send_what checks
Ferry Huberts [Thu, 26 Nov 2015 13:26:14 +0000 (14:26 +0100)]
txtinfo: simplify some send_what checks

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify some string comparisons
Ferry Huberts [Thu, 26 Nov 2015 13:23:38 +0000 (14:23 +0100)]
txtinfo: simplify some string comparisons

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify an ifdef
Ferry Huberts [Thu, 26 Nov 2015 13:21:18 +0000 (14:21 +0100)]
txtinfo: simplify an ifdef

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: use the same c-basic-offset: 2 as jsoninfo
Ferry Huberts [Thu, 26 Nov 2015 13:20:57 +0000 (14:20 +0100)]
txtinfo: use the same c-basic-offset: 2 as jsoninfo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: format code
Ferry Huberts [Thu, 26 Nov 2015 13:14:14 +0000 (14:14 +0100)]
txtinfo: format code

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: sgw: print the prefix length for IPv6
Ferry Huberts [Wed, 25 Nov 2015 23:25:33 +0000 (00:25 +0100)]
txtinfo: sgw: print the prefix length for IPv6

A mask has no meaning there.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: sgw: do not access uninitialised memory
Ferry Huberts [Wed, 25 Nov 2015 23:22:10 +0000 (00:22 +0100)]
txtinfo: sgw: do not access uninitialised memory

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: sgw: line-up to jsoninfo
Ferry Huberts [Tue, 24 Nov 2015 11:19:03 +0000 (12:19 +0100)]
txtinfo: sgw: line-up to jsoninfo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: sgw: show entries without tc too
Ferry Huberts [Tue, 24 Nov 2015 11:18:09 +0000 (12:18 +0100)]
txtinfo: sgw: show entries without tc too

The tc is only used for the path cost, so simply show that as
ROUTE_COST_BROKEN when there is no tc.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: sgw: minor simplification reducing memory usage
Ferry Huberts [Tue, 24 Nov 2015 07:57:43 +0000 (08:57 +0100)]
jsoninfo: sgw: minor simplification reducing memory usage

tunnelGw is the same as originator

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: sgw: show entries without tc too
Ferry Huberts [Mon, 23 Nov 2015 19:56:03 +0000 (20:56 +0100)]
jsoninfo: sgw: show entries without tc too

The tc is only used for the path cost, so simply show that as
ROUTE_COST_BROKEN when there is no tc.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: sgw: show tableNr, ruleNr and bypassRuleNr too
Ferry Huberts [Mon, 23 Nov 2015 20:00:23 +0000 (21:00 +0100)]
jsoninfo: sgw: show tableNr, ruleNr and bypassRuleNr too

Now all sgw info that is available is shown.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: sgw: simplify prefix output
Ferry Huberts [Mon, 23 Nov 2015 20:03:09 +0000 (21:03 +0100)]
jsoninfo: sgw: simplify prefix output

Show prefix and prefix length separately.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: sgw field in /sgw response is not an array
Ferry Huberts [Mon, 23 Nov 2015 14:00:06 +0000 (15:00 +0100)]
jsoninfo: sgw field in /sgw response is not an array

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: only select an olsr or egress interface when it is up
Ferry Huberts [Mon, 23 Nov 2015 08:00:08 +0000 (09:00 +0100)]
sgw: only select an olsr or egress interface when it is up

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

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: open syslog right at the start
Ferry Huberts [Tue, 17 Nov 2015 07:49:28 +0000 (08:49 +0100)]
main: open syslog right at the start

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: initialise sgw uplink & downlink before setting them
Ferry Huberts [Mon, 16 Nov 2015 14:33:17 +0000 (15:33 +0100)]
conf: initialise sgw uplink & downlink before setting them

Since the setters call set_smart_gateway_bandwidth_zero which
depends on both values being initialised.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: do not leak the configuration when freeing it
Ferry Huberts [Mon, 16 Nov 2015 13:51:39 +0000 (14:51 +0100)]
conf: do not leak the configuration when freeing it

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: olsrd_free_cnf: free everything
Ferry Huberts [Mon, 16 Nov 2015 12:33:17 +0000 (13:33 +0100)]
conf: olsrd_free_cnf: free everything

Free everything and do it (inversely) symmetrically
compared to startup.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: olsrd_free_cnf: reorder a bit
Ferry Huberts [Mon, 16 Nov 2015 12:39:56 +0000 (13:39 +0100)]
conf: olsrd_free_cnf: reorder a bit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: olsrd_free_cnf: refactor a bit to use the lists directly
Ferry Huberts [Mon, 16 Nov 2015 12:38:36 +0000 (13:38 +0100)]
conf: olsrd_free_cnf: refactor a bit to use the lists directly

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: olsrd_free_cnf: set pointers back to NULL after freeing
Ferry Huberts [Mon, 16 Nov 2015 11:06:42 +0000 (12:06 +0100)]
conf: olsrd_free_cnf: set pointers back to NULL after freeing

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: add ip_prefix_list_clear function
Ferry Huberts [Mon, 16 Nov 2015 12:11:37 +0000 (13:11 +0100)]
conf: add ip_prefix_list_clear function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: ensure all config fields are explicitly initialised
Ferry Huberts [Mon, 16 Nov 2015 11:05:54 +0000 (12:05 +0100)]
conf: ensure all config fields are explicitly initialised

And in the same order as in the struct.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: make sure debug_handle is initialised
Ferry Huberts [Mon, 16 Nov 2015 11:59:26 +0000 (12:59 +0100)]
conf: make sure debug_handle is initialised

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconf: avoid memory leaks during parsing
Ferry Huberts [Mon, 16 Nov 2015 12:56:56 +0000 (13:56 +0100)]
conf: avoid memory leaks during parsing

On string variables/settings, when set/declared multiple times.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolock_file: explicitly ignore failure of file removal
Ferry Huberts [Mon, 16 Nov 2015 13:35:24 +0000 (14:35 +0100)]
lock_file: explicitly ignore failure of file removal

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move some functions around
Ferry Huberts [Wed, 11 Nov 2015 11:55:30 +0000 (12:55 +0100)]
main: move some functions around

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: move CLI related function into their own file
Ferry Huberts [Wed, 11 Nov 2015 11:48:22 +0000 (12:48 +0100)]
main: move CLI related function into their own file

And refactor to not invoke olsr_exit

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: stop the scheduler in olsr_shutdown
Ferry Huberts [Wed, 11 Nov 2015 11:37:12 +0000 (12:37 +0100)]
main: stop the scheduler in olsr_shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: close the log in olsr_shutdown
Ferry Huberts [Wed, 11 Nov 2015 11:35:36 +0000 (12:35 +0100)]
main: close the log in olsr_shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolog: add olsr_closelog function
Ferry Huberts [Tue, 10 Nov 2015 11:57:48 +0000 (12:57 +0100)]
log: add olsr_closelog function

So that we can close the log during shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopid_file: add removePidFile function
Ferry Huberts [Tue, 10 Nov 2015 10:47:44 +0000 (11:47 +0100)]
pid_file: add removePidFile function

So that we can remove it during shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: stop the heartbeat timer during shutdown
Ferry Huberts [Wed, 11 Nov 2015 09:57:43 +0000 (10:57 +0100)]
main: stop the heartbeat timer during shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: track the heartbeat timer
Ferry Huberts [Tue, 10 Nov 2015 10:40:51 +0000 (11:40 +0100)]
main: track the heartbeat timer

So that we can stop it later during shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: call olsr_exit in olsr_reconfigure
Ferry Huberts [Tue, 10 Nov 2015 10:17:16 +0000 (11:17 +0100)]
main: call olsr_exit in olsr_reconfigure

Since that is the proper way to exit.

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

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolink_set: make sure link_changes is initialised
Ferry Huberts [Tue, 10 Nov 2015 10:11:12 +0000 (11:11 +0100)]
link_set: make sure link_changes is initialised

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

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
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>