net/net.c: Update ipaddr if the environment has changed
PATCH 1/1 net/net.c: Update ipaddr if the environment has changed
At least on ARM the ipaddr is only set in board_init_r function. The problem is if ipaddr is not defined in environment importing another environment defined don't update the ipaddr value.
For example, suppose we've a default environment without net variables defined and we want to import an uEnv.txt environment from SD-card like this:
ipaddr=192.168.2.240
netmask=255.255.255.0
gatewayip=192.168.2.1
serverip=192.168.2.114
Then if you try boot from NFS results in:
Importing environment from mmc ...
Running uenvcmd ...
smc911x: detected LAN9221 controller
smc911x: phy initialized
smc911x: MAC ac:de:48:00:00:00
*** ERROR: `ipaddr' not set
The ipaddr at this point is NULL beacause is only set at board_init_r function. This patch updates the ipaddr value if the environment has changed.
--- net/net.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/net.c +2 -1
@@ -321,7 +321,8 @@ NetInitLoop(proto_t protocol)/* update only when the environment has changed */ if (env_changed_id != env_id) { -NetCopyIP (&NetOurIP, &bd->bi_ip_addr); + NetOurIP =getenv_IPaddr ("ipaddr" ); +NetCopyIP (&bd->bi_ip_addr, &NetOurIP); NetOurGatewayIP =getenv_IPaddr ("gatewayip" ); NetOurSubnetMask =getenv_IPaddr ("netmask" ); NetServerIP =getenv_IPaddr ("serverip" );
Signature · 1 line
1.7.0.4
PATCH 1/1 net/net.c: Update ipaddr if the environment has changed
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110601/ba5d5be7/attachment.pgp
Wolfgang Denk
AppliedPATCH 1/1 net/net.c: Update ipaddr if the environment has changed
In reply to Enric Balletbo i SerraDear Enric Balletbo i Serra,
Quoted 22 lines · In message <[email protected]> you wrote:
At least on ARM the ipaddr is only set in
board_init_rfunction. The problem is if ipaddr is not defined in environment importing another environment defined don't update the ipaddr value.For example, suppose we've a default environment without net variables defined and we want to import an uEnv.txt environment from SD-card like this:
ipaddr=192.168.2.240
netmask=255.255.255.0
gatewayip=192.168.2.1
serverip=192.168.2.114Then if you try boot from NFS results in:
Importing environment from mmc ...
Running uenvcmd ...
smc911x: detected LAN9221 controller
smc911x: phy initialized
smc911x: MAC ac:de:48:00:00:00
*** ERROR: `ipaddr' not set
Quoted 8 lines
The ipaddr at this point is NULL beacause is only set at
board_init_rfunction. This patch updates the ipaddr value if the environment has changed.Signed-off-by Enric Balletbo i Serra <[email protected]>--- net/net.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de You said you didn't want to use CGI.pm, but methinks you are needlessly reinventing the wheel, one spoke at a time. Either you are masochistic, or you just haven't seen enough of what CGI.pm can do for you. -- Randal L. Schwartz in <[email protected]>