Skip to content

Commit 6934ac9

Browse files
committed
Avoid duplicate search entries
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
1 parent beb33bb commit 6934ac9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/link/link.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,20 @@ func (l *vpnLink) configureDNS(cfg *config.Config) error {
233233

234234
if len(cfg.DNS) > 0 && !l.resolvHandler.IsResolve() {
235235
// combine local network search with VPN gateway search
236-
dnsSuffixes = append(l.resolvHandler.GetOriginalSuffixes(), cfg.F5Config.Object.DNSSuffix...)
236+
dnsSuffixes = l.resolvHandler.GetOriginalSuffixes()
237+
for _, newSuffix := range cfg.F5Config.Object.DNSSuffix {
238+
found := false
239+
for _, existingSuffix := range l.resolvHandler.GetOriginalSuffixes() {
240+
if newSuffix == existingSuffix {
241+
found = true
242+
break
243+
}
244+
}
245+
246+
if !found {
247+
dnsSuffixes = append(dnsSuffixes, newSuffix)
248+
}
249+
}
237250
l.resolvHandler.SetSuffixes(dnsSuffixes)
238251
}
239252

0 commit comments

Comments
 (0)