diff --git a/pkg/link/link.go b/pkg/link/link.go index 3635119..4f1d82e 100644 --- a/pkg/link/link.go +++ b/pkg/link/link.go @@ -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) }