]> granicus.if.org Git - libnl/log
libnl
8 years agoxfrm: merge branch 'xfrm/various-fixes'
Thomas Haller [Sat, 25 Jun 2016 15:36:07 +0000 (17:36 +0200)]
xfrm: merge branch 'xfrm/various-fixes'

http://lists.infradead.org/pipermail/libnl/2016-June/002138.html

8 years agoxfrm: fix memleak in build_xfrm_sa_message() error-path
Thomas Haller [Sat, 25 Jun 2016 15:33:31 +0000 (17:33 +0200)]
xfrm: fix memleak in build_xfrm_sa_message() error-path

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agoxfrm: attach only one xfrm alg attribute to netlink message
Thomas Egerer [Fri, 10 Jun 2016 09:57:57 +0000 (11:57 +0200)]
xfrm: attach only one xfrm alg attribute to netlink message

The kernel only uses the xfrm alg auth attribute if the xfrm alg auth
truncated attribute is not present. Hence sending both attributes in one
message does not make sense.
This piece of code also removes the call to nla_reserve in favor of the
NLA_PUT macro.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-June/002139.html

8 years agoxfrm: fix memory leak for encap original address
Thomas Egerer [Fri, 10 Jun 2016 09:57:55 +0000 (11:57 +0200)]
xfrm: fix memory leak for encap original address

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-June/002141.html

8 years agoxfrm: reuse encap data in xfrmnl_sa_set_encap_tmpl()
Thomas Haller [Sat, 25 Jun 2016 15:31:20 +0000 (17:31 +0200)]
xfrm: reuse encap data in xfrmnl_sa_set_encap_tmpl()

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agoxfrm: fix segfault when using encapsulation templates
Thomas Egerer [Fri, 10 Jun 2016 09:57:53 +0000 (11:57 +0200)]
xfrm: fix segfault when using encapsulation templates

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-June/002140.html

8 years agoxfrm: make character pointers in setters const
Thomas Egerer [Mon, 6 Jun 2016 13:21:35 +0000 (15:21 +0200)]
xfrm: make character pointers in setters const

All of these pointers are either strcpy'd or memcpy'd and usually const
in a calling application. Changing them to const in the header does not
break the compatibility and allows for users with const pointers to use
the library without compiler warnings.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-June/002137.html

8 years agoxfrm: merge branch 'xfrm/buffer-overflows'
Thomas Haller [Sat, 25 Jun 2016 11:55:59 +0000 (13:55 +0200)]
xfrm: merge branch 'xfrm/buffer-overflows'

http://lists.infradead.org/pipermail/libnl/2016-May/002134.html

8 years agoxfrm: check length of alg_name before strcpying it
Thomas Egerer [Tue, 31 May 2016 15:30:03 +0000 (17:30 +0200)]
xfrm: check length of alg_name before strcpying it

If the parameter alg_name points to a string longer then what libnl
accepts as alg_name, the call to strcpy may write far beyond the
particular data structure.
Instead of truncating the string (using strncpy) this patch adds a check
and returns -1 for strings being longer than 63 bytes.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Fixes: 917154470895520a77f527343f3a0cc1605934b0
http://lists.infradead.org/pipermail/libnl/2016-May/002133.html

8 years agoxfrm: fix buffer overflow when copying keys
Thomas Egerer [Tue, 31 May 2016 15:29:58 +0000 (17:29 +0200)]
xfrm: fix buffer overflow when copying keys

A colleague of mine came to notice that -- when adding keys to the
xfrm-part of libnl -- memcpy is given newlen, which copies sizeof(struct
xfrmnl_...) plus keysize instead of only the keysize.
This patch uses a keysize parameter to only copy the required number of
bytes.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Fixes: 917154470895520a77f527343f3a0cc1605934b0
http://lists.infradead.org/pipermail/libnl/2016-May/002132.html

8 years agolib: return error on Netlink attribute length overflow
Przemyslaw Szczerbik [Mon, 30 May 2016 21:26:00 +0000 (23:26 +0200)]
lib: return error on Netlink attribute length overflow

Netlink attribute length is defined as u16. It's possible to exceed nla_len when
creating nested attributes. Storing incorrect length due to overflow will cause
a reader to read only a part of nested attribute or skip it entirely.

As a solution cancel the addition of a nested attribute when nla_len size is
exceeded.

Signed-off-by: Przemyslaw Szczerbik <przemek.szczerbik@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-May/002131.html

8 years agolib: merge branch 'ext_filter_mask'
Thomas Haller [Fri, 24 Jun 2016 17:26:10 +0000 (19:26 +0200)]
lib: merge branch 'ext_filter_mask'

This adds RTEXT_FILTER_VF mask support for SRIOV VFs.

http://lists.infradead.org/pipermail/libnl/2016-May/002115.html
http://lists.infradead.org/pipermail/libnl/2016-May/002123.html

8 years agolink: allow overwriting IFLA_EXT_MASK flag in ao_get_af() function
Thomas Haller [Sun, 29 May 2016 14:26:59 +0000 (16:26 +0200)]
link: allow overwriting IFLA_EXT_MASK flag in ao_get_af() function

Instead of setting it twice, once during link_request_update() and
later in bridge_get_af(), pass ext_filter_mask to ao_get_af().

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agolink: support RTEXT_FILTER_VF
Jef Oliver [Mon, 16 May 2016 23:23:23 +0000 (16:23 -0700)]
link: support RTEXT_FILTER_VF

This patch adds RTEXT_FILTER_VF mask support for SRIOV VFs. Since
SRIOV VFs don't have a defined address family (ie bridge), there
are no new address family specific operations defined.

Exposing this mask makes rtnl_link_get_num_vfs() properly return
the number of loaded SRIOV VFs.

