add macro to ignore cant connect inet socket back error

Submitted by Smite Chow on Oct. 22, 2018, 9:40 a.m.

Details

Message ID 20181022094038.22942-1-xiaopengyou2no1@gmail.com
State New
Series "add macro to ignore cant connect inet socket back error"
Headers show

Commit Message

Smite Chow Oct. 22, 2018, 9:40 a.m.
Signed-off-by: Smite Chow <xiaopengyou2no1@gmail.com>
---
 soccr/soccr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/soccr/soccr.c b/soccr/soccr.c
index 7d093b1a..03672008 100644
--- a/soccr/soccr.c
+++ b/soccr/soccr.c
@@ -492,8 +492,12 @@  static int libsoccr_set_sk_data_noq(struct libsoccr_sk *sk,
 
 	if (connect(sk->fd, &sk->dst_addr->sa, addr_size) == -1 &&
 						errno != EINPROGRESS) {
-		loge("Can't connect inet socket back\n");
+		logerr("Can't connect inet socket back");
+#ifndef TCPOPT_RESTORE_IGNORE_CANT_CONNECT_INET_SOCKET_BACK_ERROR
 		return -1;
+#else
+		return 0;
+#endif
 	}
 
 	if (data->state == TCP_SYN_SENT && tcp_repair_on(sk->fd))

Comments

Andrei Vagin Oct. 25, 2018, 5:20 p.m.
Hi Smite,

Thank you for the patch! Could you describe with more details who you
are going to use this functionality. Why it should be useful for someone
else.

And you adds an option which should be specified when a library is
compiled. I would like to have a runtime option for this.

On Mon, Oct 22, 2018 at 05:40:38PM +0800, Smite Chow wrote:
> Signed-off-by: Smite Chow <xiaopengyou2no1@gmail.com>
> ---
>  soccr/soccr.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/soccr/soccr.c b/soccr/soccr.c
> index 7d093b1a..03672008 100644
> --- a/soccr/soccr.c
> +++ b/soccr/soccr.c
> @@ -492,8 +492,12 @@ static int libsoccr_set_sk_data_noq(struct libsoccr_sk *sk,
>  
>  	if (connect(sk->fd, &sk->dst_addr->sa, addr_size) == -1 &&
>  						errno != EINPROGRESS) {
> -		loge("Can't connect inet socket back\n");
> +		logerr("Can't connect inet socket back");
> +#ifndef TCPOPT_RESTORE_IGNORE_CANT_CONNECT_INET_SOCKET_BACK_ERROR
>  		return -1;
> +#else
> +		return 0;
> +#endif
>  	}
>  
>  	if (data->state == TCP_SYN_SENT && tcp_repair_on(sk->fd))
> -- 
> 2.17.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu