mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: trond.myklebust@fys.uio.no
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Patch to pull NFS server address off root_server_path
Date: Wed, 06 Mar 2002 15:04:31 +1100	[thread overview]
Message-ID: <E16iSfH-0007W9-00@wagner.rustcorp.com.au> (raw)

This patch was submitted to the trivial patch daemon.  Looks OK to me,
Trond?

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

------- Forwarded Message

Date: Wed, 6 Mar 2002 14:06:46 +1100
To: trivial@rustcorp.com.au
Subject: Patch to pull NFS server address off root_server_path
X-Mailer: VM 7.03 under Emacs 21.1.90.1
From: "Martin Schwenke" <martin@meltin.net>

The following patch pulls an NFS server IP address off
root_server_path (handed out via the DHCP root-path option), if it is
present.  For example, you can do this sort of thing in dhcpd.conf:

  root-path = 192.168.1.33:/tftpboot/yip.zImage

The patch appears to be backwards compatible.

RFC2132 says this about the root-path option:

   This option specifies the path-name that contains the client's root
   disk.  The path is formatted as a character string consisting of
   characters from the NVT ASCII character set.

This is sufficiently vague to allow the path-name to include an
IP-address.  Also, I found some documentation for FreeBSD saying it
does this too, so it must be right, because those FreeBSD guys are
really smart...  :-)

peace & happiness,
martin

diff -r -u linux.orig/fs/nfs/nfsroot.c linux/fs/nfs/nfsroot.c
--- linux.orig/fs/nfs/nfsroot.c	Thu Oct 25 11:29:22 2001
+++ linux/fs/nfs/nfsroot.c	Wed Mar  6 14:01:10 2002
@@ -167,7 +167,7 @@
  *  need to have root_server_addr set _before_ IPConfig gets called as it
  *  can override it.
  */
-static void __init root_nfs_parse_addr(char *name)
+void __init root_nfs_parse_addr(char *name, u32 *addr)
 {
 	int octets = 0;
 	char *cp, *cq;
@@ -187,7 +187,7 @@
 	if (octets == 4 && (*cp == ':' || *cp == '\0')) {
 		if (*cp == ':')
 			*cp++ = '\0';
-		root_server_addr = in_aton(name);
+		*addr = in_aton(name);
 		strcpy(name, cp);
 	}
 }
@@ -344,7 +344,7 @@
 			line[sizeof(nfs_root_name) - strlen(NFS_ROOT) - 1] = '\0';
 		sprintf(nfs_root_name, NFS_ROOT, line);
 	}
-	root_nfs_parse_addr(nfs_root_name);
+	root_nfs_parse_addr(nfs_root_name, &root_server_addr);
 	return 1;
 }
 
diff -r -u linux.orig/net/ipv4/ipconfig.c linux/net/ipv4/ipconfig.c
--- linux.orig/net/ipv4/ipconfig.c	Tue Feb 26 07:14:51 2002
+++ linux/net/ipv4/ipconfig.c	Wed Mar  6 14:01:10 2002
@@ -1197,6 +1197,16 @@
 		ic_dev = ic_first_dev->dev;
 	}
 
+#ifdef CONFIG_ROOT_NFS
+	{
+		extern void __init root_nfs_parse_addr(char *name, u32 *addr);
+		u32 addr = INADDR_NONE;
+		root_nfs_parse_addr(root_server_path, &addr);
+		if (root_server_addr == INADDR_NONE)
+			root_server_addr = addr;
+	}
+#endif
+
 	/*
 	 * Use defaults whereever applicable.
 	 */

             reply	other threads:[~2002-03-06  4:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-06  4:04 Rusty Russell [this message]
2002-03-06 20:26 ` Trond Myklebust
2002-03-15  4:37 Martin Schwenke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E16iSfH-0007W9-00@wagner.rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®