Signed-off-by: Jef Oliver <jef.oliver@intel.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-May/002115.html
http://lists.infradead.org/pipermail/libnl/2016-May/002123.html

8 years agoneigh: add function to look up neighbour (fdb) by ifindex, mac and vlan
Jonas Johansson [Thu, 28 Apr 2016 14:07:11 +0000 (16:07 +0200)]
neigh: add function to look up neighbour (fdb) by ifindex, mac and vlan

The rtnl_neigh_get() function can not be used to look up a fdb entry in the
neigh cache. This is due to that the function searches among destination
addresses (NDA_DST) and not among link layer addresses (NDA_LLADDR), which is
used by fdb entries. A fdb entry can also exist in several vlans, so a vlan id
parameter is also needed to find a unique entry.
This commit adds a function, rtnl_neigh_get_by_vlan() which searches the neigh
cache for a specific neighbour (fdb) entry by interface index, link layer
address and vlan id.

Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-May/002124.html
https://github.com/thom311/libnl/pull/98

8 years agoneigh: support neighbour flag NTF_SELF
Jonas Johansson [Fri, 29 Apr 2016 14:26:22 +0000 (16:26 +0200)]
neigh: support neighbour flag NTF_SELF

Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se>
Signed-off-by: Thomas Haller <thaller@redhat.com>
https://github.com/thom311/libnl/pull/96

8 years agosit: merge branch 'sit-ip6rd'
Thomas Haller [Tue, 19 Apr 2016 14:17:00 +0000 (16:17 +0200)]
sit: merge branch 'sit-ip6rd'

http://lists.infradead.org/pipermail/libnl/2016-February/002086.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agosit: add public API for sit 6RD support
Thomas Haller [Thu, 31 Mar 2016 14:07:08 +0000 (16:07 +0200)]
sit: add public API for sit 6RD support

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agosit: fix invalid declaration of rtnl_link_sit_get_proto() in sit.h
Thomas Haller [Fri, 15 Apr 2016 13:51:26 +0000 (15:51 +0200)]
sit: fix invalid declaration of rtnl_link_sit_get_proto() in sit.h

Fixes: d715b8a5f6ec8faf205ae77950a1c625440be22f
Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agosit: refactor IS_SIT_LINK_ASSERT()
Thomas Haller [Thu, 31 Mar 2016 14:19:10 +0000 (16:19 +0200)]
sit: refactor IS_SIT_LINK_ASSERT()

Also check for NULL link and dereference link before
basic error checking.

Also move the declaration of the @sit member inside
the macro. Obviously, the macro must now always come at
first, after declaring local auto variables.

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agosit: don't print ip6rd_prefix as integer in sit_dump_details()
Thomas Haller [Thu, 31 Mar 2016 13:44:56 +0000 (15:44 +0200)]
sit: don't print ip6rd_prefix as integer in sit_dump_details()

First of all, inet_ntop() has no reason to fail (ever). As long
as the input arguments point to valid data and family is not bogus.

But when it fails, we cannot pass a 'struct in6_addr' to "%x"
either, so just don't do that.

Same for printing ip6rd_relay_prefix as AF_INET. If our addr-to-str
method fails, we don't want to come up with something fancy. Otherwise,
we'd just implement a inet_ntop() that does not fail.

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agosit/trivial: whitespace
Thomas Haller [Thu, 31 Mar 2016 13:43:51 +0000 (15:43 +0200)]
sit/trivial: whitespace

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agosit: add 6RD support
Thadeu Lima de Souza Cascardo [Mon, 8 Feb 2016 10:05:29 +0000 (08:05 -0200)]
sit: add 6RD support

Handle 6RD prefixes from sit linkinfo.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-February/002086.html

8 years agoipgre: add support for gretap tunnel
Haishuang Yan [Fri, 1 Apr 2016 10:18:50 +0000 (18:18 +0800)]
ipgre: add support for gretap tunnel

Since kernel support both gre/gretap tunnel, so add support
for gretap appropriately.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
[thaller@redhat.com: modified original patch to move symbols
 in libnl-route-3.sym to proper section]

http://lists.infradead.org/pipermail/libnl/2016-April/002102.html

8 years agoroute: sort entries in libnl-route-3.sym by name
Thomas Haller [Fri, 15 Apr 2016 13:45:49 +0000 (15:45 +0200)]
route: sort entries in libnl-route-3.sym by name

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agobuild: move -rdynamic from CPPFLAGS to LDFLAGS
Tobias Klauser [Thu, 31 Mar 2016 12:42:31 +0000 (14:42 +0200)]
build: move -rdynamic from CPPFLAGS to LDFLAGS

The -rdynamic flag is a linker flag, not a compiler/preprocessor flag,
so move it to LDFLAGS.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-March/002100.html

8 years agolib: add type casting for nla_for_each_nested macro
Przemyslaw Szczerbik [Thu, 25 Feb 2016 18:01:20 +0000 (19:01 +0100)]
lib: add type casting for nla_for_each_nested macro

g++ is unable to compile code with nla_for_each_nested macro due to
implicit type conversion from void* to nlattr*. This patch adds type
casting for nla_for_each_nested macro to address this issue.

Signed-off-by: Przemyslaw Szczerbik <przemek.szczerbik@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2016-February/002095.html

8 years agolib: merge branch 'nl-object-diff64'
Thomas Haller [Fri, 12 Feb 2016 17:22:14 +0000 (18:22 +0100)]
lib: merge branch 'nl-object-diff64'

