summaryrefslogtreecommitdiffstats
path: root/lib/route/link/sriov.c
Commit message (Collapse)AuthorAgeFilesLines
* all: fix and enable "-Wsign-compare" warningThomas Haller2024-05-291-3/+3
|
* include: use <linux/$file> instead of <linux-private/linux/$file>Thomas Haller2023-08-081-2/+2
| | | | | | As we now copy all linux headers, and we have include/linux-private in our include search path, just include the linux headers as we commonly do.
* include: include private linux headers with explicit pathThomas Haller2023-08-031-2/+2
| | | | | | | We have copies of the linux headers in include/linux-private. For those files, include the copies explicitly. No practice there is no difference, since we build with :-Ilinux-private".
* include: drop "netlink-private/netlink.h" and move declarationsThomas Haller2023-08-021-2/+0
|
* all: cleanup includes and use "nm-default.h"Thomas Haller2023-08-021-3/+6
|
* include: split and drop "netlink-private/types.h"Thomas Haller2023-08-021-0/+19
| | | | | Move all the declarations from "netlink-private/types.h" to places closer to where they are used.
* route: move "include/netlink-private/route/link/sriov.h" to ↵Thomas Haller2023-08-011-1/+1
| | | | lib/route/link-sriov.h
* include: move "include/netlink-private/route/link/api.h" to lib/routeThomas Haller2023-07-311-1/+2
| | | | | This header is entirely private to compiling libnl-route-3 under lib/route. Move the header there.
* sriov: fix setting ce_mask when parsing VF stat counterkyolee2022-07-061-1/+1
| | | | | | https://github.com/thom311/libnl/pull/324 Fixes: 5d6e43ebef12 ('lib/route: SRIOV Parse and Read support')
* route/sriov: fix buffer overflow in rtnl_link_sriov_parse_vflist()Thomas Haller2022-04-221-1/+1
| | | | | | | | | | | | | | Coverity: Error: OVERRUN (CWE-119): libnl-3.6.0/lib/route/link/sriov.c:653: overrun-buffer-arg: Overrunning array "stb" of 6 8-byte elements by passing it to a function which accesses it at element index 8 (byte offset 71) u # 651|··· # 652| if (t[IFLA_VF_STATS]) { # 653|-> err = nla_parse_nested(stb, IFLA_VF_STATS_MAX, # 654| t[IFLA_VF_STATS], # 655| sriov_stats_policy); Fixes: 5d6e43ebef12 ('lib/route: SRIOV Parse and Read support')
* all: fix "-Wformat" warnings for nl_dump*()Thomas Haller2022-04-221-1/+1
|
* route/link/sriov: fix initializing vlans in rtnl_link_sriov_clone()Thomas Haller2022-04-221-1/+1
| | | | | | | | | | | | | Error: SIZEOF_MISMATCH (CWE-398): libnl-3.6.0/lib/route/link/sriov.c:125: suspicious_sizeof: Passing argument "dst_vlan_info" of type "nl_vf_vlan_info_t *" and argument "dst_vlans->size * 8UL /* sizeof (dst_vlan_info) */" libnl-3.6.0/lib/route/link/sriov.c:125: remediation: Did you intend to use "sizeof (*dst_vlan_info)" instead of "sizeof (dst_vlan_info)"? # 123| dst_vlan_info = dst_vlans->vlans; # 124| memcpy(dst_vlans, src_vlans, sizeof(nl_vf_vlans_t)); # 125|-> memcpy(dst_vlan_info, src_vlan_info, # 126| dst_vlans->size * sizeof(dst_vlan_info)); # 127| d_vf->vf_vlans = dst_vlans; Fixes: a59cab6d0b0f ('lib/route: SRIOV Clone Support')
* all: avoid coverity warnings about assigning variable but not using itThomas Haller2022-04-221-5/+3
| | | | | | | | | | | | Workaround coverity warnings like: Error: CLANG_WARNING: libnl-3.6.0/lib/netfilter/exp.c:428:7: warning[deadcode.DeadStores]: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' # 426| } # 427|··· # 428|-> if ((err = nfnl_exp_build_tuple(msg, exp, CTA_EXPECT_NAT)) < 0) # 429| goto nla_put_failure; # 430|···
* license: fix and add SPDX license identifiers and drop license commentsThomas Haller2020-04-161-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes a few wrong SPDX license identifiers, where the original license comment indicates GPL-2.0-only. This is not done manually, but by running the following script: --- #!/bin/bash # Tool to drop license comments, adding SPDX license identifiers, while preserving # copyright comments. The point is not to manually do this task, but perform some # hacked up string replacement. _cp() { /bin/cp "$@" } _cat() { /bin/cat "$@" } in_file() { local T=$(mktemp) _cp -f "$1" "$T" _cat "$T" rm -f "$T" } out_file() { local T=$(mktemp) _cat - > "$T" _cp -f "$T" "$1" rm -f "$T" } join() { _cat "$@" | awk '{ printf("%s#x#", $0)}' } unjoin() { _cat - | sed 's/#x#/\n/g' } files_all() { git ls-files | grep -v '\.png$' | grep -v '^include/linux-private/' } adjust() { NEWLINES='\(#x#\)\+' COPYRIGHTS='\(\( \* Copyright (c) 20..\(-20..\|, 20..\)\? [^#]\+#x#\)\+\( \*#x# \* \(Stolen[^#]*\|Based on [^#]*\)#x#\)\?\)' _cat - | \ sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' | \ sed '1s%^/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x##x#%' | \ sed '1s%^\(\)/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU Lesser General Public#x# \*[ ]\+License as published by the Free Software Foundation version 2.1#x# \*[ ]\+of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: LGPL-2.1-only \*/#x#/*#x#\2 */#x##x#%' | \ sed '1s%^\(/\* SPDX-License-Identifier: LGPL-2.1-only \*/\|\)#x#/\*#x# \* [^#]*#x# \*#x# \*[ ]\+This library is free software; you can redistribute it and/or#x# \*[ ]\+modify it under the terms of the GNU General Public License as#x# \*[ ]\+published by the Free Software Foundation version 2 of the License.#x# \*#x#'"$COPYRIGHTS"' \*/'"$NEWLINES"'%/\* SPDX-License-Identifier: GPL-2.0-only \*/#x#/*#x#\2 */#x##x#%' } FILES=( $(files_all) ) for f in "${FILES[@]}"; do echo "processing \"$f\"..." in_file "$f" | join | adjust | unjoin | out_file "$f" done
* link/sriov: fix memleak in rtnl_link_sriov_clone()Thomas Haller2019-08-081-6/+18
| | | | Found by Coverity.
* Potential memory leak becaue of wrong variable check.Amit Khatri2017-09-011-1/+1
| | | | | | | | | | | | | 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
* sriov: avoid buffer overrun in rtnl_link_sriov_parse_vflist()Thomas Haller2017-01-171-0/+2
| | | | | | Fixes: 5d6e43ebef12deadf31fccfa46c0b34892675d36 Signed-off-by: Thomas Haller <thaller@redhat.com>
* sriov: fix crash in rtnl_link_sriov_parse_vflistLaine Stump2017-01-171-1/+1
| | | | | | | | | | | | | vf_vlan_info was incorrectly indexed with "len" (the length in bytes of the entire vfinfo_list rather than list_len (the index of the current end of the vf_vlan_info array) https://github.com/thom311/libnl/issues/126 http://lists.infradead.org/pipermail/libnl/2017-January/002270.html Fixes: 5d6e43ebef12deadf31fccfa46c0b34892675d36 Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib/route: SRIOV Set FunctionalityJef Oliver2016-11-241-1/+471
| | | | | | | | | | * 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/+138
| | | | | | | | 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/+39
| | | | | | | | 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/+52
| | | | | | | | 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-241-0/+753
* 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>