[CRIU] [PATCH cr] crtools: use a new interface for setting rcv_wscale

Andrey Vagin avagin at openvz.org
Tue Sep 18 04:15:45 EDT 2012


The previous interface is not backward compatible with big-endian
systems, so it should be chaged. Now snd_wscale is val & 0xFFFF and
rcv_wscale is val >> 16

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sk-tcp.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/sk-tcp.c b/sk-tcp.c
index fbebd08..da156cb 100644
--- a/sk-tcp.c
+++ b/sk-tcp.c
@@ -401,19 +401,10 @@ static int restore_tcp_opts(int sk, TcpStreamEntry *tse)
 	}
 
 	if (tse->opt_mask & TCPI_OPT_WSCALE) {
-		union {
-			struct {
-				u16 snd_wscale;
-				u16 rcv_wscale;
-			} v;
-			u32 raw;
-		} val = {
-			  .v.snd_wscale = tse->snd_wscale,
-			  .v.rcv_wscale = tse->rcv_wscale,
-			};
-		pr_debug("\t\tWill set wscale to %u\n", tse->snd_wscale);
+		pr_debug("\t\tWill set snd_wscale to %u\n", tse->snd_wscale);
+		pr_debug("\t\tWill set rcv_wscale to %u\n", tse->rcv_wscale);
 		opts[onr].opt_code = TCPOPT_WINDOW;
-		opts[onr].opt_val = val.raw;
+		opts[onr].opt_val = tse->snd_wscale + (tse->rcv_wscale << 16);
 		onr++;
 	}
 
-- 
1.7.1



More information about the CRIU mailing list