http://lists.infradead.org/pipermail/libnl/2015-December/002078.html
http://lists.infradead.org/pipermail/libnl/2015-December/002083.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agolib/utils: add NL_CAPABILITY_NL_OBJECT_DIFF64 capability
Thomas Haller [Fri, 12 Feb 2016 17:20:35 +0000 (18:20 +0100)]
lib/utils: add NL_CAPABILITY_NL_OBJECT_DIFF64 capability

Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agolibnl: add nl_object_diff64() to libnl-3.sym
Thomas Haller [Fri, 12 Feb 2016 17:15:08 +0000 (18:15 +0100)]
libnl: add nl_object_diff64() to libnl-3.sym

Fixes: a09b8558148b31e469d463907d103fa78d81612c
Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agolib: update ce-mask to uint64_t
David Ahern [Fri, 18 Dec 2015 17:50:03 +0000 (09:50 -0800)]
lib: update ce-mask to uint64_t

lib/route/link.c already defines 32 attributes which fills the current
uint32_t used for ce_mask. To accommodate more attributes the mask needs
to be expanded. This patch updates the definition to uint64_t.

The nl_object_diff API is maintained for ABI with existing users. A new
nl_object_diff64 API is added for the expanded attribute list. The MSB
of the 32-bit API is used to indicate if higher order attributes had a
mismatch. (Suggested by Thomas).

Note that LINK_ATTR_LINK_NETNSID changes. But since the attribute flags
are not public API it shouldn't be a problem.

http://lists.infradead.org/pipermail/libnl/2015-December/002078.html
http://lists.infradead.org/pipermail/libnl/2015-December/002083.html

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
8 years agoremove null dereference from netlink/link.h
Nick Lewycky [Fri, 29 Jan 2016 03:49:31 +0000 (19:49 -0800)]
remove null dereference from netlink/link.h

Replace a null pointer dereference with a use of the 'offsetof' macro in stddef.h.

http://lists.infradead.org/pipermail/libnl/2016-January/002085.html

Signed-off-by: Nick Lewycky <nlewycky@google.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib/route: potential memory leak in pktloc.c
Amit Khatri [Thu, 17 Dec 2015 05:03:05 +0000 (10:33 +0530)]
lib/route: potential memory leak in pktloc.c

In scneario, where file modification time is unchanged, code is returning 0
form read_pktlocs(). It causes memory leak for path variable.
Memory for this variable is allocated inside build_sysconf_path()
by asprintf() function.

http://lists.infradead.org/pipermail/libnl/2015-December/002079.html

Signed-off-by: Amit Khatri <amit.khatri@samsung.com>
Signed-off-by: Rahul Jain <rahul.jain@samsung.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add support for IN6_ADDR_GEN_MODE_STABLE_PRIVACY
Quentin Armitage [Thu, 17 Dec 2015 13:00:22 +0000 (13:00 +0000)]
route/link: add support for IN6_ADDR_GEN_MODE_STABLE_PRIVACY

IN6_ADDR_GEN_MODE_STABLE_PRIVACY was introduced in Linux 4.1

https://github.com/thom311/libnl/pull/95

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link/bridge: fixed return type
Tobias Jungel [Wed, 16 Dec 2015 13:20:53 +0000 (14:20 +0100)]
route/link/bridge: fixed return type

Fixes: 6555b0d
https://github.com/thom311/libnl/pull/94

9 years agoroute/bridge: merge branch 'bridge-vlan'
Thomas Haller [Mon, 7 Dec 2015 11:21:16 +0000 (12:21 +0100)]
route/bridge: merge branch 'bridge-vlan'

Add support for vlan attributes for bridges.

http://lists.infradead.org/pipermail/libnl/2015-November/002032.html
http://lists.infradead.org/pipermail/libnl/2015-November/002047.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: handle RTEXT_FILTER_BRVLAN_COMPRESSED
Tobias Jungel [Thu, 26 Nov 2015 15:47:58 +0000 (16:47 +0100)]
route/link: handle RTEXT_FILTER_BRVLAN_COMPRESSED

notifications from the kernel regarding vlan ids are now handled

[thaller@redhat.com: split ao_parse_af_full() to previous patch]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agobridge: add support for VLANs
David Ahern [Wed, 25 Nov 2015 19:14:16 +0000 (11:14 -0800)]
bridge: add support for VLANs

Add operation for requesting VLAN data for AF_BRIDGE and parsing of
IFLA_AF_SPEC for AF_BRIDGE. VLANs are saved in a bitmap.

Also add dumping of vlan info to link list and neigh list.
For example:

$ nl-link-list --details --family=bridge
br1 ether 8e:6e:0e:86:e5:86 master br1 <broadcast,multicast,up,running,lowerup>
    mtu 1500 txqlen 0 weight 0 index 18
    mode default carrier down
    bridge: pvid 1   all vlans: 1 301-400 601-610   untagged vlans: 1
bond1 ether 46:ef:e1:c9:46:fe <broadcast,multicast,master>
    mtu 1500 txqlen 0 weight 0 index 20
    state down mode default carrier down
    bridge:

Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: modified original patch to use ao_parse_af_full().
  Also renaming new API and drop some #defines]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoinclude/linux: update copy of kernel headers
Thomas Haller [Wed, 2 Dec 2015 14:50:51 +0000 (15:50 +0100)]
include/linux: update copy of kernel headers

Taken from upstream kernel commit 6a13feb9c82803e2b815eca72fa7a9f5561d7861
(v4.3)).

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib: handle family-based parsing of IFLA_AF_SPEC attribute
David Ahern [Wed, 25 Nov 2015 19:14:15 +0000 (11:14 -0800)]
lib: handle family-based parsing of IFLA_AF_SPEC attribute

The encoding of the IFLA_AF_SPEC attribute varies depending on the family
used for the request (RTM_GETLINK) message. For AF_UNSPEC the encoding
has another level of nesting for each address family with the type encoded
first. i.e.,
    af_spec = nla_nest_start(skb, IFLA_AF_SPEC)
    for each family:
        af = nla_nest_start(skb, af_ops->family)
        af_ops->fill_link_af(skb, dev, ext_filter_mask)
        nest_end
    nest_end

