]> granicus.if.org Git - libnl/log
libnl
10 years agoroute: update copy of kernel header 'ip.h'
Thomas Haller [Thu, 20 Mar 2014 18:18:46 +0000 (19:18 +0100)]
route: update copy of kernel header 'ip.h'

Take 'include/uapi/linux/ip.h' from current kernel v3.13
(commit d8ec26d7f8287f5788a494f56e8814210f0e64be).

Also add three new IPV4_DEVCONF_* names.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: rename internal copy of kernel header file 'inetdevice.h' to 'ip.h'
Thomas Haller [Thu, 20 Mar 2014 18:18:45 +0000 (19:18 +0100)]
route: rename internal copy of kernel header file 'inetdevice.h' to 'ip.h'

libnl used 'inetdevice.h' for the IPV4_DEVCONF_* names, which the kernel
in the meantime moved to public user space API and are now defined in 'ip.h'.

As a first step, rename the file 'inetdevice.h'.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: update kernel header snmp.h and fix inet6_parse_protinfo() after kernel API...
Thomas Haller [Thu, 20 Mar 2014 18:18:44 +0000 (19:18 +0100)]
route: update kernel header snmp.h and fix inet6_parse_protinfo() after kernel API breakage

Take 'include/uapi/linux/snmp.h' from current kernel v3.13
(commit d8ec26d7f8287f5788a494f56e8814210f0e64be).

The header file added new values for IPSTATS_MIB_* and ICMP6_MIB_*, but
more importantly, the kernel broke user space API by reordering enum values in
IPSTATS_MIB_*. Add a workaround when parsing IFLA_PROTINFO trying to
be compatible with both older and newer kernels.

Note that this workaround might fail for some specific kernel versions by
assuming the old enum value mapping, although the kernel version already
contains the API change. In this case rtnl_link_get_stat() mixes up
values.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: detect missing cfgid in rtnl_link_inet_get_conf()
Thomas Haller [Thu, 20 Mar 2014 18:18:43 +0000 (19:18 +0100)]
route: detect missing cfgid in rtnl_link_inet_get_conf()

If the netlink message for IFLA_INET_CONF contains less then
IPV4_DEVCONF_MAX entires, the last entries in i_conf are unset.
Modify rtnl_link_inet_get_conf() to return -EINVAL when accessing
an unset cfgid.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: don't enforce minlen in inet6_parse_protinfo() (IFLA_PROTINFO) and inet_parse_...
Thomas Haller [Thu, 20 Mar 2014 18:18:42 +0000 (19:18 +0100)]
route: don't enforce minlen in inet6_parse_protinfo() (IFLA_PROTINFO) and inet_parse_af() (IFLA_AF_SPEC)

Older kernel version might have fewer values defined, so they would send
netlink messages that got rejected. Only check that at least one value
got sent.

This is especially grave as libnl uses an internal copy of the
kernel header files. Thus not only it is bound to the installed kernel
headers but to the libnl internal header copies that might easily be out
of sync with the kernel.

This affects IFLA_PROTINFO, inet6_parse_protinfo():
  - tb[IFLA_INET6_CONF], expecting DEVCONF_MAX
  - tb[IFLA_INET6_STATS], expecting __IPSTATS_MIB_MAX
  - tb[IFLA_INET6_ICMP6STATS], expecting __ICMP6_MIB_MAX
and IFLA_AF_SPEC, inet_parse_af():
  - tb[IFLA_INET_CONF], expecting IPV4_DEVCONF_MAX

https://bugzilla.redhat.com/show_bug.cgi?id=1062533

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agou32: add const to rtnl_u32_add_key_in*_addr()
Cong Wang [Thu, 20 Mar 2014 17:24:12 +0000 (10:24 -0700)]
u32: add const to rtnl_u32_add_key_in*_addr()

Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink: document sk == NULL case for rtnl_link_alloc_cache()
Cong Wang [Thu, 20 Mar 2014 17:45:45 +0000 (10:45 -0700)]
link: document sk == NULL case for rtnl_link_alloc_cache()

When sk == NULL, rtnl_link_alloc_cache() returns 0 but the cache
is still empty. We should document this behavior, otherwise it is confusing.

