Skip to contentSkip to conversation

net: Add Kconfig option for BOOTP_NTPSERVER

PATCH Superseded Chris Packham 2 participants 6 messages Apr 27, 2018 – May 3, 2018 Networking

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: Add Kconfig option for BOOTP_NTPSERVER

Add a Kconfig option for BOOTP_NTPSERVER to enable the DHCP/BOOTP option to configure the sntp server address.

---

 cmd/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
cmd/Kconfig +4 -0
index bc1d2f31c010..dfb0fddb7671 100644
@@ -1086,6 +1086,10 @@ config BOOTP_SUBNETMASK
 	default y
 	depends on CMD_BOOTP
 
+config BOOTP_NTPSERVER
+	bool "Request & store 'ntpserverip' from BOOTP/DHCP server"
+	depends on CMD_BOOTP
+
 config BOOTP_PXE
 	bool "Send PXE client arch to BOOTP/DHCP server"
 	default y
Signature · 1 line
2.17.0
#1 lore raw

PATCH 2/2 net: bootp: Fix compile error processing ntpserver option

When the following configuration is set

# CONFIG_CMD_DHCP is not set
CONFIG_CMD_BOOTP=y
CONFIG_BOOTP_NTPSERVER=y

The following compile error is observed

error: used struct type value where scalar is required

    if (net_ntp_server)
        ^~~~~~~~~~~~~~

Resolve this by checking net_ntp_server.s_addr instead.

---

 net/bootp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bootp.c +1 -1
index efa959971c27..9d7cb5d30c14 100644
@@ -333,7 +333,7 @@ static void bootp_process_vendor(u8 *ext, int size)
 		debug("net_nis_domain : %s\n", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
-	if (net_ntp_server)
+	if (net_ntp_server.s_addr)
 		debug("net_ntp_server : %pI4\n", &net_ntp_server);
 #endif
 }
Signature · 1 line
2.17.0
#2 lore raw

PATCH 2/2 net: bootp: Fix compile error processing ntpserver option

Quoted 11 lines · Chris Packham

When the following configuration is set

# CONFIG_CMD_DHCP is not set
CONFIG_CMD_BOOTP=y
CONFIG_BOOTP_NTPSERVER=y

The following compile error is observed

error: used struct type value where scalar is required

    if (net_ntp_server)
        ^~~~~~~~~~~~~~

We should probably enable CMD_SNTP in devkit8000 so that this code path is compiled on travis. Can you add a patch for that to the series?

Quoted 4 lines

Resolve this by checking net_ntp_server.s_addr instead.

Quoted 25 lines

---

 net/bootp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bootp.c +1 -2
index efa959971c27..9d7cb5d30c14 100644
@@ -333,7 +333,7 @@ static void bootp_process_vendor(u8 *ext, int size)
                debug("net_nis_domain : %s\n", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
-       if (net_ntp_server)
+       if (net_ntp_server.s_addr)
                debug("net_ntp_server : %pI4\n", &net_ntp_server);
 #endif
 }
--

2.17.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH 2/2 net: bootp: Fix compile error processing ntpserver option

Quoted 1 line · Joe Hershberger

On Fri, Apr 27, 2018 at 4:55 AM, Chris Packham <[email protected]>

Quoted 8 lines · wrote:
Quoted 8 lines

When the following configuration is set

# CONFIG_CMD_DHCP is not set
CONFIG_CMD_BOOTP=y
CONFIG_BOOTP_NTPSERVER=y

The following compile error is observed

Quoted 7 lines
Quoted 3 lines

error: used struct type value where scalar is required

    if (net_ntp_server)
        ^~~~~~~~~~~~~~

We should probably enable CMD_SNTP in devkit8000 so that this code path is compiled on travis. Can you add a patch for that to the series?

It's not quite that simple. CONFIG_CMD_DHCP is selected by CONFIG_DISTRO_DEFAULTS. So just turning on CMD_SNTP doesn't catch this. It'd be a fairly invasive change to disable CONFIG_DISTRO_DEFAULTS. For now I'll send a v2 series with just the changes for 1/2.

Quoted 32 lines
Quoted 4 lines

Resolve this by checking net_ntp_server.s_addr instead.

Quoted 25 lines

---

 net/bootp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bootp.c +1 -2
index efa959971c27..9d7cb5d30c14 100644
@@ -333,7 +333,7 @@ static void bootp_process_vendor(u8 *ext, int size)
                debug("net_nis_domain : %s\n", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
-       if (net_ntp_server)
+       if (net_ntp_server.s_addr)
                debug("net_ntp_server : %pI4\n", &net_ntp_server);
 #endif
 }
--

2.17.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

PATCH 2/2 net: bootp: Fix compile error processing ntpserver option

Quoted 17 lines · Chris Packham
Quoted 1 line · Joe Hershberger

On Fri, Apr 27, 2018 at 4:55 AM, Chris Packham <[email protected]>

Quoted 11 lines · wrote:
Quoted 11 lines

When the following configuration is set

# CONFIG_CMD_DHCP is not set
CONFIG_CMD_BOOTP=y
CONFIG_BOOTP_NTPSERVER=y

The following compile error is observed

error: used struct type value where scalar is required

    if (net_ntp_server)
        ^~~~~~~~~~~~~~
Quoted 8 lines
Quoted 3 lines

We should probably enable CMD_SNTP in devkit8000 so that this code path is compiled on travis. Can you add a patch for that to the series?

It's not quite that simple. CONFIG_CMD_DHCP is selected by CONFIG_DISTRO_DEFAULTS. So just turning on CMD_SNTP doesn't catch this. It'd be a fairly invasive change to disable CONFIG_DISTRO_DEFAULTS. For now I'll send a v2 series with just the changes for 1/2.

Sounds good. Maybe it would be easier to enable the combo needed to instigate this on a board that does not use DISTRO_DEFAULTS.

Quoted 37 lines
Quoted 29 lines
Quoted 5 lines

Resolve this by checking net_ntp_server.s_addr instead.

Quoted 21 lines

---

 net/bootp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bootp.c +1 -2
index efa959971c27..9d7cb5d30c14 100644
@@ -333,7 +333,7 @@ static void bootp_process_vendor(u8 *ext, int size)
                debug("net_nis_domain : %s\n", net_nis_domain);
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
-       if (net_ntp_server)
+       if (net_ntp_server.s_addr)
                debug("net_ntp_server : %pI4\n", &net_ntp_server);
 #endif
 }
--

2.17.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#5 lore raw

PATCH 1/2 net: Add Kconfig option for BOOTP_NTPSERVER

In reply to Chris Packham
Quoted 2 lines · Chris Packham

Add a Kconfig option for BOOTP_NTPSERVER to enable the DHCP/BOOTP option to configure the sntp server address.

Please also remove it from scripts/config_whitelist.txt

Also, there is one board with it enabled:
include/configs/devkit8000.h:80. Please move this to its defconfig.

Quoted 29 lines

---

 cmd/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
cmd/Kconfig +4 -1
index bc1d2f31c010..dfb0fddb7671 100644
@@ -1086,6 +1086,10 @@ config BOOTP_SUBNETMASK
        default y
        depends on CMD_BOOTP
 
+config BOOTP_NTPSERVER
+       bool "Request & store 'ntpserverip' from BOOTP/DHCP server"
+       depends on CMD_BOOTP
+
 config BOOTP_PXE
        bool "Send PXE client arch to BOOTP/DHCP server"
        default y
--

2.17.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot