* [U-Boot] net.c: question regarding commit: fd3056337e6fcc140f400e11edd33f6f1cb37de1
@ 2015-06-22 12:23 Hannes Schmelzer
2015-06-22 21:54 ` Joe Hershberger
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Schmelzer @ 2015-06-22 12:23 UTC (permalink / raw)
To: u-boot
Hi joe,
you did introduce callbacks on setting up ip,dns, ... in net.c
Why it did become necessary to do following ?
if (flags & H_PROGRAMMATIC)
return 0;
I have actually trouble with this, because my code in
board/BuR/kwb/board.c doesn't work anymore as expected.
/* setup default IP, in case if there is nothing in environment */
if (!getenv("ipaddr")) {
setenv("ipaddr", "192.168.60.1");
setenv("netmask", "255.255.255.0");
setenv("serverip", "192.168.60.254");
setenv("gatewayip", "192.168.60.254");
puts("net: had no IP! made default setup.\n");
}
Purpose of this was/is to setup a default ip-address if nothing in
environment has been set yet.
do you (or somebody else) have an idea how to work around this ?
many thanks and best regards,
Hannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] net.c: question regarding commit: fd3056337e6fcc140f400e11edd33f6f1cb37de1
2015-06-22 12:23 [U-Boot] net.c: question regarding commit: fd3056337e6fcc140f400e11edd33f6f1cb37de1 Hannes Schmelzer
@ 2015-06-22 21:54 ` Joe Hershberger
0 siblings, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2015-06-22 21:54 UTC (permalink / raw)
To: u-boot
Hi Hannes,
On Mon, Jun 22, 2015 at 7:23 AM, Hannes Schmelzer
<hannes@schmelzer.or.at> wrote:
> Hi joe,
>
> you did introduce callbacks on setting up ip,dns, ... in net.c
>
> Why it did become necessary to do following ?
>
> if (flags & H_PROGRAMMATIC)
> return 0;
Because the callback should not be updating the network stack
variables when updated by the network stack (such as when DHCP sets
the ipaddr).
> I have actually trouble with this, because my code in
> board/BuR/kwb/board.c doesn't work anymore as expected.
>
> /* setup default IP, in case if there is nothing in environment */
> if (!getenv("ipaddr")) {
> setenv("ipaddr", "192.168.60.1");
> setenv("netmask", "255.255.255.0");
> setenv("serverip", "192.168.60.254");
> setenv("gatewayip", "192.168.60.254");
> puts("net: had no IP! made default setup.\n");
> }
>
> Purpose of this was/is to setup a default ip-address if nothing in
> environment has been set yet.
Any reason not to use link-local or DHCP in this case? What are the
chances that the board is on a compatible network and no one else has
that address? I recommend you remove this code unless you have a
really good reason.
> do you (or somebody else) have an idea how to work around this ?
You can set the ipaddr as a user would... through the command line. I
actually had to change the way env edit worked in
94b467b14ed908c89a0780256e89b375aa3cf3ef (env: Distinguish finer
between source of env change). You can do something similar to what it
does now.
+ const char * const _argv[4] = { "setenv", argv[1], buffer,
+ NULL };
+
+ return _do_env_set(0, 3, (char * const *)_argv, H_INTERACTIVE);
Cheers,
-Joe
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] net.c: question regarding commit: fd3056337e6fcc140f400e11edd33f6f1cb37de1
[not found] <14874.213.33.116.118.1434975811.squirrel@petermaier.org>
@ 2015-07-15 19:18 ` Hannes Schmelzer
0 siblings, 0 replies; 3+ messages in thread
From: Hannes Schmelzer @ 2015-07-15 19:18 UTC (permalink / raw)
To: u-boot
hi joe,
maybe my email got lost ...
best regards,
Hannes
On 2015-06-22 14:23, Hannes Schmelzer wrote:
> Hi joe,
>
> you did introduce callbacks on setting up ip,dns, ... in net.c
>
> Why it did become necessary to do following ?
>
> if (flags & H_PROGRAMMATIC)
> return 0;
>
> I have actually trouble with this, because my code in
> board/BuR/kwb/board.c doesn't work anymore as expected.
>
> /* setup default IP, in case if there is nothing in environment */
> if (!getenv("ipaddr")) {
> setenv("ipaddr", "192.168.60.1");
> setenv("netmask", "255.255.255.0");
> setenv("serverip", "192.168.60.254");
> setenv("gatewayip", "192.168.60.254");
> puts("net: had no IP! made default setup.\n");
> }
>
> Purpose of this was/is to setup a default ip-address if nothing in
> environment has been set yet.
>
> do you (or somebody else) have an idea how to work around this ?
>
> many thanks and best regards,
> Hannes
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-15 19:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 12:23 [U-Boot] net.c: question regarding commit: fd3056337e6fcc140f400e11edd33f6f1cb37de1 Hannes Schmelzer
2015-06-22 21:54 ` Joe Hershberger
[not found] <14874.213.33.116.118.1434975811.squirrel@petermaier.org>
2015-07-15 19:18 ` Hannes Schmelzer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.