mbox series

[v2,0/3] net: Sanitize DHCP variable override

Message ID 20180614100426.40511-1-agraf@suse.de
Headers show
Series net: Sanitize DHCP variable override | expand

Message

Alexander Graf June 14, 2018, 10:04 a.m. UTC
While trying to boot from network on a RISC-V AX25 platform, I saw
that the DHCP IP address did not get populated from the DHCP server
IP address. The reason for that was simple: CONFIG_BOOTP_SERVERIP
was set.

I don't know the history of that option, but it seems to decrease
intuitivity levels of the dhcp command rather than improve it.

What I usually would expect is that explicitly set values populate
through all layers. So if I set a TFTP file name, it populates. If
I set a target IP address, it populates. If I don't set anything,
the values get filled in automatically.

This patch set is trying to move us into that direction without
breaking people that rely on the existing behavior. With this patch
set applied, boards have the option to prefer the 'serverip'
environment variable (ax25-ae350 gets moved to it) over the DHCP
given address and any value explicitly set on the command line is
always preferred.

This hopefully makes the command line a bit more intuitive.

v1 -> v2:

  - new patch: net: Prefer command line arguments
  - remove README entry
  - improve Kconfig help texts


Alexander Graf (3):
  net: Prefer command line arguments
  net: Add option to prefer bootp/dhcp serverip
  ax25: Switch to CONFIG_BOOTP_PREFER_SERVERIP

 cmd/Kconfig                  | 11 +++++++++++
 cmd/net.c                    | 10 ++++++++--
 configs/ax25-ae350_defconfig |  1 +
 include/configs/ax25-ae350.h |  1 -
 include/net.h                |  2 ++
 net/bootp.c                  | 10 ++++++++--
 net/net.c                    |  2 ++
 7 files changed, 32 insertions(+), 5 deletions(-)

Comments

Rick Chen June 15, 2018, 6:12 a.m. UTC | #1
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Thursday, June 14, 2018 6:04 PM
> To: u-boot@lists.denx.de
> Cc: Rick Jian-Zhi Chen(陳建志); Joe Hershberger; Greentime Ying-Han Hu(胡英
> 漢); Simon Glass
> Subject: [PATCH v2 0/3] net: Sanitize DHCP variable override
>
> While trying to boot from network on a RISC-V AX25 platform, I saw that the
> DHCP IP address did not get populated from the DHCP server IP address. The
> reason for that was simple: CONFIG_BOOTP_SERVERIP was set.
>
> I don't know the history of that option, but it seems to decrease intuitivity levels
> of the dhcp command rather than improve it.
>
> What I usually would expect is that explicitly set values populate through all
> layers. So if I set a TFTP file name, it populates. If I set a target IP address, it
> populates. If I don't set anything, the values get filled in automatically.
>
> This patch set is trying to move us into that direction without breaking people
> that rely on the existing behavior. With this patch set applied, boards have the
> option to prefer the 'serverip'
> environment variable (ax25-ae350 gets moved to it) over the DHCP given address
> and any value explicitly set on the command line is always preferred.
>
> This hopefully makes the command line a bit more intuitive.
>
> v1 -> v2:
>
>   - new patch: net: Prefer command line arguments
>   - remove README entry
>   - improve Kconfig help texts
>
>
> Alexander Graf (3):
>   net: Prefer command line arguments
>   net: Add option to prefer bootp/dhcp serverip
>   ax25: Switch to CONFIG_BOOTP_PREFER_SERVERIP
>
>  cmd/Kconfig                  | 11 +++++++++++
>  cmd/net.c                    | 10 ++++++++--
>  configs/ax25-ae350_defconfig |  1 +
>  include/configs/ax25-ae350.h |  1 -
>  include/net.h                |  2 ++
>  net/bootp.c                  | 10 ++++++++--
>  net/net.c                    |  2 ++
>  7 files changed, 32 insertions(+), 5 deletions(-)
>
> --
> 2.12.3

Hi Alex

The V2 is ok about the dhcp verification.

Message as below:

U-Boot 2018.07-rc1-00075-g3411a40 (Jun 15 2018 - 14:05:21 +0800)

DRAM:  1 GiB
No arch specific invalidate_icache_all available!
Flash: 64 MiB
MMC:   mmc@f0e00000: 0
Loading Environment from SPI Flash... SF: Detected mx25u1635e with
page size 256 Bytes, erase size 4 KiB, total 2 MiB
OK
In:    serial@f0300000
Out:   serial@f0300000
Err:   serial@f0300000
Net:   no alias for ethernet0

Warning: mac@e0100000 (eth0) using random MAC address - 7e:c1:32:b2:20:cf
eth0: mac@e0100000
Hit any key to stop autoboot:  0
RISC-V #
RISC-V # env print
baudrate=38400
bootcmd=fatload mmc 0:1 0x20000000 ae350_64.dtb;fatload mmc 0:1 0x0
bbl-ae350.bin;go 0x0
bootdelay=3
bootfile=10.0.4.97:boomimage-310y-ag101p.bin
ethact=mac@e0100000
fdtcontroladdr=3fede290
fileaddr=600000
filesize=1bb7d34
stderr=serial@f0300000
stdin=serial@f0300000
stdout=serial@f0300000

Environment size: 329/8188 bytes
RISC-V # dhcp 0x600000 10.0.4.97:boomimage-310y-ag101p.bin
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 10.0.4.124 (4596 ms)
Using mac@e0100000 device
TFTP from server 10.0.4.97; our IP address is 10.0.4.124
Filename 'boomimage-310y-ag101p.bin'.
Load address: 0x600000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ########################################
         174.8 KiB/s
done
Bytes transferred = 13938796 (d4b06c hex)
RISC-V #

Rick