Commit graph

17 commits

Author SHA1 Message Date
Andrei Vagin
fd2995cc5b soccr: move connect from criu to soccr
We will need to disable the repair mode before connect()
to restore syn-sent sockets. And even now connect() looks
like a part of internal logic of libsoccr.

travis-ci: success for series starting with [01/21] build: install libnet-dev
v2: remove libsoccr_set_sk_data_unbound() from soccr.h
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
cdc6f4c107 soccr: add source and destination addresses to libsoccr_sk_data
These addresses will be used to restore half-closed sockets,
we will need to send a fake fin packet for that.

And in the next patch connect() will be moved into soccr.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Andrei Vagin
a73eb5300d soccr: add prefixes for log messages and print errno
loge() will start a message with "Error:" and
logd() will start a message with "Debug:".
logerr() will add strerror(errno) to the end of messages.

travis-ci: success for series starting with [01/21] build: install libnet-dev
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:04:48 +03:00
Adrian Reber
6d07a4f95b soccr: add '\n' to all loge/logd
Some of the loge messages where missing a '\n'. For consistency this
adds '\n' to all messages which were missing it.

travis-ci: success for libsoccr debug/info messages (rev2)
Signed-off-by: Adrian Reber <areber@redhat.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Cyrill Gorcunov
207bbd891f soccr: Generate config.h dynamically
Otherwise there is a broken symlink which makes tags/etags unhappy.

travis-ci: success for soccr: Generate config.h dynamically (rev5)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
[extended .gitignore, maked link relative to sources]
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Dmitry Safonov
f92b8d9c44 soccr: rectify Alpine build
Made a symlink to CRIU's generated config.h, played with
moving some code to soccr.h header.
Changed types from u32 to uint32_t, otherwise we should
include CRIU's "int.h" in soccr, but I'm lazy to add that.

Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
51e301571a soccr: Add soccr.h's comments
TODO: Write proper man page/doc.
TODO: Document that the library spoils the reuseaddrs option on socket.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
c5de18a399 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>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
cab3f17645 soccr/tcp: Restore queues using library
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
826a86e496 soccr/tcp: Restore socket's info after binding it
With window parameters, we have stuff to restore before
queues and after queues.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
611dc707e2 soccr/tcp: Restore socket's info before binding it
In TCP repair some stuff should be restored before calling
connect/bind on socker and some -- after it.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
c08eb3dde1 soccr/tcp: Read queues contents using library
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
d98c0ea67c soccr/tcp: Fill actual connection info using the library
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:42 +03:00
Pavel Emelyanov
4fdc20ed40 soccr/tcp: Introduce blob with connection info and getter for it
As an API for dumping and restoring the data the structure
with __u32-s is used. Getting one (and restoring) also involve
the size of the structure so that both -- caller and library --
can know which "version" of it the other one is using.

As a starting point all the fields that tcp_entry carries are
used.

Also note, that only tcp connection info is handled by the
library. Stuff like addresses and ports, socket options and
other are left for the caller to care for.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:41 +03:00
Pavel Emelyanov
b8b113bf56 soccr/tcp: Add _pause and _resume to library and use it
The calls put socket into a mode where it can be saved or
restored. Add take one out of this mode.

TODO: In criu we turn repair off (resume the socket) from
restorer blob that cannot use the library. Need to somehow
fix it.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:41 +03:00
Pavel Emelyanov
e3f270ac05 soccr: Add logging
In order to get messages from libsoccr I propose to
introduce a printing callback that can be set by library
user and that will be called by libsoccr.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:41 +03:00
Pavel Emelyanov
6d9e6d15bf soccr: Wire into builder
For now build the .a library not to produce criu wrappers.
Next version should include the .so library as well.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-01-16 11:03:41 +03:00