From 0bb6a7e0f143ae0cd56b71bffeb9534e9f9f1911 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 15 Feb 2024 09:40:49 +0100 Subject: [PATCH] mxrouterctl: Move main code down Move start of main code down to after subs to make the file easier to read. --- mxrouter/mxrouterctl | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/mxrouter/mxrouterctl b/mxrouter/mxrouterctl index d0eb185..ed36fb7 100755 --- a/mxrouter/mxrouterctl +++ b/mxrouter/mxrouterctl @@ -628,25 +628,6 @@ sub veth { $want_veth->{$dev} = 1; } -my @SAVED_ARGV=@ARGV; - -GetOptions(OPTIONS) or die USAGE; -@ARGV>=1 or die USAGE; - -my ($cmd)=@ARGV; - -our $CONFIG_FILE="/etc/local/mxrouter/$NETNS.cf.pl"; - -unless (-e $CONFIG_FILE) { - warn "$0 : ignored - no file $CONFIG_FILE\n"; - exit; -} - -unless (defined do "$CONFIG_FILE") { - die "$CONFIG_FILE: $@\n" if $@; - die "$CONFIG_FILE: $!\n"; -} - sub dhcrelay_forward { my ($ip)=@_; $DHCRELAY_FORWARD=$ip; @@ -760,6 +741,27 @@ sub start_process_if { start_process($process); } +########################################## + +my @SAVED_ARGV=@ARGV; + +GetOptions(OPTIONS) or die USAGE; +@ARGV>=1 or die USAGE; + +my ($cmd)=@ARGV; + +our $CONFIG_FILE="/etc/local/mxrouter/$NETNS.cf.pl"; + +unless (-e $CONFIG_FILE) { + warn "$0 : ignored - no file $CONFIG_FILE\n"; + exit; +} + +unless (defined do "$CONFIG_FILE") { + die "$CONFIG_FILE: $@\n" if $@; + die "$CONFIG_FILE: $!\n"; +} + if (!$opt_this_ns) { if ($cmd eq 'start') { # neighbour table thresholds