mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/8] net: dhcp: add support of tftp server ip or Etherboot file (option 150)
Date: Mon, 2 Apr 2012 12:49:06 +0200	[thread overview]
Message-ID: <20120402104906.GU3852@pengutronix.de> (raw)
In-Reply-To: <20120330101432.GA8116@game.jcrosoft.org>

On Fri, Mar 30, 2012 at 12:14:32PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:21 Fri 30 Mar     , Sascha Hauer wrote:
> > >  					setenv("bootfile", str);
> > >  			}
> > >  			break;
> > > +		case 150:	/* TFTP server ip or Etherboot*/
> > > +			if (oplen == sizeof(IPaddr_t)) {
> > > +				is_tftpserverip = true;
> > > +				ip = net_read_ip(popt + 2);
> > > +				net_set_serverip(ip);
> > > +				setenv_ip("tftp_server_ip", ip);
> > > +			} else {
> > > +				memcpy(str, popt + 2, oplen);
> > > +				str[oplen] = 0;
> > > +				setenv("etherboot_file", str);
> > > +			}
> > 
> > This seems fragile. What if the etherboot filename has a length of 4?
> agree but this is really unlikely and I did want to add an option in the
> client to ask a file name
> 
> And we can not detect it via the DHCP RFC

For tftp server ip it's not one server ip but a list of server ips, so
the check for sizeof(IPaddr_t) is not even correct, you must check for
multiple of sizeof(IPaddr_t) which makes the above code even more
fragile. No way to accept this.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-04-02 10:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30  4:27 [PATCH 0/8] Network update DHCP/BOOTP Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 1/8] net: dhcp: reset env variable before do a dhcp request Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 2/8] net: dhcp: add support of tftp name server Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 3/8] net: dhcp: add support of tftp server ip or Etherboot file (option 150) Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  9:21   ` Sascha Hauer
2012-03-30 10:14     ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-02 10:49       ` Sascha Hauer [this message]
2012-04-02 11:18         ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 4/8] net: dhcp: allow to set transmitted client id Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 5/8] net: dhcp: allow to set transmitted client uuid Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 6/8] net: dhcp: allow to set transmitted user class Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 7/8] net: dns: export resolved ip to var resolved_ip Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  9:12   ` Sascha Hauer
2012-03-30 10:16     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:31 ` [PATCH 8/8] defaultenv: add support of etherboot_file Jean-Christophe PLAGNIOL-VILLARD
2012-03-30 10:39 ` [PATCH 7/8 v2] net: env: getenv_ip use resolv Jean-Christophe PLAGNIOL-VILLARD
2012-04-02 11:17 ` [PATCH 0/8] Network update DHCP/BOOTP Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120402104906.GU3852@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox