search for: options_padding_len

Displaying 1 result from an estimated 1 matches for "options_padding_len".

2011 Jul 18
2
ipconfig:About the length of 'options' field of DHCP packet
...@ -212,6 +215,25 @@ static int dhcp_send(struct netdev *dev, struct iovec *vec) vec[i].iov_base = dhcp_end; vec[i].iov_len = sizeof(dhcp_end); + + if(dev->bootp.fail_count & 1){ + /* + * Append padding if the length of options field is + * shorter than 64 octets. + */ + int options_padding_len = 64; + int j; + for (j=2; j<=i; j++){ + options_padding_len -= vec[j].iov_len; + } + if(options_padding_len > 0){ + memset(&options_padding, 0, options_padding_len); + i++; + vec[i].iov_base = options_padding; + vec[i].iov_len = options_padding_len; + } + } + return pac...