导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→vxworks 添加默认网关[flycat2008]

 *第24661篇: vxworks 添加默认网关

  
楼 主:flycat2008 2008年7月22日14:18
 vxworks 添加默认网关
Q: How can I get the default gateway from the bootline to be the default gateway? 

A: Thanks to a suggestion by Michael Lawnick I pilfered some code from the bootConfig.c file and threw it into usrAppInit.c. This was to get the gateway from the bootline.... The system now works the way it should from the factory. Here is an excerpt of my code: 

#include "VxWorks.h"
#include "bootLib.h"
#include "prjParams.h"

void usrAppInit (void)
{
BOOT_PARAMS params;

#ifdef USER_APPL_INIT
USER_APPL_INIT; /* for backwards compatibility */
#endif
/* add application specific code here */
bootStringToStruct (BOOT_LINE_ADRS, ¶ms);
if ((sysNvRamGet (BOOT_LINE_ADRS, BOOT_LINE_SIZE, 0) == ERROR) ||
(*BOOT_LINE_ADRS == EOS))
{
/* either no non-volatile RAM or empty boot line */
printf("Adding hardwired gateway\n");
routeAdd ("0.0.0.0", "155.34.103.1");
}
else {
printf("Adding gateway %s from bootline\n", params.gad);
routeAdd("0.0.0.0", params.gad);
}
}
本文章来自中国IT实验室


>>>>>>对该主题发表你的看法

本主题贴数1,分页: [第1页]


[上一篇主题]:新建的几个技术群,大家看看!

[下一篇主题]:SOS!!!!!