This allows the parser to find the address family by looking at the first
type.

Whereas AF_BRIDGE encoding is just:
    af_spec = nla_nest_start(skb, IFLA_AF_SPEC)
    br_fill_ifvlaninfo{_compressed}(skb, vg)
    nest_end

which means the parser can not use the attribute itself to know the family
to which the attribute belongs.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: refactor code by merging a later patch by
 tobias.jungel@bisdn.de and introduce new function ao_parse_af_full()]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolink: add AF operation to append attributes to a GETLINK message
David Ahern [Wed, 25 Nov 2015 19:14:14 +0000 (11:14 -0800)]
link: add AF operation to append attributes to a GETLINK message

Upcoming bridge patch wants to add IFLA_EXT_MASK attribute to RTM_GETLINK
requests to retrieve VLAN data. Expand request message to a full ifinfomsg
header and call to hook to append attributes if it exists for an address
family.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: fix memleak in link_request_update()]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolibnl: don't use out-of-scope buffer in nl_send_iovec()
Andrew Vagin [Mon, 23 Nov 2015 14:23:20 +0000 (17:23 +0300)]
libnl: don't use out-of-scope buffer in nl_send_iovec()

The control message buffer is desclared in the if body
and then this buffer is used outside.

http://lists.infradead.org/pipermail/libnl/2015-November/002013.html

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link/vxlan: merge branch 'vxlan-io-compare'
Thomas Haller [Fri, 20 Nov 2015 10:26:23 +0000 (11:26 +0100)]
route/link/vxlan: merge branch 'vxlan-io-compare'

http://lists.infradead.org/pipermail/libnl/2015-October/001997.html

9 years agoroute/link/vxlan: add support for link_info compare
David Ahern [Fri, 30 Oct 2015 22:08:41 +0000 (15:08 -0700)]
route/link/vxlan: add support for link_info compare

Signed-off-by: Balki Raman <ramanb@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: whitespace, add capability, consider local6/group6]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link/vxlan: trivial rename VXLAN_HAS_ prefix and vxi_mask
David Ahern [Fri, 30 Oct 2015 22:08:40 +0000 (15:08 -0700)]
route/link/vxlan: trivial rename VXLAN_HAS_ prefix and vxi_mask

Global search and replace of VXLAN_HAS_ for VXLAN_ATTR_
and vxi_mask for ce_mask. Preparation step for using ATTR_DIFF
infrastructure in a vxlan_compare.

Signed-off-by: Balki Raman <ramanb@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: rebased patch and changed whitespace]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add link info compare operation
David Ahern [Fri, 30 Oct 2015 22:08:39 +0000 (15:08 -0700)]
route/link: add link info compare operation

Signed-off-by: Balki Raman <ramanb@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: corrected array size for inet_policy
Tobias Jungel [Thu, 19 Nov 2015 15:50:14 +0000 (16:50 +0100)]
route/link: corrected array size for inet_policy

Using now the macro for inet instead of inet6

Fixes: 53015f83811bd56d4b66331656633ad39051babf
https://github.com/thom311/libnl/pull/92

9 years agoroute/link: merge branch 'bg/vxlan-ipv6'
Thomas Haller [Thu, 19 Nov 2015 16:40:32 +0000 (17:40 +0100)]
route/link: merge branch 'bg/vxlan-ipv6'

http://lists.infradead.org/pipermail/libnl/2015-October/001981.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add ipv6 support to vxlan links
Beniamino Galvani [Fri, 16 Oct 2015 09:21:26 +0000 (11:21 +0200)]
route/link: add ipv6 support to vxlan links

Extend vxlan links to support the IFLA_VXLAN_GROUP6 and
IFLA_VXLAN_LOCAL6 attributes used to represent IPv6 endpoints.

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: fix dump of parent link for some link types
Beniamino Galvani [Fri, 16 Oct 2015 09:21:25 +0000 (11:21 +0200)]
route/link: fix dump of parent link for some link types

Some link types incorrectly dump their own interface name as parent
link; fix this.

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add macvtap support
Beniamino Galvani [Mon, 5 Oct 2015 08:55:38 +0000 (10:55 +0200)]
route/link: add macvtap support

This adds support for MAC-VLAN based tap interfaces (macvtap).

http://lists.infradead.org/pipermail/libnl/2015-October/001976.html

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agogitignore: ignore test binaries in "tests/"
Thomas Haller [Thu, 19 Nov 2015 16:14:29 +0000 (17:14 +0100)]
gitignore: ignore test binaries in "tests/"

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolink/neigh: add flags option to link and neighbor caches
David Ahern [Tue, 27 Oct 2015 22:40:48 +0000 (15:40 -0700)]
link/neigh: add flags option to link and neighbor caches

Both link and neighbor cache support specify multiple groups (nl_af_group),
but the alloc_cache functions for both do not set the NL_CACHE_AF_ITER
flag before populating the cache so only the first group is used by
default. This patch adds an API to pass in flags to make that happen
and updates the nl-neigh-list command to make use of it.

http://lists.infradead.org/pipermail/libnl/2015-October/001996.html

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/vlan: allow clearing vlan ingress map
Thomas Haller [Wed, 21 Oct 2015 16:01:02 +0000 (18:01 +0200)]
route/vlan: allow clearing vlan ingress map

An entry of the ingress map can be cleared by setting
the "to" part to zero.

Previously, vlan_put_attrs() would skip over zero "to"
and thus the user cannot unset an ingress map entry.

Add a modified-mask to record the state of each ingress
map entry and also sent explicit zeros to kernel.

