udhcpsnoop: fix an endianness error

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin 2022-09-16 17:06:54 +02:00
parent dc2feb3cc7
commit 26be5ba20e

View File

@ -49,6 +49,7 @@ const char *dhcpsnoop_parse_ipv4(const void *buf, size_t len, uint16_t port, uin
break;
case DHCPV4_OPT_LEASETIME:
if (opt[1] != 4)
continue;
leasetime = *((uint32_t *) &opt[2]);
break;
case DHCPV4_OPT_REBIND:
@ -71,7 +72,8 @@ const char *dhcpsnoop_parse_ipv4(const void *buf, size_t len, uint16_t port, uin
else if (leasetime)
*expire = leasetime;
else
*expire = 24 * 60;
*expire = 24 * 60 * 60;
*expire = ntohl(*expire);
switch(type) {
case DHCPV4_MSG_ACK: