summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2015-08-28 10:15:54 +0200
committerJoe Hershberger <joe.hershberger@ni.com>2015-10-28 14:56:20 -0500
commitc56eb57316ac0094aa2b5b805762d239a18f0c63 (patch)
treeb89d40f33ee3f731f9057ae6fa8319434910632c /net
parent454d9d3ec81c5b77adaecb9a6254336d4c5775a9 (diff)
downloadtalos-obmc-uboot-c56eb57316ac0094aa2b5b805762d239a18f0c63.tar.gz
talos-obmc-uboot-c56eb57316ac0094aa2b5b805762d239a18f0c63.zip
net: Fix parsing of Bootp/DHCP option 0 (Pad)
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>
Diffstat (limited to 'net')
-rw-r--r--net/bootp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 93eff87246..1316f00dd8 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -776,6 +776,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;
@@ -879,7 +882,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;
}
OpenPOWER on IntegriCloud