# HG changeset patch # User asl # Date 1084442435 0 # Node ID a5c7a6799462bd73b8ade1443ef733c222246a73 # Parent 474fe115adcdfb5ca3ce8bd54a5b334a2de29f1e + * 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. diff --git a/packages/net/common/current/ChangeLog b/packages/net/common/current/ChangeLog --- a/packages/net/common/current/ChangeLog +++ b/packages/net/common/current/ChangeLog @@ -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 diff --git a/packages/net/common/current/src/bootp_support.c b/packages/net/common/current/src/bootp_support.c --- 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 diff --git a/packages/net/common/current/src/dhcp_prot.c b/packages/net/common/current/src/dhcp_prot.c --- 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;