From 9e12eac1e63ef71a12c69479a023773c9a5e2bf5 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 31 Mar 2020 14:36:03 -0700 Subject: [PATCH] lf-associate: Properly ignore channel and nss if user does not input any values. Otherwise, radio values are un-expectedly set to the default values. --- lf_associate_ap.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lf_associate_ap.pl b/lf_associate_ap.pl index 055f2514..528c5a7c 100755 --- a/lf_associate_ap.pl +++ b/lf_associate_ap.pl @@ -94,8 +94,8 @@ my $log_cli = "unset"; # use ENV{'LOG_CLI'} # and we're assuming the port is on the same resource (1). our $upstream_port = "eth1"; # Step 1 upstream port our $sta_wiphy = "wiphy0"; # physical parent (radio) of virtual stations -our $phy_channel = -1; # channel number -our $phy_antenna = 0; # number of antennas, all +our $phy_channel = ""; # channel number +our $phy_antenna = ""; # number of antennas, 0 means all our %wiphy_bssids = (); our $admin_down_on_add = 0; our $ssid; @@ -1521,8 +1521,10 @@ sub set_antenna { die("Antenna mode [$ant] does not exist.") if (! exists $::antenna_table{$ant}); my $mode = 'NA'; - my $chan = ((defined $::phy_channel) && ($::phy_channel > 0)) - ? $::phy_channel : 'NA'; + my $chan = $::phy_channel; + if ($chan eq "") { + $chan = "NA"; + } my $country = 'NA'; my $freq = 'NA'; #'0xFFFF' will override channel my $frag = 'NA'; @@ -1685,10 +1687,10 @@ if (!($action =~ /del/)) { # Below steps are unrelated to deleting objects } if ($action =~ /step|add/) { - if (defined $::phy_channel && $::phy_channel > 0) { + if ($::phy_channel ne "") { set_channel($::resource, $::sta_wiphy, $::phy_channel); } - if (defined $::phy_antenna) { + if ($::phy_antenna ne "") { set_antenna($::resource, $::sta_wiphy, $::phy_antenna); } }