[CRIU] [PATCH 05/15] inet: raw -- Reuse already known family and type in gen_uncon_sk

Cyrill Gorcunov gorcunov at gmail.com
Thu Sep 13 22:57:48 MSK 2018


No need to call for do_dump_opt, since these params
are already fetched.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/sk-inet.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/criu/sk-inet.c b/criu/sk-inet.c
index c0adc168bb01..a2059ec6921c 100644
--- a/criu/sk-inet.c
+++ b/criu/sk-inet.c
@@ -213,7 +213,8 @@ static int dump_sockaddr(union libsoccr_addr *sa, u32 *pb_port, u32 *pb_addr)
 	return -1;
 }
 
-static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p, int proto)
+static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p,
+					 int proto, int family, int type)
 {
 	struct inet_sk_desc *sk;
 	union libsoccr_addr address;
@@ -231,10 +232,8 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p, int
 	if (!sk)
 		goto err;
 
-	ret  = do_dump_opt(lfd, SOL_SOCKET, SO_DOMAIN, &sk->sd.family, sizeof(sk->sd.family));
-	ret |= do_dump_opt(lfd, SOL_SOCKET, SO_TYPE, &sk->type, sizeof(sk->type));
-	if (ret)
-		goto err;
+	sk->sd.family = family;
+	sk->type = type;
 
 	if (sk->sd.family == AF_INET)
 		aux = sizeof(struct sockaddr_in);
@@ -354,7 +353,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
 	if (IS_ERR(sk))
 		goto err;
 	if (!sk) {
-		sk = gen_uncon_sk(lfd, p, proto);
+		sk = gen_uncon_sk(lfd, p, proto, family, type);
 		if (!sk)
 			goto err;
 	}
-- 
2.17.1



More information about the CRIU mailing list