Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sk-inet: Support IP_TRANSPARENT and IPV6_TRANSPARENT socket options #2357

Open
wants to merge 3 commits into
base: criu-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions criu/sk-inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,16 +413,19 @@ static int dump_ip_opts(int sk, int family, int type, int proto, IpOptsEntry *io
/* 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);
ret |= dump_opt(sk, SOL_IPV6, IPV6_TRANSPARENT, &ioe->transparent);
} else {
ret |= dump_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
ret |= dump_opt(sk, SOL_IP, IP_PKTINFO, &ioe->pktinfo);
ret |= dump_opt(sk, SOL_IP, IP_TOS, &ioe->tos);
ret |= dump_opt(sk, SOL_IP, IP_TTL, &ioe->ttl);
ret |= dump_opt(sk, SOL_IP, IP_TRANSPARENT, &ioe->transparent);
}
ioe->has_freebind = ioe->freebind;
ioe->has_pktinfo = !!ioe->pktinfo;
ioe->has_tos = !!ioe->tos;
ioe->has_ttl = !!ioe->ttl;
ioe->has_transparent = !!ioe->transparent;

return ret;
}
Expand Down Expand Up @@ -812,6 +815,8 @@ int restore_ip_opts(int sk, int family, int proto, IpOptsEntry *ioe)
ret |= restore_opt(sk, SOL_IPV6, IPV6_FREEBIND, &ioe->freebind);
if (ioe->has_pktinfo)
ret |= restore_opt(sk, SOL_IPV6, IPV6_RECVPKTINFO, &ioe->pktinfo);
if (ioe->has_transparent)
ret |= restore_opt(sk, SOL_IPV6, IPV6_TRANSPARENT, &ioe->transparent);
} else {
if (ioe->has_freebind)
ret |= restore_opt(sk, SOL_IP, IP_FREEBIND, &ioe->freebind);
Expand All @@ -821,6 +826,8 @@ int restore_ip_opts(int sk, int family, int proto, IpOptsEntry *ioe)
ret |= restore_opt(sk, SOL_IP, IP_TOS, &ioe->tos);
if (ioe->has_ttl)
ret |= restore_opt(sk, SOL_IP, IP_TTL, &ioe->ttl);
if (ioe->has_transparent)
ret |= restore_opt(sk, SOL_IP, IP_TRANSPARENT, &ioe->transparent);
}

if (ioe->raw)
Expand Down
1 change: 1 addition & 0 deletions images/sk-inet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ message ip_opts_entry {
optional bool pktinfo = 5;
optional uint32 tos = 6;
optional uint32 ttl = 7;
optional bool transparent = 8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excess tab -> bad allignment.

}

message inet_sk_entry {
Expand Down
2 changes: 2 additions & 0 deletions test/zdtm/static/sock_ip_opts00.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct sk_opt sk_opts_v4[] = {
{ SOL_IP, IP_PKTINFO, IP_OPT_VAL },
{ SOL_IP, IP_TTL, 32 },
{ SOL_IP, IP_TOS, IPTOS_TOS(IPTOS_THROUGHPUT) },
{ SOL_IP, IP_TRANSPARENT, IP_OPT_VAL },
};

#ifndef IPV6_FREEBIND
Expand All @@ -37,6 +38,7 @@ struct sk_opt sk_opts_v4[] = {
struct sk_opt sk_opts_v6[] = {
{ SOL_IPV6, IPV6_FREEBIND, IP_OPT_VAL },
{ SOL_IPV6, IPV6_RECVPKTINFO, IP_OPT_VAL },
{ SOL_IPV6, IPV6_TRANSPARENT, IP_OPT_VAL },
};

struct sk_conf {
Expand Down