summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* conntrack: fix dump counter displayed with -L expectPablo Neira Ayuso2008-10-091-0/+1
| | | | | | This patch fixes the dump counter displayed with -L expect. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrack: fix filtering for unsupported protocolPablo Neira Ayuso2008-10-042-17/+51
| | | | | | | | | This patch fixes filtering for unsupported protocol. Thus, you can use -L -p 47 or -L -p gre to filter `gre' traffic. Based on an initial patch from Bryan Duff <bduff@astrocorp.com>. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrack: fix mark-based filtering for event displayPablo Neira Ayuso2008-10-021-3/+6
| | | | | | | | | | | The mark-based filtering for events does not work if the mark is not present in the event message. This happens because nfct_cmp() skips the comparison of the compared objects since it they do not have the same attributes set. This patch make use of the new NFCT_CMP_MASK flag that returns false if the first object passed as parameter is set and the second is not. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrack: cleanup XML header handlingPablo Neira Ayuso2008-09-281-22/+6
| | | | | | | This patch removes the use of snprintf and directly print the XML header to the standard output. This simplifies the handling. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrack: cleanup for the update pathPablo Neira Ayuso2008-09-281-4/+5
| | | | | | This patch cleans up the update path for the conntrack utility. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* ftfw: reset window and flush the resend queue during helloingPablo Neira Ayuso2008-09-251-1/+21
| | | | | | | | | | | | | This fixes two bugs when a hello message is received: * We can create malformed nack messages during the helloing. We have to reset the acknowlegdment window, otherwise we may create malformed nack messages. * We have to empty the resend list/queue when a hello message is received, otherwise the entries get stuck to the resend queue once the sequence number wraps around. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* ftfw: fix race condition in the helloing routinePablo Neira Ayuso2008-09-251-14/+30
| | | | | | | | | | | | | | | | | | | | This patch fixes a race condition that can prevent one node from sending the initial hello message required to reset the sequence tracking. node A node B | | start | | hello msg |----------------------->| stop | | start | | |<-----------------------| hello-back msg In the picture above, the node A never sends the hello messages. Thus, the node B drops the next messages as they are in the before boundary. This patch adds a new state to the the helloing state-machine to fix this problem. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* ftfw: fix race that triggers a double insertion into tx_listPablo Neira Ayuso2008-09-251-2/+9
| | | | | | | | This patch fixes a race condition that can trigger a double insertion to the tx_list. This happens if we receive two resync request very close or resync just after a nack or vice-versa. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix: remove node from tx_list when the state-entry is destroyPablo Neira Ayuso2008-09-211-6/+9
| | | | | | | | | This patches fixes a race that triggers a read-after-free access to the tx_list. The state-entry is destroyed but it is still in the list. The fix removes the state-entry from the tx_list in the destroy path. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cleanup: remove some debug messages from sync-ftfw.cPablo Neira Ayuso2008-09-171-31/+8
| | | | | | | Remove useless debug messages, now we have a pluging for tcpdump to debug the FT-FW protocol. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* filter: check if kernel-space filtering is availablePablo Neira Ayuso2008-09-172-10/+11
| | | | | | | | Check if the Linux kernel is >= 2.6.26, otherwise it does not support kernel-space filtering. This is not clean but we have no choice, the BSF infrastructure does not return ENOTSUPP for unsupported operations. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cleanup: Linux kernel version checkingPablo Neira Ayuso2008-09-171-6/+1
| | | | | | | Minor cleanup to save a couple of lines in the Linux kernel version checking. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* filter: fix NAT detection tweakPablo Neira Ayuso2008-09-162-18/+3
| | | | | | | | With this patch, we rely on the real source and destination of the packet to perform the filter. The current NAT detection tweak is broken for certain situations. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* ftfw: check for malformed ack and nack messagesPablo Neira Ayuso2008-09-161-0/+8
| | | | | | | This patch checks that the [from, to] interval of ack and nack messages is OK. In other words, we check that: to >= from Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cli: insert `conntrack-tools' string in help and error messagesPablo Neira Ayuso2008-08-121-4/+4
| | | | | | | Insert string `conntrack-tools' in error messages to explicitly print that this version is inside the conntrack-tools package. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cli: check for missing arguments in getopt_longPablo Neira Ayuso2008-08-121-7/+13
| | | | | | | | | From: Pablo Neira Ayuso <pablo@netfilter.org> If getopt_long returns '?', show an error telling that some arguments are missing. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cli: remove unrequired \n in error messagePablo Neira Ayuso2008-08-121-1/+1
| | | | | | Remove extra \n in error message. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cli: remove duplicated optarg checkingPablo Neira Ayuso2008-08-121-36/+0
| | | | | | | Remove duplicated optarg checkings for options that require mandatory paramaters. This checking is already done by getopt_long(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* netlink: avoid errors related to the expected bit handlingPablo Neira Ayuso2008-08-071-2/+15
| | | | | | | | We hit error if we try to change the expected bit for already existing conntracks. On the other hand, if the conntrack does not exist, do not change the expected bit, otherwise we also hit error. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cache iterators: commit master entries before related onesPablo Neira Ayuso2008-08-072-5/+36
| | | | | | Commit master entries before related ones to avoid ENOENT errors. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cache iterators: rework cache_reset_timersPablo Neira Ayuso2008-08-074-20/+25
| | | | | | | | | | | This patch adds the clause PurgeTimeout that sets the new timer when conntrackd -t is called. This command is particularly useful when the sysadmin triggers hand-overs between several nodes without rebooting as it reduces the timers of the remaining entries in the kernel. Thus, avoiding clashes between new and old entries that may trigger INVALID packets. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* netlink: add getter and check existence functionsPablo Neira Ayuso2008-08-072-2/+31
| | | | | | | | | | This patch adds nl_get_conntrack and it changes the behaviour of nl_exist_conntrack. Now, nl_get_conntrack requests the kernel for a conntrack and updates the cached entry. On the other hand, nl_exist_conntrack only inquiries for the existence of the entry. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* cache_iterators: do not report ENOENT in cache_reset_timersPablo Neira Ayuso2008-08-021-1/+0
| | | | | | | | | | Do not report ENOENT to log files, this may confuse users. There's a race condition when shortening the timers and handling the destroy messages. However, this problem is not serious as the point of the shortening is to reduce the lifetime of the conntracks. If the conntrack is dying, there's no point to shorten their lifetime anymore :) Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: add -t option to shorten conntrack timeoutsPablo Neira Ayuso2008-08-023-0/+46
| | | | | | | | | | | | | | | | | This patch adds the new option `-t' for conntrackd. This option shortens the value of the timeout for the cached entries that lives in the kernel. This option is particularly useful to remove the zombie established entries that remain in kernel if the user tests the platform by forcing the takeover from one to another node several times. We currently use the value of CommitTimeout which is sane for it. Adding a new option does not seem to add more flexibility IMO. Once we get the patches to notify user changes via ctnetlink and the netlink flag NLM_F_ECHO works, we may directly invoke a massive purge of the entries, however, such solution would still need evaluation. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* ftfw: show consistent information to users for problem diagnosingPablo Neira Ayuso2008-08-013-9/+26
| | | | | | | | | | This patch hides information that may confuse users while they are diagnosing problems in their setup. For example, we hide entries that are schedule to expire - from the user side, they are already destroyed entries; and we show in the counters the real active entries, not all that are stored in the caches. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix broken normal deletion in cachesPablo Neira Ayuso2008-08-012-41/+40
| | | | | | | | | | | | This patch fixes the non-timer-based cache deletion. This bug affects the alarm-based approach since the backup replicas did not get the deletion event, thus, delaying the deletion. This patch introduces cache_find() to look up for a conntrack object and __cache_del_timer() to perform direct deletions by means of the pointer obtained with cache_find(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix: wrong use of timersub in cache_timerPablo Neira Ayuso2008-08-011-1/+1
| | | | | | Fix wrong output in the dump of the expire timer which was negative. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix: use %zu instead of %u for size_tPablo Neira Ayuso2008-08-011-1/+1
| | | | | | Use %zu instead of %u for size_t to remove compilation warning. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* commit: retry at least once if we hit ETIME or ENOMEMEric Leblond2008-08-011-1/+18
| | | | | | | | | Some users are reporting ETIME errors in the update. This happens when you try to update a conntrack that is expiring. To avoid this problem, we retry once at least. We do similar for ENOMEM errors, although only users in virtual machines have reported this AFAIK. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add more sanity checks in the input pathPablo Neira Ayuso2008-08-012-8/+38
| | | | | | | Some users have reported crashes when nf_conntrack_ipv6 was not present. This patch performs more robust sanity checks in the input path. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* CLI: add new option --buffer-size for -EPablo Neira Ayuso2008-07-291-18/+43
| | | | | | | Add new option --buffer-size for -E to set the netlink socket buffer size. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* filter: skip protocol state filtering if state not presentPablo Neira Ayuso2008-07-291-0/+3
| | | | | | | Skip user-space the protocol state filter if the protocol state is not present in the event message. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* log: syslog displays the entry that triggers the errorPablo Neira Ayuso2008-07-241-2/+9
| | | | | | | | This patch fixes an inconsistency in the output. If syslog was chosen as logger, the conntrack entries that triggered an error were not displayed. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add support for kernel-space filtering via BSFPablo Neira Ayuso2008-07-232-0/+104
| | | | | | | This patch adds support for kernel-space filtering via BSF by means of the libnetfilter_conntrack's BSF high-level API. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Major rework of the user-space event filteringPablo Neira Ayuso2008-07-2210-323/+457
| | | | | | | | | | This patch reworks the user-space filtering. Although we have kernel-space filtering since Linux kernel >= 2.6.26, we keep userspace filtering to ensure backward compatibility. Moreover, this patch prepares the implementation of the kernel-space filtering via libnetfilter_conntrack's high-level berkeley socket filter API. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix xml output: wrap output with one root elementPablo Neira Ayuso2008-06-221-4/+44
|
* use only the original tuple to check if a conntrack is presentPablo Neira Ayuso2008-06-161-1/+9
|
* fix unsecure usage of printf and include limits.h (PATH_MAX and INT_MAX)Albin Tonerre2008-06-153-1/+3
|
* check if entries already exist in kernel before injectionPablo Neira Ayuso2008-06-151-15/+24
|
* delay the closure of the dump descriptor to fix assertion with cache_wtconntrack-tools-0.9.7Pablo Neira Ayuso2008-05-311-1/+3
|
* increase deletion stats when the timer is scheduled in cache_del_timeout()Pablo Neira Ayuso2008-05-311-2/+7
|
* define SO_[RCV|SND]BUFFORCE if not setPablo Neira Ayuso2008-05-271-0/+8
|
* remove secmark support for conntrackdPablo Neira Ayuso2008-05-272-3/+0
|
* fix leak in cache_destroy(): release objects before destroying the cachePablo Neira Ayuso2008-05-261-0/+1
|
* rework the HELLO logic inside FT-FWPablo Neira Ayuso2008-05-262-7/+47
|
* add best effort replication protocol (aka NOTRACK)Pablo Neira Ayuso2008-05-255-2/+203
|
* add eventfd emulation to communicate receiver -> senderPablo Neira Ayuso2008-05-254-8/+100
|
* only allow the use of --secmark for listing (filtering)Pablo Neira Ayuso2008-05-222-3/+5
| | | | add missing string.h required by strdup in config parsing
* check for missing IPv6 address before hashingPablo Neira Ayuso2008-05-211-0/+8
|
* Updates (-U) show the effect of the operation in the conntrack entryPablo Neira Ayuso2008-05-201-11/+36
|