Cc: Thomas Haller <thaller@redhat.com>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoutils: indicate capability NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE
Thomas Haller [Thu, 13 Mar 2014 12:16:51 +0000 (13:16 +0100)]
utils: indicate capability NL_CAPABILITY_ROUTE_BUILD_MSG_SET_SCOPE

This capability indicates that libnl does no longer overwrites
the route scope in rtnl_route_build_msg(), as fixed by commit
85ec9c7ad80c60f4f619472f2bb9d9595da93b26.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoutils: add nl_has_capability() function
Thomas Haller [Thu, 13 Mar 2014 12:16:05 +0000 (13:16 +0100)]
utils: add nl_has_capability() function

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agofill prio and protocol attr bits when parsing cls message
Cong Wang [Wed, 12 Mar 2014 23:42:39 +0000 (16:42 -0700)]
fill prio and protocol attr bits when parsing cls message

Otherwise, the filter we get from a cls cache can't be used
for removal.

Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoremove some useless code in lib/route/cls/u32.c
Cong Wang [Wed, 26 Feb 2014 21:35:13 +0000 (13:35 -0800)]
remove some useless code in lib/route/cls/u32.c

Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agofix comments for rtnl_act_add()
Cong Wang [Wed, 26 Feb 2014 21:35:12 +0000 (13:35 -0800)]
fix comments for rtnl_act_add()

Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobasic: make BASIC_ATTR_TARGET optional
Cong Wang [Wed, 26 Feb 2014 21:35:11 +0000 (13:35 -0800)]
basic: make BASIC_ATTR_TARGET optional

At least in kernel TCA_BASIC_CLASSID is optional.

Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: rtnl_route_build_msg() should not overwrite the route scope
Thomas Haller [Thu, 13 Feb 2014 20:31:37 +0000 (21:31 +0100)]
route: rtnl_route_build_msg() should not overwrite the route scope

rtnl_route_build_msg() should allow the user to set the route scope
explicitly to RT_SCOPE_NOWHERE.

This is useful for IPv4 routes, because when deleting a route,
the kernel requires the scope to match, unless the scope is set to
RT_SCOPE_NOWHERE. Thus by setting the scope to RT_SCOPE_NOWHERE,
the user can delete a route, even without knowing its scope.

rtnl_route_build_msg() should only try to guess the scope, if it was
not explicitly specified.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
10 years agoutils: fix nl_msec2str() which always returned '0msec' for whole second durations
Thomas Haller [Wed, 19 Feb 2014 18:22:13 +0000 (19:22 +0100)]
utils: fix nl_msec2str() which always returned '0msec' for whole second durations

If the duration was without subsecond part, the function always returned
'0msec', instead of giving the time in days, hours, minutes or seconds.

Regression introduced by commit b3fb89f445108677d405c62865b25aeea209d10a.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
10 years agoremove nl_cache_lookup() from cache.h
Cong Wang [Wed, 29 Jan 2014 23:45:03 +0000 (15:45 -0800)]
remove nl_cache_lookup() from cache.h

It is never defined.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoremove the obsolete src/cls directory
Cong Wang [Wed, 29 Jan 2014 23:45:02 +0000 (15:45 -0800)]
remove the obsolete src/cls directory

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: fix return value of nl_rtgen_request()
Thomas Haller [Fri, 31 Jan 2014 13:15:13 +0000 (14:15 +0100)]
route: fix return value of nl_rtgen_request()

According to documentation, nl_rtgen_request() returns 0 on success,
but before it returned the number of bytes sent.

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: fix error when running `configure --disable-doc`
Thomas Haller [Wed, 29 Jan 2014 17:13:35 +0000 (18:13 +0100)]
build: fix error when running `configure --disable-doc`

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolibnl-3.2.24 release libnl3_2_24
Thomas Haller [Tue, 21 Jan 2014 18:47:27 +0000 (19:47 +0100)]
libnl-3.2.24 release

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agodoc: fix typo in documentation
Thomas Haller [Wed, 8 Jan 2014 16:23:05 +0000 (17:23 +0100)]
doc: fix typo in documentation

