summaryrefslogtreecommitdiffstats
path: root/src/run.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-07-17 13:33:36 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2009-07-17 13:33:36 +0200
commit9406f29b89f6727c3db5485d109466701393b4d4 (patch)
tree6b5b9898b6bd9063d26087450b9044f2e500a80f /src/run.c
parent589fd85fa48b8e1da2debd08b90a6062cf64ef15 (diff)
local: add LOCAL_RET_* return values for UNIX sockets callbacks
This patch adds the LOCAL_RET_* return values. The return value LOCAL_RET_STOLEN which allows to leave a client socket open while waiting for an operation to finish. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/run.c')
-rw-r--r--src/run.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/run.c b/src/run.c
index 95d51a2..87b6fb2 100644
--- a/src/run.c
+++ b/src/run.c
@@ -182,18 +182,18 @@ static void dump_stats_runtime(int fd)
send(fd, buf, size, 0);
}
-void local_handler(int fd, void *data)
+static int local_handler(int fd, void *data)
{
- int ret;
+ int ret = LOCAL_RET_OK;
int type;
ret = read(fd, &type, sizeof(type));
if (ret == -1) {
STATE(stats).local_read_failed++;
- return;
+ return LOCAL_RET_OK;
}
if (ret == 0)
- return;
+ return LOCAL_RET_OK;
switch(type) {
case FLUSH_MASTER:
@@ -207,22 +207,26 @@ void local_handler(int fd, void *data)
nl_flush_conntrack_table(STATE(flush));
exit(EXIT_SUCCESS);
}
- return;
+ break;
case RESYNC_MASTER:
STATE(stats).nl_kernel_table_resync++;
dlog(LOG_NOTICE, "resync with master table");
nl_dump_conntrack_table(STATE(dump));
- return;
+ break;
case STATS_RUNTIME:
dump_stats_runtime(fd);
- return;
+ break;
case STATS_PROCESS:
fork_process_dump(fd);
- return;
+ break;
}
- if (!STATE(mode)->local(fd, type, data))
+ ret = STATE(mode)->local(fd, type, data);
+ if (ret == LOCAL_RET_ERROR) {
STATE(stats).local_unknown_request++;
+ return LOCAL_RET_ERROR;
+ }
+ return ret;
}
static void do_overrun_resync_alarm(struct alarm_block *a, void *data)