From a7d5401953c548c9479c386b52fffcba6b49c0e3 Mon Sep 17 00:00:00 2001 From: "fu.lin" Date: Wed, 27 Oct 2021 11:57:43 +0800 Subject: [PATCH 51/72] sk: ignore the bind error for icmp socket Conflict:NA Reference:https://gitee.com/src-openeuler/criu/pulls/21 Signed-off-by: fu.lin --- criu/sk-inet.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/criu/sk-inet.c b/criu/sk-inet.c index c0251db..96c2d09 100644 --- a/criu/sk-inet.c +++ b/criu/sk-inet.c @@ -1160,8 +1160,24 @@ int inet_bind(int sk, struct inet_sk_info *ii) } if (bind(sk, (struct sockaddr *)&addr, addr_size) == -1) { - pr_perror("Can't bind inet socket (id %d)", ii->ie->id); - return -1; + InetSkEntry *ie = ii->ie; + + /* + * Sometimes the ping-like program restoration may appear + * `bind()` error when it is specified the address. In view + * of the principle that we should try our best to restore the + * process, and ping-like program works abnormal can tolerate, + * just warn here instead of report error. + */ + if (ie->proto == IPPROTO_ICMP || ie->proto == IPPROTO_ICMPV6) { + pr_warn("Can't bind inet socket (id %d) proto %s\n", + ie->id, + ie->proto == IPPROTO_ICMP ? + "IPPROTO_ICMP" : "IPPROTO_ICMPV6"); + } else { + pr_perror("Can't bind inet socket (id %d)", ii->ie->id); + return -1; + } } if (rst_freebind) { -- 2.34.1