6 def make_variant(string):
7 return dbus.String(string, variant_level=1)
10 print "Usage: %s <service> off|manual|auto [<address> [prefixlen] [gateway]] [<privacy>]" % (sys.argv[0])
12 if (len(sys.argv) < 3):
16 bus = dbus.SystemBus()
17 path = "/net/connman/service/" + sys.argv[1]
18 service = dbus.Interface(bus.get_object('net.connman', path),
19 'net.connman.Service')
21 properties = service.GetProperties()
23 print "Setting method %s for %s" % (sys.argv[2], sys.argv[1])
25 ipv6_configuration = { "Method": make_variant(sys.argv[2])}
26 if sys.argv[2] == "auto":
27 if (len(sys.argv) > 3):
28 ipv6_configuration["Privacy"] = make_variant(sys.argv[3])
30 if (len(sys.argv) > 3):
31 ipv6_configuration["Address"] = make_variant(sys.argv[3])
32 if (len(sys.argv) > 4):
33 ipv6_configuration["PrefixLength"] = make_variant(sys.argv[4])
34 if (len(sys.argv) > 5):
35 ipv6_configuration["Gateway"] = make_variant(sys.argv[5])
37 service.SetProperty("IPv6.Configuration", ipv6_configuration)
38 print "New IPv6.Configuration: ", ipv6_configuration