ipconfig: add nameserver IPs to kernel-parameter ip=
Subsystems (7)
PATCH 1/1 ipconfig: add nameserver IPs to kernel-parameter ip=
On small systems (e.g. embedded ones) IP addresses are often configured by bootloaders and get assigned to kernel via parameter "ip=". If set to "ip=dhcp", even nameserver entries from DHCP daemons are handled. These entries exported in /proc/net/pnp are commonly linked by /etc/resolv.conf.
To configure nameservers for networks without DHCP, this patch adds option <dns0-ip> and <dns1-ip> to kernel-parameter 'ip='.
--- Documentation/filesystems/nfs/nfsroot.txt | 7 +++++ net/ipv4/ipconfig.c | 39 ++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-)
Documentation/filesystems/nfs/nfsroot.txt +7 -0
@@ -158,6 +158,13 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> Default: any + <dns0-ip> IP address of first nameserver. + Value gets exported by /proc/net/pnp which is often linked + on embedded systems by /etc/resolv.conf. + + <dns1-ip> IP address of secound nameserver. + Same as above. + nfsrootdebug
net/ipv4/ipconfig.c +36 -3
@@ -743,14 +743,22 @@ static void __init ic_bootp_init_ext(u8 *e)/* -* Initialize the DHCP/BOOTP mechanism. +* Predefine Nameservers */ -static inline void __init ic_bootp_init (void ) +static inline void __init ic_nameservers_predef (void ) {int i;for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) ic_nameservers[i] =NONE ; +} + +/* +* Initialize the DHCP/BOOTP mechanism. +*/ +static inline void __init ic_bootp_init (void ) +{ +ic_nameservers_predef ();dev_add_pack (&bootp_packet_type); }
@@ -1379,6 +1387,7 @@ static int __init ip_auto_config(void)int retries =CONF_OPEN_RETRIES ;#endif int err; +unsigned int i;#ifdef CONFIG_PROC_FS proc_net_fops_create (&init_net,"pnp" ,S_IRUGO , &pnp_seq_fops);
@@ -1499,7 +1508,15 @@ static int __init ip_auto_config(void) &ic_servaddr, &root_server_addr, root_server_path);if (ic_dev_mtu)pr_cont (", mtu=%d" , ic_dev_mtu); -pr_cont ("\n" ); +for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) +if (ic_nameservers[i] !=NONE ) { +pr_info (" nameserver%u=%pI4" , + i, &ic_nameservers[i]); +break ; + } +for (i++; i <CONF_NAMESERVERS_MAX ; i++) +if (ic_nameservers[i] !=NONE ) +pr_cont (", nameserver%u=%pI4\n" , i, &ic_nameservers[i]);#endif /* !SILENT */ return 0 ;
@@ -1570,6 +1587,8 @@ static int __init ip_auto_config_setup(char *addrs)return 1 ; } +ic_nameservers_predef (); +/* Parse string for static IP assignment. */ ip = addrs;while (ip && *ip) {
@@ -1613,6 +1632,20 @@ static int __init ip_auto_config_setup(char *addrs) ic_enable =0 ; }break ; +case 7 : +if (CONF_NAMESERVERS_MAX >=1 ) { + ic_nameservers[0 ] =in_aton (ip); +if (ic_nameservers[0 ] ==ANY ) + ic_nameservers[0 ] =NONE ; + } +break ; +case 8 : +if (CONF_NAMESERVERS_MAX >=2 ) { + ic_nameservers[1 ] =in_aton (ip); +if (ic_nameservers[1 ] ==ANY ) + ic_nameservers[1 ] =NONE ; + } +break ; } } ip = cp;
Signature · 1 line
1.7.2.5
David Miller
maintainerFrom: Christoph Fritz <[email protected]>
Date: Thu, 20 Sep 2012 23:28:05 +0200
net/ipv4/ipconfig.c static int __init ip_auto_config(void) · line 1514
Quoted 2 lines
net/ipv4/ipconfig.c +2
-0+pr_info (" nameserver%u=%pI4" , + i, &ic_nameservers[i]);
Why don't you just tab that second line out to planet Mars while you're at it?
Please format this correctly, the goal is not to use a million TAB characters. Rather, the goal is to get the text starting on the second line of a function call to line up with the first column after the openning parenthesis on the previous line.
What you're doing there looks awful, so you'll need to fix this up before this patch will be considered seriously.
Thanks.
PATCH v2 1/1 ipconfig: add nameserver IPs to kernel-parameter ip=
On small systems (e.g. embedded ones) IP addresses are often configured by bootloaders and get assigned to kernel via parameter "ip=". If set to "ip=dhcp", even nameserver entries from DHCP daemons are handled. These entries exported in /proc/net/pnp are commonly linked by /etc/resolv.conf.
To configure nameservers for networks without DHCP, this patch adds option <dns0-ip> and <dns1-ip> to kernel-parameter 'ip='.
---
v2: - fix indent
--- Documentation/filesystems/nfs/nfsroot.txt | 7 +++++ net/ipv4/ipconfig.c | 39 ++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-)
Documentation/filesystems/nfs/nfsroot.txt +7 -0
@@ -158,6 +158,13 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> Default: any + <dns0-ip> IP address of first nameserver. + Value gets exported by /proc/net/pnp which is often linked + on embedded systems by /etc/resolv.conf. + + <dns1-ip> IP address of secound nameserver. + Same as above. + nfsrootdebug
net/ipv4/ipconfig.c +36 -3
@@ -743,14 +743,22 @@ static void __init ic_bootp_init_ext(u8 *e)/* -* Initialize the DHCP/BOOTP mechanism. +* Predefine Nameservers */ -static inline void __init ic_bootp_init (void ) +static inline void __init ic_nameservers_predef (void ) {int i;for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) ic_nameservers[i] =NONE ; +} + +/* +* Initialize the DHCP/BOOTP mechanism. +*/ +static inline void __init ic_bootp_init (void ) +{ +ic_nameservers_predef ();dev_add_pack (&bootp_packet_type); }
@@ -1379,6 +1387,7 @@ static int __init ip_auto_config(void)int retries =CONF_OPEN_RETRIES ;#endif int err; +unsigned int i;#ifdef CONFIG_PROC_FS proc_net_fops_create (&init_net,"pnp" ,S_IRUGO , &pnp_seq_fops);
@@ -1499,7 +1508,15 @@ static int __init ip_auto_config(void) &ic_servaddr, &root_server_addr, root_server_path);if (ic_dev_mtu)pr_cont (", mtu=%d" , ic_dev_mtu); -pr_cont ("\n" ); +for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) +if (ic_nameservers[i] !=NONE ) { +pr_info (" nameserver%u=%pI4" , + i, &ic_nameservers[i]); +break ; + } +for (i++; i <CONF_NAMESERVERS_MAX ; i++) +if (ic_nameservers[i] !=NONE ) +pr_cont (", nameserver%u=%pI4\n" , i, &ic_nameservers[i]);#endif /* !SILENT */ return 0 ;
@@ -1570,6 +1587,8 @@ static int __init ip_auto_config_setup(char *addrs)return 1 ; } +ic_nameservers_predef (); +/* Parse string for static IP assignment. */ ip = addrs;while (ip && *ip) {
@@ -1613,6 +1632,20 @@ static int __init ip_auto_config_setup(char *addrs) ic_enable =0 ; }break ; +case 7 : +if (CONF_NAMESERVERS_MAX >=1 ) { + ic_nameservers[0 ] =in_aton (ip); +if (ic_nameservers[0 ] ==ANY ) + ic_nameservers[0 ] =NONE ; + } +break ; +case 8 : +if (CONF_NAMESERVERS_MAX >=2 ) { + ic_nameservers[1 ] =in_aton (ip); +if (ic_nameservers[1 ] ==ANY ) + ic_nameservers[1 ] =NONE ; + } +break ; } } ip = cp;
Signature · 1 line
1.7.2.5
David Miller
maintainerFrom: Christoph Fritz <[email protected]>
Date: Thu, 20 Sep 2012 23:48:50 +0200
Quoted 8 lines
Documentation/filesystems/nfs/nfsroot.txt +0
-0@@ -158,6 +158,13 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> Default: any
Documentation/filesystems/nfs/nfsroot.txt ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> · line 170
Quoted 10 lines
Documentation/filesystems/nfs/nfsroot.txt +7
-0+ <dns0-ip> IP address of first nameserver. + Value gets exported by /proc/net/pnp which is often linked + on embedded systems by /etc/resolv.conf. + + <dns1-ip> IP address of secound nameserver. + Same as above. + nfsrootdebug
This documentation update is not sufficient.
You have to properly show, in the lines above where you made your change, where the new settings are placed in the "ip=" option.
PATCH v3 1/1 ipconfig: add nameserver IPs to kernel-parameter ip=
On small systems (e.g. embedded ones) IP addresses are often configured by bootloaders and get assigned to kernel via parameter "ip=". If set to "ip=dhcp", even nameserver entries from DHCP daemons are handled. These entries exported in /proc/net/pnp are commonly linked by /etc/resolv.conf.
To configure nameservers for networks without DHCP, this patch adds option <dns0-ip> and <dns1-ip> to kernel-parameter 'ip='.
---
v2: - fix indent
v3: - fix docu: add new arguments to option "ip="
--- Documentation/filesystems/nfs/nfsroot.txt | 10 ++++++- net/ipv4/ipconfig.c | 39 ++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-)
Documentation/filesystems/nfs/nfsroot.txt +9 -1
@@ -78,7 +78,8 @@ nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>] flags = hard, nointr, noposix, cto, ac -ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> +ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>: + <dns0-ip>:<dns1-ip> This parameter tells the kernel how to configure IP addresses of devices and also how to set up the IP routing table. It was originally called
@@ -158,6 +159,13 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> Default: any + <dns0-ip> IP address of first nameserver. + Value gets exported by /proc/net/pnp which is often linked + on embedded systems by /etc/resolv.conf. + + <dns1-ip> IP address of secound nameserver. + Same as above. + nfsrootdebug
net/ipv4/ipconfig.c +36 -3
@@ -743,14 +743,22 @@ static void __init ic_bootp_init_ext(u8 *e)/* -* Initialize the DHCP/BOOTP mechanism. +* Predefine Nameservers */ -static inline void __init ic_bootp_init (void ) +static inline void __init ic_nameservers_predef (void ) {int i;for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) ic_nameservers[i] =NONE ; +} + +/* +* Initialize the DHCP/BOOTP mechanism. +*/ +static inline void __init ic_bootp_init (void ) +{ +ic_nameservers_predef ();dev_add_pack (&bootp_packet_type); }
@@ -1379,6 +1387,7 @@ static int __init ip_auto_config(void)int retries =CONF_OPEN_RETRIES ;#endif int err; +unsigned int i;#ifdef CONFIG_PROC_FS proc_net_fops_create (&init_net,"pnp" ,S_IRUGO , &pnp_seq_fops);
@@ -1499,7 +1508,15 @@ static int __init ip_auto_config(void) &ic_servaddr, &root_server_addr, root_server_path);if (ic_dev_mtu)pr_cont (", mtu=%d" , ic_dev_mtu); -pr_cont ("\n" ); +for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) +if (ic_nameservers[i] !=NONE ) { +pr_info (" nameserver%u=%pI4" , + i, &ic_nameservers[i]); +break ; + } +for (i++; i <CONF_NAMESERVERS_MAX ; i++) +if (ic_nameservers[i] !=NONE ) +pr_cont (", nameserver%u=%pI4\n" , i, &ic_nameservers[i]);#endif /* !SILENT */ return 0 ;
@@ -1570,6 +1587,8 @@ static int __init ip_auto_config_setup(char *addrs)return 1 ; } +ic_nameservers_predef (); +/* Parse string for static IP assignment. */ ip = addrs;while (ip && *ip) {
@@ -1613,6 +1632,20 @@ static int __init ip_auto_config_setup(char *addrs) ic_enable =0 ; }break ; +case 7 : +if (CONF_NAMESERVERS_MAX >=1 ) { + ic_nameservers[0 ] =in_aton (ip); +if (ic_nameservers[0 ] ==ANY ) + ic_nameservers[0 ] =NONE ; + } +break ; +case 8 : +if (CONF_NAMESERVERS_MAX >=2 ) { + ic_nameservers[1 ] =in_aton (ip); +if (ic_nameservers[1 ] ==ANY ) + ic_nameservers[1 ] =NONE ; + } +break ; } } ip = cp;
Signature · 1 line
1.7.2.5
From: Christoph Fritz <[email protected]>
Date: Fri, 21 Sep 2012 20:31:19 +0200
Quoted 10 lines
On small systems (e.g. embedded ones) IP addresses are often configured by bootloaders and get assigned to kernel via parameter "ip=". If set to "ip=dhcp", even nameserver entries from DHCP daemons are handled. These entries exported in
/proc/net/pnpare commonly linked by/etc/resolv.conf.To configure nameservers for networks without DHCP, this patch adds option <dns0-ip> and <dns1-ip> to kernel-parameter 'ip='.
Signed-off-by Christoph Fritz <[email protected]>Tested-by Jan Weitzel <[email protected]>
Applied to net-next, thanks.
Quoted 8 lines · David Miller
From: Christoph Fritz <[email protected]>
Date: Fri, 21 Sep 2012 20:31:19 +0200Quoted 5 lines
On small systems (e.g. embedded ones) IP addresses are often configured by bootloaders and get assigned to kernel via parameter "ip=". If set to "ip=dhcp", even nameserver entries from DHCP daemons are handled. These entries exported in
/proc/net/pnpare commonly linked by/etc/resolv.conf.
Quoted 7 lines
Quoted 5 lines
To configure nameservers for networks without DHCP, this patch adds option <dns0-ip> and <dns1-ip> to kernel-parameter 'ip='.
Signed-off-by Christoph Fritz <[email protected]>Tested-by Jan Weitzel <[email protected]>Applied to net-next, thanks.
Thanks a lot for your reviews.
-- Christoph
PATCH 1/1 ipconfig: fix trivial build error
The commit 5e953778a2aab04929a5e7b69f53dc26e39b079e ("ipconfig: add nameserver IPs to kernel-parameter ip=") introduces ic_nameservers_predef() that defined only for BOOTP. However it is used by ip_auto_config_setup() as well. This patch moves it outside of #ifdef BOOTP.
--- net/ipv4/ipconfig.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
net/ipv4/ipconfig.c +11 -11
@@ -583,6 +583,17 @@ static void __init ic_rarp_send_if(struct ic_device *d)#endif /* +* Predefine Nameservers +*/ +static inline void __init ic_nameservers_predef (void ) +{ +int i; + +for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) + ic_nameservers[i] =NONE ; +} + +/* * DHCP/BOOTP support. */
@@ -743,17 +754,6 @@ static void __init ic_bootp_init_ext(u8 *e)/* -* Predefine Nameservers -*/ -static inline void __init ic_nameservers_predef (void ) -{ -int i; - -for (i =0 ; i <CONF_NAMESERVERS_MAX ; i++) - ic_nameservers[i] =NONE ; -} - -/* * Initialize the DHCP/BOOTP mechanism. */ static inline void __init ic_bootp_init (void )
Signature · 1 line
1.7.10.4
Re: [PATCH] ipconfig: fix trivial build error
From: Andy Shevchenko <[email protected]>
Date: Tue, 25 Sep 2012 11:09:58 +0300
Quoted 6 lines
The commit
5e953778a2aab04929a5e7b69f53dc26e39b079e("ipconfig: add nameserver IPs to kernel-parameter ip=") introducesic_nameservers_predef()that defined only for BOOTP. However it is used byip_auto_config_setup()as well. This patch moves it outside of #ifdef BOOTP.Signed-off-by Andy Shevchenko <[email protected]>
Applied, thanks.