summaryrefslogtreecommitdiffstats
path: root/lib/route/cls/ematch
Commit message (Collapse)AuthorAgeFilesLines
* all: use defines for attributesThomas Haller2024-04-221-1/+1
| | | | We have those defines. Use them throughout.
* 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-1/+1
| | | | | | | 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-025-9/+1
|
* all: cleanup includes and use "nm-default.h"Thomas Haller2023-08-025-10/+28
|
* include: split and drop "netlink-private/types.h"Thomas Haller2023-08-021-0/+2
| | | | | Move all the declarations from "netlink-private/types.h" to places closer to where they are used.
* route: merge "include/netlink-private/tc.h" to lib/route/tc-api.hThomas Haller2023-08-015-5/+0
| | | | | It's a private header only for lib/route (libnl-route-3). We already have a similar header. Move the content to "lib/route/tc-api.h".
* base: move "netlink-private/utils.h" to "base/nl-base-utils.h"Thomas Haller2023-07-311-1/+1
| | | | | | | | | | "base/nl-base-utils.h" (formerly "netlink-private/utils.h") contains no libnl3 specific references, just a bunch of C helpers. It's also a header-only "library", so it can be freely used by all our C-code. Move it to a separate directory, to make that clear.
* lib: use _nl_{init,exit} instead of __{init,exit}Thomas Haller2023-07-285-5/+5
| | | | | We should have things with "nl" prefix in our headers. Also, netlink-private/netlink.h is not header-only, preferably header-only stuff is in netlink-private/utils.h
* all: fix "-Wformat" warnings for nl_dump*()Thomas Haller2022-04-221-2/+2
|
* license: fix and add SPDX license identifiers and drop license commentsThomas Haller2020-04-165-35/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* lib: use _nl_strncpy*() instead of plain strncpy()Thomas Haller2020-04-151-2/+2
| | | | | | | | | | | | | | | | There wasn't really a bug previously, but it's ugly and raises questions about the correct use of strncpy(). For example, void genl_family_set_name(struct genl_family *family, const char *name) { strncpy(family->gf_name, name, GENL_NAMSIZ-1); was in fact correct, because family->gf_name will (presumably) always have a NUL character as last position. Still use _nl_strncpy*() wrappers, to avoid raising such questions.
* Sync linux headers to 4.19.66Michael Forney2019-08-261-1/+1
| | | | | | | | | | | | | | | | | | | This fixes the build with musl libc. Additionally, several changes were made to account for changes to the headers: - ip_mp_alg.h was removed, since it was removed in linux commit e06e7c61 (v2.6.23), and the last use of those constants was removed in libnl commit 535e8316. - Uses of TCF_META_ID_SK_ROUTE_CAPS were updated to __TCF_META_ID_SK_ROUTE_CAPS, since it was renamed in linux commit e20e6940 (v3.1). - Uses of IF_CARRIER_DOWN and IF_CARRIER_UP were replaced with their values, 0 and 1, since they are not in linux/if.h (they appear to be libnl-specific, added in libnl commit 3540e44b). https://github.com/thom311/libnl/pull/222
* lib: Don't omit second operand to `?` operatorMichael Forney2019-08-161-1/+1
|
* all: Avoid pointer arithmetic on `void *`Michael Forney2019-08-162-2/+2
| | | | | | | ISO C requires that the pointer operand to the binary + operator be to a complete object type[0]. [0] http://port70.net/~nsz/c/c11/n1570.html#6.5.6p2
* route: fix strncpy() warning from coverity about unterminated stringThomas Haller2019-08-081-0/+1
| | | | | | | | | | | | | | | | | | | | 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);
* include: don't include kernel headers in public libnl3 headersThomas Haller2017-03-023-0/+3
| | | | | | | | | | | | | | | | | It would be desirable not to include kernel headers in our public libnl3 headers. As a test, remove all those includes, and fix compilation by explicitly including the kernel headers where needed. In some cases, that requires forward declaration for kernel structures, as we use them as part of our own headers. Realistically, we cannot drop those includes as it probalby breaks compilation for users that expect to get a certain kernel header when including a libnl3 header. So, this will not be done and the includes will be restored in the next commit. Do this step to show how it would be and to verify that we could build with such a change. The reason not to do this is backward compatibility (at compile-time).
* cls: check data before memcpy() itNicolas PLANEL2014-08-271-1/+2
| | | | | | | | | | | [thaller@redhat.com: I modified the condition "if (data && len)" in the original patch to just check "len > 0". Note that all call sites of meta_alloc() make sure to pass a valid data pointer with a non-zero length (anything else would be a bug). But indeed, calling memcpy with invalid src pointer is undefined behavior, even if len is zero.] Signed-off-by: Thomas Haller <thaller@redhat.com>
* ematch/cmp: Include <netlink/route/cls/ematch/cmp.h>Thomas Graf2014-07-271-0/+1
| | | | | Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
* style: require comma after __ADD() macroThomas Haller2014-07-271-47/+47
| | | | | | | $ 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>
* Move private header files to <netlink-private/*>Thomas Graf2013-01-245-15/+15
| | | | | | | This clarifies the seperation between public and private header files. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* Clang diagnosticsКоренберг Марк (ноутбук дома)2012-10-191-1/+7
| | | | | | | | | | | | Based on clang diagnostics: 1. lib/nl.c: recvmsgs(): nla filling with zeros commented. 2. lib/route/classid.c: & lib/route/pktloc.c: remove zero-filling of struct stat 3. lib/route/qdisc/htb.c: Fix htb_qdisc_msg_fill(): fix zero-filling 4. ematch/container.c: container_parse: commented why only 4 bytes are copied len marked as unused to eliminate compiler warning
* constify struct trans_tblThomas Graf2010-11-171-2/+2
|
* ematch/meta: id definitionsThomas Graf2010-11-031-1/+44
|
* Support for meta matchThomas Graf2010-10-311-0/+291
| | | | | Syntax: meta(pktlen > 768)
* text ematch supportThomas Graf2010-10-291-0/+183
|
* Tons of ematch workThomas Graf2010-10-283-67/+185
| | | | | | | | | | - Fixes a bunch of bugs related to ematches - Adds support for the nbyte ematch - Adds a bison/flex parser for ematch expressions, expressions may look like this: ip.length > 256 && pattern(ip6.src = 3ffe::/16) documenation on syntax follows - adds ematch support to the basic classifier (--ematch EXPR)
* - Reworked the classifier interface.Thomas Graf2009-09-022-0/+155
- Added initial ematch support - Added support for the basic classifier - Added support for the cgroup classifier