when we receive a IFLA_VLAN_INGRESS_QOS message from kernel,
vlan_parse() similarly sets the received entries as modified.
This preserves previous behavior when using a received object
to modify a vlan.

Add a capability NL_CAPABILITY_RTNL_LINK_VLAN_INGRESS_MAP_CLEAR
to indicate the behavioral change.

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: fix parsing of 'remote' attribute for GRE links
Beniamino Galvani [Wed, 11 Nov 2015 18:16:34 +0000 (19:16 +0100)]
route/link: fix parsing of 'remote' attribute for GRE links

Fixes: 57bdc4ff4895dd91cc723d22eecadcf48945e87c
http://lists.infradead.org/pipermail/libnl/2015-November/002004.html

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
[thaller@redhat.com: add capability to indicate bug-fix]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoneigh: add support for NTF_SELF
David Ahern [Tue, 27 Oct 2015 22:39:55 +0000 (15:39 -0700)]
neigh: add support for NTF_SELF

http://lists.infradead.org/pipermail/libnl/2015-October/001995.html

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/vrf: add VRF support
David Ahern [Wed, 21 Oct 2015 17:44:29 +0000 (10:44 -0700)]
route/vrf: add VRF support

http://lists.infradead.org/pipermail/libnl/2015-October/001991.html

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: slightly modified original patch]
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agortnl/link: merge branch 'vlan-protocol-serialize'
Thomas Haller [Wed, 21 Oct 2015 17:04:03 +0000 (19:04 +0200)]
rtnl/link: merge branch 'vlan-protocol-serialize'

9 years agortnl/link: indicate capability NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE
Thomas Haller [Wed, 21 Oct 2015 16:17:28 +0000 (18:17 +0200)]
rtnl/link: indicate capability NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZE

Related: 0aca70083e51d97d0102c73852d31625f75c942b

9 years agoroute/link: IFLA_VLAN_PROTOCOL added to vlan_put_attrs
skuklinski [Tue, 20 Oct 2015 12:56:06 +0000 (14:56 +0200)]
route/link: IFLA_VLAN_PROTOCOL added to vlan_put_attrs

Fixes: 430eb4004ab7f93fd840e9836d4bc9220d3c406d
https://github.com/thom311/libnl/issues/90
https://github.com/thom311/libnl/pull/91

9 years agortnl/link: document vlan-protocol to be exposed in network-byte order
Thomas Haller [Wed, 21 Oct 2015 16:57:47 +0000 (18:57 +0200)]
rtnl/link: document vlan-protocol to be exposed in network-byte order

Unfortunately this was done wrong. Instead of fixing it now
(and change behavior), document the behavior.

Fixes: 430eb4004ab7f93fd840e9836d4bc9220d3c406d
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolibnl-3.2.27 release libnl3_2_27
Thomas Haller [Fri, 16 Oct 2015 12:08:36 +0000 (14:08 +0200)]
libnl-3.2.27 release

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add missing newlines after debug messages
Beniamino Galvani [Mon, 5 Oct 2015 08:55:39 +0000 (10:55 +0200)]
route/link: add missing newlines after debug messages

http://lists.infradead.org/pipermail/libnl/2015-October/001977.html

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib/attr: add nla utility functions for signed integers
Thomas Haller [Mon, 5 Oct 2015 14:52:07 +0000 (16:52 +0200)]
lib/attr: add nla utility functions for signed integers

Commit 7bb956501ccd58ed3bbffc59de996f056e178683 added nla functions for
s32. We preferibly add all signed integer operations at the same time.
Thus, also add s8, s16, and s64.

Also, previously the NLA_TYPE_MAX enum was not extended to have
NLA_S32. Fix that too.

Reported-By: Jiri Pirko <jiri@resnulli.us>
Fixes: 7bb956501ccd58ed3bbffc59de996f056e178683
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute: add capability indicating the behavior of rtnl_neigh_get()
Thomas Haller [Tue, 29 Sep 2015 16:32:23 +0000 (18:32 +0200)]
route: add capability indicating the behavior of rtnl_neigh_get()

A wrong behavior for rtnl_neigh_get() was introduced between 3.2.14 and 3.2.15
(commit 64fcb47a36ec12d7e7f00605f6a8952ce985dd08).

It was later fixed between 3.2.21 and 3.2.22
(commit 8571f58f23763d8db7365d02c9b27832ad3d7005).

Add a capability NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX
to indicate that this buggy behavior was fixed.

https://bugzilla.redhat.com/show_bug.cgi?id=1261028
http://lists.infradead.org/pipermail/libnl/2015-August/001951.html
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolibnl-3.2.27-rc1 release libnl3_2_27rc1
Thomas Haller [Mon, 21 Sep 2015 10:38:48 +0000 (12:38 +0200)]
libnl-3.2.27-rc1 release

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolibnl: report an error if unexpected control data was received
Andrey Vagin [Mon, 14 Sep 2015 15:59:58 +0000 (18:59 +0300)]
libnl: report an error if unexpected control data was received

Currently, we try to handle MSG_CTRUNC, but if msg_controllen is zero, we make
double free for the same address.

realloc(0, 0) returns non-zero address
realloc(addr, 0) returns zero and free(addr) has already been called

Then we call free(addr) again and get an error like this:

