summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * bridge: add support for VLANsDavid Ahern2015-12-074-2/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * include/linux: update copy of kernel headersThomas Haller2015-12-075-12/+831
| | | | | | | | | | | | | | Taken from upstream kernel commit 6a13feb9c82803e2b815eca72fa7a9f5561d7861 (v4.3)). Signed-off-by: Thomas Haller <thaller@redhat.com>
| * lib: handle family-based parsing of IFLA_AF_SPEC attributeDavid Ahern2015-12-072-13/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * link: add AF operation to append attributes to a GETLINK messageDavid Ahern2015-12-072-1/+29
|/ | | | | | | | | | | 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>
* libnl: don't use out-of-scope buffer in nl_send_iovec()Andrew Vagin2015-11-241-1/+1
| | | | | | | | | | 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>
* route/link/vxlan: merge branch 'vxlan-io-compare'Thomas Haller2015-11-206-103/+167
|\ | | | | | | http://lists.infradead.org/pipermail/libnl/2015-October/001997.html
| * route/link/vxlan: add support for link_info compareDavid Ahern2015-11-203-1/+36
| | | | | | | | | | | | | | 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>
| * route/link/vxlan: trivial rename VXLAN_HAS_ prefix and vxi_maskDavid Ahern2015-11-201-102/+102
| | | | | | | | | | | | | | | | | | | | | | 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>
| * route/link: add link info compare operationDavid Ahern2015-11-203-0/+29
|/ | | | | | Signed-off-by: Balki Raman <ramanb@cumulusnetworks.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: corrected array size for inet_policyTobias Jungel2015-11-191-1/+1
| | | | | | | | Using now the macro for inet instead of inet6 Fixes: 53015f83811bd56d4b66331656633ad39051babf https://github.com/thom311/libnl/pull/92
* route/link: merge branch 'bg/vxlan-ipv6'Thomas Haller2015-11-198-27/+132
|\ | | | | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-October/001981.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * route/link: add ipv6 support to vxlan linksBeniamino Galvani2015-11-191-21/+78
| | | | | | | | | | | | | | | | 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>
| * route/link: fix dump of parent link for some link typesBeniamino Galvani2015-11-198-6/+54
|/ | | | | | | | 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>
* route/link: add macvtap supportBeniamino Galvani2015-11-198-12/+357
| | | | | | | | | 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>
* gitignore: ignore test binaries in "tests/"Thomas Haller2015-11-191-1/+3
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/neigh: add flags option to link and neighbor cachesDavid Ahern2015-11-1912-6/+127
| | | | | | | | | | | | | 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>
* route/vlan: allow clearing vlan ingress mapThomas Haller2015-11-193-3/+25
| | | | | | | | | | | | | | | | | | | | | 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>
* route/link: fix parsing of 'remote' attribute for GRE linksBeniamino Galvani2015-11-193-3/+9
| | | | | | | | | | 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>
* neigh: add support for NTF_SELFDavid Ahern2015-11-012-6/+15
| | | | | | | | 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>
* route/vrf: add VRF supportDavid Ahern2015-11-018-0/+374
| | | | | | | | 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>
* rtnl/link: merge branch 'vlan-protocol-serialize'Thomas Haller2015-10-213-4/+15
|\
| * rtnl/link: indicate capability NL_CAPABILITY_RTNL_LINK_VLAN_PROTOCOL_SERIALZEThomas Haller2015-10-212-1/+7
| | | | | | | | Related: 0aca70083e51d97d0102c73852d31625f75c942b
| * route/link: IFLA_VLAN_PROTOCOL added to vlan_put_attrsskuklinski2015-10-211-0/+3
| | | | | | | | | | | | | | Fixes: 430eb4004ab7f93fd840e9836d4bc9220d3c406d https://github.com/thom311/libnl/issues/90 https://github.com/thom311/libnl/pull/91
| * rtnl/link: document vlan-protocol to be exposed in network-byte orderThomas Haller2015-10-211-3/+5
|/ | | | | | | | | 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>
* libnl-3.2.27 releaselibnl3_2_27Thomas Haller2015-10-164-3/+9
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: add missing newlines after debug messagesBeniamino Galvani2015-10-0511-11/+11
| | | | | | | 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>
* lib/attr: add nla utility functions for signed integersThomas Haller2015-10-053-7/+133
| | | | | | | | | | | | | 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>
* route: add capability indicating the behavior of rtnl_neigh_get()Thomas Haller2015-09-292-1/+9
| | | | | | | | | | | | | | | 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>
* libnl-3.2.27-rc1 releaselibnl3_2_27rc1Thomas Haller2015-09-212-5/+5
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnl: report an error if unexpected control data was receivedAndrey Vagin2015-09-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* doc: enable generation of Doxygen tagfile for libnl API referenceSteffen Vogel2015-09-192-1/+2
| | | | | | | | | 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
* route/link: merge branch 'vlan-flags'Thomas Haller2015-09-032-0/+4
|\ | | | | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-September/001961.html Signed-off-by: Thomas Haller <thaller@redhat.com>
| * vlan: add MVRP VLAN flagJiří Klimeš2015-09-032-0/+2
| | | | | | | | | | | | | | | | 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>
| * vlan: add VLAN flags to trans_tbl to print them properlyJiří Klimeš2015-09-031-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | 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>
* route/link: add missing link_attrs translationsTobias Klauser2015-08-311-0/+3
| | | | | | | | | | | | 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>
* socket: fix assertion in nl_connect() when all ports are already in useThomas Haller2015-08-243-5/+8
| | | | | | | | | | | | | 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
* route/link: merge support for 'netnsid' (fixes)Thomas Haller2015-08-176-8/+50
|\ | | | | | | | | | | | | | | 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>
| * 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>