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

Submitted by Cyrill Gorcunov on Sept. 13, 2018, 7:57 p.m.

Details

Message ID 20180913195758.30566-6-gorcunov@gmail.com
State Accepted
Series "net: Add support for raw inet sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 13, 2018, 7:57 p.m.
No need to call for do_dump_opt, since these params
are already fetched.

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

Patch hide | download patch | download mbox

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;
 	}