*** Error in `./task_diag_all': double free or corruption (fasttop): 0x0000000000f9c160 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x77e9d)[0x7f360ed96e9d]
/lib64/libc.so.6(+0x7f53c)[0x7f360ed9e53c]
/lib64/libc.so.6(cfree+0x4c)[0x7f360eda2e9c]
/lib64/libnl-3.so.200(nl_recv+0x221)[0x7f360f2f6361]
/lib64/libnl-3.so.200(nl_recvmsgs_report+0x555)[0x7f360f2f6a95]
/lib64/libnl-3.so.200(nl_recvmsgs+0x9)[0x7f360f2f6d89]
./task_diag_all[0x400f8d]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x7f360ed3f790]
./task_diag_all[0x401169]

http://lists.infradead.org/pipermail/libnl/2015-September/001965.html

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agodoc: enable generation of Doxygen tagfile for libnl API reference
Steffen Vogel [Sat, 19 Sep 2015 13:19:27 +0000 (15:19 +0200)]
doc: enable generation of Doxygen tagfile for libnl API reference

This enables other projects which are using Doxygen for documentation
to automatically create hyperlinks to libnl's API reference.

See: http://www.stack.nl/~dimitri/doxygen/manual/external.html

https://github.com/thom311/libnl/pull/89

9 years agoroute/link: merge branch 'vlan-flags'
Thomas Haller [Thu, 3 Sep 2015 16:22:17 +0000 (18:22 +0200)]
route/link: merge branch 'vlan-flags'

http://lists.infradead.org/pipermail/libnl/2015-September/001961.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agovlan: add MVRP VLAN flag
Jiří Klimeš [Thu, 3 Sep 2015 12:23:53 +0000 (14:23 +0200)]
vlan: add MVRP VLAN flag

Kernel patch:   http://patchwork.ozlabs.org/patch/219040/
iproute2 patch: http://patchwork.ozlabs.org/patch/219364/

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agovlan: add VLAN flags to trans_tbl to print them properly
Jiří Klimeš [Thu, 3 Sep 2015 12:23:52 +0000 (14:23 +0200)]
vlan: add VLAN flags to trans_tbl to print them properly

nl-link-list only showed reorder_hdr.

$ ip -d link show dev em1.444
28: em1.444@em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
    link/ether 3c:97:0e:58:1d:c1 brd ff:ff:ff:ff:ff:ff promiscuity 0
    vlan protocol 802.1Q id 444 <REORDER_HDR,GVRP,LOOSE_BINDING>
      ingress-qos-map { 1:3 4:2 }
      egress-qos-map { 2:6 9:5 }
$ /usr/sbin/nl-link-list --details -i 28
em1.444 ether 3c:97:0e:18:2e:a1 <broadcast,multicast,up,running,lowerup> slave-of em1 group 0 vlan-id 444
    mtu 1500 txqlen 0 weight 0 qdisc noqueue index 28
    txq 1 rxq 1 brd ff:ff:ff:ff:ff:ff state up mode default carrier up
    vlan-info id 444 <reorder_hdr,>    vlan protocol <129>
      ingress vlan prio -> qos/socket prio mapping:
      1 -> 0x000003, 4 -> 0x000002,
      egress qos/socket prio -> vlan prio mapping:
      0x000002 -> 6, 0x000009 -> 5,
  ...

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add missing link_attrs translations
Tobias Klauser [Thu, 20 Aug 2015 13:46:22 +0000 (15:46 +0200)]
route/link: add missing link_attrs translations

Add LINK_ATTR_NSFD, LINK_ATTR_NS_PID and LINK_ATTR_LINK_NETNSID to the
link_attrs translation table after they were added in commits
760bfabad8cd ("add link netns support") and 66aab65595fb ("route/link:
add support for IFLA_LINK_NETNSID") respectively.

http://lists.infradead.org/pipermail/libnl/2015-August/001959.html

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agosocket: fix assertion in nl_connect() when all ports are already in use
Thomas Haller [Mon, 24 Aug 2015 15:57:16 +0000 (17:57 +0200)]
socket: fix assertion in nl_connect() when all ports are already in use

When generating a port fails a few times (because they are already in used
outside of libnl's knowledge), we would back off generating a local
port and instead let kernel decide.

There was however a bug in nl_connect() that caused an assertion:

    BUG at file position socket.c:147:_nl_socket_used_ports_release_all
    app: socket.c:147: _nl_socket_used_ports_release_all: Assertion `0' failed.

Fixes: 96e1e5bdc2e803700055395cc3c428fa2525d1ca
9 years agoroute/link: merge support for 'netnsid' (fixes)
Thomas Haller [Mon, 17 Aug 2015 15:11:56 +0000 (17:11 +0200)]
route/link: merge support for 'netnsid' (fixes)

Fix previous patches to have link_netnsid as signed int32_t.

http://lists.infradead.org/pipermail/libnl/2015-August/001941.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: make link_netnsid argument (signed) int32_t
Thomas Haller [Mon, 17 Aug 2015 17:12:09 +0000 (19:12 +0200)]
route/link: make link_netnsid argument (signed) int32_t

Fixes: 66aab65595fb20bf166936fcfa4c8568b58f7f68
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib/attr: add nla utility functions for s32
Thomas Haller [Fri, 14 Aug 2015 15:32:36 +0000 (17:32 +0200)]
lib/attr: add nla utility functions for s32

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: merge support for 'netnsid'
Thomas Haller [Mon, 17 Aug 2015 15:11:56 +0000 (17:11 +0200)]
route/link: merge support for 'netnsid'

http://lists.infradead.org/pipermail/libnl/2015-August/001941.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: add support for IFLA_LINK_NETNSID
Thomas Haller [Fri, 14 Aug 2015 15:32:38 +0000 (17:32 +0200)]
route/link: add support for IFLA_LINK_NETNSID

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoinclude/linux: update copy of kernel header "if_link.h"
Thomas Haller [Fri, 14 Aug 2015 15:32:37 +0000 (17:32 +0200)]
include/linux: update copy of kernel header "if_link.h"

Taken from upstream kernel commit b953c0d234bc72e8489d3bf51a276c5c4ec85345
(v4.1), file 'include/uapi/linux/if_link.h' (after `make headers_install`).

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib/socket: in nl_socket_set_fd() always reset the local port
Thomas Haller [Fri, 14 Aug 2015 16:12:25 +0000 (18:12 +0200)]
lib/socket: in nl_socket_set_fd() always reset the local port

