summaryrefslogtreecommitdiffstats
path: root/src/extra
Commit message (Collapse)AuthorAgeFilesLines
* src: Update UDP header length field after manglingDuncan Roe2019-10-061-0/+2
| | | | | | | | | | One would expect nfq_udp_mangle_ipv4() to take care of the length field in the UDP header but it did not. With this patch, it does. This patch is very unlikely to adversely affect any existing userspace software (that did its own length adjustment), because UDP checksumming was broken. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* checksum: Fix UDP checksum calculationPablo Neira Ayuso2019-09-303-8/+9
| | | | | | | | | | The level 4 protocol is part of the UDP and TCP calculations. nfq_checksum_tcpudp_ipv4() was using IPPROTO_TCP in this calculation, which gave the wrong answer for UDP. Based on patch from Alin Nastac, and patch description from Duncan Roe. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Revert "src: Declare the define visibility attribute together"Pablo Neira Ayuso2017-04-145-36/+72
| | | | | | | | This reverts commit 58cb0668dc15c78cd3af9eeaedf29386e86ecac1. Prepare a new patch to keep this update consistent with libmnl. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: Declare the define visibility attribute togetherKhem Raj2017-04-145-72/+36
| | | | | | | | | clang ignores the visibility attribute if its not defined before the definition. As a result these symbols become hidden and consumers of this library fail to link due to these missing symbols. Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extra: Define _GNU_SOURCE to get members of tcphdr&ucphdrFelix Janda2015-05-292-0/+2
| | | | | | | | | The source uses linux names for members of tcphdr. For example "source" instead of "th_sport", ... musl libc's headers need _GNU_SOURCE defined in order to expose these. Signed-off-by: Felix Janda <felix.janda@posteo.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extra: tcp: insufficient sanitization in nfq_tcp_get_payload()Pablo Neira Ayuso2014-06-301-3/+7
| | | | | | | Similar to 7335cbe ("extra: fix wrong implementation in nfq_udp_get_payload"). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extra: fix wrong implementation in nfq_udp_get_payloadTing-Wei Lan2014-06-301-4/+8
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extra: use inet_ntop instead of inet_ntoaTing-Wei Lan2014-06-301-1/+5
| | | | | | | | The result of inet_ntoa() will be overwritten by the next call to inet_ntoa(), so using it twice in the same snprintf() call causes wrong result. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: extra: add prefix nfq_ to internal checksum functionsPablo Neira Ayuso2013-08-134-10/+10
| | | | | | | | These functions are internal and they belong to the libnetfilter_queue scope, so let's add the corresponding nfq_ prefix. Suggested-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* build: avoid symbol namespace pollutionFlorian Westphal2013-08-131-0/+12
| | | | | | | | | | | | | | | As of f40eabb01 (add pkt_buff and protocol helper functions) libnetfilter_queue accidentally exports the internal function named 'checksum'. This is a bit too generic and may cause crashes with applications that worked fine before. This patch makes the functions checksum, checksum_tcpudp_ipv4 and checksum_tcpudp_ipv6 local by building with fvis-hidden and adding EXPORTs for the legacy api calls and the ones that seem to have missing EXPORT tags (mainly pktbuff api). Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: update doxygen documentation for new API for libmnlPablo Neira Ayuso2012-08-204-4/+83
| | | | | | This patch updates the doxygen documentation for the new API. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* pktbuff: fix pktb_push, _pull and _put functionPablo Neira Ayuso2012-08-201-2/+5
| | | | | | Fix wrong arithmetics and missing pktb->len update Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* extra: pktbuff: pktb_expand_tail return 0 if there is no room in the tailPablo Neira Ayuso2012-08-201-3/+9
| | | | | | | | | | | | pktb_expand_tail returns 0 if there is no room for the mangling. Note that we don't support dynamic reallocation, instead the caller is responsible for allocating the extra room via pktb_alloc according to the maximum amount of bytes it needs for the mangling. Since pkt_buff layout is not exposed, we can change this in the future if we prefer dynamic reallocation. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add mangle functions for IPv4/TCP and IPv4/UDPPablo Neira Ayuso2012-08-066-4/+135
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add pkt_buff and protocol helper functionsPablo Neira Ayuso2012-08-066-0/+798
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>