Also fix typo in source code comment.

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agopython: fix build error for missing library_path in setup.py
Thomas Haller [Tue, 21 Jan 2014 18:05:37 +0000 (19:05 +0100)]
python: fix build error for missing library_path in setup.py

Patch obtained from gentoo package.

https://bugs.gentoo.org/show_bug.cgi?id=477110
https://bugs.gentoo.org/show_bug.cgi?id=490584

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoaddr: add address flag IFA_F_NOPREFIXROUTE
Thomas Haller [Wed, 8 Jan 2014 00:44:58 +0000 (01:44 +0100)]
addr: add address flag IFA_F_NOPREFIXROUTE

Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agoact: remove rtnl_act_alloc_cache()
Cong Wang [Wed, 15 Jan 2014 01:37:42 +0000 (17:37 -0800)]
act: remove rtnl_act_alloc_cache()

It is complicated to cache tc actions, they are different
from tc qdisc's and filters by design. So, it is simple
if we just don't cache them.

This patch only removes the tc action cache allocation API.
We still need to bypass the libnl cache layer from scratch,
but that would not break ABI any more, therefore we can do
it later.

Cc: Thomas Graf <tgraf@suug.ch>
Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agobridge: add rtnl_link_add_bridge() function
HongweiBi [Thu, 2 Jan 2014 03:29:42 +0000 (11:29 +0800)]
bridge: add rtnl_link_add_bridge() function

Signed-off-by: HongweiBi <hwbi2008@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agoaddr: add address flag IFA_F_MANAGETEMPADDR
Thomas Haller [Thu, 2 Jan 2014 09:51:38 +0000 (10:51 +0100)]
addr: add address flag IFA_F_MANAGETEMPADDR

Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agoadd support for IFA_FLAGS nl attribute
Jiri Pirko [Sun, 8 Dec 2013 11:26:24 +0000 (12:26 +0100)]
add support for IFA_FLAGS nl attribute

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agoroute: add libnl name prefix to global variable link_policy
Thomas Haller [Thu, 2 Jan 2014 10:00:31 +0000 (11:00 +0100)]
route: add libnl name prefix to global variable link_policy

Public names should be prefixed with a libnl specific
prefix to avoid name collisions. Rename link_policy to
rtln_link_policy.

Related bugs:
  https://github.com/thom311/libnl/issues/52
  https://bugzilla.gnome.org/show_bug.cgi?id=720902
  https://bugs.gentoo.org/show_bug.cgi?id=494986
  https://bugs.gentoo.org/show_bug.cgi?id=494890

Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agolibnl-3.2.24-rc1 release libnl3_2_24rc1
Thomas Haller [Mon, 16 Dec 2013 19:57:57 +0000 (20:57 +0100)]
libnl-3.2.24-rc1 release

Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agobuild: fix build failure when using different build dir (make distcheck)
Thomas Haller [Mon, 16 Dec 2013 20:19:14 +0000 (21:19 +0100)]
build: fix build failure when using different build dir (make distcheck)

`make distcheck` builds outside the source directory using
`../configure --srcdir=..`. This was broken because libnl.sym was
expected in the $(top_srcdir) instead of $(top_builddir).

Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agou32: add rtnl_u32_get_key()
Cong Wang [Fri, 13 Dec 2013 23:24:50 +0000 (15:24 -0800)]
u32: add rtnl_u32_get_key()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
11 years agocache: Add missing declaration for nl_cache_find()
Thomas Graf [Fri, 13 Dec 2013 14:57:43 +0000 (15:57 +0100)]
cache: Add missing declaration for nl_cache_find()

Reported-by: Andrej.Gantvorg@wago.com
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd declaration for rtnl_basic_add_action()
Cong Wang [Wed, 4 Dec 2013 04:16:10 +0000 (20:16 -0800)]
add declaration for rtnl_basic_add_action()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoRevert "basic: Add missing declaration for rtnl_basic_add_action()"
Thomas Graf [Wed, 11 Dec 2013 08:10:32 +0000 (09:10 +0100)]
Revert "basic: Add missing declaration for rtnl_basic_add_action()"

