]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
general-functions.pl: Return unique list of nameservers
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 30 Jan 2020 12:13:46 +0000 (13:13 +0100)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 30 Jan 2020 12:13:46 +0000 (13:13 +0100)
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
config/cfgroot/general-functions.pl

index 448f4c6355ba2dfe26a352f7e36e4d24c4ebcf90..41a0eac2d43bd3a007ae79adc68c99f99b0279a5 100644 (file)
@@ -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;