Even if the local port of @sk already equals to the port of
the file descriptor @fd, we want to release a possibly generated
port and set NL_OWN_PORT.

Fixes: 2d61e890379888907a93ddd0a04187b130629f6f
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/link: Remove unnecessary NULL check before release_link_info()
Tobias Klauser [Tue, 14 Jul 2015 09:43:01 +0000 (11:43 +0200)]
route/link: Remove unnecessary NULL check before release_link_info()

release_link_info() already check whether link->l_info_ops is not NULL
before accessing it, thus there is no need to do the same before calling
it.

http://lists.infradead.org/pipermail/libnl/2015-July/001929.html

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agosocket: fix autogeneration of local ports for more then 1024 sockets
Thomas Haller [Fri, 14 Aug 2015 14:01:47 +0000 (16:01 +0200)]
socket: fix autogeneration of local ports for more then 1024 sockets

http://lists.infradead.org/pipermail/libnl/2015-June/001889.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agosocket: add fallback for nl_connect() by trying to bind to unspecified local port
Thomas Haller [Fri, 10 Jul 2015 12:58:51 +0000 (14:58 +0200)]
socket: add fallback for nl_connect() by trying to bind to unspecified local port

libnl allows the user to explicitly set the local port before connecting
the socket. A more convenient way is to leave the local port unspecified
and let libnl generate a port id.

As it is, generate_local_port() would try at most 1024 ports, that
means if a user tries to connect more sockets, the automatism will
fail.

Kernel also supports choosing the local port itself (via netlink_autobind()).
So, this could be fixed by always leaving the port unspecified and let
kernel decide on the port. For that we could entirely drop generate_local_port().

There are however problems with that:

  - it is unclear why generate_local_port() was even introduced in the
    first place instead of always relying kernel. This code already
    appeared in libnl-1, so maybe there was a good reason for it or
    it is necessary on some kernel versions.

  - The deprecated libnl-1 library also uses a form of generate_local_port().
    Its first guess would always be getpid(), but the problem is that
    it would not retry on EADDRINUSE. Currently libnl-3 generates ports in
    a different sequence and will not generate a conflicting port (until it
    already exhausted 1016 other ports).
    Hence, currently if your application uses libnl1 and libnl3
    together, the automatism might just work without conflicts
    (commit 1f734a8f892abcd3f81637df4a089155aca1b66a).
    Accidently, kernel/netlink_autobind() also first tries the process
    id as port. That means, if we change libnl-3 to leave the decision
    to kernel, and
      - the application connects sockets both via libnl-1 and libnl-3
      - and the libnl-3 socket happens to connect first
    then the libnl-1 socket would fail to connect without retrying
    another port.

  - Removing generate_local_port() entirely changes behavior in the
    following case:

        sk = nl_socket_alloc();
        /* accessing local port before connecting the socket used to
         * freeze the local port to the generated value. */
        port = nl_socket_get_local_port(sk);
        nl_connect(sk, NETLINK_...);

Maybe the issues are minor and it would simplify the code just to get
rid of the cruft. But instead fix the issue without changing behavior.
Just keep trying with generate_local_port() first, before fallback to
kernel.

Reported-by: Julien Courtat <julien.courtat@6wind.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
http://lists.infradead.org/pipermail/libnl/2015-June/001889.html

9 years agosocket: clear port when unable to generate local port
Thomas Haller [Fri, 10 Jul 2015 12:58:50 +0000 (14:58 +0200)]
socket: clear port when unable to generate local port

When running out of local ports, _nl_socket_generate_local_port_no_release()
would leave the socket with port UINT32_MAX. That means if nl_connect()
fails due to out-of-ports, it would leave the port id assigned to an
invalid port and the socket instance was not re-usable until the user
called nl_socket_set_local_port(). Fix that by resetting the local port
to zero.

Thereby, also change generate_local_port() to return zero when
running out of ports. zero is a more natural value for ~no port found~.
It also matches the port that _nl_socket_generate_local_port_no_release()
uses when failing to generate a port.

Also ensure that zero cannot be returned as valid port by generate_local_port().
Arguably, that would only be possible if (getpid() & 0x3FFFFF)
returns zero. Just be extra cautious.

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib/route: merge fixes to dump_details
Thomas Haller [Fri, 14 Aug 2015 13:25:27 +0000 (15:25 +0200)]
lib/route: merge fixes to dump_details

http://lists.infradead.org/pipermail/libnl/2015-July/001933.html
http://lists.infradead.org/pipermail/libnl/2015-July/001932.html
http://lists.infradead.org/pipermail/libnl/2015-July/001931.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/qdisc: fixe printing whitespace in qdisc_dump_details()
Steffen Vogel [Fri, 24 Jul 2015 06:42:28 +0000 (08:42 +0200)]
route/qdisc: fixe printing whitespace in qdisc_dump_details()

And whitespace (source code) fix.

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/tc: use plain format string in rtnl_tc_dump_stats()
Thomas Haller [Fri, 14 Aug 2015 13:17:30 +0000 (15:17 +0200)]
route/tc: use plain format string in rtnl_tc_dump_stats()

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/tc: improved statistics dump (just alignment)
Steffen Vogel [Fri, 24 Jul 2015 06:42:27 +0000 (08:42 +0200)]
route/tc: improved statistics dump (just alignment)

9 digits for for B/s don't make sense to me. It's just breaks the alignment.

[thaller@redhat.com: whitespace fixes]

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoroute/qdisc: added more attributes to netem dump
Steffen Vogel [Fri, 24 Jul 2015 06:42:26 +0000 (08:42 +0200)]
route/qdisc: added more attributes to netem dump

