Usually the peer of a veth device is moved to a new netns
after creation, so add a pid parameter to rtnl_link_veth_add().
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
allow the parsing of {netlink,packet,unix}_diag, even if they are
using type 0 for valid attributes.
It lacked this part in nla_parse.
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
{netlink,packet,unix}_diag use attribute type 0 for valid
attributes. The value was reserved and usage was prohibited
by the protocol but we can't undo the breakge.
Make libnl accept attribute type 0 to allow parsing these
attributes.
Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
-Wall is a compiler flag, and thus should be in CFLAGS,
not CPPFLAGS. Similarly, -l belongs into LDADD/LIBADD because of
ordering constraints.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
We should copy and use the kernel header linux/tc_act/tc_mirred.h.
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
This fixes the following error while compiling libnl3 on CentOS5:
addr.c:1027: error: 'AF_RDS' undeclared here (not in a function)
addr.c:1033: error: 'AF_CAN' undeclared here (not in a function)
addr.c:1034: error: 'AF_TIPC' undeclared here (not in a function)
addr.c:1036: error: 'AF_IUCV' undeclared here (not in a function)
addr.c:1037: error: 'AF_RXRPC' undeclared here (not in a function)
addr.c:1038: error: 'AF_ISDN' undeclared here (not in a function)
addr.c:1039: error: 'AF_PHONET' undeclared here (not in a function)
make[2]: *** [addr.lo] Error 1
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
A few lines above nm->nm_nlh is already allocated with calloc, the
allocated memory has at least sizeof(struct nlmsghdr).
Signed-off-by: Olaf Hering <olaf@aepfle.de>
This patch adds ingress qdisc to libnl.
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Set the address flags when creating/updating an address with
rtnl_addr_add/rtnl_addr_build_add_request. Before, the flags
were not passed on.
As of now, the flags except IFA_F_NODAD|IFA_F_HOMEADDRESS are ignored by
the kernel. Still pass them on without filtering.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Add flags set/get methods aim to change bridge flags :
o hairpin_mode
o bpdu_guard
o root_block
o fast_leave
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
New test sample file, test-create-bridge.py
Create an bridge (testbrige) and attach an already setup interface (testtap1) to it.
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Implements basic bridge interface support using netlink protocol
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
New test sample file, test-create-bridge.c
Create an bridge (testbrige) and attach an already setup interface (testtap1) to it.
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Lookup on IFLA_INFO_KIND information to setup the right link->l_af_ops callbacks
For example, if you setup a bridge this is avoid to trig IS_BRIDGE_LINK_ASSERT() on rtnl_link_bridge_get_flags() call.
line=<optimized out>, function=<optimized out>) at assert.c:94
0x7ffff5dc39a0 "rtnl_link_bridge_get_flags") at assert.c:103
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
I modified the nl-link-set.c file to be able to set the interface up or
down. I joined the patch.
With the new nl-link-set binary I can set the tap interface down.
I am working with Ubuntu 12.04 LTS 64bits and the libnl and libnl-route
packages built from libnl3-3.2.3 from ubuntu reprositories.
--
Julien BERNARD
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Here are a few things I fixed and that provoked a python error.
I canno't answer to this thread but one solution I found while using
the python binding is to iterate over all and filter via python
http://list-archives.org/2013/09/09/libnl-lists-infradead-org/missing-feature-for-retrieving-cached-
address-objects/f/5031600704
Example:
cache = nlrta.AddressCache()
cache.resync()
for i in cache:
print ("item", i ) # then you can filter here
Signed-off-by: Thomas Graf <tgraf@suug.ch>
The varialble name should be link._rtnl_link
instead of link._link to get rid of the AttributeError.
Traceback (most recent call last):
File "examples/test.py", line 11, in <module>
eth0 = link.resolve('eth0.800')
...
File
"/home/ubuntu/libnl/python/build/lib.linux-x86_64-2.7/netlink/route/link.py",
line 151, in __init__
self._module_lookup('netlink.route.links.' + self.type)
...
File
"/home/ubuntu/libnl/python/build/lib.linux-x86_64-2.7/netlink/route/links/vlan.py",
line 70, in init
link.vlan = VLANLink(link._link)
AttributeError: 'Link' object has no attribute '_link'
Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
The message receive callback handler in the netlink api processes
the result object from the python callback. It used PyArg_ParseTuple()
to get the value, but this does not work as intended (see ref [1]).
Instead check the type and convert it accordingly.
refs:
[1] http://stackoverflow.com/questions/13636711/what-is-the-proper-usage-of-pyarg-parsetuple
Reported-by: Teto <mattator@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Adding class methods send_auto_complete() and recvmsgs()
that call their swig capi equivalent function.
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
The property name used in __str__ should be local_port
instead of localPort to get rid of the AttributeError.
>>> str(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../netlink/core.py", line 172, in __str__
return 'nlsock<{0}>'.format(self.localPort)
AttributeError: 'Socket' object has no attribute 'localPort'
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Copied the typedefs when adding callback support, but they serve
no actual use in the swig input file.
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>