Skip to content

Commit

Permalink
Avoid duplicate search entries
Browse files Browse the repository at this point in the history
More a stilistic nicety. If we get a search suffix passed,
which is already part of the local configuration, it will
be duplicated. The change avoids that
  • Loading branch information
fwiesel committed Mar 28, 2022
1 parent beb33bb commit 46e3417
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,17 @@ func (l *vpnLink) configureDNS(cfg *config.Config) error {

if len(cfg.DNS) > 0 && !l.resolvHandler.IsResolve() {
// combine local network search with VPN gateway search
dnsSuffixes = append(l.resolvHandler.GetOriginalSuffixes(), cfg.F5Config.Object.DNSSuffix...)
dnsSuffixes = l.resolvHandler.GetOriginalSuffixes()
existingSuffixes := make(map[string]bool)
for _, existingSuffix := range l.resolvHandler.GetOriginalSuffixes() {
existingSuffixes[existingSuffix] = true
}

for _, newSuffix := range cfg.F5Config.Object.DNSSuffix {
if !existingSuffixes[newSuffix] {
dnsSuffixes = append(dnsSuffixes, newSuffix)
}
}
l.resolvHandler.SetSuffixes(dnsSuffixes)
}

Expand Down

0 comments on commit 46e3417

Please sign in to comment.