* [U-Boot] [PATCH] net: Fix parsing of Bootp/DHCP option 0 (Pad)
@ 2015-08-28 8:15 Stefan Brüns
2015-09-03 21:44 ` Joe Hershberger
2015-10-29 19:25 ` Joe Hershberger
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Brüns @ 2015-08-28 8:15 UTC (permalink / raw
To: u-boot
Pad has no len byte, so the normal parsing code fails.
Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
---
net/bootp.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/bootp.c b/net/bootp.c
index 9700e95..7fd29ee 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -774,6 +774,9 @@ static void dhcp_process_options(uchar *popt, struct bootp_hdr *bp)
while (popt < end && *popt != 0xff) {
oplen = *(popt + 1);
switch (*popt) {
+ case 0:
+ oplen = -1; /* Pad omits len byte */
+ break;
case 1:
net_copy_ip(&net_netmask, (popt + 2));
break;
@@ -877,7 +880,13 @@ static int dhcp_message_type(unsigned char *popt)
while (*popt != 0xff) {
if (*popt == 53) /* DHCP Message Type */
return *(popt + 2);
- popt += *(popt + 1) + 2; /* Scan through all options */
+ if (*popt == 0) {
+ /* Pad */
+ popt += 1;
+ } else {
+ /* Scan through all options */
+ popt += *(popt + 1) + 2;
+ }
}
return -1;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: Fix parsing of Bootp/DHCP option 0 (Pad)
2015-08-28 8:15 [U-Boot] [PATCH] net: Fix parsing of Bootp/DHCP option 0 (Pad) Stefan Brüns
@ 2015-09-03 21:44 ` Joe Hershberger
2015-10-29 19:25 ` Joe Hershberger
1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2015-09-03 21:44 UTC (permalink / raw
To: u-boot
Hi Stefan,
On Fri, Aug 28, 2015 at 3:15 AM, Stefan Br?ns
<stefan.bruens@rwth-aachen.de> wrote:
> Pad has no len byte, so the normal parsing code fails.
>
> Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: Fix parsing of Bootp/DHCP option 0 (Pad)
2015-08-28 8:15 [U-Boot] [PATCH] net: Fix parsing of Bootp/DHCP option 0 (Pad) Stefan Brüns
2015-09-03 21:44 ` Joe Hershberger
@ 2015-10-29 19:25 ` Joe Hershberger
1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2015-10-29 19:25 UTC (permalink / raw
To: u-boot
On Fri, Aug 28, 2015 at 3:15 AM, Stefan Br?ns
<stefan.bruens@rwth-aachen.de> wrote:
> Pad has no len byte, so the normal parsing code fails.
>
> Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
Applied to u-boot-net/master, thanks!
-Joe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-29 19:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 8:15 [U-Boot] [PATCH] net: Fix parsing of Bootp/DHCP option 0 (Pad) Stefan Brüns
2015-09-03 21:44 ` Joe Hershberger
2015-10-29 19:25 ` Joe Hershberger
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.