summaryrefslogtreecommitdiffstats
path: root/lib/xfrm/ae.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/xfrm: add missing #include <time.h>Aleksander Mazur2024-01-081-0/+1
| | | | | | https://github.com/thom311/libnl/issues/370 https://github.com/thom311/libnl/pull/371
* xfrm: refactor error handling in XFRM parsingThomas Haller2023-11-291-24/+14
| | | | Use cleanup attribute and return-early.
* xfrm: fix crashes in case of ENOMEMThomas Haller2023-11-291-2/+9
|
* xfrm: fix error code for NLE_ENOMEM in xfrmnl_ae_parse()Thomas Haller2023-11-291-1/+1
| | | | | | | 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()')
* xfrm: fix parsing address in xfrmnl_ae_parse()Thomas Haller2023-11-291-2/+3
| | | | | | | 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')
* lib/xfrm: use thread-safe gmtime_r() instead of gmtime()Thomas Haller2023-08-181-2/+3
|
* include: use <linux/$file> instead of <linux-private/linux/$file>Thomas Haller2023-08-081-1/+1
| | | | | | 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/+2
|
* all: cleanup includes and use "nm-default.h"Thomas Haller2023-08-021-1/+3
|
* include: split and drop "netlink-private/types.h"Thomas Haller2023-08-021-2/+30
| | | | | Move all the declarations from "netlink-private/types.h" to places closer to where they are used.
* all: rework ATTR_DIFF() macros to not generate attribute namesThomas Haller2023-07-281-11/+15
| | | | | | | | | | I find macros that stitch together names like "FAMILY_ATTR_##ATTR" very confusing, because we no longer see where a certain name is used. It breaks grepping for symbols, and it breaks cscope. Yes, it's more verbose to not do that. If you really think that those names are too verbose, then maybe they should get a shorter name. And not use macros to make them palatable.
* xfrm: fix uninitalized variables in build_xfrm_ae_message()Thomas Haller2022-04-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error: UNINIT (CWE-457): libnl-3.6.0/lib/xfrm/ae.c:377: var_decl: Declaring variable "ae_id" without initializer. libnl-3.6.0/lib/xfrm/ae.c:402: uninit_use_in_call: Using uninitialized value "ae_id". Field "ae_id.flags" is uninitialized when calling "nlmsg_append". # 400| return -NLE_NOMEM; # 401|··· # 402|-> if (nlmsg_append(msg, &ae_id, sizeof(ae_id), NLMSG_ALIGNTO) < 0) # 403| goto nla_put_failure; # 404|··· Error: UNINIT (CWE-457): libnl-3.6.0/lib/xfrm/ae.c:377: var_decl: Declaring variable "ae_id" without initializer. libnl-3.6.0/lib/xfrm/ae.c:402: uninit_use_in_call: Using uninitialized value "ae_id". Field "ae_id.reqid" is uninitialized when calling "nlmsg_append". # 400| return -NLE_NOMEM; # 401|··· # 402|-> if (nlmsg_append(msg, &ae_id, sizeof(ae_id), NLMSG_ALIGNTO) < 0) # 403| goto nla_put_failure; # 404|··· Error: UNINIT (CWE-457): libnl-3.6.0/lib/xfrm/ae.c:377: var_decl: Declaring variable "ae_id" without initializer. libnl-3.6.0/lib/xfrm/ae.c:402: uninit_use_in_call: Using uninitialized value "ae_id". Field "ae_id.saddr" is uninitialized when calling "nlmsg_append". # 400| return -NLE_NOMEM; # 401|··· # 402|-> if (nlmsg_append(msg, &ae_id, sizeof(ae_id), NLMSG_ALIGNTO) < 0) # 403| goto nla_put_failure; # 404|···
* all: fix "-Wformat" warnings for nl_dump*()Thomas Haller2022-04-221-2/+3
|
* lib: make nl_object_clone() out-of-memory safeThomas Haller2022-03-161-4/+10
| | | | | | | | | | | | | | | | | nl_object_clone() first does a shallow copy using memcpy(). That is useful, because it can correctly copy simple fields (like numbers). For pointer values, we need to implement oo_clone() to fixup the pointers and get the deep-copy correct. Now, oo_clone() must always follow through, to un-alias the copied pointer. In particular also in the error case. The oo_clone() implementations sometimes fail (with ENOMEM) and just return. In those cases, we must make sure that we don't leave the wrong pointers there. The pointers must be cleared first. Otherwise, any failure (which basically are ENOMEM) leave the object in an inconsistent state, and we double-free/use-after-free the pointers.
* dbg: Use __func__ instead of __PRETTY_FUNCTION__Michael Forney2019-08-161-1/+1
| | | | | | | | These behave the same, except when used at top-level. This can't happen since the macro body is a statement. __func__ is standardized since C99, while __PRETTY_FUNCTION__ is a GNU extension.
* Add SPDX identifiersYegor Yefremov2019-08-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Software Package Data Exchange identifiers help to detect source file licenses and hence simplify the FOSS compliance process. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> https://github.com/thom311/libnl/pull/219 --- FILES=( lib/addr.c lib/attr.c lib/cache.c lib/cache_mngr.c lib/cache_mngt.c lib/data.c lib/error.c lib/fib_lookup/lookup.c lib/fib_lookup/request.c lib/genl/ctrl.c lib/genl/family.c lib/genl/genl.c lib/genl/mngt.c lib/handlers.c lib/hash.c lib/hashtable.c lib/idiag/idiag.c lib/idiag/idiag_meminfo_obj.c lib/idiag/idiag_msg_obj.c lib/idiag/idiag_req_obj.c lib/idiag/idiag_vegasinfo_obj.c lib/mpls.c lib/msg.c lib/netfilter/ct.c lib/netfilter/ct_obj.c lib/netfilter/exp.c lib/netfilter/exp_obj.c lib/netfilter/log.c lib/netfilter/log_msg.c lib/netfilter/log_msg_obj.c lib/netfilter/log_obj.c lib/netfilter/netfilter.c lib/netfilter/nfnl.c lib/netfilter/queue.c lib/netfilter/queue_msg.c lib/netfilter/queue_msg_obj.c lib/netfilter/queue_obj.c lib/nl.c lib/object.c lib/route/act.c lib/route/addr.c lib/route/class.c lib/route/classid.c lib/route/cls.c lib/route/link.c lib/route/neigh.c lib/route/neightbl.c lib/route/netconf.c lib/route/nexthop.c lib/route/nexthop_encap.c lib/route/nh_encap_mpls.c lib/route/pktloc.c lib/route/qdisc.c lib/route/route.c lib/route/route_obj.c lib/route/route_utils.c lib/route/rtnl.c lib/route/rule.c lib/route/tc.c lib/socket.c lib/utils.c lib/version.c lib/xfrm/ae.c lib/xfrm/lifetime.c lib/xfrm/sa.c lib/xfrm/selector.c lib/xfrm/sp.c lib/xfrm/template.c src/genl-ctrl-list.c src/idiag-socket-details.c src/lib/addr.c src/lib/class.c src/lib/cls.c src/lib/ct.c src/lib/exp.c src/lib/link.c src/lib/neigh.c src/lib/qdisc.c src/lib/route.c src/lib/rule.c src/lib/tc.c src/lib/utils.c src/nf-ct-add.c src/nf-ct-events.c src/nf-ct-list.c src/nf-exp-add.c src/nf-exp-delete.c src/nf-exp-list.c src/nf-log.c src/nf-monitor.c src/nf-queue.c src/nl-addr-add.c src/nl-addr-delete.c src/nl-addr-list.c src/nl-class-add.c src/nl-class-delete.c src/nl-class-list.c src/nl-classid-lookup.c src/nl-cls-add.c src/nl-cls-delete.c src/nl-cls-list.c src/nl-fib-lookup.c src/nl-link-enslave.c src/nl-link-ifindex2name.c src/nl-link-list.c src/nl-link-name2ifindex.c src/nl-link-release.c src/nl-link-set.c src/nl-link-stats.c src/nl-list-caches.c src/nl-list-sockets.c src/nl-monitor.c src/nl-neigh-add.c src/nl-neigh-delete.c src/nl-neigh-list.c src/nl-neightbl-list.c src/nl-pktloc-lookup.c src/nl-qdisc-add.c src/nl-qdisc-delete.c src/nl-qdisc-list.c src/nl-route-add.c src/nl-route-delete.c src/nl-route-get.c src/nl-route-list.c src/nl-rule-list.c src/nl-tctree-list.c src/nl-util-addr.c ) sed '1s#^#/* SPDX-License-Identifier: LGPL-2.1-only */\n#' "${FILES[@]}" -i
* lib/xfrm/ae.c: fix memcpy(dst, dst) bugRasmus Villemoes2017-06-151-2/+2
| | | | | | 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.
* xfrm/ae: Include own public header for function prototypesTobias Klauser2017-01-201-0/+1
| | | | | | | | | Include the own public header in order to get function prototypes for all public functions defined in this module. This fixes GCC -Wmissing-prototype warnings. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* trivial: whitespace-only fixes for src and libPeter Wu2016-08-121-2/+2
| | | | | | | | | | | Fixes alignment, lines with just whitespace and mixed tab/space indentation. Searched, reviewed and optionally fixed in vim using regex ^\t* [\t ]*\([^*us ]\|$\)\|\t\+$ http://lists.infradead.org/pipermail/libnl/2016-August/002183.html Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Thomas Haller <thaller@redhat.com>
* lib: update ce-mask to uint64_tDavid Ahern2016-02-121-2/+4
| | | | | | | | | | | | | | | | | | | | lib/route/link.c already defines 32 attributes which fills the current uint32_t used for ce_mask. To accommodate more attributes the mask needs to be expanded. This patch updates the definition to uint64_t. The nl_object_diff API is maintained for ABI with existing users. A new nl_object_diff64 API is added for the expanded attribute list. The MSB of the 32-bit API is used to indicate if higher order attributes had a mismatch. (Suggested by Thomas). Note that LINK_ATTR_LINK_NETNSID changes. But since the attribute flags are not public API it shouldn't be a problem. http://lists.infradead.org/pipermail/libnl/2015-December/002078.html http://lists.infradead.org/pipermail/libnl/2015-December/002083.html Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: fix an unintialized return value on memory allocation error in ↵Nicolas PLANEL2014-08-271-1/+3
| | | | | | | | xfrmnl_ae_parse() fix : err = -ENOMEM if calloc() failed Signed-off-by: Thomas Haller <thaller@redhat.com>
* style: require comma after __ADD() macroThomas Haller2014-07-271-19/+19
| | | | | | | $ sed -i 's/^\([\t ]\+\<__ADD\> \?([^)]\+)\) *$/\1,/' `git grep -w -l __ADD` Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: style-fixesThomas Haller2014-07-201-550/+552
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* xfrm: add xfrm supportSruthi Yellamraju2014-07-201-0/+977
Signed-off-by: Sruthi Yellamraju <ysruthi@gmail.com> Signed-off-by: Thomas Haller <thaller@redhat.com>