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);
}
}
【责编:Luzi】
--------------------next---------------------
阅读(1433) | 评论(0) | 转发(0) |