---
 test/test-connman |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/test/test-connman b/test/test-connman
index 9a855fb..c297cf7 100755
--- a/test/test-connman
+++ b/test/test-connman
@@ -18,6 +18,7 @@ if len(sys.argv) < 2:
        print "  connect <service>"
        print "  disconnect <service>"
        print "  remove <service>"
+       print "  6to4 <service> [on|off]"
        print ""
        print "  scan [type]"
        print "  enable <type>"
@@ -170,6 +171,42 @@ elif sys.argv[1] in ["remove"]:
        except dbus.DBusException, error:
                print "%s: %s" % (error._dbus_error_name, error.message)
 
+elif sys.argv[1] == "6to4":
+       if (len(sys.argv) < 3):
+               print "Need at least service parameter"
+               sys.exit(1)
+
+       path = "/profile/default/" + sys.argv[2]
+
+       service = dbus.Interface(bus.get_object("net.connman", path),
+                                               "net.connman.Service")
+       properties = service.GetProperties()
+
+       if (len(sys.argv) > 3):
+               flag = sys.argv[3].strip().lower()
+               six2four = dbus.Boolean(flag not in ['false', 'off', 'f', 'n', 
'0'])
+
+               ipv4_config = properties["IPv4.Configuration"]
+               ipv4_configuration = { "Method" : str(ipv4_config["Method"]) }
+               ipv4_configuration["6to4"] = str(six2four)
+               if "Address" in ipv4_config.keys():
+                       ipv4_configuration["Address"] = 
str(ipv4_config["Address"])
+               if "Netmask" in ipv4_config.keys():
+                       ipv4_configuration["Netmask"] = 
str(ipv4_config["Netmask"])
+               if "Gateway" in ipv4_config.keys():
+                       ipv4_configuration["Gateway"] = 
str(ipv4_config["Gateway"])
+               service.SetProperty("IPv4.Configuration", ipv4_configuration)
+
+               print "6to4 tunnelling set to %s for %s" % (six2four, 
sys.argv[2])
+       else:
+               ipv4_configuration = properties["IPv4.Configuration"]
+               if "6to4" in ipv4_configuration.keys():
+                       six2four = ipv4_configuration["6to4"]
+               else:
+                       six2four = dbus.Boolean(0)
+
+               print "6to4 tunnelling set to %s for %s" % (six2four, 
sys.argv[2])
+
 elif sys.argv[1] == "scan":
        if len(sys.argv) > 2:
                manager.RequestScan(sys.argv[2])
-- 
1.7.0.4

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to