2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

13 Commits

Author SHA1 Message Date
Pavel Tikhomirov
f38e58836a net/sysctl: c/r ipv4/ping_group_range value
It is per net namespace, we need it to allow creation of unprivileged
ICMP sockets.

Note: in case this sysctl was disabled after unprivileged ICMP
socket was created we still need to somehow handle it on restore.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2025-02-03 12:35:58 +08:00
Adrian Reber
eb5726c44a images: re-license as Expat license (so-called MIT)
This changes the license of all files in the images/ directory from
GPLv2 to the Expat license (so-called MIT).

According to git the files have been authored by:

   Abhishek Dubey
   Adrian Reber
   Alexander Mikhalitsyn
   Alice Frosi
   Andrei Vagin (Andrew Vagin, Andrey Vagin)
   Cyrill Gorcunov
   Dengguangxing
   Dmitry Safonov
   Guoyun Sun
   Kirill Tkhai
   Kir Kolyshkin
   Laurent Dufour
   Michael Holzheu
   Michał Cłapiński
   Mike Rapoport
   Nicolas Viennot
   Nikita Spiridonov
   Pavel Emelianov (Pavel Emelyanov)
   Pavel Tikhomirov
   Radostin Stoyanov
   rbruno@gsd.inesc-id.pt
   Sebastian Pipping
   Stanislav Kinsburskiy
   Tycho Andersen
   Valeriy Vdovin

The Expat license (so-called MIT) can be found here:
https://opensource.org/licenses/MIT

According to that link the correct SPDX short identifier is 'MIT'.

https://spdx.org/licenses/MIT.html

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-09-03 10:31:00 -07:00
Cyrill Gorcunov
ebe3b52353 unix: sysctl -- Preserve max_dgram_qlen value
The /proc/sys/net/unix/max_dgram_qlen is a per-net variable and
we already noticed that systemd inside a container may change its value
(for example it sets it to 512 by now instead of kernel's default
value 10), thus we need keep it inside image and restore then.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
2020-02-04 12:39:05 -08:00
Andrei Vagin
c2b21fbf4b criu: add support for external net namespaces
It works like other external resources.
A user specify which namespaces are external and have not to be dumped.
On restore, the user gives file descriptors to preconfigured namespaces.

How to use:
dump:
        --external net[INO]:KEY
restore:
        --inherit-fd fd[NSFD]:KEY

The test script contains more details how to use this:
test/others/netns_ext/run.sh

Acked-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-10-30 19:27:54 +03:00
Andrei Vagin
f06369b9e2 net: dump and restore connected to a bridge links
A network device, which is connected to a bridge, is restored
after the bridge. In this case we can set the master attribute and
the device will be connected to the bridge automatically.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-02-15 21:45:08 +03:00
Andrei Vagin
dd9e114276 images: add a network namespace id into images
It is possible to assign id for network namespaces and
this id will be used by the kernel in some netlink messages.
If no id is assigned when the kernel needs it, it will be
automatically assigned by the kernel.

For example, this id is reported for peer veth devices.

v2: add a comment
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-02-15 21:45:08 +03:00
Pavel Emelyanov
4a044e6af9 net: Dump regular sit device
Nothing special here, just parse all known NLAs and keep them
on the image.

Issue #11

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-10-17 10:48:46 +03:00
Cyrill Gorcunov
59c9583992 images: netdev -- Adjust venet comment
venet is not virtuozzo specific but rather
came from openvz, make it so.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-08-16 13:06:50 +03:00
Tycho Andersen
5f2233ea71 net: add support for macvlan link types
While this is in principle similar to how veths are handled, we have to do
things in two different ways depending on whether or not there is a user
namespace involved, because there is no way to ask the kernel to attach a
macvlan NIC to a device in a net ns that we don't have CAP_NET_ADMIN in.

So we do it in two ways:

a. If we are in a user namespace, we create the device in usernsd and use
   IFLA_NET_NS_FD to set the netns which it should be created in (saving
   us a "move into this netns" step).

b. If we aren't in a user namespace, we could still be in a net namespace,
   so we use IFLA_LINK_NETNSID to set namespace that the i/o device will be
   in. Then we open a netlink socket from criu's netns and use
   IFLA_NET_NS_FD to tell the kernel to create the macvlan device in the
   target's namespace.

v2: * s/CLONE_NEWNET/CLONE_NEWUSER
    * Don't bother to dump IFLA_LINK and IFLA_LINK_NETNSID. Although we
      need to provide these on restore, there's no kernel interface that
      persists these. To populate IFLA_LINK, we require users pass
      --macvlan-pair, and we create a NETNSID relation as needed and pass
      that in for macvlan links (although this infrastructure could be used
      elsewhere for links that need it in the future, since is in the
      hoisted populate_newlink_req()).
    * use new external command instead of creating a --macvlan-pair option

v3: add a feature check for linux/net_namespace.h, since not every arch in
    travis has this (new-ish) header

v4: * include sys/types.h instead of linux/if.h to get IFF_UP flag
    * remove old doc addition about --macvlan-pair option

v5: define IFLA_LINK_NETNSID and RTM_NEWNSID if they don't exist

v6: define IFLA_MACVLAN_FLAGS and bump the size of IFLA_MACVLAN_MAX when
    necessary

v7: * remove unused struct macvlan_pair
    * split feature test for linux/net_namespace.h into separate patch
    * move IFLA_INFO_MAX testing in dump_one_netdev to the right patch
    * add documents for netwlink_extras fields
    * split changeflags into separate patch
    * use existing netnsid if we get EEXIST
    * move macvlan code to a helper function
    * use netnsid to restore in userns case, and not pid

v8: * define RTM_GETNSID since we use that too now :)
    * don't bother with IFLA_MACVLAN_MAX; we only understand things up to
      IFLA_MACVLAN_FLAGS, so let's just use that as our max instead. The
      problem with using macros here, is that IFLA_MACLAN_MAX is defined as
      a macro with an enum expansion in it, so we get bitten by the enum
      not being available at preprocessing time, and implicit zero coercion
      when testing against its value for stuff. Yeesh.

v10: * add some comments about when we set up NET_NS_FD and why we use
       IFLA_LINK and IFLA_NET_NS_ID
     * use the socket opened in restore_links() instead of opening one in
       restore_one_macvlan()
     * split the new argument to restore_one_link into its own patch

travis-ci: success for series starting with [v10,01/11] net: pass the struct nlattrs to dump() functions
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-03 18:14:17 +03:00
Sebastian Pipping
78ab4a548f Add missing "proto2" syntax marker
.. to address protobuf 3.x proto-c warnings

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-07 12:38:39 +03:00
Pavel Tikhomirov
200c8b002b net/ipv6/protobuf: add device config options for ipv6
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Reviewed-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:32:05 +03:00
Pavel Tikhomirov
7ea8601c99 protobuf: add SysctlEntry for ipv4/ipv6 sysctl confs or some others
int32 with boolean value in protobuf has the same size with bool,
many sysctls are boolean but we don't lose anything by storing them
in int32, so add only int32 and string fields

will need string field for stable_secret ipv6 sysctl

also such fromat allows us to easily handle non-present int sysctls
we can check if we have it using has_*arg

v3: rebase images/Makefile to criu-dev branch
v4: use enum for type

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Reviewed-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-05-27 13:32:03 +03:00
Cyrill Gorcunov
594fb52753 build: Move @protobuf dir into @images
But keep @protobuf as a symlink: we have
this path encoded in sources. Gonna be
removed with time.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-15 15:32:27 +03:00