summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libnl-3.2.28-rc1 releaselibnl3_2_28rc1Thomas Haller2016-06-302-5/+5
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: fix adding macsec files to include/Makefile.amThomas Haller2016-06-301-0/+2
| | | | Fixes: 885ff4ae1efce35f8db378b2533025c3c931823c
* route/addr: merge branch 'ip-addr-fixes'Thomas Haller2016-06-295-22/+97
|\ | | | | | | | | http://lists.infradead.org/pipermail/libnl/2016-June/002156.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/addr: add capability NL_CAPABILITY_RTNL_ADDR_PEER_FIX to indicate ↵Thomas Haller2016-06-292-1/+8
| | | | | | | | | | | | address fixes Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/addr: fix handling peer addresses for IPv4 addressesThomas Haller2016-06-291-19/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For IPv4, a "normal" route has IFA_LOCAL and IFA_ADDRESS set to the same destination. An address with a explicit peer, has them differing. A peer of 0.0.0.0 is also valid and must be treated different from a normal address. unshare -n ip link add T type dummy ip link set T up ip addr add 192.168.5.10 peer 192.168.5.10/24 dev T ip addr add 192.168.5.10/24 dev T #RTNETLINK answers: File exists ip addr add 192.168.5.10 peer 192.168.6.10/24 dev T ip addr add 192.168.5.10 peer 0.0.0.0/24 dev T Previously, that would give: nl-addr-list #192.168.5.10/24 inet dev T scope global <permanent> #192.168.5.10 peer 192.168.6.10/24 inet dev T scope global <permanent> #192.168.5.10/24 inet dev T scope global <permanent> With this change, we properly get: nl-addr-list #192.168.5.10/24 inet dev T scope global <permanent> #192.168.5.10/24 peer 192.168.6.10 inet dev T scope global <permanent> #192.168.5.10/24 peer 0.0.0.0 inet dev T scope global <permanent> http://lists.infradead.org/pipermail/libnl/2016-June/002157.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/addr: fix ID comparison for AF_INET and AF_INET6 addressesThomas Haller2016-06-293-2/+35
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For AF_INET/IPv4 addresses, the ID equality comparison must include the net-part of the peer address: unshare -n ip link add T type dummy ip link set T up ip addr add 192.168.5.10/24 dev T ip addr add 192.168.5.10 peer 192.168.6.1/24 dev T ip addr add 192.168.5.10 peer 192.168.7.1/24 dev T ip addr add 192.168.5.10 peer 192.168.7.2/24 dev T # RTNETLINK answers: File exists ip addr change 192.168.5.10 peer 192.168.7.2/24 dev T ip addr show | grep 192.168.7. # inet 192.168.5.10 peer 192.168.7.1/24 scope global T For AF_INET6/IPv6 addresses, the prefix length of the address is not part of the ID: unshare -n ip link add T type dummy ip link set T up ip addr add 192.168.7.10/24 dev T ip addr add 192.168.7.10/23 dev T ip addr add 1:2:3:4:5::1/64 dev T ip addr add 1:2:3:4:5::1/63 dev T # RTNETLINK answers: File exists ip addr change 1:2:3:4:5::1/63 dev T ip addr show | grep 1:2:3:4:5::1 # inet6 1:2:3:4:5::1/64 scope global *sigh* http://lists.infradead.org/pipermail/libnl/2016-June/002158.html Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: allow avoiding buffer overflow for key in xfrmnl_sa_get_*_params()Thomas Haller2016-06-293-14/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous API of xfrmnl_sa_get_*_params() would always require a @key buffer, but it was not possible to avoid buffer overflow because the required size was unknown. That is not really fixable, because the old API is broken. Now, allow omitting the @key argument to only request the @key_size. That allows the caller to ask beforehand how large the @key buffer must be: ((@key_size + 7) / 8). Unfortunately, omitting the key against previous versions of libnl leads to a crash. And passing a key against older versions makes it impossible to avoid buffer-overflow. Another option would be to add functions like xfrmnl_sa_get_crypto_params_keylen() so the user can query the required buffer size by calling that instead of xfrmnl_sa_get_crypto_params(). However, then the user also requires a backport of the new API and this will not be possible against older libnl3 versions either. Thus, if the user already requires the fix, he can just as well require a backport of this patch and then safely call xfrmnl_sa_get_crypto_params() without @key argument. This way has the advantage/disadvantage, that it can detect the presence of the patch at runtime. The cumbersome way to get it right would be: unsiged key_len; char *key; int r; if (!nl_has_capability(17 /*NL_CAPABILITY_XFRM_SA_KEY_SIZE*/)) { /* no way to use this API safely. Abort. */ return -NLE_OPNOTSUPP; } r = xfrmnl_sa_get_crypto_params(sa, NULL, &key_len, NULL); if (r < 0) return r; key = malloc((key_len + 7) / 8); if (!key) return -NLE_NOMEM; r = xfrmnl_sa_get_crypto_params(sa, NULL, &key_len, &key); if (r < 0) { free(key); return r; } ... http://lists.infradead.org/pipermail/libnl/2016-June/002155.html Signed-off-by: Thomas Haller <thaller@redhat.com>
* macsec: merge branch 'qsn-macsec'Thomas Haller2016-06-279-1/+1135
|\ | | | | | | | | | | https://github.com/thom311/libnl/pull/100 Signed-off-by: Thomas Haller <thaller@redhat.com>
| * lib/route: add macsec supportSabrina Dubroca2016-06-257-1/+936
| | | | | | | | Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
| * import macsec uapi headersSabrina Dubroca2016-06-252-0/+199
|/ | | | Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
* link: merge branch 'qsn-io_compare' (#99)Thomas Haller2016-06-254-6/+8
|\ | | | | | | | | | | https://github.com/thom311/libnl/pull/99 Signed-off-by: Thomas Haller <thaller@redhat.com>
| * vxlan: properly handle LOOSE_COMPARISON in ->io_compareSabrina Dubroca2016-06-251-1/+1
| | | | | | | | | | | | | | | | This lets us match links only on the attributes that have actually been set, instead of comparing all attributes. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Thomas Haller <thaller@redhat.com>
| * pass flags through ->io_compare opSabrina Dubroca2016-06-254-6/+8
|/ | | | | | | | | | Currently rtnl_link_info_data_compare doesn't pass flags (LOOSE_COMPARISON) to the ->io_compare op, so we cannot do a match on only the attributes that are actually set in the filter object used in a cache lookup via nl_cache_find(). Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: merge branch 'xfrm/various-fixes'Thomas Haller2016-06-251-18/+32
|\ | | | | | | http://lists.infradead.org/pipermail/libnl/2016-June/002138.html
| * xfrm: fix memleak in build_xfrm_sa_message() error-pathThomas Haller2016-06-251-1/+3
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * xfrm: attach only one xfrm alg attribute to netlink messageThomas Egerer2016-06-251-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * xfrm: fix memory leak for encap original addressThomas Egerer2016-06-251-2/+5
| | | | | | | | | | | | | | 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
| * xfrm: reuse encap data in xfrmnl_sa_set_encap_tmpl()Thomas Haller2016-06-251-3/+2
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * xfrm: fix segfault when using encapsulation templatesThomas Egerer2016-06-251-3/+8
|/ | | | | | | 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
* xfrm: make character pointers in setters constThomas Egerer2016-06-252-17/+19
| | | | | | | | | | | | 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
* xfrm: merge branch 'xfrm/buffer-overflows'Thomas Haller2016-06-251-12/+16
|\ | | | | | | http://lists.infradead.org/pipermail/libnl/2016-May/002134.html
| * xfrm: check length of alg_name before strcpying itThomas Egerer2016-06-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * xfrm: fix buffer overflow when copying keysThomas Egerer2016-06-251-8/+12
|/ | | | | | | | | | | | | | | 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
* lib: return error on Netlink attribute length overflowPrzemyslaw Szczerbik2016-06-243-5/+8
| | | | | | | | | | | | | | 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
* lib: merge branch 'ext_filter_mask'Thomas Haller2016-06-243-8/+24
|\ | | | | | | | | | | | | 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
| * link: allow overwriting IFLA_EXT_MASK flag in ao_get_af() functionThomas Haller2016-06-243-11/+13
| | | | | | | | | | | | | | 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>
| * link: support RTEXT_FILTER_VFJef Oliver2016-06-241-2/+16
|/ | | | | | | | | | | | | | | 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
* neigh: add function to look up neighbour (fdb) by ifindex, mac and vlanJonas Johansson2016-05-293-0/+29
| | | | | | | | | | | | | | | | | 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
* neigh: support neighbour flag NTF_SELFJonas Johansson2016-04-291-0/+2
| | | | | | | Signed-off-by: Jonas Johansson <jonas.johansson@westermo.se> Signed-off-by: Thomas Haller <thaller@redhat.com> https://github.com/thom311/libnl/pull/96
* sit: merge branch 'sit-ip6rd'Thomas Haller2016-04-193-56/+264
|\ | | | | | | | | | | http://lists.infradead.org/pipermail/libnl/2016-February/002086.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * sit: add public API for sit 6RD supportThomas Haller2016-04-153-0/+164
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * sit: fix invalid declaration of rtnl_link_sit_get_proto() in sit.hThomas Haller2016-04-151-1/+1
| | | | | | | | | | | | Fixes: d715b8a5f6ec8faf205ae77950a1c625440be22f Signed-off-by: Thomas Haller <thaller@redhat.com>
| * sit: refactor IS_SIT_LINK_ASSERT()Thomas Haller2016-04-151-53/+26
| | | | | | | | | | | | | | | | | | | | | | 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>
| * sit: don't print ip6rd_prefix as integer in sit_dump_details()Thomas Haller2016-04-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * sit/trivial: whitespaceThomas Haller2016-04-151-4/+3
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * sit: add 6RD supportThadeu Lima de Souza Cascardo2016-04-151-2/+74
|/ | | | | | | | | 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
* ipgre: add support for gretap tunnelHaishuang Yan2016-04-156-5/+160
| | | | | | | | | | | | | 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
* route: sort entries in libnl-route-3.sym by nameThomas Haller2016-04-151-3/+3
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: move -rdynamic from CPPFLAGS to LDFLAGSTobias Klauser2016-03-311-2/+2
| | | | | | | | | | 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
* lib: add type casting for nla_for_each_nested macroPrzemyslaw Szczerbik2016-02-251-1/+1
| | | | | | | | | | | 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
* lib: merge branch 'nl-object-diff64'Thomas Haller2016-02-1228-65/+111
|\ | | | | | | | | | | | | 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>
| * lib/utils: add NL_CAPABILITY_NL_OBJECT_DIFF64 capabilityThomas Haller2016-02-122-1/+7
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * libnl: add nl_object_diff64() to libnl-3.symThomas Haller2016-02-121-0/+5
| | | | | | | | | | | | Fixes: a09b8558148b31e469d463907d103fa78d81612c Signed-off-by: Thomas Haller <thaller@redhat.com>
| * lib: update ce-mask to uint64_tDavid Ahern2016-02-1225-64/+99
|/ | | | | | | | | | | | | | | | | | | | 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>
* remove null dereference from netlink/link.hNick Lewycky2016-02-121-1/+3
| | | | | | | | | 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>
* lib/route: potential memory leak in pktloc.cAmit Khatri2015-12-181-2/+4
| | | | | | | | | | | | | 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>
* route/link: add support for IN6_ADDR_GEN_MODE_STABLE_PRIVACYQuentin Armitage2015-12-181-0/+1
| | | | | | | | | 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>
* route/link/bridge: fixed return typeTobias Jungel2015-12-161-1/+1
| | | | | | Fixes: 6555b0d https://github.com/thom311/libnl/pull/94
* route/bridge: merge branch 'bridge-vlan'Thomas Haller2015-12-0711-28/+1136
|\ | | | | | | | | | | | | | | | | 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>
| * route/link: handle RTEXT_FILTER_BRVLAN_COMPRESSEDTobias Jungel2015-12-071-9/+28
| | | | | | | | | | | | | | 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>