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 8, 2022
1 parent beb33bb commit 6934ac9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,20 @@ 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()
for _, newSuffix := range cfg.F5Config.Object.DNSSuffix {
found := false
for _, existingSuffix := range l.resolvHandler.GetOriginalSuffixes() {
if newSuffix == existingSuffix {
found = true
break
}
}

if !found {
dnsSuffixes = append(dnsSuffixes, newSuffix)
}
}
l.resolvHandler.SetSuffixes(dnsSuffixes)
}

Expand Down

0 comments on commit 6934ac9

Please sign in to comment.