6 if (len(sys.argv) < 3):
7 print "Usage: %s <address> <netmask | prefix length> <gateway> [version]" % (sys.argv[0])
10 bus = dbus.SystemBus()
12 manager = dbus.Interface(bus.get_object('net.connman', "/"),
13 'net.connman.Manager')
15 properties = manager.GetProperties()
17 for path in properties["Services"]:
18 service = dbus.Interface(bus.get_object('net.connman', path),
19 'net.connman.Service')
21 properties = service.GetProperties()
25 if (len(sys.argv) == 5 and sys.argv[4] == "ipv6"):
30 print "Setting IPv%d address %s for %s" % (ipv, sys.argv[1], path)
33 service.SetProperty("IPv4.Configuration",
35 "Address": sys.argv[1],
36 "Netmask": sys.argv[2],
37 "Gateway": sys.argv[3]})
39 service.SetProperty("IPv6.Configuration",
41 "Address": sys.argv[1],
42 "PrefixLength": sys.argv[2],
43 "Gateway": sys.argv[3]})