Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/soccr
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@virtuozzo.com>2016-04-18 16:06:58 +0300
committerPavel Emelyanov <xemul@virtuozzo.com>2017-01-16 11:03:42 +0300
commitc5de18a399ec8aed2b7560f926ebf18668a9ed6a (patch)
tree71ad1074dc2a253f8c1d0d075c6a0544a79a8fac /soccr
parentcab3f17645289141059c00cc452b4ed33f1f0c61 (diff)
soccr: Handle connection state
For now we only support ESTABLISHED state, so this is mostly a preparation for the future extention. Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Diffstat (limited to 'soccr')
-rw-r--r--soccr/soccr.c7
-rw-r--r--soccr/soccr.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/soccr/soccr.c b/soccr/soccr.c
index 0dfdb5e75..c27ba66e8 100644
--- a/soccr/soccr.c
+++ b/soccr/soccr.c
@@ -109,6 +109,8 @@ static int refresh_sk(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, str
return -1;
}
+ data->state = TCP_ESTABLISHED;
+
if (ioctl(sk->fd, SIOCOUTQ, &size) == -1) {
loge("Unable to get size of snd queue");
return -1;
@@ -265,7 +267,7 @@ err_recv:
/*
* This is how much data we've had in the initial libsoccr
*/
-#define SOCR_DATA_MIN_SIZE (16 * sizeof(__u32))
+#define SOCR_DATA_MIN_SIZE (17 * sizeof(__u32))
int libsoccr_get_sk_data(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size)
{
@@ -339,6 +341,9 @@ int libsoccr_set_sk_data_unbound(struct libsoccr_sk *sk,
if (!data || data_size < SOCR_DATA_MIN_SIZE)
return -1;
+ if (data->state != TCP_ESTABLISHED)
+ return -1;
+
if (set_queue_seq(sk, TCP_RECV_QUEUE,
data->inq_seq - data->inq_len))
return -2;
diff --git a/soccr/soccr.h b/soccr/soccr.h
index 2d8b7f3e1..e6239b7ec 100644
--- a/soccr/soccr.h
+++ b/soccr/soccr.h
@@ -12,6 +12,7 @@ void libsoccr_set_log(unsigned int level, void (*fn)(unsigned int level, const c
struct libsoccr_sk;
struct libsoccr_sk_data {
+ __u32 state;
__u32 inq_len;
__u32 inq_seq;
__u32 outq_len;