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

Cyrill Gorcunov gorcunov at gmail.com
Thu Mar 22 12:13:43 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 e29e4f478770..dc9c453fe8c0 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.14.3



More information about the CRIU mailing list