Commit 64d039dc authored by Pavel Emelyanov's avatar Pavel Emelyanov

tcp: Print error reported from sys_setsockopt

We use pr_perror, but after direct syscall calling the
errno is not initialized (and in PIE it doesn't even exists).
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 84a0cabb
......@@ -51,10 +51,11 @@ struct rst_tcp_sock {
static inline void tcp_repair_off(int fd)
{
int aux = 0;
int aux = 0, ret;
if (sys_setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux)) < 0)
pr_perror("Failed to turn off repair mode on socket");
ret = sys_setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux));
if (ret < 0)
pr_perror("Failed to turn off repair mode on socket (%d)", ret);
}
void tcp_locked_conn_add(struct inet_sk_info *);
......
......@@ -333,13 +333,15 @@ static u64 restore_mapping(const VmaEntry *vma_entry)
static void rst_tcp_repair_off(struct rst_tcp_sock *rts)
{
int aux;
int aux, ret;
aux = rts->reuseaddr;
pr_debug("pie: Turning repair off for %d (reuse %d)\n", rts->sk, aux);
tcp_repair_off(rts->sk);
aux = rts->reuseaddr;
if (sys_setsockopt(rts->sk, SOL_SOCKET, SO_REUSEADDR, &aux, sizeof(aux)) < 0)
pr_perror("Failed to restore of SO_REUSEADDR on socket");
ret = sys_setsockopt(rts->sk, SOL_SOCKET, SO_REUSEADDR, &aux, sizeof(aux));
if (ret < 0)
pr_perror("Failed to restore of SO_REUSEADDR on socket (%d)", ret);
}
static void rst_tcp_socks_all(struct rst_tcp_sock *arr, int size)
......
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