summaryrefslogtreecommitdiffstats
path: root/src/tcp.c
Commit message (Collapse)AuthorAgeFilesLines
* src: Fix for implicit-fallthrough warningsPhil Sutter2019-02-131-0/+1
| | | | | | | | Mark fall through cases as such. Note that correctness of those fall throughs have not been verified. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: simplify branch in tcp_accept()Pablo Neira Ayuso2015-08-181-7/+5
| | | | | | The same code is executed regardless the reason why accept() has failed. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: generalize file descriptor infrastructurePablo Neira Ayuso2012-08-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch generalizes the select-based file descriptor infrastructure by allowing you to register file descriptors and its callbacks. Instead of hardcoding the descriptors that needs to be checked. Now, struct fds_item contains a callback and pointer to data that is passed to it: struct fds_item { struct list_head head; int fd; + void (*cb)(void *data); + void *data; }; Then, we check which ones are active in the select_main_step() function: list_for_each_entry(cur, &STATE(fds)->list, head) { if (FD_ISSET(cur->fd, &readfds)) cur->cb(cur->data); } And it invoked the corresponding callback. I had to slightly modify the channel infrastructure to fit it into the changes. This modularity is required for the upcoming cthelper support. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: simplify TCP connection handling logicPablo Neira Ayuso2012-05-281-27/+2
| | | | | | | | | | Before this patch, we called accept() to likely return EAGAIN. This is not required as select() will tell us that we're ready to accept. Therefore, that early accept() invocation complicates the whole handling just to get the connection accepted a bit before. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: rate-limit the amount of connect() callsPablo Neira Ayuso2009-09-231-0/+14
| | | | | | | | This patch rate-limits the amount of connect() calls to avoid syn-floods when the other peer is not connected and we are generating updates. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: fix re-connect with multiple TCP channelsPablo Neira Ayuso2009-09-231-5/+5
| | | | | | | | This patch fixes a bug in the TCP support that breaks re-connections of the client side if several TCP channels are used in the configuration file. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: improve error handling in tcp_sendPablo Neira Ayuso2009-09-211-1/+4
| | | | | | | | | | | | With this patch, we increase the error stats if: * we failed to connect to the other peer. * some unexpected error made connect() fail. * sendto returned ECONNRESET or EPIPE. Moreover, we propagate the sendto() errors to upper layers under failure as Samuel Gauthier suggested. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* conntrackd: add support state-replication based on TCPPablo Neira Ayuso2009-08-231-0/+440
This patch adds support for TCP as protocol to replicate state-changes between two daemons. Note that this only makes sense with the notrack mode. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>