This reverts commit 4b84836085067722882129b8c6a864364ae4ca42.

11 years agoRevert "basic: Declare rtnl_act in basic.h to silence warning"
Thomas Graf [Wed, 11 Dec 2013 08:10:26 +0000 (09:10 +0100)]
Revert "basic: Declare rtnl_act in basic.h to silence warning"

This reverts commit a858d996e952af5bf449b87775f74355d492a0ec.

11 years agoadd an assertion in rtnl_tc_set_link()
Cong Wang [Wed, 4 Dec 2013 04:16:11 +0000 (20:16 -0800)]
add an assertion in rtnl_tc_set_link()

So that we can catch the bug easily.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agobasic: Declare rtnl_act in basic.h to silence warning
Thomas Graf [Mon, 9 Dec 2013 14:43:33 +0000 (15:43 +0100)]
basic: Declare rtnl_act in basic.h to silence warning

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agofix some typo in lib/route/act.c
Cong Wang [Fri, 6 Dec 2013 22:58:38 +0000 (14:58 -0800)]
fix some typo in lib/route/act.c

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agobasic: Add missing declaration for rtnl_basic_add_action()
Thomas Graf [Mon, 9 Dec 2013 14:39:11 +0000 (15:39 +0100)]
basic: Add missing declaration for rtnl_basic_add_action()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agobasic: add action removal API
Cong Wang [Thu, 5 Dec 2013 23:48:30 +0000 (15:48 -0800)]
basic: add action removal API

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agou32: add action removal API
Cong Wang [Thu, 5 Dec 2013 23:48:29 +0000 (15:48 -0800)]
u32: add action removal API

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd rtnl_mirred_get* functions
Cong Wang [Thu, 5 Dec 2013 23:48:28 +0000 (15:48 -0800)]
add rtnl_mirred_get* functions

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agorename rtnl_mirred_set_index() to rtnl_mirred_set_ifindex()
Cong Wang [Thu, 5 Dec 2013 23:48:27 +0000 (15:48 -0800)]
rename rtnl_mirred_set_index() to rtnl_mirred_set_ifindex()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agofix a bug in rtnl_act_fill()
Cong Wang [Thu, 5 Dec 2013 23:48:26 +0000 (15:48 -0800)]
fix a bug in rtnl_act_fill()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd declaration for rtnl_cls_change()
Cong Wang [Thu, 5 Dec 2013 23:48:25 +0000 (15:48 -0800)]
add declaration for rtnl_cls_change()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd a parameter to rtnl_link_veth_add()
Cong Wang [Wed, 4 Dec 2013 04:16:08 +0000 (20:16 -0800)]
add a parameter to rtnl_link_veth_add()

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>
11 years agofix rtnl_link_info_parse() and rtnl_link_fill_info()
Cong Wang [Wed, 4 Dec 2013 04:16:09 +0000 (20:16 -0800)]
fix rtnl_link_info_parse() and rtnl_link_fill_info()

So that the veth peer could be parsed correctly.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoThe commit 6a8d90f5fec4 "attr: Allow attribute type 0" intended to
Samuel Gauthier [Fri, 29 Nov 2013 08:28:44 +0000 (09:28 +0100)]
The commit 6a8d90f5fec4 "attr: Allow attribute type 0" intended to
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>
11 years agoattr: Allow attribute type 0
Thomas Graf [Thu, 28 Nov 2013 22:14:38 +0000 (23:14 +0100)]
attr: Allow attribute type 0

