dhcp: Minimum option length implied by RFC 951 is 60 bytes, not 62
In section 3 ("Packet Format"), "vend" is 64 bytes long, minus the magic that's 60 bytes, not 62. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
54d9df3903
commit
f41f0416b8
1 changed files with 5 additions and 3 deletions
8
dhcp.c
8
dhcp.c
|
@ -57,6 +57,8 @@ static struct opt opts[255];
|
||||||
#define DHCPINFORM 8
|
#define DHCPINFORM 8
|
||||||
#define DHCPFORCERENEW 9
|
#define DHCPFORCERENEW 9
|
||||||
|
|
||||||
|
#define OPT_MIN 60 /* RFC 951 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dhcp_init() - Initialise DHCP options
|
* dhcp_init() - Initialise DHCP options
|
||||||
*/
|
*/
|
||||||
|
@ -158,9 +160,9 @@ static int fill(struct msg *m)
|
||||||
m->o[offset++] = 255;
|
m->o[offset++] = 255;
|
||||||
m->o[offset++] = 0;
|
m->o[offset++] = 0;
|
||||||
|
|
||||||
if (offset < 62 /* RFC 951 */) {
|
if (offset < OPT_MIN) {
|
||||||
memset(&m->o[offset], 0, 62 - offset);
|
memset(&m->o[offset], 0, OPT_MIN - offset);
|
||||||
offset = 62;
|
offset = OPT_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
|
|
Loading…
Reference in a new issue