I'm writing a little program using TCP sockets for communication between a CPU board and a server machine (Motorola MVME2400, T2, vxWorks 5.4). By accident I found out that the program only works with server machines being in the same subnet. Further investigations showed that the gateway is set to the boards IP address although it is given correctly in the bootline. My further observations: * Print statements in bootConfig.c show that the gateway is read correctly from the bootline and set with routeAdd. * A print statement in usrAppInit.c gives the boards IP address as the gateway address. * After deleting this entry with routeDelete and reseting it correctly with routeAdd in usrAppInit.c a routeShow gives the correct address. * Typing routeShow in the host shell again gives the boards IP address as the gateway and pinging an "out of subnet" machine does not work. * After doing the routeDelete-routeAdd-gymnastics in the shell the gateway is set correctly, stays correctly and ping work fine.
Does anyone of you has an idea what goes wrong before?
Thanks in advance, -- Jürgen Naumann e----------------------------->H1<---------------------------p
> I'm writing a little program using TCP sockets for communication > between a CPU board and a server machine (Motorola MVME2400, > T2, vxWorks 5.4). By accident I found out that the program only works > with server machines being in the same subnet. Further investigations > showed that the gateway is set to the boards IP address although it > is given correctly in the bootline. My further observations: > * Print statements in bootConfig.c show that the gateway is read > correctly from the bootline and set with routeAdd. > * A print statement in usrAppInit.c gives the boards IP address as > the gateway address. > * After deleting this entry with routeDelete and reseting it correctly > with routeAdd in usrAppInit.c a routeShow gives the correct address. > * Typing routeShow in the host shell again gives the boards IP address > as the gateway and pinging an "out of subnet" machine does not work. > * After doing the routeDelete-routeAdd-gymnastics in the shell the > gateway is set correctly, stays correctly and ping work fine.
> Does anyone of you has an idea what goes wrong before?
> Thanks in advance, > -- > Jürgen Naumann > e----------------------------->H1<---------------------------p
I found something similar. The cause appeared to be that the gateway is added, not as the default route, but as a route to a network based on the class (A, B or C) of the host's IP address.
This has some problems: - class A/B/C has been replaced by variable-length subnet masks - inet_netof_string() doesn't handle subnet masks - a single gateway is usually added as the default route (0.0.0.0)
I edited the configlette (usrNetRemoteCfg.c) to add the gateway as the default route, since that seemed more like common sense to me. At the time I also found out about the newer interface for adding routes: mRouteXxx routines. routeAdd is a hangover from the old Net/1 network stack (used in VxWorks 5.1.1 for example) whereas mRouteXxx is for the current Net/3 (BSD4.4-based) stack.
> I'm writing a little program using TCP sockets for communication > between a CPU board and a server machine (Motorola MVME2400, > T2, vxWorks 5.4). By accident I found out that the program only works > with server machines being in the same subnet. Further investigations > showed that the gateway is set to the boards IP address although it > is given correctly in the bootline. My further observations: > * Print statements in bootConfig.c show that the gateway is read > correctly from the bootline and set with routeAdd. > * A print statement in usrAppInit.c gives the boards IP address as > the gateway address. > * After deleting this entry with routeDelete and reseting it correctly > with routeAdd in usrAppInit.c a routeShow gives the correct address. > * Typing routeShow in the host shell again gives the boards IP address > as the gateway and pinging an "out of subnet" machine does not work. > * After doing the routeDelete-routeAdd-gymnastics in the shell the > gateway is set correctly, stays correctly and ping work fine.
> Does anyone of you has an idea what goes wrong before?
> Thanks in advance, > -- > Jürgen Naumann > e----------------------------->H1<---------------------------p
One other thing I forgot to mention. The other configlettes in target/config/comps/src/net (usrDhcpcCfg.c, usrNetPPPBoot.c, usrNetSlipBoot.c) also have the same problem adding the gateway as usrNetRemoteCfg.c has.
James Marshall wrote: > I found something similar. The cause appeared to be that the gateway is added, not as the default > route, but as a route to a network based on the class (A, B or C) of the host's IP address.
> This has some problems: > - class A/B/C has been replaced by variable-length subnet masks > - inet_netof_string() doesn't handle subnet masks > - a single gateway is usually added as the default route (0.0.0.0)
> I edited the configlette (usrNetRemoteCfg.c) to add the gateway as the default route, since that > seemed more like common sense to me. At the time I also found out about the newer interface for > adding routes: mRouteXxx routines. routeAdd is a hangover from the old Net/1 network stack (used in > VxWorks 5.1.1 for example) whereas mRouteXxx is for the current Net/3 (BSD4.4-based) stack.
> James Marshall.
> Juergen Naumann wrote:
> > Dear all
> > I'm writing a little program using TCP sockets for communication > > between a CPU board and a server machine (Motorola MVME2400, > > T2, vxWorks 5.4). By accident I found out that the program only works > > with server machines being in the same subnet. Further investigations > > showed that the gateway is set to the boards IP address although it > > is given correctly in the bootline. My further observations: > > * Print statements in bootConfig.c show that the gateway is read > > correctly from the bootline and set with routeAdd. > > * A print statement in usrAppInit.c gives the boards IP address as > > the gateway address. > > * After deleting this entry with routeDelete and reseting it correctly > > with routeAdd in usrAppInit.c a routeShow gives the correct address. > > * Typing routeShow in the host shell again gives the boards IP address > > as the gateway and pinging an "out of subnet" machine does not work. > > * After doing the routeDelete-routeAdd-gymnastics in the shell the > > gateway is set correctly, stays correctly and ping work fine.
> > Does anyone of you has an idea what goes wrong before?
> > Thanks in advance, > > -- > > Jürgen Naumann > > e----------------------------->H1<---------------------------p