Skip to content

Commit

Permalink
fix path for the restoring resolv.config (#1296)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Tingaikin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin authored May 18, 2022
1 parent 1955d61 commit dd9b496
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/networkservice/connectioncontext/dnscontext/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"io/ioutil"
"os"
"path"
"path/filepath"

"github.com/edwarnicke/serialize"
Expand All @@ -48,7 +49,7 @@ type dnsContextClient struct {

// NewClient creates a new DNS client chain component. Setups all DNS traffic to the localhost. Monitors DNS configs from connections.
func NewClient(options ...DNSOption) networkservice.NetworkServiceClient {
c := &dnsContextClient{
var c = &dnsContextClient{
chainContext: context.Background(),
defaultNameServerIP: "127.0.0.1",
resolveConfigPath: "/etc/resolv.conf",
Expand All @@ -57,7 +58,9 @@ func NewClient(options ...DNSOption) networkservice.NetworkServiceClient {
for _, o := range options {
o.apply(c)
}
c.storedResolvConfigPath = c.resolveConfigPath + ".restore"

var _, name = path.Split(c.resolveConfigPath)
c.storedResolvConfigPath = path.Join(path.Dir(c.coreFilePath), name+".restore")
c.initialize()
return c
}
Expand Down

0 comments on commit dd9b496

Please sign in to comment.