summaryrefslogtreecommitdiff
path: root/lib/networking/dhserver.c
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-04-26 13:12:56 +0200
committerHiFiPhile <[email protected]>2024-04-26 13:12:56 +0200
commit9ef3755f0316d25864d3ac3a49a2523eabfddf8a (patch)
tree4fb337482662308674101d5269192b7a4fe58f91 /lib/networking/dhserver.c
parentf88a5bb03b2504df272d2cd285b17e66f11dfc64 (diff)
parent69313ef45564cc8967575f47fb8c57371cbea470 (diff)
Merge branch 'master' of https://github.com/hathach/tinyusb into pr/2283
Diffstat (limited to 'lib/networking/dhserver.c')
-rw-r--r--lib/networking/dhserver.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/networking/dhserver.c b/lib/networking/dhserver.c
index def431f75..2f14f7a09 100644
--- a/lib/networking/dhserver.c
+++ b/lib/networking/dhserver.c
@@ -2,17 +2,17 @@
* The MIT License (MIT)
*
* Copyright (c) 2015 by Sergey Fetisov <[email protected]>
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -86,7 +86,7 @@ typedef struct
uint8_t dp_giaddr[4]; /* gateway IP address */
uint8_t dp_chaddr[16]; /* client hardware address */
uint8_t dp_legacy[192];
- uint8_t dp_magic[4];
+ uint8_t dp_magic[4];
uint8_t dp_options[275]; /* options area */
} DHCP_TYPE;
@@ -242,7 +242,11 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const
memcpy(&dhcp_data, p->payload, n);
ptr = find_dhcp_option(dhcp_data.dp_options, sizeof(dhcp_data.dp_options), DHCP_MESSAGETYPE);
- if (ptr == NULL) return;
+ if (ptr == NULL)
+ {
+ pbuf_free(p);
+ return;
+ }
switch (ptr[2])
{
@@ -263,7 +267,7 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const
DHCP_OFFER,
config->domain,
config->dns,
- entry->lease,
+ entry->lease,
*netif_ip4_addr(netif),
config->router,
*netif_ip4_netmask(netif));
@@ -305,7 +309,7 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const
DHCP_ACK,
config->domain,
config->dns,
- entry->lease,
+ entry->lease,
*netif_ip4_addr(netif),
config->router,
*netif_ip4_netmask(netif));