From d42b5604ce6ccdd9c5acba009e6a3d95c27ca573 Mon Sep 17 00:00:00 2001 From: Peter Lawrence <12226419+majbthrd@users.noreply.github.com> Date: Fri, 15 Oct 2021 20:10:19 -0500 Subject: net_lwip_webserver: allow users to enable LWIP_IP6 if desired --- lib/networking/dhserver.c | 16 ++++++++-------- lib/networking/dhserver.h | 10 +++++----- lib/networking/dnserver.c | 2 +- lib/networking/dnserver.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/networking/dhserver.c b/lib/networking/dhserver.c index 9287858ea..590739236 100644 --- a/lib/networking/dhserver.c +++ b/lib/networking/dhserver.c @@ -96,19 +96,19 @@ static const dhcp_config_t *config = NULL; char magic_cookie[] = {0x63,0x82,0x53,0x63}; -static ip_addr_t get_ip(const uint8_t *pnt) +static ip4_addr_t get_ip(const uint8_t *pnt) { - ip_addr_t result; + ip4_addr_t result; memcpy(&result, pnt, sizeof(result)); return result; } -static void set_ip(uint8_t *pnt, ip_addr_t value) +static void set_ip(uint8_t *pnt, ip4_addr_t value) { memcpy(pnt, &value.addr, sizeof(value.addr)); } -static dhcp_entry_t *entry_by_ip(ip_addr_t ip) +static dhcp_entry_t *entry_by_ip(ip4_addr_t ip) { int i; for (i = 0; i < config->num_entry; i++) @@ -162,11 +162,11 @@ uint8_t *find_dhcp_option(uint8_t *attrs, int size, uint8_t attr) int fill_options(void *dest, uint8_t msg_type, const char *domain, - ip_addr_t dns, + ip4_addr_t dns, int lease_time, - ip_addr_t serverid, - ip_addr_t router, - ip_addr_t subnet) + ip4_addr_t serverid, + ip4_addr_t router, + ip4_addr_t subnet) { uint8_t *ptr = (uint8_t *)dest; /* ACK message type */ diff --git a/lib/networking/dhserver.h b/lib/networking/dhserver.h index 0d22461c7..2a0b15854 100644 --- a/lib/networking/dhserver.h +++ b/lib/networking/dhserver.h @@ -41,16 +41,16 @@ typedef struct dhcp_entry { - uint8_t mac[6]; - ip_addr_t addr; - uint32_t lease; + uint8_t mac[6]; + ip4_addr_t addr; + uint32_t lease; } dhcp_entry_t; typedef struct dhcp_config { - ip_addr_t router; + ip4_addr_t router; uint16_t port; - ip_addr_t dns; + ip4_addr_t dns; const char *domain; int num_entry; dhcp_entry_t *entries; diff --git a/lib/networking/dnserver.c b/lib/networking/dnserver.c index 6df0bd0c4..e4e7c3492 100644 --- a/lib/networking/dnserver.c +++ b/lib/networking/dnserver.c @@ -136,7 +136,7 @@ static void udp_recv_proc(void *arg, struct udp_pcb *upcb, struct pbuf *p, const dns_header_t *header; static dns_query_t query; struct pbuf *out; - ip_addr_t host_addr; + ip4_addr_t host_addr; dns_answer_t *answer; (void)arg; diff --git a/lib/networking/dnserver.h b/lib/networking/dnserver.h index 130991f5f..a062e3aa7 100644 --- a/lib/networking/dnserver.h +++ b/lib/networking/dnserver.h @@ -39,7 +39,7 @@ #include "lwip/udp.h" #include "netif/etharp.h" -typedef bool (*dns_query_proc_t)(const char *name, ip_addr_t *addr); +typedef bool (*dns_query_proc_t)(const char *name, ip4_addr_t *addr); err_t dnserv_init(const ip_addr_t *bind, uint16_t port, dns_query_proc_t query_proc); void dnserv_free(void); -- cgit v1.3.1