summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-06-25nl: fix function name in debug msgMatthieu Baerts
Just a typo. Fixes: f545295 (lib: log errors from platform) Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> https://github.com/thom311/libnl/pull/191
2018-04-11route/class: add new api rtnl_class_get_by_parent()d0u9
This function searches a class cache previously allocated with rtnl_class_alloc_cache() and searches for a class matching the interface index and parent qdisc. https://github.com/thom311/libnl/pull/185
2018-04-11nl-msg: explicitly initialize nlmsg_seq and nlmsg_pid field in ↵Thomas Haller
nlmsg_alloc_simple() This is no change in behavior, because the NL_AUTO_* macros are both zero.
2018-04-11route/link: assert in rtnl_link_change() that the sequence number is set as ↵Thomas Haller
expected
2018-04-11route/link: fix sequence number handling in rtnl_link_change()Tuetuopay
When rtnl_link_change() fails with -NLE_OPNOTSUPP, it retries with RTM_SETLINK operation. However, it also needs to re-adjust the sequence number. Otherwise, the second request might fail with NLE_SEQ_MISMATCH, although it actually succeeded. [thaller@redhat.com: changed commit message] https://github.com/thom311/libnl/issues/179 https://github.com/thom311/libnl/pull/184
2018-04-11route/mall: fix deep cloning mallThomas Haller
rtnl_act_append() does not clone the object, it takes it over and thus the source object is destroyed.
2018-04-11route:cls: add matchall classifierVolodymyr Bendiuga
This simple classifier allows any traffic pass through. Useful as an example for port mirroring. Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
2018-04-11cache: make "result" output argument for nl_cache_mngr_add() optionalTuetuopay
[thaller@redhat.com: rewritten commit message] https://github.com/thom311/libnl/issues/178 https://github.com/thom311/libnl/pull/183
2018-04-06neigh: support bridge entries for vxlan interfacesTobias Jungel
bridge entries used for switching into vxlan interfaces do not include a vlan. A comparison of such entires currently always fails which leads to an invalid cache. This patch selectively adds the NEIGH_ATTR_VLAN flag based on the passed entry. https://github.com/thom311/libnl/pull/182
2018-04-06neigh: set correct AF for NDA_DSTTobias Jungel
In case using a VXLAN interface at a bridge you will set L2 bridging entries using a IP destination to tunnel the according L2 traffic. The current behavior for the dst entries for a neighbor is to use the AF of the neighbor itself thus in this case AF_BRIDGE is set. This is changed in the PR to update the family of the dst using nl_addr_guess_family. https://github.com/thom311/libnl/pull/180
2018-04-06rule: Add support for protocol and port rangesDavid Ahern
Add support for recent fib rule features - specifying a protocol that installed a rule and an IP protocol plus port range for rules. Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
2018-03-12route/vrf: initalize clone destination with NULL in vrf_clone()Jonas Johansson
Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
2018-02-15lib: route: rule: add rule_groups to cache opsRoopa Prabhu
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Acked-by: David Ahern <dsa@cumulusnetworks.com>
2018-02-12lib/rtnl: rename public define RTNL_GENEVE_ID_MAXThomas Haller
Public defines must have a libnl3 related prefix. Rename GENEVE_ID_MAX to RTNL_GENEVE_ID_MAX.
2018-02-12link: add Geneve support.Wang Jian
Signed-off-by: Wang Jian <jianjian.wang1@gmail.com>
2018-02-12lib: merge implementations of nl_attr_end() and nl_attr_keep_empty()Thomas Haller
Both functions are almost identical. Merge them into a common helper function with an @keep_empty argument, so it is clear at which point they differ. Also, fix symbols versioning for nl_attr_keep_empty(). For symbol versioning, once released a version cannot be modifified/extended.
2018-01-24Fix for cgroup filter addition problem.d0u9
Currently, due to the incomplete netlink datagram sent by libnl, cgroup filter addition is not fully functional. The datagram generated by `tc` command includes an empty attribute section, which is stripped off in the libnl counterpart. In this commit, a new `interface nla_nest_end_keep_empty()` is added. This function closes attribute without stripping off empty attribute.
2018-01-18route: rename rtnl_cls_cache_set_tcm_params() and fix symbol versioningThomas Haller
After rethinking, "tcm_params" doesn't seem like a good name. Change it to "tc_params". Also, an already released section in the linker file must never be modified. It defeats the purpose of symbol versioning. Move the symbol to the right section.
2018-01-18Add new function for setting ifindex and parent of a classifier cache.d0u9
It is not good to give classifier cache users only one chance to set interface index and parent handle when allocte new cache. Sometimes we want to reuse classifier cache to reduce the overhead of allocating new memory everytime a new cache is created.
2018-01-16Coding style formatd0u9
Fix incorrect code indent. https://github.com/thom311/libnl/pull/165
2018-01-16lib/veth.c: Disassociate link name of peer nameMarcos Paulo de Souza
Based in the function documentation, peer name could be set regardless of the link name being informed of not. These parameters should be checked independently. Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com> https://github.com/thom311/libnl/pull/162
2018-01-16route/netem: merge branch 'pr/159'Thomas Haller
https://github.com/thom311/libnl/pull/159
2018-01-16route: free previous data in rtnl_netem_set_delay_distribution_data()Thomas Haller
Otherwise, calling rtnl_netem_set_delay_distribution_data() will leak memory, and that should just be supported. Also, handle failure to allocate memory.
2018-01-16route: fix memleak in rtnl_netem_set_delay_distribution_data()Thomas Haller
2018-01-16route: mark data argument for rtnl_netem_set_delay_distribution_data() as constThomas Haller
2018-01-16route: add rtnl_netem_set_delay_distribution_data() to linker scriptThomas Haller
And some style fixes.
2018-01-16all: declare all variables at the beginning of scope ↵Thomas Haller
(-Wdeclaration-after-statement) Avoid gcc warning: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
2017-12-20route: add separate function to set netem qdisc delay distributionSteffen Vogel
A new function rtnl_netem_set_delay_distribution_data() has been added to allow the user to pass the delay distribution directly without loading it from a file. In conjunction with the maketable code (see iproute2 / NISTnet) this can be used to generate and load custom delay distributions on the fly.
2017-11-29Change rtnl_link_af_ops.ao_override_rtm behaviorJef Oliver
rtnl_link_af_ops.ao_override_rtm allows for a link module to override the change request type being sent to the kernel. More specifically, the default change request type is RTM_NEWLINK. Some link change requests require the reqeust type to be set to RTM_SETLINK. This is the case for IFLA_PROTINFO specific attributes for a link that is slave to a bridge. Currently, ao_override_rtm is static to the address family type. So, all changes submitted to AF_BRIDGE override the link change request type. The override only needs to happen if IFLA_PROTINFO attributes are appended to the link change request. This patch changes ao_override_rtm from a const integer to a function pointer that allows for a link module to determine if the override needs to actually happen. Currently, only the bridge module uses this functionality. If bridge flags are applied to a link (bdpu blocking, learning, fast leave, etc...), these flags are nested in IFLA_PROTINFO. If the flags are present, the link change request type will be overridden as RTM_SETLINK. This fixes the ability to set a bridge link up or down by using the correct RTM_NEWLINK link change request type. $ sudo src/nl-link-set -n br2 --state=down Changed bridge br2 ether a6:e6:94:8c:61:ec <broadcast,multicast,up,running,lowerup> group 0 $ ip link show br2: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000 $ sudo src/nl-link-set -n br2 --state=up Changed bridge br2 ether a6:e6:94:8c:61:ec <broadcast,multicast> group 0 $ ip link show br2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 Signed-off-by: Jef Oliver <jef.oliver@intel.com> Fixes: 55bc931a7272e6ac8f555bcc2a373eb2b6b58377 http://lists.infradead.org/pipermail/libnl/2017-November/002382.html http://lists.infradead.org/pipermail/libnl/2017-November/002385.html
2017-11-06route: fix handling old_nh in rtnl_route_parse() and avoid leakThomas Haller
The previous code would miss to release old_nh in the error path. Also, it relied on the present netlink attributes to have old_nh initialized. Don't do that. Also, fixup error codes by using "goto errout_nomem" where appropriate and keep @err as returned from rtnl_route_set_metric().
2017-10-23route/vlan: add capability to indicate heap overflow fix in ↵Thomas Haller
rtnl_link_vlan_set_egress_map() Without this fix/capablity, adding more then 4 mappings in rtnl_link_vlan_set_egress_map() overflows the heap.
2017-10-23route/vlan: grow buffer exponentially in rtnl_link_vlan_set_egress_map()Thomas Haller
By a factor of 1.5 instead of 2, to value wasted storage overhead higher then the number of operations. Also, check for integer overflows.
2017-10-23route/vlan: fix cloning vlan link in vlan_clone()Thomas Haller
We need to copy the entire source struct over from source to destination. The only thing that needs special handling is to deep-clone the vi_egress_qos buffer. Fixes: a7469ce758fac3631df6ce72eb3f89150070e7f8
2017-10-23route/vlan: fix memory corruption in rtnl_link_vlan_set_egress_mapSebastian Bixl
If you set more than four entries for the vlan egress map a memory corruption occurs because the reallocation does not reserve memory for more than four. Fixes: a7469ce758fac3631df6ce72eb3f89150070e7f8 https://github.com/thom311/libnl/pull/155 [thaller@redhat.com: squashed commits and updated commit message]
2017-10-12route: neigh: print family in neigh dumpsRoopa Prabhu
Since the neigh cache can contain msgs from different families, print family id to distinguish neigh cache entries in the dump output Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-10-12route: link: add family to dump messagesRoopa Prabhu
Since the link cache can contain msgs from different families, print family id to distinguish link cache entries in the dump output Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-10-09nl: add "const" specifier for nla_policy argument of parse functionsThomas Haller
Adding const to a function argument is generally not an API break (at least, if the argument is a struct, like in this case). Usually we declare the policy as static variables. The user should be able to mark them as "const", so that the linker makes the policy array read-only. Adjust the API to allow for that. Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-10-09libnl-3.4.0 releaseThomas Haller
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-09-21netconf: Put nc reference in msg_parserDavid Ahern
netconf_msg_parser is leaking memory. Add the put in the newly allocated nc object to release the initial reference. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> http://lists.infradead.org/pipermail/libnl/2017-September/002378.html
2017-09-01Potential memory leak becaue of wrong variable check.Amit Khatri
in rtnl_link_vf_vlan_alloc() function allocating memory to vlans while checking NULL or not vf_vlans. it can cause memory leak. Signed-off-by: Amit Khatri <amit.khatri@samsung.com> Signed-off-by: Rohit Pratap Singh <rohit.s@samsung.com> Fixes: 5d6e43ebef12deadf31fccfa46c0b34892675d36 http://lists.infradead.org/pipermail/libnl/2017-August/002373.html
2017-08-18route: Add support for MPLS encapDavid Ahern
Add support for MPLS lwtunnel encapsulation. Signed-off-by: David Ahern <dsahern@gmail.com>
2017-08-18route: Add support for lwtunnel encapsulationsDavid Ahern
Add framework to support lwtunnel encapsulations per nexthop. Encapsulations types are expected to fill in the nh_encap_ops for building and parsing messages, compare encapsulations in routes, dumping the encapsulations and freeing memory. Signed-off-by: David Ahern <dsahern@gmail.com>
2017-08-18route: Add support for ttl propagation in MPLS routesDavid Ahern
Add support for RTA_TTL_PROPAGATE attribute on a per-route basis. Used to enable/disable TTL propagation at LSP egress. Signed-off-by: David Ahern <dsahern@gmail.com>
2017-08-18route: Add support for MPLS address familyDavid Ahern
Add support for route in MPLS family. New attributes: - RTA_NEWDST - label stack for a nexthop - RTA_VIA - nexthop address (e.g., IPv4 or IPv6) Other changes required: - scope has to be universe for MPLS routes so fixup rtnl_route_guess_scope - priority attribute can not be set for MPLS. Change rtnl_route_parse to not set the attribute by default for AF_MPLS. - table attribute should not be set unless something other than the default table. For MPLS this attribute can not be set. '/' is the separator in label stacks for consistency with iproute2. Signed-off-by: David Ahern <dsahern@gmail.com>
2017-08-18addr: Add support for AF_MPLSDavid Ahern
MPLS 'addresses' are 4-byte labels with a prefix length of 20. Signed-off-by: David Ahern <dsahern@gmail.com>
2017-08-18addr: Add implementations for mpls_ntop and mpls_ptonDavid Ahern
Implementations of mpls_ntop and mpls_pton taken from iproute2. Signed-off-by: David Ahern <dsahern@gmail.com>
2017-08-14lib/route: add /usr/lib64/tc/ search path for netem dist fileThomas Haller
https://github.com/thom311/libnl/issues/148
2017-06-15all: avoid compiler warnings -Wimplicit-fallthroughThomas Haller
2017-06-15lib/genl/family.c: fix if (x) y; else y;Rasmus Villemoes
I'm not 100% sure this is the correct fix; maybe this really is supposed to return family->gf_maxattr, but this is an odd way of writing that. Anyway, comparing to the other genl_family_[gs]et functions, I suppose this is what was really meant.
2017-06-15lib/xfrm/ae.c: fix memcpy(dst, dst) bugRasmus Villemoes
This is clearly not what was intended. While at it, drop the pointless cast of the allocator's return value, and use plain malloc since we're explicitly populating all len bytes immediately afterwards.