From: Arne Fitzenreiter Date: Thu, 30 Jan 2020 12:13:46 +0000 (+0100) Subject: general-functions.pl: Return unique list of nameservers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8adbea97beb1107a48b3f804143e11ebf6228bb;p=people%2Fms%2Fipfire-2.x.git general-functions.pl: Return unique list of nameservers Signed-off-by: Arne Fitzenreiter --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 448f4c6355..41a0eac2d4 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -29,6 +29,9 @@ $General::adminmanualurl = 'http://wiki.ipfire.org'; require "${General::swroot}/network-functions.pl"; +# Function to remove duplicates from an array +sub uniq { my %seen; grep !$seen{$_}++, @_ } + # # log ("message") use default 'ipcop' tag # log ("tag","message") use your tag @@ -1255,7 +1258,7 @@ sub get_nameservers () { } # Return the array. - return @nameservers; + return &uniq(@nameservers); } 1;