summaryrefslogtreecommitdiffstats
path: root/src/expect/parse_mnl.c
Commit message (Collapse)AuthorAgeFilesLines
* conntrack: Replace strncpy with snprintf to improve null byte handlingDaniel Gröber2020-07-011-7/+8
| | | | | | | | | | | | | | We currently use strncpy in a bunch of places which has this weird quirk where it doesn't write a terminating null byte if the input string is >= the max length. To mitigate this we write a null byte to the last character manually. While this works it is easy to forget. Instead we should just be using snprintf which has more sensible behaviour as it always writes a null byte even when truncating the string. Signed-off-by: Daniel Gröber <dxld@darkboxed.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* expect: parse_mnl: fix gcc compile warningPablo Neira Ayuso2020-04-011-0/+1
| | | | | | | | | | | | | parse_mnl.c: In function ‘nfexp_nlmsg_parse’: parse_mnl.c:142:3: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] 142 | strncpy(exp->helper_name, | ^~~~~~~~~~~~~~~~~~~~~~~~~ 143 | mnl_attr_get_str(tb[CTA_EXPECT_HELP_NAME]), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | NFCT_HELPER_NAME_MAX); | ~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* expect: add missing handling for CTA_EXPECT_* attributesPablo Neira Ayuso2019-05-021-3/+61
| | | | | | | Add missing code to handle CTA_EXPECT_CLASS, CTA_EXPECT_NAT and CTA_EXPECT_FN from libmnl parser. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: introduce abi_breakage()Pablo Neira Ayuso2019-05-021-4/+4
| | | | | | | | | Changes in the netlink attribute layout is considered to be a kernel ABI breakage, so report this immediately and stop execution, instead of lazy error back to the client application, which cannot do anything with this. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* expect: add new API to build/parse ctnetlink messages using libmnlPablo Neira Ayuso2012-05-261-0/+104
This patch adds support to build and to parse netlink messages from/to one user-space nf_conntrack object. It uses libmnl, thus libnetfilter_conntrack now depends on this library. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>