[5/5] sockets: Don't exit with error if raw module unloaded

Submitted by Cyrill Gorcunov on Dec. 20, 2018, 8:08 a.m.

Details

Message ID 20181220080841.28950-6-gorcunov@gmail.com
State Accepted
Series "net: diag -- Placate diag probing"
Headers show

Commit Message

Cyrill Gorcunov Dec. 20, 2018, 8:08 a.m.
In regular checkpoint (not "check" action) current
architecture implies that basic diag modules such as
tcp/udp and etc will be loaded. In turn raw diag in
most case is either unloaded or even not compiled in
the system.

Thus for them just zap an error (but print this information
inside log). If an application does use raw sockets in real
we will fail later when being checkpointing the sockets
itselves.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/sockets.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/sockets.c b/criu/sockets.c
index 6601774a9513..30072ac73751 100644
--- a/criu/sockets.c
+++ b/criu/sockets.c
@@ -743,6 +743,18 @@  static int collect_err(int err, struct ns_id *ns, void *arg)
 	 */
 	if (err == -ENOENT) {
 		pr_debug("%s: %d\n", msg, err);
+		/*
+		 * Unlike other modules RAW sockets are
+		 * always optional and not commonly used.
+		 * Currently we warn user about lack of
+		 * a particular module support in "check"
+		 * procedure. Thus don't fail on lack of
+		 * RAW diags in a regular dump. If we meet
+		 * a raw socket we will simply fail on dump
+		 * procedure because it won't be resolved.
+		 */
+		if (gr->protocol == IPPROTO_RAW)
+			return 0;
 		return -ENOENT;
 	}