diff -Nur linux-2.4.26/fs/Config.in linux-2.4.26-ipconfig-module/fs/Config.in --- linux-2.4.26/fs/Config.in 2004-02-18 14:36:31.000000000 +0100 +++ linux-2.4.26-ipconfig-module/fs/Config.in 2004-07-21 19:39:38.000000000 +0200 @@ -117,7 +117,9 @@ dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET dep_mbool ' Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS dep_mbool ' Allow direct I/O on NFS files (EXPERIMENTAL)' CONFIG_NFS_DIRECTIO $CONFIG_NFS_FS $CONFIG_EXPERIMENTAL - dep_bool ' Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP + if [ "$CONFIG_IP_PNP" != "n" ]; then + dep_bool ' Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS + fi dep_tristate 'NFS server support' CONFIG_NFSD $CONFIG_INET dep_mbool ' Provide NFSv3 server support' CONFIG_NFSD_V3 $CONFIG_NFSD diff -Nur linux-2.4.26/fs/nfs/Makefile linux-2.4.26-ipconfig-module/fs/nfs/Makefile --- linux-2.4.26/fs/nfs/Makefile 2003-08-25 13:44:43.000000000 +0200 +++ linux-2.4.26-ipconfig-module/fs/nfs/Makefile 2004-07-21 18:06:25.000000000 +0200 @@ -9,6 +9,10 @@ O_TARGET := nfs.o +# Objects that export symbols. + +export-objs := nfsroot.o + obj-y := dir.o file.o flushd.o inode.o nfs2xdr.o pagelist.o proc.o \ read.o symlink.o unlink.o write.o diff -Nur linux-2.4.26/fs/nfs/nfsroot.c linux-2.4.26-ipconfig-module/fs/nfs/nfsroot.c --- linux-2.4.26/fs/nfs/nfsroot.c 2003-08-25 13:44:43.000000000 +0200 +++ linux-2.4.26-ipconfig-module/fs/nfs/nfsroot.c 2004-07-21 20:47:41.000000000 +0200 @@ -82,6 +82,8 @@ #include #include #include +#include +#include #include /* Define this to allow debugging output */ @@ -104,6 +106,13 @@ static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */ static int nfs_port __initdata = 0; /* Port to connect to for NFS */ static int mount_port __initdata = 0; /* Mount daemon port number */ +u32 root_server_addr __initdata = INADDR_NONE; /* Address of NFS server */ +u8 root_server_path[NFS_ROOT_PATH_LEN] __initdata = { 0, }; /* Path to mount as root */ + +#ifdef CONFIG_IP_PNP_MODULE +EXPORT_SYMBOL(root_server_addr); +EXPORT_SYMBOL(root_server_path); +#endif /*************************************************************************** @@ -298,6 +307,39 @@ return 0; } +/* + * Extract IP address from the parameter string if needed. + */ +#ifdef CONFIG_IP_PNP_MODULE +u32 __init nfsroot_nfs_parse_addr(char *name) +{ + u32 addr; + int octets = 0; + char *cp, *cq; + + cp = cq = name; + while (octets < 4) { + while (*cp >= '0' && *cp <= '9') + cp++; + if (cp == cq || cp - cq > 3) + break; + if (*cp == '.' || octets == 3) + octets++; + if (octets < 4) + cp++; + cq = cp; + } + if (octets == 4 && (*cp == ':' || *cp == '\0')) { + if (*cp == ':') + *cp++ = '\0'; + addr = in_aton(name); + strcpy(name, cp); + } else + addr = INADDR_NONE; + + return addr; +} +#endif /* * Parse NFS server and directory information passed on the kernel @@ -315,7 +357,11 @@ line[sizeof(nfs_root_name) - strlen(NFS_ROOT) - 1] = '\0'; sprintf(nfs_root_name, NFS_ROOT, line); } +#ifdef CONFIG_IP_PNP_MODULE + root_server_addr = nfsroot_nfs_parse_addr(nfs_root_name); +#else root_server_addr = root_nfs_parse_addr(nfs_root_name); +#endif return 1; } diff -Nur linux-2.4.26/include/linux/nfs_fs.h linux-2.4.26-ipconfig-module/include/linux/nfs_fs.h --- linux-2.4.26/include/linux/nfs_fs.h 2004-04-14 15:05:40.000000000 +0200 +++ linux-2.4.26-ipconfig-module/include/linux/nfs_fs.h 2004-07-21 18:42:20.000000000 +0200 @@ -340,7 +340,11 @@ /* NFS root */ +#ifdef CONFIG_ROOT_NFS +#define NFS_ROOT_PATH_LEN 256 +extern u8 root_server_path[NFS_ROOT_PATH_LEN]; /* Path to mount as root */ extern void * nfs_root_data(void); +#endif #define nfs_wait_event(clnt, wq, condition) \ ({ \ diff -Nur linux-2.4.26/include/net/ipconfig.h linux-2.4.26-ipconfig-module/include/net/ipconfig.h --- linux-2.4.26/include/net/ipconfig.h 2001-05-02 05:59:24.000000000 +0200 +++ linux-2.4.26-ipconfig-module/include/net/ipconfig.h 2004-07-21 18:06:25.000000000 +0200 @@ -21,7 +21,6 @@ extern u32 ic_servaddr; /* Boot server IP address */ extern u32 root_server_addr; /* Address of NFS server */ -extern u8 root_server_path[]; /* Path to mount as root */ diff -Nur linux-2.4.26/net/ipv4/Config.in linux-2.4.26-ipconfig-module/net/ipv4/Config.in --- linux-2.4.26/net/ipv4/Config.in 2003-11-28 19:26:21.000000000 +0100 +++ linux-2.4.26-ipconfig-module/net/ipv4/Config.in 2004-07-21 18:06:25.000000000 +0200 @@ -15,8 +15,8 @@ bool ' IP: use TOS value as routing key' CONFIG_IP_ROUTE_TOS bool ' IP: verbose route monitoring' CONFIG_IP_ROUTE_VERBOSE fi -bool ' IP: kernel level autoconfiguration' CONFIG_IP_PNP -if [ "$CONFIG_IP_PNP" = "y" ]; then +tristate ' IP: kernel level autoconfiguration' CONFIG_IP_PNP +if [ "$CONFIG_IP_PNP" = "y" -o "$CONFIG_IP_PNP" = "m" ]; then bool ' IP: DHCP support' CONFIG_IP_PNP_DHCP bool ' IP: BOOTP support' CONFIG_IP_PNP_BOOTP bool ' IP: RARP support' CONFIG_IP_PNP_RARP diff -Nur linux-2.4.26/net/ipv4/ipconfig.c linux-2.4.26-ipconfig-module/net/ipv4/ipconfig.c --- linux-2.4.26/net/ipv4/ipconfig.c 2003-11-28 19:26:21.000000000 +0100 +++ linux-2.4.26-ipconfig-module/net/ipv4/ipconfig.c 2004-07-21 18:06:25.000000000 +0200 @@ -51,6 +51,8 @@ #include #include #include +#include +#include #include #include #include @@ -130,9 +132,6 @@ u32 ic_servaddr = INADDR_NONE; /* Boot server IP address */ -u32 root_server_addr = INADDR_NONE; /* Address of NFS server */ -u8 root_server_path[256] = { 0, }; /* Path to mount as root */ - /* Persistent data: */ int ic_proto_used; /* Protocol used, if any */ @@ -1306,8 +1305,6 @@ return 0; } -module_init(ip_auto_config); - /* * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel @@ -1429,6 +1426,26 @@ return 1; } +#ifdef CONFIG_IP_PNP_MODULE +char *ip = NULL; +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Maik Broemme "); +MODULE_DESCRIPTION("IP Autoconfig module"); +MODULE_PARM(ip, "s"); +MODULE_PARM_DESC(ip, "[[]:[]:[]:[]:[]:[]:]"); + +int __init init_module(void) +{ + if (ip != NULL) { + ip_auto_config_setup(ip); + } + + return ip_auto_config(); +} +#else +module_init(ip_auto_config); + + static int __init nfsaddrs_config_setup(char *addrs) { return ip_auto_config_setup(addrs); @@ -1436,3 +1453,4 @@ __setup("ip=", ip_auto_config_setup); __setup("nfsaddrs=", nfsaddrs_config_setup); +#endif