mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 10:16:41 +00:00
non-root: Don't dump socket option SO_MARK if 0
Restoring SO_MARK requires root or CAP_NET_ADMIN. If the value is 0 we will avoid dumping it so that we don't need to do a privileged call on restore. Signed-off-by: Younes Manton <ymanton@ca.ibm.com>
This commit is contained in:
parent
2180e03b90
commit
5a19c34322
1 changed files with 6 additions and 1 deletions
|
|
@ -647,8 +647,13 @@ int dump_socket_opts(int sk, SkOptsEntry *soe)
|
|||
ret |= dump_opt(sk, SOL_SOCKET, SO_PRIORITY, &soe->so_priority);
|
||||
soe->has_so_rcvlowat = true;
|
||||
ret |= dump_opt(sk, SOL_SOCKET, SO_RCVLOWAT, &soe->so_rcvlowat);
|
||||
soe->has_so_mark = true;
|
||||
/*
|
||||
* Restoring SO_MARK requires root or CAP_NET_ADMIN. Avoid saving it
|
||||
* in unprivileged mode if still has its default value.
|
||||
*/
|
||||
ret |= dump_opt(sk, SOL_SOCKET, SO_MARK, &soe->so_mark);
|
||||
if (soe->so_mark != 0)
|
||||
soe->has_so_mark = true;
|
||||
|
||||
ret |= dump_opt(sk, SOL_SOCKET, SO_SNDTIMEO, &tv);
|
||||
soe->so_snd_tmo_sec = tv.tv_sec;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue