未验证 提交 f698c0d6 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1552 from aozima/dhcpd_dev

add new DHCPD use lwip raw api.
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
if GetDepend('RT_USING_LWIP202'):
src = ['dhcp_server_raw.c']
else:
src = ['dhcp_server.c']
CPPPATH = [cwd]
......
......@@ -441,17 +441,19 @@ static void dhcpd_thread_entry(void *parameter)
*dhcp_opt++ = DHCPD_SERVER_IPADDR2;
*dhcp_opt++ = 1;
#else
struct ip_addr dns_addr;
ip4addr_aton(DHCP_DNS_SERVER_IP, &dns_addr);
DNS_SERVER_IPADDR0 = (ntohl(dns_addr.addr) >> 24) & 0xFF;
DNS_SERVER_IPADDR1 = (ntohl(dns_addr.addr) >> 16) & 0xFF;
DNS_SERVER_IPADDR2 = (ntohl(dns_addr.addr) >> 8) & 0xFF;
DNS_SERVER_IPADDR3 = (ntohl(dns_addr.addr) >> 0) & 0xFF;
*dhcp_opt++ = DNS_SERVER_IPADDR0;
*dhcp_opt++ = DNS_SERVER_IPADDR1;
*dhcp_opt++ = DNS_SERVER_IPADDR2;
*dhcp_opt++ = DNS_SERVER_IPADDR3;
{
#if (LWIP_VERSION) >= 0x02000000U
ip4_addr_t dns_addr;
#else
struct ip_addr dns_addr;
#endif /* LWIP_VERSION */
ip4addr_aton(DHCP_DNS_SERVER_IP, &dns_addr);
*dhcp_opt++ = (ntohl(dns_addr.addr) >> 24) & 0xFF;
*dhcp_opt++ = (ntohl(dns_addr.addr) >> 16) & 0xFF;
*dhcp_opt++ = (ntohl(dns_addr.addr) >> 8) & 0xFF;
*dhcp_opt++ = (ntohl(dns_addr.addr) >> 0) & 0xFF;
}
#endif
// DHCP_OPTION_LEASE_TIME
......
......@@ -31,7 +31,15 @@
#ifndef DHCPV4_SERVER_H__
#define DHCPV4_SERVER_H__
#ifdef __cplusplus
extern "C" {
#endif
void dhcpd_start(const char *netif_name);
#ifdef __cplusplus
}
#endif
#endif
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册