I added all the netem attributes (except for limit) to the NL_DUMP_DETAILS section.

[thaller@redhat.com: whitespace fixes]

Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agolib/nl: add missing header
Jörg Krause [Thu, 13 Aug 2015 11:34:13 +0000 (13:34 +0200)]
lib/nl: add missing header

CMSG_NXTHDR requires <linux/socket.h>. This fix a build error with the musl
C library:

```
undefined reference to `__cmsg_nxthdr'
```

https://github.com/thom311/libnl/pull/83

9 years agoipvlan: fix return error code for rtnl_link_ipvlan_get_mode()
Thomas Haller [Fri, 10 Jul 2015 09:01:30 +0000 (11:01 +0200)]
ipvlan: fix return error code for rtnl_link_ipvlan_get_mode()

rtnl_link_ipvlan_get_mode() was just introduced as new API. Fix the
error code to return -NLE_INVAL instead of -NLE_OPNOTSUPP.

http://lists.infradead.org/pipermail/libnl/2015-June/001921.html

9 years agonf: fix potential bug in nfnl_queue_msg_set_payload() when malloc() failed
Коренберг Марк [Thu, 2 Jul 2015 09:59:55 +0000 (14:59 +0500)]
nf: fix potential bug in nfnl_queue_msg_set_payload() when malloc() failed

Suppose the case:
1. message have already some payload
2. malloc() failed

In that case:
1. msg->queue_msg_payload become NULL
2. msg->queue_msg_payload_len stay non-zero

Now when malloc() error occurs, nothing changed.

https://github.com/thom311/libnl/pull/83

9 years agobuild: merge branch 'kolyshkin-build-cleanups'
Thomas Haller [Thu, 9 Jul 2015 20:49:19 +0000 (22:49 +0200)]
build: merge branch 'kolyshkin-build-cleanups'

https://github.com/thom311/libnl/pull/84

9 years agodoc/Makefile.am: don't use asciidoc if disabled
Kir Kolyshkin [Tue, 7 Jul 2015 05:33:23 +0000 (22:33 -0700)]
doc/Makefile.am: don't use asciidoc if disabled

In case doc/configure.ac hasn't found asciidoc or any of its
prerequisites (such as pygmentize), make shouldn't try to run it.
One such case ("gendoc" target) is covered while the other
("%.html" target) is not. Fix it by adding a proper ifdef.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
9 years agodoc/configure.ac: simplify python check
Kir Kolyshkin [Tue, 7 Jul 2015 05:23:45 +0000 (22:23 -0700)]
doc/configure.ac: simplify python check

A check for python binary that was originally introduced by commit
183e869 is needed because python is used for a couple of preprocessors
(doxygen-link.py and resolve-asciidoc-refs.py) and therefore it is
impossible to build docs without python.

While it is right to check for python, the check was both wrong and
excessive. Instead of just checking for python binary, it checked for
various versions of python and set a few variables that are not needed
here. More to say, the absense of python binary was not treated as
being fatal like it should.

Fix both problems by using AC_CHECK_PROG for python, terminating the
build in the same way as with doxygen absense. Also, remove the
m4/ax_python.m4 which is no longer needed.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
9 years agom4/ax*.m4: remove
Kir Kolyshkin [Tue, 7 Jul 2015 00:25:14 +0000 (17:25 -0700)]
m4/ax*.m4: remove

These files, as well as the proper configure.ac calls, were added
by commit f443be6, but the calls were later removed by commit b4b853e,
so these are no longer needed.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
9 years agom4/ax_python.m4: remove
Kir Kolyshkin [Tue, 7 Jul 2015 00:15:15 +0000 (17:15 -0700)]
m4/ax_python.m4: remove

This file is no longer needed since commit db13843 which copied it
to doc/ subdir and removed the call to AX_PYTHON from configure.ac.

That commit should have moved it rather than copied, let's fix it.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
9 years agolink: set ifi_change in link message
matben2 [Thu, 9 Jul 2015 05:40:18 +0000 (17:40 +1200)]
link: set ifi_change in link message

The ifi_change field can be set with the mask of the flags that need
to be changed as part of the link message to the kernel. This means only
the specific flags that have been changed will be modified in the kernel,
rather than the entire flags entry.

[thaller@redhat.com: add capability to indicate the change in behavior]

https://github.com/thom311/libnl/pull/86

9 years agoipvlan: don't check for valid @mode argument in rtnl_link_ipvlan_set_mode()
Thomas Haller [Fri, 26 Jun 2015 16:01:21 +0000 (18:01 +0200)]
ipvlan: don't check for valid @mode argument in rtnl_link_ipvlan_set_mode()

In the future kernel might support more modes. Don't be so
strict in rtnl_link_ipvlan_set_mode() and accept any uint16
mode.
This way when adding new modes, rtnl_link_ipvlan_set_mode() does not
need to be changed.

If the user passes an invalid value and sends a message to the kernel,
it will be rejected there.

http://lists.infradead.org/pipermail/libnl/2015-June/001902.html

Fixes: 7de5be85bf9aa3eb9f022e4813226135e89adec2
Signed-off-by: Thomas Haller <thaller@redhat.com>
9 years agoipvlan: fix signature of rtnl_link_ipvlan_get_mode() to signal error
Thomas Haller [Fri, 26 Jun 2015 15:58:06 +0000 (17:58 +0200)]
ipvlan: fix signature of rtnl_link_ipvlan_get_mode() to signal error

http://lists.infradead.org/pipermail/libnl/2015-June/001902.html

Fixes: 7de5be85bf9aa3eb9f022e4813226135e89adec2
Signed-off-by: Thomas Haller <thaller@redhat.com>