Imported Upstream version 1.4.16

This commit is contained in:
Jan Wagner 2013-11-26 23:59:06 +01:00
parent 212b4b8677
commit e76be63abf
50 changed files with 11903 additions and 38608 deletions

View file

@ -141,7 +141,7 @@ typedef struct dhcp_packet_struct{
u_int16_t flags; /* flags */
struct in_addr ciaddr; /* IP address of this machine (if we already have one) */
struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */
struct in_addr siaddr; /* IP address of DHCP server */
struct in_addr siaddr; /* IP address of next server */
struct in_addr giaddr; /* IP address of DHCP relay */
unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */
char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */
@ -587,11 +587,6 @@ int get_dhcp_offer(int sock){
/* Save a copy of "source" into "via" even if it's via itself */
memcpy(&via,&source,sizeof(source)) ;
/* If siaddr is non-zero, set "source" to siaddr */
if(offer_packet.siaddr.s_addr != 0L){
source.sin_addr.s_addr = offer_packet.siaddr.s_addr ;
}
if(verbose){
printf(_("DHCPOFFER from IP address %s"),inet_ntoa(source.sin_addr));
printf(_(" via %s\n"),inet_ntoa(via.sin_addr));
@ -839,8 +834,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
/* process all DHCP options present in the packet */
for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){
/* end of options (0 is really just a pad, but bail out anyway) */
if((int)offer_packet->options[x]==-1 || (int)offer_packet->options[x]==0)
if((int)offer_packet->options[x]==-1)
break;
/* get option type */
@ -872,7 +866,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
}
/* skip option data we're ignoring */
if(option_type!=DHCP_OPTION_REBINDING_TIME)
if(option_type==0) /* "pad" option, see RFC 2132 (3.1) */
x+=1;
else
x+=option_length;
}
@ -903,9 +899,9 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
* the next bootstrap service (e.g., delivery of an operating system
* executable image). A DHCP server always returns its own address in
* the 'server identifier' option." 'serv_ident' is the 'server
* identifier' option, 'source' is the 'siaddr' field or (if 'siaddr'
* wasn't available) the IP address we received the DHCPOFFER from. If
* 'serv_ident' isn't available for some reason, we use 'source'.
* identifier' option, 'source' is the IP address we received the
* DHCPOFFER from. If 'serv_ident' isn't available for some reason, we
* use 'source'.
*/
new_offer->server_address=serv_ident.s_addr?serv_ident:source;
new_offer->offered_address=offer_packet->yiaddr;