The VxWorks programmer's Guide 5.4 Edition 1 says on page 320:
"Before the network can be used, it must be initialized with de routine
usrNetInit(), which is called by usrRoot() when the constant
INCLUDE_NET_INIT
is defined (...)."
However, if I look at the function usrRoot() in file prjConfig.c, I see
that function
usrNetworkInit() is being called instead of function usrNetInit(). As a
consequence,
the following statement made in the VxWorks Programmar's Guide on page
70 isn't
true either: "The VxWorks network startup routine, usrNetInit() in
usrNetwork.c,
automatically adds the gateway specified in the boot parameters (if any)
to the routing tables."
I have filled in the IP address of a gateway in the gateway (g) boot
parameter.
However, a ping from my target to an IP address outside the network
fails, because
the gateway has NOT been added to the routing tables (routeShow confirms
this).
Can somebody please explain this discrepancy between the Documentation
and how it
works in reality? And how can I make it work as advertised (i.e. gateway
IP address
from boot parameter automatically added the the routing tables)?
Rob Uiterlinden
uit...@nlr.nl
>Using Tornado II/VxWork 5.4 and the pc486 BSP, I have stumbled on
>something that
>behaves differently than it should behave according to the
>Documentation.
>
>The VxWorks programmer's Guide 5.4 Edition 1 says on page 320:
>"Before the network can be used, it must be initialized with de routine
>usrNetInit(), which is called by usrRoot() when the constant
>INCLUDE_NET_INIT
>is defined (...)."
>
>However, if I look at the function usrRoot() in file prjConfig.c, I see
>that function
>usrNetworkInit() is being called instead of function usrNetInit().
This is right for the bootstrap code. The code as generated with the
Tornado project tool generates it's own startup code. If you look into the
prjConfig.c you see that the function usrNetworkInit is also in this
module. In this function a lot of init functions are called, and also the
function usrNetworkBoot. From this function all parameters are inserted.
Groeten,
Johan
--
o o o o o o o . . . ___________________________________
o _____ || Johan Borkhuis |
.][__n_n_|DD[ ====_____ | jo...@borksoft.xs4all.nl |
>(________|__|_[_________]_|________________________________|
_/oo OOOOO oo` ooo ooo 'o!o!o o!o!o`
=== VxWorks FAQ: http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html ===
Not surprising! look in usrNetwork.c, usrNetInit() contains:
if (params.gad[0] != EOS) {
inet_netof_string( params.had, nad );
routeAdd( nad, params.gad );
}
Which adds the 'gateway' as the route to the (sub)net containing your boot host.
This only makes sense (and can only add a route) if the boot host isn't in the
same (sub)net as your target.
In order to talk to the outside world you need a default route - not an extra
route for a specific subnet. Change the above to:
if (params.gad[0] != EOS)
routeAdd( "0.0.0.0", params.gad );
If have no idea why vxworks contains the former definition. Such a system would
need a different default route set somewhere else, anyone building such a system
would have enough knowlege of routing to set up their own rules...
David
----------------------------------------------------------------
David Laight email: d...@tadpole.co.uk
Tadpole Technology plc phone: +44 1223 428 232
Cambridge, UK fax: +44 1223 428 201
Rob Uiterlinden
Rob Uiterlinden
/******************************************************************************
*
* usrAppInit - initialize the users application
*/
#include "vxWorks.h" /* for types used by sysLib.h (sigh...) */
#include "sysLib.h" /* for sysBootParams */
void usrAppInit (void)
{
#ifdef USER_APPL_INIT
USER_APPL_INIT; /* for backwards compatibility */
#endif
/* add application specific code here */
/*
Drive number and mount point for True Flash File System on DiskOnChip
*/
#define TFFS0_Drive 0
#define TFFS0_MountPoint "/tffs0"
#define NON_REMOVABLE 0
/*
Mount the DOS file system on a TFFS Flash disk
and set the current directory
*/
usrTffsConfig (TFFS0_Drive, NON_REMOVABLE, TFFS0_MountPoint);
cd (TFFS0_MountPoint);
/*
If a gateway has been specified in the boot parameters,
add it as default route entry to the routing table
*/
if (sysBootParams.gad [0] != EOS)
routeAdd ("0.0.0.0", sysBootParams.gad);