summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
...
| * sit: Fix invalid function prototypes in public headerTobias Klauser2017-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | Change rtnl_link_get_sit_local() rtnl_link_sit_get_local() as this is the function's exported name. This fixes a GCC -Wmissing-prototypes warning. Fixes: d715b8a5f6ec ("introduce sit tunnel support") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* | build: distribute in.h in6.h libc-compat.hJeroen Roovers2017-01-201-16/+19
|/ | | | | | https://github.com/thom311/libnl/pull/130 Related: https://github.com/thom311/libnl/pull/127 Related: https://github.com/thom311/libnl/pull/121
* libnl-3.2.29 releaselibnl3_2_29Thomas Haller2016-12-301-0/+6
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* utils/trivial: rename internal _nl_offset_plus_sizeof() macro to ↵Thomas Haller2016-12-151-1/+1
| | | | | | | | | _nl_offsetofend() Kernel calls a very similar macro "offsetofend". So use that name as it migth be more familiar to the reader. Signed-off-by: Thomas Haller <thaller@redhat.com>
* link: add support for IFLA_GSO_MAX_SEGS and IFLA_GSO_MAX_SIZETobias Klauser2016-12-062-0/+6
| | | | Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* link: add support for IFLA_PHYS_SWITCH_IDTobias Klauser2016-12-062-0/+3
| | | | Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* link: add support for IFLA_PHYS_PORT_NAMETobias Klauser2016-12-062-0/+3
| | | | Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* link: add support for IFLA_CARRIER_CHANGESTobias Klauser2016-12-062-0/+3
| | | | | | Also expose the attribute value via link_dump_details() Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* route/act: add gact tc actionSushma Sitaram2016-12-024-0/+72
| | | | | | | Signed-off-by: Sushma Sitaram <sushma.sitaram@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com> http://lists.infradead.org/pipermail/libnl/2016-November/002249.html
* cache_mngr: add include callback v2Tobias Jungel2016-12-013-1/+12
| | | | | | | | | | | | | | | | | | | | | This patch adds change_func_v2_t to add a more detailed callback in case of a cache change. The change function is registered using the new nl_cache_mngr_add_cache_v2. In case the new change function is set, nl_cache_include_v2 and thus cache_include_v2 will be used to perform the cache inclusion. The parameter of change_func_v2_t are the following: * struct nl_cache * => cache * struct nl_object * => the old/deleted nl_object * struct nl_object * => the new nl_object * uint64_t => the result of nl_object_diff64 in case of a change * int => NL_ACT_* * void * => data https://github.com/thom311/libnl/issues/71 http://lists.infradead.org/pipermail/libnl/2016-September/002214.html http://lists.infradead.org/pipermail/libnl/2016-October/002229.html http://lists.infradead.org/pipermail/libnl/2016-November/002250.html
* lib: use MSG_PEEK by default for nl_recvmsgs()Thomas Haller2016-11-302-1/+17
| | | | | | | | | | | | | | | The MSG_PEEK API of recvmsg() should be avoid because it requires an additional syscall. But worse is to choose a too small buffer size and failing to receive the message. A user who is aware of the issue can avoid MSG_PEEK by either nl_socket_disable_msg_peek()/nl_socket_enable_msg_peek() or by setting a buffer size via nl_socket_set_msg_buf_size(). By default however we now use MSG_PEEK. This is more important since commit 90c6ebec9bd7a where the link dump request can be rather large. Signed-off-by: Thomas Haller <thaller@redhat.com>
* link: set ifi_change flags for rtnl_link_build_add_request()Thomas Haller2016-11-291-0/+8
| | | | | | | | For the add-request, we should set ifi_change flags together with the ifi_flags. A similar thing is done by rtnl_link_build_change_request() in commit 34ccb7210f1238f89229c117dc3d28cea7ae00bb. https://github.com/thom311/libnl/issues/111
* lib/route: add rx_nohandler link stats fieldTobias Klauser2016-11-291-0/+1
| | | | | | | | A new counter rx_nohandler was added to the link stats in kernel commit 6e7333d315a7 ("net: add rx_nohandler stat counter"). Wire it up in the libnl link stats as well. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* route/cls: support setting of selector fieldsSushma Sitaram2016-11-281-0/+1
| | | | | | | | | | Enables to set the shift, offset, mask and flags of the position to next header http://lists.infradead.org/pipermail/libnl/2016-September/002227.html http://lists.infradead.org/pipermail/libnl/2016-October/002232.html Signed-off-by: Sushma Sitaram <sushma.sitaram@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* ppp: fix API in ppp.h headerThomas Haller2016-11-281-2/+2
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* Add PPP supportJonas Johansson2016-11-283-1/+57
| | | | | | This patch add support for kernel PPP interfaces. Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
* utils: add internal _nl_offset_plus_sizeof() macroThomas Haller2016-11-281-0/+5
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: SRIOV Set FunctionalityJef Oliver2016-11-242-0/+26
| | | | | | | | | | * This patch adds functionality to set attributes on an SRIOV VF object. * This patch adds functionality to append attributes to the link change request sent to the kernel. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: SRIOV Info Dump FunctionsJef Oliver2016-11-241-0/+2
| | | | | | | | This patch adds functions to dump information and stats for each SRIOV VF. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: SRIOV Utility FunctionsJef Oliver2016-11-241-0/+7
| | | | | | | | This patch adds utility functions for translating link state and VLAN protocols for SRIOV VFs. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: SRIOV Clone SupportJef Oliver2016-11-241-0/+1
| | | | | | | | This patch adds support for cloning SRIOV VF specific data in the link object. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: SRIOV Parse and Read supportJef Oliver2016-11-247-0/+189
| | | | | | | | | | | | | | | | | | * This patch adds support for parsing SRIOV VF specific information on a link. * Adds LINK_ATTR_VF_LIST to add to link->ce_mask. * Extends the rtnl_link object to include 'l_vf_list', a member to carry information for SRIOV VFs. * Adds rtnl_link_sriov, a private structure to fill link->l_vf_list. * This patch adds support for reading parsed SRIOV VF specific informatino on a link. * This patch adds support for freeing stored SRIOV VF specific information on a link. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: remove unused struct xfrmnl_sec_ctx from header filesThomas Haller2016-11-061-9/+0
|
* xfrm: fix xfrm security context managementThomas Egerer2016-11-062-1/+9
| | | | | | | | | | | | | | | | The data structure of choice when adding/processing a security context for xfrm is struct xfrm(nl)_user_sec_ctx. The previous code did however use the (also exported) struct xfrm(nl)_sec_ctx. While sizeof(struct xfrm(nl)_*sec_ctx) yields the same result, the interpretation of one of the data structures as the other one messes up the contents. With this fix, the wrong data structure has been replaced with the correct one. Also -- since the size of the context string is not known -- one can now call xfrmnl_sa_get_sec_ctx with ctx_str being NULL, thus retrieving the length of the context string. A new capability has been introduced, to test whether libnl3 supports the modified semantics of this function. Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
* lib/route: Export correct ipgre functionalityJef Oliver2016-11-051-0/+3
| | | | | | | | | | | | | | * Rename rtnl_link_get_pmtudisc to rtnl_link_ipgre_get_pmtudisc in ipgre.c, making the function correctly match the exported functionality in ipgre.h. This fixes an error when trying to use the function, returning an incorrect type usage due to the link module already having a function of the same name. * Export rtnl_link_is_[ipgre/ipgretap] allowing for usage per documentation. Reported-by: Sharada Shiddibhavi <sharada.shiddibhavi@intel.com> Signed-off-by: Jef Oliver <jef.oliver@intel.com>
* vxlan: refactor setting/getting vxlan flagsThomas Haller2016-11-051-8/+2
| | | | | | | | | | | | As these properties are FLAG types in the netlink API, we should also expose them as such in the libnl API. It is less code and require less code to support a new flag. The point is really to keep the API smaller instead of wasting a getter and setter for each flag.
* vxlan: don't store vxlan flags as ce_maskThomas Haller2016-11-051-0/+9
| | | | | | | | The ce_mask is there to indicate whether a certain attribute is set or not. The VXLAN flags are different, because the flag is either set or not. It cannot have the meaning of being missing. Therefore, it should not be stored as a VXLAN_ATTR in ce_mask.
* vxlan: remove redundant enable/disable API from vxlanThomas Haller2016-11-051-18/+0
| | | | | | | | | The enable/disable API is redundant and increases the library in binary size and documentation. There should be one sensible way to do something, not several. Yes, there is prior act to that like rtnl_link_vxlan_disable_proxy(). That doesn't mean it should be repeated.
* vxlan: add support for additional VXLAN attributes.Brandon Carpenter2016-10-302-5/+236
| | | | | | | | | | | | | | | | | | | Includes all VXLAN attributes as of Linux kernel 4.7.5. In particular it adds the following attributes: * IFLA_VXLAN_PORT, * IFLA_VXLAN_UDP_CSUM, * IFLA_VXLAN_UDP_ZERO_CSUM6_TX, * IFLA_VXLAN_UDP_ZERO_CSUM6_RX, * IFLA_VXLAN_REMCSUM_TX, * IFLA_VXLAN_REMCSUM_RX, * IFLA_VXLAN_GBP, * IFLA_VXLAN_REMCSUM_NOPARTIAL, * IFLA_VXLAN_COLLECT_METADATA, * IFLA_VXLAN_LABEL, * IFLA_VXLAN_GPE https://github.com/thom311/libnl/pull/110
* macvlan: adjust types and merge MACVLAN_HAS_MACCOUNT and MACVLAN_HAS_MACDATAThomas Haller2016-09-271-1/+1
| | | | | | | | | | | | | | | | mvi_maccount only makes sense together with the data. They should be treated as one setting, and both should be consistent. That means, if there are no addresses, mvi_maccount should always be set to zero. This is regardless of whether the mvi_mask indicates that MACVLAN_HAS_MACADDR is set. Similarly, if mvi_maccount is larger then zero, the mvi_macaddr must point to some valid addresses. The only exception is, when mvi_maccount is zero, mvi_macaddr may be NULL or point to some data of zero allocated bytes. Also, ensure that uint32_t is used for all the types that compare with mvi_maccount. Signed-off-by: Thomas Haller <thaller@redhat.com>
* macvlan: add support for "source" modeMichael Braun2016-09-261-0/+18
| | | | | | This adds libnl support for new "source" mode. Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
* trivial: whitespaceThomas Haller2016-09-241-1/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: Support IFLA_BRIDGE_MODEJef Oliver2016-09-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | This patch adds support for hardware assisted bridge modes stored in IFLA_AF_SPEC[IFLA_BRIDGE_MODE]. This patch adds rtnl_link_[g/s]et_hwmode() functions, allowing for getting and setting the hardware mode for a bridged link. This patch adds the convenience functions for translating between integer and string names for hardware modes. This patch adds rtnl_link_bridge_set_self(), a function that stores flags in IFLA_AF_SPEC[IFLA_BRIDGE_FLAGS], an attribute that tells the kernel whether it should apply settings to the virtual bridge device or the hardware device itself. This requires hardware that supports the hardware flags. This patch adds bridge_fill_af(), a function to fill IFLA_AF_SPEC with AF_BRIDGE specific information. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: Allow override of IFLA_AF_SPEC nestingJef Oliver2016-09-241-0/+8
| | | | | | | | | | | | | | | | | | | | | This patch adds the ability to override nesting into an AF specific attribute. An example of this is the bridge module. Regular Nesting: [IFLA_AF_SPEC] [AF_INET] [AF_INET_ATTRS] Bridge Nesting: [IFLA_AF_SPEC] [AF_BRIDGE_ATTRS] This patch adds ao_fill_af_no_nest to struct rtnl_link_af_ops. When set to non-zero, this will override the nested AF attribute and allow nesting of attributes directly into IFLA_AF_SPEC. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: Extend Bridge FlagsJef Oliver2016-09-241-0/+3
| | | | | | | | | | | This patch adds support for the following bridge port flags: IFLA_BRPORT_UNICAST_FLOOD IFLA_BRPORT_LEARNING IFLA_BRPORT_LEARNING_SYNC Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: Add port state translation functionsJef Oliver2016-09-241-0/+3
| | | | | | | | This patch adds translation functions for translating the port state between integers and strings. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* remove multiple implementations of htonll(), ntohll()Davide Caratti2016-09-061-0/+8
| | | | | | use a single #define in include/netlink-private/utils.h Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
* macsec: fix maximum ICV lengthDavide Caratti2016-09-051-0/+2
| | | | | | | | | Update copy of kernel header 'if_macsec.h' to Linux 4.8-rc5, so that upstream commit 2ccbe2cb79f2f74ab739252299b6f9ff27586f2c ("macsec: limit ICV length to 16 octets") is included. Return -NLE_INVAL when trying to configure an ICV length greater than 16 octets. Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
* lib/route: set IFLA_PROTINFO attribute in request messageJef Oliver2016-08-291-0/+13
| | | | | | | | | | | | | | | | | | | | | | | This patch adds the functionality to set IFLA_PROTINFO in a request. This allows for appending protocol specific information to a request message. This patch adds ao_fill_pi to the rtnl_link_af_ops structure. This registers a function to fill the IFLA_PROTINFO attribute. This function follows the makeup of ao_fill_af. This patch adds ao_fill_pi_flags to the rtnl_link_af_ops structure. This registers an extra flag that can be bitmasked onto the IFLA_PROTINFO definition. This is useful for address families that require NLA_F_NESTED. This patch adds a function named af_fill_pi, which is called by build_link_msg. This function calls the registered function pointers for an address family to fill IFLA_PROTINFO and to bitmask any extra flags. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: allow override of message type during link changeJef Oliver2016-08-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | When rtnl_link_build_change_request() builds a change request, it sets the message type to RTM_NEWLINK by default. If the request fails, it changes the type to RTM_SETLINK, and resubmits. For some address families, this will result in a requested change never being applied by the kernel. An exmaple of this is the Linux bridge. When a netlink message of type RTM_NEWLINK is recieved, rather than failing, it simply ignores the message and does not return a failure. To fix this, this patch implements an override for address families that require it. The override can be set when an address family registers itself in libnl. This patch adds ao_override_rtm to the rtnl_link_af_ops structure. This patch adds a static function named af_request_type. This patch modifies rtnl_link_build_change_request to call af_request_type to properly set the request type if an address family wishes to override. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* compat: add linux/socket.h for __kernel_sa_family_tJeff Squyres2016-08-292-0/+22
| | | | | | | | | | | | | | | | | The __kernel_sa_family_t type is not present on older systems (e.g., RHEL 6), and libnl3 will not built without it. Copy /usr/include/linux/socket.h from a RHEL7 system to include/linux-private/linux/socket.h so that it will be found by the build system. Fortunately, this socket.h is small and self-contained; it contains very little (and does not #include any other files) beyond necessary type. https://github.com/thom311/libnl/pull/107 Signed-off-by: Jeff Squyres <jsquyres@cisco.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib: add utility function nl_strerror_l()André Draszik2016-08-252-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libnl currently uses strerror_r() throughout, but this is problematic because there is a non-standard GNU version implemented in glibc, and the standard POSIX version, which differ in signature. When using glibc, one can choose between the two versions using feature test macros _GNU_SOURCE and _POSIX_C_SOURCE. Given libnl is built using the former, we always get the glibc special version, and all code so far has been written for that non-standard version. Other C libraries like musl on the other hand only try to be posix compliant, and only ever provide the posix version of strerror_r(), which has a different signature. The alternative is to use strerror_l() rather than strerror_r() http://austingroupbugs.net/view.php?id=655 - this will avoid the non-confirming versions issue - strerror_l() is now recommended by POSIX to replace strerror_r() usage So rather than changing all uses of strerror_r() to be in line with posix, we are going to switch to the recommended interface strerror_l(). Since strerror_l() is slightly more difficuly to use, we add a little (private) wrapper that we can use from all current callsites of strerror_r(). Signed-off-by: André Draszik <adraszik@tycoint.com> Reviewed-by: Stephane Ayotte <sayotte@tycoint.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* nl-addr: avoid read-out-of-bound in nl_addr_fill_sockaddr()Thomas Haller2016-08-141-0/+7
| | | | | | https://github.com/thom311/libnl/issues/103 Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib: capability NL_CAPABILITY_RTNL_ADDR_PEER_ID_FIX for ID comparison of v4 ↵Thomas Haller2016-08-141-0/+7
| | | | | | | | | | | addresses The ID attributes for IPv4 addresses were broken which causes wrong nl_object_identical() and cache lookup. This capability shall indicate that the bug was fixed. Signed-off-by: Thomas Haller <thaller@redhat.com>
* cli: add noreturn attributesPeter Wu2016-08-141-2/+4
| | | | | | | | | Teach static code analyzers (such as Clang static analyzer) that code following nl_cli_fatal can never be executed. Avoids false positives such as detecting use of NULL pointers when that cannot happen. Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Thomas Haller <thaller@redhat.com>
* build: fixup headers for C++ inclusionCraig Gallek2016-08-127-10/+15
| | | | | | | | | | | | | - Fix typos in extern "C" wrappers. - 'class' is a reserved word, change to cls. - int -> enum casts are not automatic. - Static strings must be of type const char* - Add a few implicit header dependencies explicitly. http://lists.infradead.org/pipermail/libnl/2016-July/002165.html Signed-off-by: Craig Gallek <kraig@google.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnl-3.2.28 releaselibnl3_2_28Thomas Haller2016-07-081-0/+6
| | | | 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: add capability NL_CAPABILITY_RTNL_ADDR_PEER_FIX to indicate ↵Thomas Haller2016-06-291-0/+7
| | | | | | address fixes Signed-off-by: Thomas Haller <thaller@redhat.com>
* route/addr: fix ID comparison for AF_INET and AF_INET6 addressesThomas Haller2016-06-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>