Thomas Haller
325d30403a
all: merge branch 'coverity-fixes'
...
https://bugzilla.redhat.com/show_bug.cgi?id=1606988
2019-08-08 17:45:00 +02:00
Thomas Haller
f1a085994a
link/sriov: fix memleak in rtnl_link_sriov_clone()
...
Found by Coverity.
2019-08-08 17:01:21 +02:00
Thomas Haller
f6f163d68e
route: fix strncpy() warning from coverity about unterminated string
...
Coverity says:
Error: BUFFER_SIZE_WARNING (CWE-120): [#def1]
libnl-3.4.0/lib/route/cls/ematch/text.c:94: buffer_size_warning: Calling strncpy with a maximum size argument of 16 bytes on destination array "t->cfg.algo" of size 16 bytes might leave the destination string unterminated.
# 92| struct text_data *t = rtnl_ematch_data(e);
# 93|
# 94|-> strncpy(t->cfg.algo, algo, sizeof(t->cfg.algo));
# 95| }
# 96|
Error: BUFFER_SIZE_WARNING (CWE-120): [#def11]
libnl-3.4.0/lib/xfrm/sa.c:1192: buffer_size_warning: Calling strncpy with a maximum size argument of 64 bytes on destination array "auth->alg_name" of size 64 bytes might leave the destination string unterminated.
# 1190| }
# 1191|
# 1192|-> strncpy(auth->alg_name, tmpl->auth->alg_name, sizeof(auth->alg_name));
# 1193| auth->alg_key_len = tmpl->auth->alg_key_len;
# 1194| memcpy(auth->alg_key, tmpl->auth->alg_key, (tmpl->auth->alg_key_len + 7) / 8);
2019-08-08 17:01:21 +02:00
xinbao
fbf831fe47
Add CTA_LABELS and CTA_LABELS_MASK to ctattr_type according to the new kernel
...
https://github.com/thom311/libnl/pull/218
2019-08-07 15:39:35 +02:00
Thomas Haller
7de65a051f
attr: mark nested attributes as NLA_F_NESTED
...
Kernel 5.2 is adding stricter checking for netlink messages.
In particular, for certain API it checks now that NLA_F_NESTED flag is
set for nested attributes ([1]).
Do like libmnl, which always adds this flag ([2]). So we should do
that as well.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b424e432e770d6dd572765459d5b6a96a19c5286
[2] https://git.netfilter.org/libmnl/tree/src/attr.c?id=5937dfcb0185f5cb9cf275992ea701ec4e619d9c#n535
2019-08-07 15:32:19 +02:00
Thomas Haller
e5961ffaf1
doc: fix typos in example in documentation
...
https://github.com/thom311/libnl/issues/210
2019-08-07 14:51:30 +02:00
Byeonggon Lee
4ff7c66996
tests: use nl_send_auto() instead of deprecated nl_send_auto_complete() in test-genl.c
...
https://github.com/thom311/libnl/pull/213
2019-08-07 14:44:58 +02:00
Thomas Haller
65b3dd5ac2
route/link: merge branch 'toanju/link-slave-kind'
...
https://github.com/thom311/libnl/pull/202
2019-03-07 11:54:16 +01:00
Thomas Haller
cf6804add6
route/link: avoid dangling pointer in rtnl_link_set_slave_type()
...
- don't leave a dangling pointer, in case we unset the
kind.
- try first to clone the string. If that fails, return early
without modifying the link. Only start modifying the link,
after we know it's going to succeed.
2019-03-07 11:50:52 +01:00
Tobias Jungel
c503f924a0
route/link: expose IFLA_INFO_SLAVE_KIND
...
add rtnl_link_{get,set}_slave_type functions to expose the
IFLA_INFO_SLAVE_KIND attribute.
2018-10-22 15:20:19 +02:00
Thomas Haller
08160f0555
route/macvlan: style fixes in "lib/route/link/macvlan.c"
2018-10-10 12:16:16 +02:00
Wang Jian
470b983546
link: macvlan fixes
...
1. While parsing flags, it overrides mode.
2. Before, dump-line and dump-details are same leading that macvlan info will be shown twice while dumpping details.
So make dump-line show nothing.
3. Add some spaces to show dump-details more prettier.
Signed-off-by: Wang Jian <jianjian.wang1@gmail.com>
Fixes: c76393e203
http://lists.infradead.org/pipermail/libnl/2018-August/002405.html
http://lists.infradead.org/pipermail/libnl/2018-September/002406.html
http://lists.infradead.org/pipermail/libnl/2018-September/002411.html
2018-10-10 12:11:55 +02:00
Patrick Havelange
123dc07bcc
nla_ok: fix overrun in attribute iteration.
...
A detailed explanation is provided in the original Linux kernel commit that
fixes the bug: 1045b03e07d85f3545118510a587035536030c1c
Valgrind spotted the issue when the remaining was negative.
This bug was triggering application crashes.
Signed-off-by: Patrick Havelange <patrick.havelange@tessares.net>
https://github.com/thom311/libnl/pull/199
2018-10-10 11:54:08 +02:00
Ilya Pronin
1ac40683a8
route/cls: fix potential memory leak
...
rtnl_act_append() cannot add more than TCA_ACT_MAX_PRIO actions to the
same list. Because of that rtnl_basic_add_action() and
rtnl_u32_add_action() should not increment the reference counter of the
given action until it is successfully added to the filter's list.
Signed-off-by: Ilya Pronin <ipronin@twitter.com>
Fixes: e5d9b828f6
https://github.com/thom311/libnl/pull/201
2018-10-10 11:48:55 +02:00
Thomas Haller
d1b5f55b31
route/act: merge branch 'westermo/act-vlan'
...
https://github.com/thom311/libnl/pull/198
2018-10-10 11:41:07 +02:00
Thomas Haller
46440e7fe7
route/act: return error code from act-vlan getters
...
Our API is unfortunately not consistent about this.
However, in general, getters should aim to return an
error code whether the attribute could be retrieved.
2018-10-10 11:37:41 +02:00
Thomas Haller
a358cf2cd1
route/act: style fixes in "lib/route/act/vlan.c"
2018-10-10 11:30:06 +02:00
Volodymyr Bendiuga
b004e40063
route:act: add vlan action
...
For more information please see:
http://man7.org/linux/man-pages/man8/tc-vlan.8.html
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
2018-10-10 11:12:08 +02:00
Volodymyr Bendiuga
07fa87ba90
include: import tc_vlan.h
...
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
2018-10-10 11:12:08 +02:00
Thomas Haller
5d1cef73c2
route/tc: merge branch ' westermo/tc-chain'
...
https://github.com/thom311/libnl/pull/197
2018-10-10 11:04:28 +02:00
Thomas Haller
a90256de2f
route/tc: return error code from rtnl_tc_get_chain()
...
Our API is unfortunately not consistent about this.
However, in general, getters should aim to return an
error code whether the attribute could be retrieved.
2018-10-10 11:02:46 +02:00
Volodymyr Bendiuga
c9b28170e7
route:tc: allow to set chain index for tc objects
...
This is useful when one wants to chain filters.
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
2018-10-10 11:00:21 +02:00
Thomas Haller
1bffe3cc67
lib/tc: fix uninitalized err variable in rtnl_tc_msg_build()
...
Fixes: 52cd3c14ce
2018-10-10 10:59:48 +02:00
Thomas Haller
8faa8659ec
build: sort entries in libnl-route-3.sym
2018-10-10 10:54:31 +02:00
Thomas Haller
ebcfdc28b8
lib/qdisc: merge branch 'westermo/qdisc-mqprio'
...
https://github.com/thom311/libnl/pull/196
2018-10-10 10:51:36 +02:00
Thomas Haller
b7419a1bce
lib/qdisc: avoid BUG() in "lib/route/qdisc/mqprio.c"
...
BUG() raises an assertion. It seems overly harsh.
For example, rtnl_tc_data() can fail if we fail to allocate
memory. Asserting against that, makes libnl3 not out-of-memory
safe.
Just return a regular error.
2018-10-09 15:31:39 +02:00
Thomas Haller
8a6c8e548d
lib/qdisc: style fixes in "lib/route/qdisc/mqprio.c"
2018-10-09 10:57:58 +02:00
Thomas Haller
52cd3c14ce
lib/tc: ensure correct error code in rtnl_tc_msg_build()
2018-10-08 13:41:25 +02:00
Thomas Haller
4702d53679
build: cleanup Makefile.am
...
Sort files asciibetically and add $(NULL) sentinel to
Makefile lines.
2018-10-08 13:22:28 +02:00
Volodymyr Bendiuga
25cf1d39ed
route:qdisc: add MQPRIO Qdisc
...
More about Qdisc mqprio can be found at:
http://man7.org/linux/man-pages/man8/tc-mqprio.8.html
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
2018-07-26 11:17:37 +02:00
Volodymyr Bendiuga
0fc332dc9c
include: import linux header pkt_sched.h
...
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@westermo.se>
2018-07-24 11:49:09 +02:00
Thomas Haller
9e34b5db36
route/ip-tunnels: merge branch 'TummyFish/pr/194' (partial)
...
Cherry-pick parts of the commits from pr#194.
https://github.com/thom311/libnl/pull/194
2018-06-25 15:17:54 +02:00
Thomas Haller
2eb0eebc41
include/linux: update copy of kernel headers
...
Taken from upstream kernel commit 29dcea88779c856c7dc92040a0c01233263101d4
(v4.17).
2018-06-25 15:13:19 +02:00
Thomas Winter
bb504393c4
if_tunnel: Update IFLA defines up to FWMARK
...
This is a new option that was added in Linux v4.12.
Signed-off-by: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
2018-06-25 15:10:42 +02:00
Thomas Winter
daa2edebe7
ipvti: Fix wrong array size initialization
...
IPv4 VTI tunnels use the VTI defines.
Signed-off-by: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
Fixes: 8f6301426a
2018-06-25 15:10:00 +02:00
Thomas Winter
a31948b905
ipgre: Fix wrong array size initialization
...
IPv4 GRE tunnels use the GRE defines.
Signed-off-by: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
Fixes: 57bdc4ff48
2018-06-25 15:07:46 +02:00
Tobias Jungel
a153517c5c
neigh: update neighbour.h and add missing flags
...
NTF_EXT_LEARNED, NTF_OFFLOADED and NTF_MASTER are added to neigh_flags.
https://github.com/thom311/libnl/pull/186
2018-06-25 14:50:03 +02:00
Tuetuopay
cd5f6f8429
route/link/vxlan: Fix IPv4 set_local resetting ce_mask
...
rtnl_link_vxlan_set_local() removes the bit for the other IP version in
ce_mask. A missing flag inversion in the v4 part made this removal
reset all bits to 0 except the v6 one, screwing all link configuration.
Fixes: 2e68fb5b02
https://github.com/thom311/libnl/pull/192
2018-06-25 14:44:56 +02:00
d0u9
ddfc36f46e
Add support for cloning cgroup filter object.
...
In this commit, we implement ematch_tree_clone(), which is basis of
cgroup_clone() interface. The whole ematch tree is deep-copied except
the e_ops filed.
Also, a new unit test is added for testing the interface, which named as
check-ematch-tree-clone.c located in tests directory.
https://github.com/thom311/libnl/pull/176
2018-06-25 14:39:41 +02:00
Tobias Jungel
3ebb0ea66b
neigh_dump_line: dump master as well
...
In case NEIGH_ATTR_MASTER is set this dumps as well the master
interface.
https://github.com/thom311/libnl/pull/190
2018-06-25 14:30:02 +02:00
Tobias Jungel
2e87f72bf4
neigh: add get/set functions for NEIGH_ATTR_MASTER
...
Beeing able to set NEIGH_ATTR_MASTER hash based lookups are possible for
AF_BRIDGE neighbours.
https://github.com/thom311/libnl/pull/189
2018-06-25 14:27:50 +02:00
Thomas Haller
ad7c49e77b
neigh: merge branch 'toanju/bridge-neigh'
...
https://github.com/thom311/libnl/pull/188
2018-06-25 14:25:00 +02:00
Tobias Jungel
250a7c9ae9
nl-neigh-list: free allocated items
2018-06-25 13:57:34 +02:00
Tobias Jungel
857961ac02
whitespace cleanup
2018-06-25 13:57:34 +02:00
Tobias Jungel
ee16d50a68
neigh: cache updates as well query AF_BRIDGE neigh
...
This commit adds the query for AF_BRIDGE neighbours. A cache refresh now
includes these objects as well. The result of `./src/nl-neigh-list
--family=bridge` includes now as well the same entries you would
retrieve from the kernel by calling `bridge fdb show`.
2018-06-25 13:57:34 +02:00
Matthieu Baerts
40fd4113f2
nl: fix function name in debug msg
...
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-06-25 13:55:22 +02:00
Tobias Jungel
0a96d14417
neigh: correct symbol exposed
...
instead of exposing rtnl_neigh_ll_get the function
rtnl_neigh_get_by_vlan has to be exposed
Fixes: 3bf503d30c
https://github.com/thom311/libnl/pull/187
2018-06-25 13:51:46 +02:00
d0u9
17f0459c8d
route/class: add new api rtnl_class_get_by_parent()
...
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-11 13:05:09 +02:00
Thomas Haller
2a3a669779
lib/route: merge branch 'pr/184'
2018-04-11 12:50:04 +02:00
Thomas Haller
bb446bc116
nl-msg: explicitly initialize nlmsg_seq and nlmsg_pid field in nlmsg_alloc_simple()
...
This is no change in behavior, because the NL_AUTO_* macros are both
zero.
2018-04-11 12:48:44 +02:00