Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyufan2 committed Oct 13, 2023
1 parent 115f826 commit 682977b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions network/network_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,11 @@ func (nm *networkManager) applyIPConfig(extIf *externalInterface, targetIf *net.
return nil
}

func applyDnsConfig(extIf *externalInterface, ifName string) error {
func (nm *networkManager) applyDNSConfig(extIf *externalInterface, ifName string) error {
var (
setDnsList string
err error
)
p := platform.NewExecClient(logger)

if extIf != nil {
for _, server := range extIf.DNSInfo.Servers {
Expand All @@ -351,15 +350,15 @@ func applyDnsConfig(extIf *externalInterface, ifName string) error {

if setDnsList != "" {
cmd := fmt.Sprintf("systemd-resolve --interface=%s%s", ifName, setDnsList)
_, err = p.ExecuteCommand(cmd)
_, err = nm.plClient.ExecuteCommand(cmd)
if err != nil {
return err
}
}

if extIf.DNSInfo.Suffix != "" {
cmd := fmt.Sprintf("systemd-resolve --interface=%s --set-domain=%s", ifName, extIf.DNSInfo.Suffix)
_, err = p.ExecuteCommand(cmd)
_, err = nm.plClient.ExecuteCommand(cmd)
}

}
Expand Down Expand Up @@ -504,7 +503,7 @@ func (nm *networkManager) connectExternalInterface(extIf *externalInterface, nwI
if isGreaterOrEqualUbuntu17 && isSystemdResolvedActive {
logger.Info("Applying dns config on", zap.String("bridgeName", bridgeName))

if err = applyDnsConfig(extIf, bridgeName); err != nil {
if err = nm.applyDNSConfig(extIf, bridgeName); err != nil {
logger.Error("Failed to apply DNS configuration with", zap.Error(err))
return err
}
Expand Down

0 comments on commit 682977b

Please sign in to comment.