Commit 536e5798 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

inet: raw -- Reuse already known family and type in gen_uncon_sk

No need to call for do_dump_opt, since these params
are already fetched.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent 347980d4
...@@ -220,7 +220,8 @@ static int dump_sockaddr(union libsoccr_addr *sa, u32 *pb_port, u32 *pb_addr) ...@@ -220,7 +220,8 @@ static int dump_sockaddr(union libsoccr_addr *sa, u32 *pb_port, u32 *pb_addr)
return -1; 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; struct inet_sk_desc *sk;
union libsoccr_addr address; union libsoccr_addr address;
...@@ -238,10 +239,8 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p, int ...@@ -238,10 +239,8 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p, int
if (!sk) if (!sk)
goto err; goto err;
ret = do_dump_opt(lfd, SOL_SOCKET, SO_DOMAIN, &sk->sd.family, sizeof(sk->sd.family)); sk->sd.family = family;
ret |= do_dump_opt(lfd, SOL_SOCKET, SO_TYPE, &sk->type, sizeof(sk->type)); sk->type = type;
if (ret)
goto err;
if (sk->sd.family == AF_INET) if (sk->sd.family == AF_INET)
aux = sizeof(struct sockaddr_in); aux = sizeof(struct sockaddr_in);
...@@ -361,7 +360,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa ...@@ -361,7 +360,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
if (IS_ERR(sk)) if (IS_ERR(sk))
goto err; goto err;
if (!sk) { if (!sk) {
sk = gen_uncon_sk(lfd, p, proto); sk = gen_uncon_sk(lfd, p, proto, family, type);
if (!sk) if (!sk)
goto err; goto err;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment