diff options
author | Andrei Vagin <avagin@virtuozzo.com> | 2017-02-15 02:59:25 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@virtuozzo.com> | 2018-02-15 19:45:49 +0300 |
commit | a54d3cf11098b2c853a584277fdae7f358afa7f2 (patch) | |
tree | db1e4a1d49ca997af90b19ff3d5e741b75a44092 /criu/sk-packet.c | |
parent | 17f163a6f28f0f70476d6b40e0154bca934d52fd (diff) |
net: save network namespaces for sockets
Each socket has to be restored in a proper namespaces where
it has been created.
Here is an issue about unconnected and unbound sockets,
they are not reported via socket-diag and we can't to
get their network namespaces.
v2: add a comment before get_socket_ns()
remove nsid from sk_packet_entry
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Diffstat (limited to 'criu/sk-packet.c')
-rw-r--r-- | criu/sk-packet.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/criu/sk-packet.c b/criu/sk-packet.c index 2aa2a2a3a..17432fc00 100644 --- a/criu/sk-packet.c +++ b/criu/sk-packet.c @@ -20,6 +20,7 @@ #include "xmalloc.h" #include "images/packet-sock.pb-c.h" #include "images/fdinfo.pb-c.h" +#include "namespaces.h" struct packet_sock_info { PacketSockEntry *pse; @@ -163,6 +164,8 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p) sd->sd.already_dumped = 1; psk.id = sd->file_id = id; + psk.ns_id = sd->sd.sk_ns->id; + psk.has_ns_id = true; psk.type = sd->type; psk.flags = p->flags; psk.fown = (FownEntry *)&p->fown; @@ -301,7 +304,7 @@ int packet_receive_one(struct nlmsghdr *hdr, struct ns_id *ns, void *arg) memcpy(sd->tx, RTA_DATA(tb[PACKET_DIAG_TX_RING]), sizeof(*sd->tx)); } - return sk_collect_one(m->pdiag_ino, PF_PACKET, &sd->sd); + return sk_collect_one(m->pdiag_ino, PF_PACKET, &sd->sd, ns); err: xfree(sd->tx); xfree(sd->rx); |