| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Otherwise, whether libnl-3.so exports nl_debug_dp depends on NL_DEBUG.
That is ugly. It also breaks the linker checking the symbol versioning
file with the "--no-undefined-version" flag.
Instead, always define it. It's small anyway.
Reported-by: lch361 <lch361@skiff.com>
See-also: https://github.com/thom311/libnl/pull/375
|
|
|
|
|
|
|
|
|
|
| |
Conditionally defining to nothing, means that the compiler doesn't see
the print statement without NL_DEBUG. In turn, we lack checking of the
statement by the compiler.
Instead, add an "if (NL_DEBUG)" around it. Since NL_DEBUG is a constant, the
compiler will optimize out all the code of the statement, while still
checking it.
|
|
|
|
|
|
|
|
|
|
| |
Checking conditional defines with #ifdef is error prone because we don't
get a compiler warning when the define wrongly is missing.
Instead, always define it to either 0 or 1.
The benefit is also that now we can use NL_DEBUG in C (not only in the
preprocessor).
|
|
|
|
| |
We have those defines. Use them throughout.
|
|
|
|
|
|
|
|
|
|
|
| |
For building all of our source files, we should include first
"config.h". This ensures that we have for example NL_DEBUG available.
Actually, "config.h" is included by "nl-default.h". In turn this means,
all our source files should first include "nl-default.h", which drags in
a set of default headers.
Fix the lex/yacc files for that.
|
|
|
|
| |
https://github.com/thom311/libnl/pull/373
|
|\
| |
| |
| | |
https://github.com/thom311/libnl/pull/372
|
| | |
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
| |
https://github.com/thom311/libnl/issues/370
https://github.com/thom311/libnl/pull/371
|
| |
|
|
|
|
| |
Add headers from 6995e2de6891c724bfeb2db33d7b87775f913ad1 (tag: v6.4).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity warns about this. Avoid it.
Error: CLANG_WARNING: [#def3]
libnl-3.8.0/lib/addr.c:324:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read
# 322| !strcasecmp(str, "any")) {
# 323|
# 324|-> len = 0;
# 325|
# 326| switch (hint) {
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity doesn't like this. Workaround.
Error: CPPCHECK_WARNING (CWE-190): [#def97]
libnl-3.8.0/lib/route/tc.c:681: error[integerOverflow]: Signed integer overflow for expression '1<<i'.
# 679|
# 680| for (i = 0; i < 32; i++)
# 681|-> if ((1 << i) == cell_size)
# 682| return i;
# 683|
|
|
|
|
|
|
| |
Don't return -1, that is not an error code.
Also, return early from function.
|
|
|
|
| |
Fixes: 49c20efaa783 ('xfrm: fix crashes in case of ENOMEM')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity really wants to warn if a time_t is cast to 32 bits.
We use time() here to get (some very bad) randomness. The loss
of the upper bits is the least of the problems.
Work around the coverity warning by also the higher bits.
Error: Y2K38_SAFETY (CWE-197): [#def12]
libnl-3.8.0/lib/socket.c:76: store_truncates_time_t: A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "time(NULL)" is cast to "uint32_t".
# 74|
# 75| if (idx_state == 0) {
# 76|-> uint32_t t = (uint32_t) time(NULL);
# 77|
# 78| /* from time to time (on average each 2^15 calls), the idx_state will
Error: Y2K38_SAFETY (CWE-197): [#def13]
libnl-3.8.0/lib/socket.c:193: store_truncates_time_t: A "time_t" value is stored in an integer with too few bits to accommodate it. The expression "time(NULL)" is cast to "unsigned int".
# 191| sk->s_local.nl_family = AF_NETLINK;
# 192| sk->s_peer.nl_family = AF_NETLINK;
# 193|-> sk->s_seq_next = (unsigned int) time(NULL);
# 194| sk->s_seq_expect = sk->s_seq_next;
# 195|
|
|
|
|
|
| |
Update the Fedora container for github. In particular, this updates
the used version of clang-format for formatting the C sources.
|
|
|
|
| |
Build a container image for the code formatting, and run that.
|
|
|
|
| |
Coverity warns "Signed integer overflow for expression '1<<31'".
|
|
|
|
|
|
| |
Coverity warns about this. Try to avoid the warning by casting.
We only use time() to get some (very little) entropy. The cast
is fine.
|
|
|
|
| |
Not important, but coverity flags this. Avoid it.
|
|
|
|
|
|
|
|
|
|
|
|
| |
rtnl_act_append() either takes ownership of the argument, or does
nothing (on error). This pattern is hard to get right. In the past,
there were various bugs at this place.
Add two wrappers _rtnl_act_append_get() and _rtnl_act_append_take()
which consistently don't take ownership of the pointer or take it.
Also, in functions like rtnl_flower_append_action() only set the mask
after successfully modifying the data.
|
|
|
|
|
|
| |
Using rtnl_act_append() correctly is hard.
Fixes: ef46de143206 ('route/cls: add flower classifier')
|
|
|
|
| |
Fixes: 105a6be10a5f ('route: use cleanup macro in rtnl_act_parse()')
|
| |
|
| |
|
|
|
|
|
|
|
| |
This is useful for a very special case. For a cleanup macro
that calls rtnl_act_put_all(). In that case, we have a auto
variable `struct rtnl_act *head`, but the cleanup function
expects as argument `&head`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity warns:
Error: RESOURCE_LEAK (CWE-772): [#def2]
libnl-3.8.0/lib/route/act.c:421: alloc_fn: Storage is returned from allocation function "rtnl_act_alloc".
libnl-3.8.0/lib/route/act.c:421: var_assign: Assigning: "act" = storage returned from "rtnl_act_alloc()".
libnl-3.8.0/lib/route/act.c:426: var_assign: Assigning: "tc" = "act".
libnl-3.8.0/lib/route/act.c:438: noescape: Resource "tc" is not freed or pointed-to in "rtnl_tc_set_kind".
libnl-3.8.0/lib/route/act.c:455: leaked_storage: Variable "tc" going out of scope leaks the storage it points to.
libnl-3.8.0/lib/route/act.c:455: leaked_storage: Variable "act" going out of scope leaks the storage it points to.
# 453| tc_act_stats_policy);
# 454| if (err < 0)
# 455|-> return err;
# 456|
# 457| if (tb3[TCA_STATS_BASIC]) {
Fixes: 05bd6366387c ('add support for TC action statistics')
|
|
|
|
|
|
|
|
|
|
|
|
| |
Seems the static array indices can confuse coverity. I think coverity is wrong
here, regardless, change it.
libnl-3.8.0/include/base/nl-base-utils.h:683: overrun-buffer-arg: Overrunning buffer pointed to by "buf" of 16 bytes by passing it to a function which accesses it at byte offset 45 using argument "(addr_family == 2) ? 16 : 46" (which evaluates to 46).
# 681| * and a suitably large buffer, it cannot. Assert for that. */
# 682|
# 683|-> r = (char *)inet_ntop(addr_family, addr, buf,
# 684| (addr_family == AF_INET) ? INET_ADDRSTRLEN :
# 685| INET6_ADDRSTRLEN);
|
|
|
|
|
|
|
| |
Adds the rtnl_link_can_get_device_stats function to get xstats of a
CAN-bus link as a can_device_stats struct.
https://github.com/thom311/libnl/pull/368
|
|
|
|
|
|
|
|
|
|
|
| |
This seems good for our test builds.
This can result in additional uninitialized variable warnings about
autovariables with cleanup attribute.
This flag is also enabled by default on Fedora package build ([1]).
[1] https://src.fedoraproject.org/rpms/redhat-rpm-config//blob/rawhide/f/buildflags.md
|
|\
| |
| |
| | |
https://github.com/thom311/libnl/pull/367
|
| |
| |
| |
| | |
Use cleanup attribute and return-early.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Use _nl_addr_build() helper. No need for all this redundant code.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
These internal error codes are probably a bad idea. However, at least be
consistent about it.
Fixes: 77bbf2270ce7 ('xfrm: fix an unintialized return value on memory allocation error in xfrmnl_ae_parse()')
|
| |
| |
| |
| |
| |
| |
| | |
Passing a size of (sizeof (ae_id->saddr)) is wrong for IPv4. The size depends
on the address family.
Fixes: 917154470895 ('xfrm: add xfrm support')
|
| | |
|
|/ |
|
|\
| |
| |
| | |
https://github.com/thom311/libnl/pull/366
|
| |
| |
| |
| |
| |
| |
| |
| | |
Leaving XFRM_SP_ATTR_TMPL active in the mask may not impose a problem
but, when removing the last template from a policy, the value signifying
attached templates should be cleared.
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's a similar issue as in commit 3f4f1dda, when calling
xfrmnl_sp_parse, the refcount of the addresses for selectors and
templates increases to two, as xfrmnl_sel_set_[s|d]addr and
xfrmnl_user_tmpl_set_[s|d]addr add another reference to the address
object. As only one of those refs is dropped in sel_destroy or
xfrmnl_user_tmpl_free respectively the address objects' refcount
will never drop to zero, causing a leak.
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
Fixes: 917154470895 ('xfrm: add xfrm support')
|
|
|
|
|
|
|
| |
[thaller@redhat.com: fixed wrong variable name in code and reworded
commit message.]
https://github.com/thom311/libnl/pull/363
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes tests with a non-bash shell as /bin/sh (in this case, dash) which
does not support `echo -e`. echo itself is portable, but not echo with any arguments.
Use `printf` instead.
Fixes: d9a1e0ce9c95 ('build: add "check-local-build-headers" test target to build public headers')
https://github.com/thom311/libnl/pull/360
|