Skip to content

Commit

Permalink
mxrouterctl: Move main code down
Browse files Browse the repository at this point in the history
Move start of main code down to after subs to make the file easier to
read.
  • Loading branch information
donald committed Feb 15, 2024
1 parent 7159b3a commit 0bb6a7e
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions mxrouter/mxrouterctl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0bb6a7e

Please sign in to comment.