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

sk-inet: support IP_PKTINFO and IPV6_RECVPKTINFO options

We see systemd-resolved relying on these options, and after migration
the options are lost and systemd-resolved stops serving dns requests.

The socket options make kernel add cmsg with destination address to
packets, see more how systemd-resolved uses them:

00a60eaf5f/src/resolve/resolved-manager.c (L826)

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov 2022-11-29 14:47:28 +03:00 committed by Andrei Vagin
parent 7d4d4915af
commit bd9b66c8c0
2 changed files with 9 additions and 0 deletions

View File

@ -412,10 +412,13 @@ static int dump_ip_opts(int sk, int family, int type, int proto, IpOptsEntry *io
else if (type != SOCK_RAW)
/* Due to kernel code we can use SOL_IP instead of SOL_IPV6 */
ret |= dump_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
ret |= dump_opt(sk, SOL_IPV6, IPV6_RECVPKTINFO, &ioe->pktinfo);
} else {
ret |= dump_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
ret |= dump_opt(sk, SOL_IP, IP_PKTINFO, &ioe->pktinfo);
}
ioe->has_freebind = ioe->freebind;
ioe->has_pktinfo = !!ioe->pktinfo;
return ret;
}
@ -803,9 +806,13 @@ int restore_ip_opts(int sk, int family, int proto, IpOptsEntry *ioe)
if (family == AF_INET6) {
if (ioe->has_freebind)
ret |= restore_opt(sk, SOL_IPV6, IPV6_FREEBIND, &ioe->freebind);
if (ioe->has_pktinfo)
ret |= restore_opt(sk, SOL_IPV6, IPV6_RECVPKTINFO, &ioe->pktinfo);
} else {
if (ioe->has_freebind)
ret |= restore_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
if (ioe->has_pktinfo)
ret |= restore_opt(sk, SOL_IP, IP_PKTINFO, &ioe->pktinfo);
}
if (ioe->raw)

View File

@ -17,6 +17,8 @@ message ip_opts_entry {
optional bool freebind = 1;
// Fields 2 and 3 are reserved for vz7 use
optional ip_opts_raw_entry raw = 4;
optional bool pktinfo = 5;
}
message inet_sk_entry {