~martijnbraam/ofonoctl

[PATCH 1/2] also add IPv6 DNS servers

Details
Message ID
<mehaiUdd0tNb2tzKQC9kuIczTAynjReGILm5WIuJ5WJEBys1Tw3qQJ_RnU8lfys7V1tzVqA1OS9Vl_UDiUIW6X19HL19AbqixaZKKlfOZ-8=@protonmail.com>
DKIM signature
pass
Download raw message
Patch: +9 -2
From: anteater <nt8r@protonmail.com>

---
 ofonoctl/__init__.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ofonoctl/__init__.py b/ofonoctl/__init__.py
index a5b54f5..52be47a 100644
--- a/ofonoctl/__init__.py
+++ b/ofonoctl/__init__.py
@@ -197,6 +197,7 @@ def action_wan(connect=False, resolv=False):
    for path, properties in contexts:
        settings4 = properties['Settings']
        settings6 = properties['IPv6.Settings']
        dns_servers = []
        if "Method" in settings4:
            s = settings4

@@ -217,8 +218,8 @@ def action_wan(connect=False, resolv=False):
                subprocess.check_output(cmd)
                cmd = ['ip', 'route', 'add', 'default', 'via', gateway, 'dev', s["Interface"]]
                subprocess.check_output(cmd)
            if resolv and s["Method"] == "static":
                update_resolvconf(s["DomainNameServers"])
            if s["Method"] == "static":
                dns_servers += s["DomainNameServers"]

        if "Method" in settings6:
            s = settings6
@@ -233,6 +234,12 @@ def action_wan(connect=False, resolv=False):
            dns = ", ".join(s["DomainNameServers"]) if s["Method"] == "static" else ""
            result.append([s["Interface"], "ipv6", properties["AccessPointName"], s["Method"], address, gateway, dns])

            if s["Method"] == "static":
                dns_servers += s["DomainNameServers"]

        if resolv:
            update_resolvconf(dns_servers)

    print(tabulate.tabulate(result, headers=["Interface", "Protocol", "APN", "Method", "Address", "Gateway", "DNS"]))


--
2.28.0
Reply to thread Export thread (mbox)