Ignore network devices used by NBD 83/304783/5
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 23 Jan 2024 14:03:21 +0000 (15:03 +0100)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 8 Mar 2024 14:38:21 +0000 (15:38 +0100)
Add support for ignoring devices used by NBD to mount root the same way
ConnMan ignores devices used for NFS roots. nbdroot= nbddev= parameters
are used by Debian and Tizen initramfs scripts to configure NBD for
mounting as root device.

Change-Id: Ic30ca3110553c0646c3edb2d87a1ea8e8917b370
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Forwarded: https://lore.kernel.org/connman/20240308143630.2195695-1-l.stelmach@samsung.com/

src/inet.c

index 81668f8..b1c55b8 100644 (file)
@@ -3509,6 +3509,10 @@ static int get_nfs_server_ip(const char *cmdline_file, const char *pnp_file,
        for (pp = args; *pp; pp++) {
                if (!strcmp(*pp, "root=/dev/nfs"))
                        break;
+               if (!strncmp(*pp, "root=/dev/nbd", strlen("root=/dev/nbd")))
+                       break;
+               if (!strncmp(*pp, "nbddev=", strlen("nbddev=")))
+                       break;
        }
        /* no rootnfs found */
        if (!*pp)
@@ -3518,6 +3522,8 @@ static int get_nfs_server_ip(const char *cmdline_file, const char *pnp_file,
        for (pp = args; *pp; pp++) {
                if (!strncmp(*pp, "nfsroot=", strlen("nfsroot=")))
                        break;
+               if (!strncmp(*pp, "nbdroot=", strlen("nbdroot=")))
+                       break;
        }
        /* no nfsroot argument found */
        if (!*pp)