{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>
11 years agobuild: separate compiler and linker flags
Jan Engelhardt [Tue, 26 Nov 2013 14:19:45 +0000 (15:19 +0100)]
build: separate compiler and linker flags

-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>
11 years agoadd fq_codel cli module
Cong Wang [Wed, 20 Nov 2013 05:10:05 +0000 (21:10 -0800)]
add fq_codel cli module

Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd fq_codel qdisc
Cong Wang [Wed, 20 Nov 2013 05:10:04 +0000 (21:10 -0800)]
add fq_codel qdisc

Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agofix linux/pkt_act.h inclusion
Cong Wang [Mon, 11 Nov 2013 23:17:49 +0000 (15:17 -0800)]
fix linux/pkt_act.h inclusion

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>
11 years agolink: Fall back to global provisioned link cache if object is not a cache resident
Thomas Graf [Sat, 9 Nov 2013 09:04:35 +0000 (10:04 +0100)]
link: Fall back to global provisioned link cache if object is not a cache resident

... if that fails, print ifindices directly.

Reported-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd veth.h into include/Makefile.am
Cong Wang [Sat, 9 Nov 2013 00:07:12 +0000 (16:07 -0800)]
add veth.h into include/Makefile.am

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agobasic: add action support
Cong Wang [Fri, 8 Nov 2013 18:47:53 +0000 (10:47 -0800)]
basic: add action support

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd u32 action test
Cong Wang [Fri, 8 Nov 2013 18:47:52 +0000 (10:47 -0800)]
add u32 action test

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd u32 action support
Cong Wang [Fri, 8 Nov 2013 18:47:51 +0000 (10:47 -0800)]
add u32 action support

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd mirred tc action
Cong Wang [Fri, 8 Nov 2013 18:47:50 +0000 (10:47 -0800)]
add mirred tc action

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd initial tc action support
Cong Wang [Fri, 8 Nov 2013 18:47:49 +0000 (10:47 -0800)]
add initial tc action support

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agodo not compile some address families when not available
Cong Wang [Fri, 8 Nov 2013 19:32:13 +0000 (11:32 -0800)]
do not compile some address families when not available

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>
11 years agoMerge pull request #50 from olafhering/olh_memset__nlmsg_alloc
Thomas Graf [Fri, 8 Nov 2013 23:47:06 +0000 (15:47 -0800)]
Merge pull request #50 from olafhering/olh_memset__nlmsg_alloc

Remove extra memset from __nlmsg_alloc

11 years agoRemove extra memset from __nlmsg_alloc
Olaf Hering [Fri, 8 Nov 2013 16:15:16 +0000 (17:15 +0100)]
Remove extra memset from __nlmsg_alloc

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>
11 years agopython: Include all files in distribution
Thomas Graf [Wed, 6 Nov 2013 09:28:37 +0000 (10:28 +0100)]
python: Include all files in distribution

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agofactor out rtnl_link_info_parse()
Cong Wang [Fri, 1 Nov 2013 23:58:47 +0000 (16:58 -0700)]
factor out rtnl_link_info_parse()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd link netns support
Cong Wang [Fri, 1 Nov 2013 23:58:49 +0000 (16:58 -0700)]
add link netns support

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd veth link support
Cong Wang [Fri, 1 Nov 2013 23:58:48 +0000 (16:58 -0700)]
add veth link support

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agofactor out rtnl_link_fill_info()
Cong Wang [Fri, 1 Nov 2013 23:58:46 +0000 (16:58 -0700)]
factor out rtnl_link_fill_info()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd ingress qdisc
Cong Wang [Fri, 25 Oct 2013 06:59:15 +0000 (23:59 -0700)]
add ingress qdisc

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>
11 years ago3.2.23 release libnl3_2_23
Thomas Graf [Wed, 30 Oct 2013 23:11:18 +0000 (00:11 +0100)]
3.2.23 release

11 years agotests: fix make test-create-vxlan
Cong Wang [Fri, 25 Oct 2013 07:02:05 +0000 (00:02 -0700)]
tests: fix make test-create-vxlan

Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agolibnl-3.2.23-rc2 release libnl3_2_23rc2
Thomas Graf [Wed, 23 Oct 2013 09:06:50 +0000 (11:06 +0200)]
libnl-3.2.23-rc2 release

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoinclude: Provide <netlink/route/link/vxlan.h> in distribution
Thomas Graf [Wed, 23 Oct 2013 07:28:05 +0000 (09:28 +0200)]
include: Provide <netlink/route/link/vxlan.h> in distribution

Reported-by: Jeroen Roovers <jer@gentoo.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoFix up -rc1 versioning to not be included in libnl_micro_version
Thomas Graf [Tue, 22 Oct 2013 14:45:21 +0000 (16:45 +0200)]
Fix up -rc1 versioning to not be included in libnl_micro_version

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agodoc: Add instructions on how to build docs
Thomas Graf [Tue, 22 Oct 2013 14:33:27 +0000 (16:33 +0200)]
doc: Add instructions on how to build docs

Reported-by: Teto <mattator@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agodoxygen-link: Be python3 compatible
Thomas Graf [Tue, 22 Oct 2013 14:32:23 +0000 (16:32 +0200)]
doxygen-link: Be python3 compatible

Reported-by: Teto <mattator@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agolibnl-3.2.23-rc1 release libnl3_2_23rc1
Thomas Graf [Tue, 22 Oct 2013 13:26:12 +0000 (15:26 +0200)]
libnl-3.2.23-rc1 release

11 years agortnl-addr: set ifa_flags when creating/updating address
Thomas Haller [Tue, 22 Oct 2013 08:38:14 +0000 (10:38 +0200)]
rtnl-addr: set ifa_flags when creating/updating address

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>
11 years agoobj: Check for NULL pointer in nl_object_clone()
Thomas Graf [Tue, 22 Oct 2013 12:16:43 +0000 (14:16 +0200)]
obj: Check for NULL pointer in nl_object_clone()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agopython: add bridge flags API
Nicolas PLANEL [Fri, 11 Oct 2013 15:52:22 +0000 (15:52 +0000)]
python: add bridge flags API

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>
11 years agotest: add python bridge testing sample
Nicolas PLANEL [Thu, 10 Oct 2013 22:34:18 +0000 (22:34 +0000)]
test: add python bridge testing sample

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>
11 years agopython: add basic netlink protocol bridge interface support
Nicolas PLANEL [Thu, 10 Oct 2013 22:27:44 +0000 (22:27 +0000)]
python: add basic netlink protocol bridge interface support

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>
11 years agotest: add bridge creation sample
Nicolas PLANEL [Thu, 10 Oct 2013 21:43:12 +0000 (21:43 +0000)]
test: add bridge creation sample

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>
11 years agoroute/link: fixup link->l_af_ops must be set for some kind of links
Nicolas PLANEL [Thu, 10 Oct 2013 20:51:38 +0000 (20:51 +0000)]
route/link: fixup link->l_af_ops must be set for some kind of links

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>
11 years agonl-link-set: Add --state option
Julien BERNARD [Tue, 8 Oct 2013 11:04:30 +0000 (13:04 +0200)]
nl-link-set: Add --state option

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>
11 years agoMerge branch 'recvmsgs-comment-typo' of git://github.com/olafhering/libnl into olafhe...
Thomas Graf [Mon, 7 Oct 2013 09:40:13 +0000 (11:40 +0200)]
Merge branch 'recvmsgs-comment-typo' of git://github.com/olafhering/libnl into olafhering-recvmsgs-comment-typo

11 years agoFixed ObjIterator for python3, fixed output of _color and added missing parameter...
Teto [Wed, 2 Oct 2013 20:18:31 +0000 (22:18 +0200)]
Fixed ObjIterator for python3, fixed output of _color and added missing parameter to nl_cache_resync

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>
11 years agopython: fixup VLANLink() initialization
Nicolas PLANEL [Tue, 1 Oct 2013 19:58:36 +0000 (15:58 -0400)]
python: fixup VLANLink() initialization

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>
11 years agopython: remove use of PyArg_ParseTuple() for callback result
Arend van Spriel [Mon, 30 Sep 2013 08:21:46 +0000 (10:21 +0200)]
python: remove use of PyArg_ParseTuple() for callback result

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>
11 years agonl: Fix comment typo on recvmsgs
Olaf Hering [Tue, 1 Oct 2013 16:23:54 +0000 (18:23 +0200)]
nl: Fix comment typo on recvmsgs

Signed-off-by: Olaf Hering <olaf@aepfle.de>
11 years agopython: add send and receive functions to Socket class
Arend van Spriel [Thu, 5 Sep 2013 12:11:32 +0000 (14:11 +0200)]
python: add send and receive functions to Socket class

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>
11 years agopython: fix typo in Socket::__str__() function
Arend van Spriel [Thu, 5 Sep 2013 12:11:25 +0000 (14:11 +0200)]
python: fix typo in Socket::__str__() function

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>
11 years agopython: remove unnecessary callback type definitions
Arend van Spriel [Thu, 5 Sep 2013 12:11:28 +0000 (14:11 +0200)]
python: remove unnecessary callback type definitions

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>
11 years agopython: allow callback function to be a class method
Arend van Spriel [Thu, 5 Sep 2013 12:11:27 +0000 (14:11 +0200)]
python: allow callback function to be a class method

The callback functionality only worked for regular Python
functions. With this patch it also allows the callback
to be a class method (bounded or unbounded) as show in
example below.

class test_class(object):
def my_callback(self, msg, arg):
print('handling %s' % str(msg))

s = netlink.core.Socket()
testobj = test_class()
netlink.capi.py_nl_cb_set(cb, netlink.capi.NL_CB_VALID,
  netlink.capi.NL_CB_CUSTOM,
  test_class.my_callback, testobj)
netlink.capi.py_nl_cb_err(cb, netlink.capi.NL_CB_CUSTOM,
                          test_class.my_callback, s)

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agouse Callback object constructing Socket
Arend van Spriel [Thu, 5 Sep 2013 12:11:31 +0000 (14:11 +0200)]
use Callback object constructing Socket

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agopython: rework netlink callback handling
Arend van Spriel [Thu, 5 Sep 2013 12:11:26 +0000 (14:11 +0200)]
python: rework netlink callback handling

The initial commit adding netlink callback handling also introduced
memory leak issue. The python callback info was stored in an allocated
structure, but that was never freed.

Only exposing nl_cb_alloc() as is. nl_cb_get() is removed as it is
not very useful to use reference counting mechanism. Python uses
that itself internally. To deal properly with Python callback info
the function nl_cb_put() and nl_cb_clone() have a custom wrapper
taking care of Python reference counting.

This commit also adds a Callback python class using the netlink
callback functions.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agonl_cb: store nl_cb_type in struct nl_cb
Arend van Spriel [Thu, 5 Sep 2013 12:11:29 +0000 (14:11 +0200)]
nl_cb: store nl_cb_type in struct nl_cb

The application could use the same handler for multiple
nl_cb_type events. This patch stores the nl_cb_type in
the nl_cb struct during the callback. This allows the
application to obtain that information using the new
nl_cb_active_type() function. This way the callback
signature remains as is so existing applications are
not affected.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoadd python examples using swig provided api
Arend van Spriel [Thu, 5 Sep 2013 12:11:30 +0000 (14:11 +0200)]
add python examples using swig provided api

using the nl80211 family to show use of generic netlink api and
attribute parsing.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agonetfilter/ct: support optional CTA_ZONE attribute
Holger Eitzenberger [Fri, 30 Aug 2013 08:50:23 +0000 (10:50 +0200)]
netfilter/ct: support optional CTA_ZONE attribute

Newer kernels support conntrack zones, which help to partition the
conntrack table into virtual conntrack tables.

This patch is for adding support for the optional attribute, adds
setters and getters, and adds support for the zone ID in the conntrack
dumper.

An example entry in NL_DUMP_LINE format looks like:

  tcp SYN_SENT 10.128.128.99:43354 <-> 10.128.129.20:22 zone 1

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agonetfilter/ct: support optional CTA_TIMESTAMP attribute
Holger Eitzenberger [Fri, 30 Aug 2013 08:50:22 +0000 (10:50 +0200)]
netfilter/ct: support optional CTA_TIMESTAMP attribute

Recent kernels support conntrack time stamping, which is a helpful
feature to determine the duration of a flow without building a flow
cache in your user space application, just to keep the 'start' time of
your flow.

Timestamps are recorded with nanosecond resolution once this feature
is enabled.

This patch adds optional support for the CTA_TIMESTAMP, then
modifies the dump routine to write that info in a format similar
to /proc/net/nf_conntrack.  This is an example output when using
NL_DUMP_LINE:

  udp 10.128.128.28:56836 <-> 10.128.129.255:8612 delta-time 30

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>