{"action":"created","issue":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/247","repository_url":"https://api.github.com/repos/svinota/pyroute2","labels_url":"https://api.github.com/repos/svinota/pyroute2/issues/247/labels{/name}","comments_url":"https://api.github.com/repos/svinota/pyroute2/issues/247/comments","events_url":"https://api.github.com/repos/svinota/pyroute2/issues/247/events","html_url":"https://github.com/svinota/pyroute2/issues/247","id":153966275,"number":247,"title":"TypeError exception throw when call tc with command 'add-filter' on PandoraBox(openwrt) ","user":{"login":"coderzh","id":329164,"avatar_url":"https://avatars.githubusercontent.com/u/329164?v=3","gravatar_id":"","url":"https://api.github.com/users/coderzh","html_url":"https://github.com/coderzh","followers_url":"https://api.github.com/users/coderzh/followers","following_url":"https://api.github.com/users/coderzh/following{/other_user}","gists_url":"https://api.github.com/users/coderzh/gists{/gist_id}","starred_url":"https://api.github.com/users/coderzh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coderzh/subscriptions","organizations_url":"https://api.github.com/users/coderzh/orgs","repos_url":"https://api.github.com/users/coderzh/repos","events_url":"https://api.github.com/users/coderzh/events{/privacy}","received_events_url":"https://api.github.com/users/coderzh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/svinota/pyroute2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/svinota/pyroute2/labels/waiting%20for%20feedback","name":"waiting for feedback","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-10T09:49:32Z","updated_at":"2016-05-11T15:13:55Z","closed_at":null,"body":"I wrote this test code: \r\n\r\n```python\r\n#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n\r\nfrom pyroute2 import IPRoute\r\nfrom pyroute2.protocols import ETH_P_IP\r\nfrom pyroute2.netlink import NetlinkError\r\nfrom pyroute2.netlink.rtnl import TC_H_ROOT\r\n\r\nipr = IPRoute()\r\ndev = ipr.link_lookup(ifname='eth0')[0]\r\n\r\ntry:\r\n    ipr.tc('add', 'htb', dev, 0x10000, default=2)\r\nexcept NetlinkError as e:\r\n    if e.code == 17:\r\n        print('root htb already exist')\r\n    else:\r\n        raise\r\n\r\ntry:\r\n    ipr.tc('add-class', 'htb', dev, 0x10001, parent=0x10000, rate='100mbit', ceil='100mbit')\r\nexcept NetlinkError as e:\r\n    if e.code == 17:\r\n        print('add class 0x10001 already exist')\r\n    else:\r\n        raise\r\n\r\ntry:\r\n    # Not works on PandoraBox(openwrt) ?\r\n    ipr.tc('add-class', 'htb', dev, 0x10002, parent=0x10000, rate='100mbit', ceil='100mbit')\r\nexcept NetlinkError as e:\r\n    if e.code == 17:\r\n        print('add class 0x10002 already exist')\r\n    else:\r\n        raise\r\n\r\n\r\ntry:\r\n    ipr.tc('add-filter', 'fw', dev, 1, parent=0x10000, prio=10, protocol=ETH_P_IP, classid=0x10001)\r\nexcept NetlinkError as e:\r\n    if e.code == 17:\r\n        print('add filter already exist')\r\n    else:\r\n        raise\r\n\r\n\r\nprint('done.')\r\n```\r\n\r\nThis code works perfect on Ubuntu 14.04, but TypeError exception throws on PandoraBox(openwrt):\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 38, in <module>\r\n    ipr.tc('add-filter', 'fw', dev, 1, parent=0x10000, prio=10, protocol=ETH_P_IP, classid=0x10001)\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/iproute.py\", line 1312, in tc\r\n    return self.nlm_request(msg, msg_type=command, msg_flags=flags)\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py\", line 777, in nlm_request\r\n    return do_try()\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py\", line 755, in do_try\r\n    self.put(msg, msg_type, msg_flags, msg_seq=msg_seq)\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py\", line 536, in put\r\n    self.sendto_gate(msg, addr)\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/netlink/nlsocket.py\", line 544, in sendto_gate\r\n    msg.encode()\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/netlink/__init__.py\", line 1000, in encode\r\n    self.encode_nlas()\r\n  File \"/usr/lib/python2.7/site-packages/pyroute2/netlink/__init__.py\", line 1201, in encode_nlas\r\n    nla = msg_class(self.buf, parent=self, init=prime['init'])\r\nTypeError: object.__new__() takes no parameters\r\n```\r\n\r\nCould  you give some help about this?  Many thanks!"},"comment":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/comments/218490650","html_url":"https://github.com/svinota/pyroute2/issues/247#issuecomment-218490650","issue_url":"https://api.github.com/repos/svinota/pyroute2/issues/247","id":218490650,"user":{"login":"coderzh","id":329164,"avatar_url":"https://avatars.githubusercontent.com/u/329164?v=3","gravatar_id":"","url":"https://api.github.com/users/coderzh","html_url":"https://github.com/coderzh","followers_url":"https://api.github.com/users/coderzh/followers","following_url":"https://api.github.com/users/coderzh/following{/other_user}","gists_url":"https://api.github.com/users/coderzh/gists{/gist_id}","starred_url":"https://api.github.com/users/coderzh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coderzh/subscriptions","organizations_url":"https://api.github.com/users/coderzh/orgs","repos_url":"https://api.github.com/users/coderzh/repos","events_url":"https://api.github.com/users/coderzh/events{/privacy}","received_events_url":"https://api.github.com/users/coderzh/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T15:13:54Z","updated_at":"2016-05-11T15:13:54Z","body":"So good! I'll try it tomorow."}}