seveas / python-networkmanager

Easy communication with NetworkManager
http://packages.python.org/python-networkmanager/
Other
166 stars 90 forks source link

invalid literal for long() with base 10: 'fec0::1' #58

Closed videlanicolas closed 1 year ago

videlanicolas commented 6 years ago

Hey, trying to add an IPv6 connection like this:

connection = {
      '802-3-ethernet': {'mac-address': mac_address,
                         'mac-address-blacklist': a_blacklist},
      'connection': {'autoconnect': True,
                     'id': 'myid',
                     'type': '802-3-ethernet',
                     'uuid': some_UUID},
  }
addr1 = dbus.Dictionary({
    'address': 'fec0::1',
    'prefix': dbus.UInt32(64)})
connection['ipv6'] = dbus.Dictionary({
       'address-data': dbus.Array([addr1], signature=dbus.Signature('a{sv}')),
       'gateway': '::',
       'method': 'shared'})
NetworkManager.Settings.AddConnection(connection)

But I'm getting the following: ValueError: invalid literal for long() with base 10: 'fec0::1'

Can someone please tell me where is my mistake here? Thanks!

videlanicolas commented 6 years ago

An update on this bug. I've tried to setup with the deprecated 'addresses' but still not luck:

connection = {
      '802-3-ethernet': {'mac-address': mac_address,
                         'mac-address-blacklist': a_blacklist},
      'connection': {'autoconnect': True,
                     'id': 'myid',
                     'type': '802-3-ethernet',
                     'uuid': some_UUID},
      'ipv6': {'method': 'shared'}
  }
connection['ipv6']['addresses'] = dbus.Struct(
      (
          dbus.ByteArray(socket.inet_pton(socket.AF_INET6, 'fec0::1')),
          dbus.UInt32(64),
          dbus.ByteArray(socket.inet_pton(socket.AF_INET6, '::'))
      ), signature = 'ayuay')

It fails with the following message: TypeError: 'dbus.UInt32' object is not iterable

So apparently is complaining that dbus.UInt32 is not an iterable, which is weird since I'm specifying the signature as being a single unsigned int (u). I'll keep on working on this and posting my results.

seveas commented 1 year ago

Closing all PR's and issues prior to archiving this repository.