summaryrefslogtreecommitdiffstats
path: root/lib/route/link
Commit message (Collapse)AuthorAgeFilesLines
* lib/route: add macsec supportSabrina Dubroca2016-06-251-0/+786
| | | | Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
* 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-252-3/+4
| | | | | | | | | | 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>
* link: allow overwriting IFLA_EXT_MASK flag in ao_get_af() functionThomas Haller2016-06-241-4/+3
| | | | | | | 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>
* sit: add public API for sit 6RD supportThomas Haller2016-04-151-0/+144
| | | | 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-151-5/+98
| | | | | | | | | | | | | 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/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: 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>
* bridge: add support for VLANsDavid Ahern2015-12-071-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* route/link/vxlan: add support for link_info compareDavid Ahern2015-11-201-0/+29
| | | | | | | 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-201-0/+22
| | | | | | 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: 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-196-6/+42
| | | | | | | | 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-191-12/+189
| | | | | | | | | 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>
* route/vlan: allow clearing vlan ingress mapThomas Haller2015-11-191-2/+16
| | | | | | | | | | | | | | | | | | | | | 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-191-2/+2
| | | | | | | | | | 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>
* route/vrf: add VRF supportDavid Ahern2015-11-011-0/+263
| | | | | | | | 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>
* 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>
* 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>
* vlan: add MVRP VLAN flagJiří Klimeš2015-09-031-0/+1
| | | | | | | | 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>
* 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
* 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-261-6/+7
| | | | | | | | http://lists.infradead.org/pipermail/libnl/2015-June/001902.html Fixes: 7de5be85bf9aa3eb9f022e4813226135e89adec2 Signed-off-by: Thomas Haller <thaller@redhat.com>
* ipvlan: add ipvlan supportCong Wang2015-06-191-0/+279
| | | | | Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: fix indention in inet6_dump_details()Thomas Haller2015-03-221-2/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* link: fix memory leaks due to repeated calls to .io_alloc()Thomas Haller2014-10-129-39/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the io_alloc() implementation unconditionally allocated new memory, thus leaking memory if called more then once. Fix io_alloc() implementations not to allocate new memory if not needed. This happens for example in link_msg_parser() which first calls rtnl_link_set_type(): #0 macvlan_alloc (link=0x609d50) at route/link/macvlan.c:56 #1 0x00007ffff7b99a78 in rtnl_link_set_type (link=link@entry=0x609d50, type=type@entry=0x609a94 "macvlan") at route/link.c:2233 #2 0x00007ffff7b99c28 in link_msg_parser (ops=<optimized out>, who=<optimized out>, n=<optimized out>, pp=0x7fffffffd870) at route/link.c:547 #3 0x00007ffff7dea109 in nl_cache_parse (ops=0x7ffff7dd8600 <rtnl_link_ops>, who=0x603338, nlh=0x6098a0, params=0x7fffffffd870) at cache.c:914 #4 0x00007ffff7dea15b in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at cache.c:668 #5 0x00007ffff7def7bf in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:142 #6 recvmsgs (cb=0x6057a0, sk=0x6034c0) at nl.c:952 #7 nl_recvmsgs_report (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1003 #8 0x00007ffff7defb79 in nl_recvmsgs (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1027 #9 0x00007ffff7de9668 in __cache_pickup (sk=0x6034c0, cache=0x603510, param=param@entry=0x7fffffffd870) at cache.c:701 #10 0x00007ffff7dea08d in nl_cache_pickup (sk=<optimized out>, cache=<optimized out>) at cache.c:753 #11 0x0000000000400d56 in main () and later ops->io_parse(): #0 macvlan_alloc (link=0x609d50) at route/link/macvlan.c:56 #1 0x00007ffff7baae9d in macvlan_parse (link=0x609d50, data=<optimized out>, xstats=<optimized out>) at route/link/macvlan.c:79 #2 0x00007ffff7b99c80 in link_msg_parser (ops=<optimized out>, who=<optimized out>, n=<optimized out>, pp=0x7fffffffd870) at route/link.c:567 #3 0x00007ffff7dea109 in nl_cache_parse (ops=0x7ffff7dd8600 <rtnl_link_ops>, who=0x603338, nlh=0x6098a0, params=0x7fffffffd870) at cache.c:914 #4 0x00007ffff7dea15b in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at cache.c:668 #5 0x00007ffff7def7bf in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:142 #6 recvmsgs (cb=0x6057a0, sk=0x6034c0) at nl.c:952 #7 nl_recvmsgs_report (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1003 #8 0x00007ffff7defb79 in nl_recvmsgs (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1027 #9 0x00007ffff7de9668 in __cache_pickup (sk=0x6034c0, cache=0x603510, param=param@entry=0x7fffffffd870) at cache.c:701 #10 0x00007ffff7dea08d in nl_cache_pickup (sk=<optimized out>, cache=<optimized out>) at cache.c:753 #11 0x0000000000400d56 in main () https://github.com/thom311/libnl/issues/59 Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet6: add support for tokenized interface identifiersLubomir Rintel2014-10-081-0/+70
| | | | | | | | | | | http://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02 [thaller@redhat.com: Add OOM handling, fix whitespace issues] https://github.com/thom311/libnl/pull/63 Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet6: add link IPv6 address generation mode supportDan Williams2014-07-301-7/+102
| | | | | Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet: Include <netlink/route/link/inet.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/bonding: Include <netlink/route/link/bonding.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/ipgre: Include <netlink/route/link/ipgre.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/sit: Include <netlink/route/link/sit.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/ip6tnl: Include <netlink/route/link/ip6tnl.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link/inet: fix rtnl_link_inet_get_conf() not to allocate inet_dataThomas Haller2014-07-271-1/+1
| | | | | | | | Instead of allocating a 'struct inet_data', rtnl_link_inet_get_conf() should only look for an existing entry. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* style: require comma after __ADD() macroThomas Haller2014-07-276-77/+77
| | | | | | | $ sed -i 's/^\([\t ]\+\<__ADD\> \?([^)]\+)\) *$/\1,/' `git grep -w -l __ADD` Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* veth: add kernel header linux/veth.h for VETH definesDan Williams2014-07-251-0/+1
| | | | | | | | | | | | Similar to what's done with <linux/if_link.h>, make sure used defines actually exist. Otherwise building on even slightly older kernels fails. Taken from upstream kernel commit 1860e379875dfe7271c649058aeddffe5afd9d0d (tag: v3.15), file 'include/uapi/linux/veth.h'. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* link: add ifb device supportCong Wang2014-07-241-0/+40
| | | | | | | | Cc: Thomas Graf <tgraf@suug.ch> Cc: Thomas Haller <thaller@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* ip6tnl: Use <netinet/in.h> for in6_addr and stuffThomas Graf2014-06-291-1/+1
| | | | | | | | | <linux/in6.h> is not compatible with some versions of <netinet/in.h>. Cc: Susant Sahani <susant@redhat.com> Cc: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* ip6tnl: introduce ip6 tunnel supportSusant Sahani2014-06-161-0/+688
| | | | | | | | This patch adds support for ip6 tunnel that works with the ip6_tunnel kernel module. Signed-off-by: Susant Sahani <susant@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/link: pass proper type to sizeof() for calloc() in vlan_parse()Thomas Haller2014-06-101-1/+1
| | | | | | | | | | | This fixes the following coverity warning: lib/route/link/vlan.c:148:23:warning – Result of 'calloc' is converted to a pointer of type 'struct vlan_map', which is incompatible with sizeof operand type 'struct ifla_vlan_qos_mapping' This was not a real problem, because the types are effectively the same. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* vlan: add support for IFLA_VLAN_PROTOCOLSusant Sahani2014-05-121-1/+51
| | | | | | | | | This patch adds support for IFLA_VLAN_PROTOCOL Signed-off-by: Susant Sahani <susant@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch> [thaller@redhat.com: minor fixes (whitespace, documentation, and a typo)] Signed-off-by: Thomas Haller <thaller@redhat.com>
* ipvti: introduce vti tunnel supportSusant Sahani2014-05-061-0/+477
| | | | | | Signed-off-by: Susant Sahani <susant@redhat.com> [thaller@redhat.com: some whitespace fixes] Signed-off-by: Thomas Haller <thaller@redhat.com>