Mercurial > ecos
changeset 1632:a5c7a6799462
+ * 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.
| author | asl |
|---|---|
| date | Thu, 13 May 2004 10:00:35 +0000 |
| parents | 474fe115adcd |
| children | 5b90296c022f |
| files | packages/net/common/current/ChangeLog packages/net/common/current/src/bootp_support.c packages/net/common/current/src/dhcp_prot.c |
| diffstat | 3 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/net/common/current/ChangeLog +++ b/packages/net/common/current/ChangeLog @@ -1,3 +1,9 @@ +2004-05-04 Jay Foster <jay.foster@systech.com> + + * 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 <oyvind.harboe@zylin.com> * src/tftp_server.c: files are now created with the
--- a/packages/net/common/current/src/bootp_support.c +++ b/packages/net/common/current/src/bootp_support.c @@ -298,6 +298,9 @@ show_bootp(const char *intf, struct boot 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 @@ get_bootp_option(struct bootp *bp, unsig *length=max; \ return true; \ } \ - op += *(op+1)+2; \ + if (*op == TAG_PAD) { \ + op++; \ + } else { \ + op += *(op+1)+2; \ + } \ } \ CYG_MACRO_END
--- a/packages/net/common/current/src/dhcp_prot.c +++ b/packages/net/common/current/src/dhcp_prot.c @@ -110,8 +110,14 @@ scan_dhcp_size( struct bootp *ppkt ) 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;
