diff --git a/include/sk-inet.h b/include/sk-inet.h index 42694c489..18bce7d00 100644 --- a/include/sk-inet.h +++ b/include/sk-inet.h @@ -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 *); diff --git a/pie/restorer.c b/pie/restorer.c index e4d65c53b..f2559a5b7 100644 --- a/pie/restorer.c +++ b/pie/restorer.c @@ -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; - - tcp_repair_off(rts->sk); + int aux, ret; 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"); + pr_debug("pie: Turning repair off for %d (reuse %d)\n", rts->sk, aux); + tcp_repair_off(rts->sk); + + 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)