Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SummerGao.
rt-thread
提交
47a0e464
R
rt-thread
项目概览
SummerGao.
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
47a0e464
编写于
5月 09, 2018
作者:
wuyangyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[DHCPD] update DHCPD_SERVER_IP config.
上级
6a36d0c5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
9 deletion
+17
-9
components/net/Kconfig
components/net/Kconfig
+4
-0
components/net/lwip_dhcpd/dhcp_server.c
components/net/lwip_dhcpd/dhcp_server.c
+13
-9
未找到文件。
components/net/Kconfig
浏览文件 @
47a0e464
...
...
@@ -202,6 +202,10 @@ config LWIP_USING_DHCPD
default n
if LWIP_USING_DHCPD
config DHCPD_SERVER_IP
string "DHCPD SERVER IP address"
default 192.168.169.1
config DHCPD_USING_ROUTER
bool "alloc gateway ip for router"
default y
...
...
components/net/lwip_dhcpd/dhcp_server.c
浏览文件 @
47a0e464
...
...
@@ -55,11 +55,8 @@
#endif
/* the DHCP server address */
#ifndef DHCPD_SERVER_IPADDR0
#define DHCPD_SERVER_IPADDR0 192UL
#define DHCPD_SERVER_IPADDR1 168UL
#define DHCPD_SERVER_IPADDR2 169UL
#define DHCPD_SERVER_IPADDR3 1UL
#ifndef DHCPD_SERVER_IP
#define DHCPD_SERVER_IP "192.168.169.1"
#endif
//#define DHCP_DEBUG_PRINTF
...
...
@@ -215,12 +212,22 @@ static void dhcpd_thread_entry(void *parameter)
struct
dhcp_msg
*
msg
;
int
optval
=
1
;
struct
mac_addr_t
mac_addr
;
uint8_t
DHCPD_SERVER_IPADDR0
,
DHCPD_SERVER_IPADDR1
,
DHCPD_SERVER_IPADDR2
,
DHCPD_SERVER_IPADDR3
;
/* get ethernet interface. */
netif
=
(
struct
netif
*
)
parameter
;
RT_ASSERT
(
netif
!=
RT_NULL
);
/* our DHCP server information */
{
ip4_addr_t
addr
;
ip4addr_aton
(
DHCPD_SERVER_IP
,
&
addr
);
DHCPD_SERVER_IPADDR0
=
(
ntohl
(
addr
.
addr
)
>>
24
)
&
0xFF
;
DHCPD_SERVER_IPADDR1
=
(
ntohl
(
addr
.
addr
)
>>
16
)
&
0xFF
;
DHCPD_SERVER_IPADDR2
=
(
ntohl
(
addr
.
addr
)
>>
8
)
&
0xFF
;
DHCPD_SERVER_IPADDR3
=
(
ntohl
(
addr
.
addr
)
>>
0
)
&
0xFF
;
}
DEBUG_PRINTF
(
"DHCP server IP: %d.%d.%d.%d client IP: %d.%d.%d.%d-%d
\n
"
,
DHCPD_SERVER_IPADDR0
,
DHCPD_SERVER_IPADDR1
,
DHCPD_SERVER_IPADDR2
,
DHCPD_SERVER_IPADDR3
,
...
...
@@ -492,12 +499,9 @@ void dhcpd_start(const char *netif_name)
{
extern
void
set_if
(
const
char
*
netif_name
,
const
char
*
ip_addr
,
const
char
*
gw_addr
,
const
char
*
nm_addr
);
char
ip_str
[
4
*
4
+
1
];
dhcp_stop
(
netif
);
sprintf
(
ip_str
,
"%d.%d.%d.%d"
,
DHCPD_SERVER_IPADDR0
,
DHCPD_SERVER_IPADDR1
,
DHCPD_SERVER_IPADDR2
,
DHCPD_SERVER_IPADDR3
);
set_if
(
netif_name
,
ip_str
,
"0.0.0.0"
,
"255.255.255.0"
);
set_if
(
netif_name
,
DHCPD_SERVER_IP
,
"0.0.0.0"
,
"255.255.255.0"
);
netif_set_up
(
netif
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录