Skip to content

Commit

Permalink
z0 - fix VPN DNS setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Saidl committed Aug 6, 2023
1 parent 572c814 commit 0010082
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
17 changes: 11 additions & 6 deletions src/vpn/dnsCleanNetworkSetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ package vpn

import (
"context"
"fmt"
"os"
)

func (h *Handler) dnsCleanNetworkSetup(ctx context.Context) error {

os.Remove("/etc/resolver/zerops")
{
stdin := "remove State:/Network/Service/zerops_vpn_service/IPv6\n"
if _, err := h.runCommand(ctx, makeCommand("scutil", commandWithStdin(stdin))); err != nil {
return err
}
}

stdin := fmt.Sprintf(`remove State:/Network/Service/zerops_vpn_service/IPv6
remove Setup:/Network/Service/zerops_vpn_service/IPv6`)

if _, err := h.runCommand(ctx, makeCommand("scutil", commandWithStdin(stdin))); err != nil {
return err
{
stdin := "remove Setup:/Network/Service/zerops_vpn_service/IPv6\n"
if _, err := h.runCommand(ctx, makeCommand("scutil", commandWithStdin(stdin))); err != nil {
return err
}
}

return nil
Expand Down
25 changes: 21 additions & 4 deletions src/vpn/setDnsNetworksetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,35 @@ func (h *Handler) setDnsNetworksetup(ctx context.Context) error {
return err
}

stdin := fmt.Sprintf(`d.init
{
stdin := fmt.Sprintf(`d.init
d.add Addresses * fe80::1d04:6b6d:7ad7:85e4 2600:3c03::de:d002
d.add DestAddresses * ::ffff:ffff:ffff:ffff:0:0 ::
d.add Flags * 0 0
d.add InterfaceName %s
d.add PrefixLength * 64 116
set State:/Network/Service/zerops_vpn_service/IPv6
set Setup:/Network/Service/zerops_vpn_service/IPv6`, data.InterfaceName)
`, data.InterfaceName)

if _, err := h.runCommand(ctx, makeCommand("scutil", commandWithStdin(stdin))); err != nil {
return err
}

if _, err := h.runCommand(ctx, makeCommand("scutil", commandWithStdin(stdin))); err != nil {
return err
}
{
stdin := fmt.Sprintf(`d.init
d.add Addresses * fe80::1d04:6b6d:7ad7:85e4 2600:3c03::de:d002
d.add DestAddresses * ::ffff:ffff:ffff:ffff:0:0 ::
d.add Flags * 0 0
d.add InterfaceName %s
d.add PrefixLength * 64 116
set Setup:/Network/Service/zerops_vpn_service/IPv6
`, data.InterfaceName)

if _, err := h.runCommand(ctx, makeCommand("scutil", commandWithStdin(stdin))); err != nil {
return err
}

}
return nil
}

0 comments on commit 0010082

Please sign in to comment.