Index: net/common/current//ChangeLog =================================================================== RCS file: /cvs/ecos/ecos-opt/net/net/common/current/ChangeLog,v retrieving revision 1.61 diff -u -r1.61 ChangeLog --- net/common/current//ChangeLog 29 Apr 2004 07:19:57 -0000 1.61 +++ net/common/current//ChangeLog 13 May 2004 09:59:53 -0000 @@ -1,3 +1,9 @@ +2004-05-04 Jay Foster + + * src/bootp_support.c (get_bootp_option, show_bootp): + * src/dhcp_prot.c (scan_dhcp_size): Fixed bug that didn't handle + the pad option. + 2004-04-19 Oyvind Harboe * src/tftp_server.c: files are now created with the Index: net/common/current//src/bootp_support.c =================================================================== RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/bootp_support.c,v retrieving revision 1.6 diff -u -r1.6 bootp_support.c --- net/common/current//src/bootp_support.c 13 Apr 2004 07:32:41 -0000 1.6 +++ net/common/current//src/bootp_support.c 13 May 2004 09:59:54 -0000 @@ -298,6 +298,9 @@ op = &bp->bp_vend[4]; while (*op != TAG_END) { switch (*op) { + case TAG_PAD: + op++; + continue; case TAG_SUBNET_MASK: case TAG_GATEWAY: case TAG_IP_BROADCAST: @@ -410,7 +413,11 @@ *length=max; \ return true; \ } \ - op += *(op+1)+2; \ + if (*op == TAG_PAD) { \ + op++; \ + } else { \ + op += *(op+1)+2; \ + } \ } \ CYG_MACRO_END Index: net/common/current//src/dhcp_prot.c =================================================================== RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/dhcp_prot.c,v retrieving revision 1.17 diff -u -r1.17 dhcp_prot.c --- net/common/current//src/dhcp_prot.c 13 Apr 2004 07:32:41 -0000 1.17 +++ net/common/current//src/dhcp_prot.c 13 May 2004 09:59:56 -0000 @@ -110,8 +110,14 @@ return NULL; } op += 4; + + // This will only scan the options field. while (*op != TAG_END) { - op += *(op+1)+2; + if ( *op == TAG_PAD ) { + op++; + } else { + op += *(op+1)+2; + } if ( op > &ppkt->bp_vend[BP_VEND_LEN-1] ) { CYG_FAIL( "Oversize DHCP packet in dhcp_size" ); return NULL;