Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help with TypeError: #526

Closed
vinod9987 opened this issue Jul 13, 2018 · 7 comments
Closed

Need help with TypeError: #526

vinod9987 opened this issue Jul 13, 2018 · 7 comments
Labels

Comments

@vinod9987
Copy link

Hi All,

I am trying to create a simple Vlan like below but I am running into issues. This might be silly question but I am still learning, so please help.

eth1.101  Link encap:Ethernet HWaddr 80:18:44:E0:12:D5  
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:252 (252.0 b)

I am using below code -

from pyroute2 import IPDB
ipdb = IPDB()
link_iface_name = 'eth1'
vlan_iface_name = 'eth1.101'
vlan_iface_id = 101
ipdb = IPDB()
link_iface = ipdb.interfaces[link_iface_name]
with ipdb.create(kind="vlan", ifname=vlan_iface_name, link=link_iface, vlan_id=vlan_iface_id).commit() as i:
        i.add_ip("192.168.1.10", 24)
        i.mtu = 1500
ipdb.release()

And I am getting below error -

Traceback (most recent call last):
  File "./createVlan.py", line 8, in <module>
    link_iface = ipdb.interfaces[link_iface_name]
  File "/usr/local/lib/python2.7/site-packages/pyroute2/ipdb/main.py", line 1004, in __getattribute__
    obj._register()
  File "/usr/local/lib/python2.7/site-packages/pyroute2/ipdb/interfaces.py", line 1154, in _register
    links = self.ipdb.nl.get_links()
  File "/usr/local/lib/python2.7/site-packages/pyroute2/iproute/linux.py", line 237, in get_links
    result.extend(self.link(cmd, **kwarg))
  File "/usr/local/lib/python2.7/site-packages/pyroute2/iproute/linux.py", line 1114, in link
    msg_flags=msg_flags)
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 351, in nlm_request
    return tuple(self._genlm_request(*argv, **kwarg))
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 832, in nlm_request
    callback=callback):
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 354, in get
    return tuple(self._genlm_get(*argv, **kwarg))
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 744, in get
    data = self.recv_ft(bufsize)
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/rtnl/iprsocket.py", line 79, in _p_recv_ft
    data = self._recv_ft(bufsize, flags)
TypeError: recv_ft() takes at most 2 arguments (3 given)

I have even tried -

Python 2.7.11 (default, Jun 13 2018, 10:30:02) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyroute2 import IPDB
>>> ip = IPDB()
>>> ip.by_name.keys()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pyroute2/ipdb/main.py", line 1004, in __getattribute__
    obj._register()
  File "/usr/local/lib/python2.7/site-packages/pyroute2/ipdb/interfaces.py", line 1154, in _register
    links = self.ipdb.nl.get_links()
  File "/usr/local/lib/python2.7/site-packages/pyroute2/iproute/linux.py", line 237, in get_links
    result.extend(self.link(cmd, **kwarg))
  File "/usr/local/lib/python2.7/site-packages/pyroute2/iproute/linux.py", line 1114, in link
    msg_flags=msg_flags)
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 351, in nlm_request
    return tuple(self._genlm_request(*argv, **kwarg))
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 832, in nlm_request
    callback=callback):
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 354, in get
    return tuple(self._genlm_get(*argv, **kwarg))
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py", line 744, in get
    data = self.recv_ft(bufsize)
  File "/usr/local/lib/python2.7/site-packages/pyroute2/netlink/rtnl/iprsocket.py", line 79, in _p_recv_ft
    data = self._recv_ft(bufsize, flags)
TypeError: recv_ft() takes at most 2 arguments (3 given)
>>> 

I am using freshly installed Centos 6.9 on kernel 2.6.32-696.30.1.el6.x86_64. Any help is truly appreciated.

Thanks,
Vinod

@svinota
Copy link
Owner

svinota commented Jul 13, 2018

Ough! Which pyroute2 version do you use?

@svinota
Copy link
Owner

svinota commented Jul 13, 2018

Got it. It's a bug in the library, sorry. Fixing.

@svinota svinota added the bug label Jul 13, 2018
@svinota
Copy link
Owner

svinota commented Jul 13, 2018

The bug appears only on old kernels < 3.3.0, caused by the internal library API. Will be fixed tonight.

@vinod9987
Copy link
Author

Thanks for looking into this Peter.
I am using Version: 0.5.2

Regards,
Vinod

@svinota
Copy link
Owner

svinota commented Jul 14, 2018

Tried to make a simple quick-fix, but the issue is a bit more complicated. I'm trying to fix it until the next weekend. Sorry for the delay.

@vinod9987
Copy link
Author

Peter any way forward you found for this issue?

Thanks,
Vinod

svinota added a commit that referenced this issue Sep 27, 2018
@svinota
Copy link
Owner

svinota commented Sep 27, 2018

@vinod9987 can you check — if it's working now? I started to fix but then suddenly didn't do the last step, sorry. There it is (I hope).

@svinota svinota closed this as completed May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants