[U-Boot] [RFC] Preventing overriding of serverip when set in environment by user

Chase Maupin chase.maupin2003 at gmail.com
Wed Apr 18 20:46:42 CEST 2012


> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de]
> Sent: Wednesday, April 18, 2012 10:28 AM
> To: Maupin, Chase
> Cc: u-boot at lists.denx.de; Rini, Tom
> Subject: Re: [U-Boot] [RFC] Preventing overriding of serverip when
> set in environment by user
> 
> Dear "Maupin, Chase",
> 
> In message
> <7D46E86EC0A8354091174257B2FED10138DD6205 at DLEE12.ent.ti.com> you
> wrote:
> >
> > I recently was trying out a Linksys WRT54G2 V1 router and
> 
> Thi sis out-of-tree code, so we cannot help much - we hav eno idea
> which modifications they made to the code.
> 
> > So the net effect was that the dhcp server in this router was
> > providing information in its response packet that was overriding
> the
> > setting I had programmed. I dug into the u-boot code a little and
> 
> This is normal, and intended.  If you run DHCP, the information
> returned from the server is put in the respective environment
> variables.  That's how it works.
> 
> Note however, that of course this will not change the persistent
> copy
> of the environment - to do that, you would have to run "saveenv".
> 
> > The first was to set CONFIG_BOOTP_SERVERIP in my board config
> file.
> > I discarded this because this would seem to make me always ignore
> the
> > serverip setting from the DHCP server, and it seemed likely that
> > there were cases where you would want this.
> 
> I don;t understand your description here, but indeed, putting
> CONFIG_BOOTP_SERVERIP in the config file almost never makes sense,
> and
> it is definitly not acceptable for mainline.
> 
> > The second was to check if the serverip was already set in the
> > environment and if so then not override that value with the one
> in
> > the response from the DHCP server. The below patch snippet does
> this
> 
> This is not what is supposed to happen.  You are breaking regular
> functionality this way.
> 
> > Is this the proper way to fix this issue and the right location
> to
> > make the change? The overall goal was to make sure that if I
> > specified a particular serverip that I wanted to use, then the
> DHCP
> > server should not be changing that.
> 
> No, this is not an acceptable patch.
> 
> What exactly _are_ you trying to fix?  What is wrong with using the
> DHCP server supplied address?  If it is incorrect, you should fix
> your
> DHCP server configuration.
> 

I can see your point.  Why treat serverip any different than the ipaddr returned from the DHCP server?  I guess this can be worked around by resetting serverip between the dhcp command and the tftp command (using autoload off).  Or I can take the approach I am currently using which is to put the linksys router away and buy a cheap trendnet router that doesn't do this :)

> Best regards,
> 
> Wolfgang Denk
> 
> --
> 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 may call me by my name, Wirth, or by my value, Worth.
> - Nicklaus Wirth



More information about the U-Boot mailing list