summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * route/link: make link_netnsid argument (signed) int32_tThomas Haller2015-08-173-8/+8
| | | | | | | | | | | | Fixes: 66aab65595fb20bf166936fcfa4c8568b58f7f68 Signed-off-by: Thomas Haller <thaller@redhat.com>
| * lib/attr: add nla utility functions for s32Thomas Haller2015-08-173-0/+42
|/ | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: merge support for 'netnsid'Thomas Haller2015-08-175-7/+104
|\ | | | | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-August/001941.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/link: add support for IFLA_LINK_NETNSIDThomas Haller2015-08-174-2/+55
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * include/linux: update copy of kernel header "if_link.h"Thomas Haller2015-08-171-5/+49
|/ | | | | | | 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>
* lib/socket: in nl_socket_set_fd() always reset the local portThomas Haller2015-08-141-6/+1
| | | | | | | | | 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>
* route/link: Remove unnecessary NULL check before release_link_info()Tobias Klauser2015-08-141-6/+2
| | | | | | | | | | | 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>
* socket: fix autogeneration of local ports for more then 1024 socketsThomas Haller2015-08-142-22/+40
|\ | | | | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-June/001889.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * socket: add fallback for nl_connect() by trying to bind to unspecified local ↵Thomas Haller2015-08-142-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * socket: clear port when unable to generate local portThomas Haller2015-08-142-9/+23
|/ | | | | | | | | | | | | | | | | | | | 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>
* lib/route: merge fixes to dump_detailsThomas Haller2015-08-143-29/+81
|\ | | | | | | | | | | | | | | 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>
| * route/qdisc: fixe printing whitespace in qdisc_dump_details()Steffen Vogel2015-08-142-4/+4
| | | | | | | | | | | | And whitespace (source code) fix. Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/tc: use plain format string in rtnl_tc_dump_stats()Thomas Haller2015-08-141-8/+11
| | | | | | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/tc: improved statistics dump (just alignment)Steffen Vogel2015-08-141-18/+9
| | | | | | | | | | | | | | | | 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>
| * route/qdisc: added more attributes to netem dumpSteffen Vogel2015-08-141-2/+60
|/ | | | | | | | 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>
* lib/nl: add missing headerJörg Krause2015-08-141-0/+1
| | | | | | | | | | | 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
* ipvlan: fix return error code for rtnl_link_ipvlan_get_mode()Thomas Haller2015-07-101-1/+1
| | | | | | | 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
* nf: fix potential bug in nfnl_queue_msg_set_payload() when malloc() failedКоренберг Марк2015-07-101-4/+7
| | | | | | | | | | | | | | 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
* build: merge branch 'kolyshkin-build-cleanups'Thomas Haller2015-07-097-722/+9
|\ | | | | | | https://github.com/thom311/libnl/pull/84
| * doc/Makefile.am: don't use asciidoc if disabledKir Kolyshkin2015-07-091-0/+4
| | | | | | | | | | | | | | | | | | 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>
| * doc/configure.ac: simplify python checkKir Kolyshkin2015-07-092-101/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * m4/ax*.m4: removeKir Kolyshkin2015-07-093-524/+0
| | | | | | | | | | | | | | | | 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>
| * m4/ax_python.m4: removeKir Kolyshkin2015-07-091-97/+0
|/ | | | | | | | | 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>
* link: set ifi_change in link messagematben22015-07-093-0/+18
| | | | | | | | | | | 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
* ipvlan: don't check for valid @mode argument in rtnl_link_ipvlan_set_mode()Thomas Haller2015-06-261-3/+0
| | | | | | | | | | | | | | | | | 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>
* ipvlan: fix signature of rtnl_link_ipvlan_get_mode() to signal errorThomas Haller2015-06-262-7/+8
| | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-June/001902.html Fixes: 7de5be85bf9aa3eb9f022e4813226135e89adec2 Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: merge branch 'neigh-typo'Thomas Haller2015-06-261-2/+7
|\ | | | | | | https://github.com/thom311/libnl/pull/79
| * neigh: accept "norarp" in rtnl_neigh_state2str()Thomas Haller2015-06-261-1/+6
| | | | | | | | | | | | | | | | Commit 6a9335f101e22cd5eaba4dfcf0a44e2c3097b4ab fixed a typo in the string-to-flags conversion. At least for rtnl_neigh_str2state() we want to continue to parse "norarp" for backward compatiblity. Signed-off-by: Thomas Haller <thaller@redhat.com>
| * neigh: fix type for NUD_NOARP flag in trans_tblTobias Jungel2015-06-261-1/+1
|/ | | | | | | | | | Translate NUD_NOARP to "noarp", instead of "norarp". https://github.com/thom311/libnl/pull/79 Fixes: 44d362409d5469aed47d19e7908d19bd194493a4 Signed-off-by: Thomas Haller <thaller@redhat.com>
* ipvlan: merge branch 'add-ipvlan'Thomas Haller2015-06-198-1/+389
|\ | | | | | | http://lists.infradead.org/pipermail/libnl/2015-June/001902.html
| * ipvlan: add a testcase for ipvlanCong Wang2015-06-192-0/+46
| | | | | | | | | | Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
| * ipvlan: add ipvlan supportCong Wang2015-06-196-1/+343
|/ | | | | Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: fix path to cli linker version script for out-of-tree buildjfarrell2015-06-191-2/+2
| | | | https://github.com/thom311/libnl/pull/78
* lib: fix spelling of NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEKThomas Haller2015-06-052-3/+3
| | | | | | | | Instead of NL_CAPABILITY_NL_RECV_FAIL_TRUNK_NO_PEEK. Fixes: bbdcaea9a779885fedc04817dcc11953a377bfd5 Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib: return error if an incomplete message was readThomas Egerer2015-06-053-1/+16
| | | | | | | | | | | | | | | | | | | If recvmsg indicates that the message read was truncated libnl retries to read the complete message after increasing the message buffer. This only works if the message flags MSG_PEEK | MSG_TRUNC are set. If NL_MSG_PEEK is not enabled on the nl_sock structure, flags are left empty and the rest of the truncated message is discarded, hence a subsequent recvmsg returns the next message (in case of a multipart message, the NLMSG_DONE) is read and returned. This patch aborts message processing if the message was truncated and the NL_MSG_PEEK flags was not activated for the nl_sock structure. http://lists.infradead.org/pipermail/libnl/2015-June/001888.html [thaller@redhat.com: add NL_CAPABILITY_NL_RECV_FAIL_TRUNK_NO_PEEK] Signed-off-by: Thomas Egerer <hakke_007@gmx.de> Signed-off-by: Thomas Haller <thaller@redhat.com>
* utils: add missing link layer protocol translationsThomas Haller2015-06-041-0/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* utils: update link layer protocol translationsTobias Klauser2015-06-042-14/+13
| | | | | | | | | | | | | Update the private copy of linux/if_arp.h and hook up the not yet defined ARPHRD_* types in the llprotos translation table. Reorder the entries such that they correspond to the order they're defined in linux/if_arp.h. Also remove the #ifdef guards since these are unnecessary given that the private copy of the kernel header is used. http://lists.infradead.org/pipermail/libnl/2015-May/001883.html Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: fix memleaks in link_msg_parser()Thomas Haller2015-06-041-4/+6
| | | | | | http://lists.infradead.org/pipermail/libnl/2015-May/001880.html Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/doc: clearify return value of send_simple() functionsThomas Haller2015-05-127-7/+26
| | | | | | | | | | | | | | | | | | The return value of the *nl_send_simple() functions is inconsistent and not according to the documentation. nl_send_simple() is document to return the number of bytes sent. Other *nl_send_simple() functions are documented to return 0 on success -- for the most part. See also commit b70174668b9867de573cf51471bc98bfe7fd2bc3 which changed behavior of nl_rtgen_request() to be according to documenation. Don't change behavior again, only adjust the documentation. http://lists.infradead.org/pipermail/libnl/2015-May/001872.html Reported-by: Xiao Jia <stfairy@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: trival refactoring initialization of stack-allocated arguments to ↵Thomas Haller2015-05-122-6/+8
| | | | | | nl_send_simple() Signed-off-by: Thomas Haller <thaller@redhat.com>
* python: merge branch 'python-capi'Thomas Haller2015-05-122-1/+27
|\ | | | | | | | | | | | | Disable debug macro in swig API to reduce the noise and expose a couple of functions. https://github.com/thom311/libnl/pull/77
| * python: genl: capi: add genlmsg_hdr() to capiArend van Spriel2015-05-121-0/+8
| | | | | | | | | | | | | | Allow using genlmsg_hdr() function and make the header fields accessible in Python scripts. Signed-off-by: Arend van Spriel <aspriel@gmail.com>
| * python: capi: add nla_put() function to python capiArend van Spriel2015-05-121-0/+14
| | | | | | | | | | | | | | | | Adding nla_put() to the capi using a typemap on the input parameter which needs to be either a str or bytearray. Otherwise a SWIG exception with be thrown. Signed-off-by: Arend van Spriel <aspriel@gmail.com>
| * python: capi: expose multicast membership functionsArend van Spriel2015-05-121-0/+3
| | | | | | | | | | | | Adding functions to add/drop membership to single multicast group. Signed-off-by: Arend van Spriel <aspriel@gmail.com>
| * python: disable swig debug print messagesArend van Spriel2015-05-121-1/+2
|/ | | | | | | | The define was left enabled during development on netlink (and genl) python swig api. It is a bit annoying in production release so disable the define. Signed-off-by: Arend van Spriel <aspriel@gmail.com>
* xfrm: fix potential NULL dereferenceTobias Klauser2015-05-122-4/+6
| | | | | | | | | | | | If xfrmnl_sel_alloc() returns NULL, the daddr and saddr members are still accessed, leading to a potential NULL dereference. The same is the case for xfrmnl_user_tmpl_alloc(). Fix this by returning NULL right away if allocation fails. http://lists.infradead.org/pipermail/libnl/2015-May/001874.html Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/tc: remove unnecessary check for tc_kind member of struct rtnl_tcTobias Klauser2015-05-051-3/+0
| | | | | | | | | | | The tc_kind member of struct rtnl_tc (and all types which can be converted to it) is defined as an array and can thus never be NULL. http://lists.infradead.org/pipermail/libnl/2015-April/001869.html Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* utils: Add translations for NETLINK_RDMA and NETLINK_CRYPTOTobias Klauser2015-05-052-3/+8
| | | | | | | | | | | | | | | | | | Add translations for NETLINK_RDMA and NETLINK_CRYPTO to nlfamilies, allowing to use nl_nlfamily2str() and nl_str2nlfamily() for these families. This makes it necessary to update the private copy of linux/netlink.h and also includes the rename of NETLINK_INET_DIAG to NETLINK_SOCK_DIAG in upstream commit 7f1fb60c4fc9fb29 ("inet_diag: Partly rename inet_ to sock_") and the removal of the duplicate NLMSG_ALIGN in the NLMSG_LENGTH() macro in upstream commit a88b9ce5ad4fc633 ("netlink: remove duplicated NLMSG_ALIGN"). http://lists.infradead.org/pipermail/libnl/2015-April/001868.html Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnl-3.2.26 releaselibnl3_2_26Thomas Haller2015-03-304-4/+10
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* neigh: add support for NDA_VLAN nl attributeJonas Johansson2015-03-235-0/+33
| | | | | | | | | [thaller@redhat.com: modified patch to parse NDA_VLAN and diff vlan] http://lists.infradead.org/pipermail/libnl/2015-March/001861.html Signed-off-by: Jonas Johansson <jonasj76@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>