Upload
mohammad-mohsen-amiri
View
214
Download
0
Embed Size (px)
Citation preview
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 1/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-1
Chapter
12Networking
ntroduction
xWorks Network Configuration
Routing ProtocolsRemote Access Services
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 2/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-2
Networking
12.1 Introduction
VxWorks Network Configuration
Routing Protocols
Remote Access Services
etwork Stack
xWorks Network Configuration
vailable Network Facilities
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 3/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-3
Network Protocols
• Machines on a network must agree to exchange data in
some standard way.
• Internet protocol suite (also called TCP/IP) providessystem independent protocols.
• VxWorks provides an implementation of TCP/IP
protocol suite based on the 4.4BSD release
• Features include:
q Increased configurability and scalabilityq MUX layerq Support for contemporary Internet features
• Internet protocols are standardized through Requests for Comments
(RFCs) circulated by the Internet Engineering Task Force (IETF). These
RFCs are the authoritative guide to how these protocols should work.
RFCs can be found at www.ietf.org/rfc/ .
• Good books on network programming:
q Unix Network Programming, volume I, 2nd ed. (Stevens), 1997.q Internetworking with TCP/IP volume III, 2nd ed. (Comer), 1996.
• For an overview and internals of network protocols:
q
TCP/IP Illustrated, Volume 1 (Stevens), 1994.q TCP/IP Illustrated, Volume 2 (Wright and Stevens), 1995.q Internetworking with TCP/IP volume I, 3rd ed. (Comer), 1995.q Internetworking with TCP/IP volume II, 2nd ed. (Comer), 1994.q The Design and Implementation of the 4.4 BSD UNIX Operating System
(McKusick et. al.), 1996.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 4/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-4
Network Components
Shared MemoryNetwork
SLIP/PPPEthernet
Socketszbuf API
TCP UDP
rlogin telnet rsh ftp Tornado
tgtsvrNFS
RPC
IP
netDrv
MUX
• The MUX layer is a thin API layer that decouples network interface
drivers from the network protocol.
• IP, the Internet Protocol, is responsible for point-to-point delivery of
datagrams.
• TCP, Transmission Control Protocol, and UDP, User Datagram Protocol,
are both transport level protocols. UDP is a lightweight datagram
delivery service, and TCP is a full-featured connection-based protocol
which provides reliable data transport.
• Berkeley sockets, zbuf sockets, and RPC are supported networkprogramming APIs.
• The zbuf Sockets API uses buffer loaning to speed up network
communication.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 5/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-5
Network Scalability
• Selective inclusion of core TCP/IP networking
protocols is provided.
• TCP/IP parameters can be set by setting properties of individual components. Examples: TCP ConnectionTimeout, IP Time-to-Live value, TCP/UDP receive andsend buffer sizes, and tuning of internal buffers. (SeeVxWorks Network Programmer’s Guide.)
• ICMP (Internet Control Message Protocol), configurable separately
from IP, handles error and informational messages at the IP layer. Two
such messages are echo reply (used by ping()) and redirect (used to repair
bad routing entries).
• IGMP (Internet Group Management Protocol) is used by hosts and
routers to support multicasting.
• The network library support component includes the library netLib which
provides support for network drivers through the system task tNetTask .
• Internal buffering is in the form of pre-allocated memory pools of fixedsize mBlks and clBlks. The size and number of blocks in these pools can
be changed to tune stack performance, but be sure to read the VxWorks
Network Programmer’s Guide description first!
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 6/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-6
Network Services
• VxWorks network services include:
q DHCP/BOOTPq Simple Network Time Protocol (SNTP)q DNS resolverq Dynamic Routing (RIPv1/RIPv2/OSPF)q rlogin/telnetq Remote command executionq Remote file access
q Multicasting, including IGMP• User can build other network services as needed.
• To use these network services the appropriate components must be
included in the VxWorks image.
• DHCP, Dynamic Host Configuration Protocol, and BOOTP are two
protocols supporting booting a target from a remote boot server. DHCP
will be discussed in in this chapter.
• DNS, Domain Name Service, allows a target to look up remote hosts by
name. DNS will be discussed in this chapter.
• A number of optional networking products are available, including:
q WindWeb server (HTTP server)q SNMPq STREAMSq eNavigator (an embeddable browser and toolkit)
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 7/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-7
Networking
Introduction
12.2 VxWorks Network Configuration
Routing Protocols
Remote Access Services
Host Names and Tables
Domain Name Service
Dynamic Host Configuration Protocol
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 8/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-8
Host Names
• To associate a name with an internet address:
hostAdd (hostName, hostAddr)
• To display host name table use:
hostShow ( )
• The name of the boot host is automatically added to the
table from the boot parameters.
Example:
-> hostAdd “tuolumne”, “147.11.12.14”
value = 0 = 0x0
-> hostAdd “todd”, “147.11.12.14”
value = 0 = 0x0
-> hostShow
hostname inet address aliases
-------- ------------ -----------
t12-164 147.11.12.164
localhost 127.0.0.1wolverine 147.11.12.165
tuolumne 147.11.12.14 todd
value = 0 = 0x0
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 9/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-9
Domain Name System
• Domain Name System (DNS) is a distributed
client/server application supporting host names being
stored in a distributed database.• DNS requires a name server and, on the client side, a
resolver. VxWorks supports resolver functionality in
resolvLib.
• resolvLib includes the following routines:
q
resolvGetHostByName() -- send a DNS query to thename server for the IP address of a host.q resolvGetHostByAddr() -- send a DNS query to the
name server for the host name of an IP address.
• The name server must have a corresponding route in the target routing
table.
• hostLib contains two related routines, hostGetByName() and
hostGetByAddr(), which normally use the local host name table.
However, if resolvLib is configured and a host name or IP address is
not found locally, then a DNS query will be sent.
• DNS is described in RFC’s 1034 and 1035.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 10/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-10
DNS Resolver Configuration
• The DNS resolver component (/network
components/networking applications/DNS resolver) must be
added to VxWorks.• The resolver must be initialized before use. Required
information includes RESOLVER_DOMAIN and
RESOLVER_DOMAIN_SERVER. This can be done through
the project facility or by calling resolvInit().
• Example configuration:
q RESOLVER_DOMAIN “wrs.com”q RESOLVER_DOMAIN_SERVER “147.11.254.1”q DNS_DEBUG FALSE
• Setting the DNS_DEBUG flag will result in diagnostic messages being sent
to the console when DNS queries are made.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 11/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-11
DHCP Basics
• Dynamic Host Configuration Protocol (DHCP) allows a
host to acquire an IP address, and possibly boot
parameters, from a remote host.
• A DHCP client can obtain a temporary lease of an IPaddress from a DHCP server, which maintains a
database of available addresses and other parameters.
A DHCP relay agent is necessary to support DHCP
operation across subnet boundaries.
DHCPrelay
agent
DHCPClient
DHCPServer
• The DHCP server database can contain entries that allow BOOTP client
requests to be handled. (BOOTP is a simpler protocol allowing remote
clients to obtain boot parameters.)
• The VxWorks implementation of DHCP conforms to RFC 1541.
• See the VxWorks Network Programmer’s Guide chapter on Booting over the
Network for more details on DHCP boot configuration.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 12/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-12
DHCP Configuration
DHCPClient
Add component /network components /
networking protocols/ network applications/
DHCPv4 runtime client.
Default parameters:DHCP client port number = 68DHCP server port number = 67Desired lease length = 3600 secondsMinimum acceptable lease length = 30 seconds
DHCPServer
Add component /network components /
networking protocols/ network applications / DHCP
Server.
Default parameters:Port numbers the same as for clientDHCP server port number = 67Max number of hops for DHCP = 4
• The DHCP relay agent configuration is described in the help page for
dhcpsLib. (Yes, the server help file!)
• A DHCP server requires a database of addresses and boot parameters.
A default database is found in.../target/config/comps/src/net/usrNetDhcpsCfg.c.
• Details on database entries and a server hook to assign permanent
storage for dynamically added addresses can be found on the help page
for dhcpsLib.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 13/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-13
Networking
Introduction
VxWorks Network Configuration
12.3 Routing Protocols
Remote Access Services
Routing Overview
Static Routing
Dynamic Routing
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 14/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-14
Routing Overview
• Internet Protocol (IP) routing algorithm:
if (destination on a directly attached network)
send data to destination
else
use routing table to find correct router
send data to router
• The target routing table can be built in two ways:
q Statically, by adding routes to a local routing tableusing mRouteAdd() or routeAdd( ).
q
Or dynamically, where hosts exchange routinginformation using a routing protocol.
• VxWorks supports two routing protocols: Routing
Information Protocol (RIP) and Open Shortest Path First
(OSPF).
• mRouteAdd(), strangely enough, is found in routeLib.
• RIPv1 and RIPv2 are both supported by ripLib. Differences between
these versions is discussed later.
• OSPF is an optional product.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 15/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-15
Adding Static Routes in VxWorks
• To add multiple routes to the same location, use
mRouteAdd (dest, gateway, mask, tos, flags)
Can use a destination/gateway internet address in dotnotation. Specify destination subnet mask and IP type-of-service. See routeLib help page for details.
• To add a route to the 90.0.0.0 /24 network through the
router gatehost:
mRouteAdd (“90.0.0.0”, “gatehost”, 0xffffff00, 0, 0)
• Routing table show routines, mRouteShow() orrouteShow() require the component /network
components/networking protocols/network debugging/ Network
show routines.
• To delete a route, use mRouteEntryDelete( ) or mRouteDelete( ).
• routeAdd() and routeShow(), while obsolete, are provided for
backwards compatibility.
• Routing example:
->mRouteAdd (“147.11.12.0”, “90.0.0.254”, 0xffffff00, 0, 0)
value = 0 = 0x0
->mRouteShow
Destination Mask TOS Gateway Flags RefCnt Use Interface Proto
0.0.0.0 0 0 90.0.0.1 101 0 0 nt0 0
127.0.0.1 0 0 127.0.0.1 5 0 0 lo0 0
147.11.12.0 ffffff0 0 90.0.0.254 3 0 0 nt0 1
value = 0 = 0x0
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 16/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-16
Network Show Routines
• Are used to display network statistics and debugging
information. Configuration information and statistics
can be shown for protocols (IP, ICMP, TCP, etc.) , buffering, network interfaces, etc.
• Example (ARP table entries):
->arptabShow
LINK LEVEL ARP TABLE
destination gateway flags Refcnt Use Interface
--------------------------------------------------------------------------
147.11.12.14 08:00:20:7b:06:fb 405 0 45 ei0
147.11.12.165 00:60:97:4f:d5:16 405 0 0 ei0--------------------------------------------------------------------------value = 75 = 0x4b = ‘K’
• ARP is the Address Resolution Protocol, a protocol to find link layer
addresses (ethernet addresses in this example) given an IP address.
• A flag value of 0x405 is 0x400 (generated by ARP) + 0x4 (host specific
entry) + 0x1 (route is “up”)
• The components for network show routines are:
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 17/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-17
Dynamic Routing Overview
• Dynamic routing protocols allow hosts (typically
routers) to exchange routing information. Advantages
over statically created routing tables include:q Faster update as link states changeq Ability to calculate the most efficient route if there
are multiple routes to a destinationq Easier maintenance
• These protocols do not affect the Internet routing
algorithm, but instead impose a routing policy whenconstructing the routing table.
• VxWorks supports RIP versions 1 and 2 and OSPF (an
optional component).
• The common UNIX routing daemon routed uses RIP.
• RIP and OSPFs are examples of IGPs (Interior Gateway Protocols)
which allow routers within an organization (in formal networking
lingo, an autonomous system) to exchange routing information.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 18/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-18
Routing Internet Protocol
• RIP uses UDP to exchange routing information.
• RIP is a distance vector protocol -- each route includes a
number of hop counts. If multiple paths to adestination exist, RIP chooses the most efficient route
by minimizing this count.
• RIPv2 updates RIPv1 by including:
q support for classless addressingq
ability to use multicasting and broadcastingq support for authentication
• use ping( ) for testing routes
• See ripLib in the VxWorks Reference Manual for details.
• RIPv2 can also process RIPv1 messages.
• RIPv1 is described in RFC 1058 and RIPv2 in RFC 1388.
• OSPF is a link state protocol -- such protocols do not require wholesaleexchange of routing tables. Instead, OSPF routers exchange
information about link states. This information is used by each router
to calculate an optimal routing table. Link state information includes a
link weight, which reflects delays and bandwidth restrictions on that
network segment. Advantages of OSPF over RIP:
q Link state metrics lead to better optimized routes than hop counts.q Routing updates occur more promptly.q OSPF can accomodate larger and more complex organization
networks (RIP is limited to hop counts < 16).
• Networking implements OSPF version 2, as defined in RFC 1583.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 19/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-19
Networking
Introduction
VxWorks Network Configuration
Routing Protocols
12.4 Remote Access Services
Remote Access Services Supported by VxWorks
Server Services: rlogin, telnet, FTP, NFS
Client Services: NFS, RSH, FTP
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 20/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-20
VxWorks Remote Services
• A TFTP (Trivial File Transfer Protocol) client and server are also
supplied. TFTP is a light-weight version of FTP implemented using
UDP. It does not support any authentication. See tftpLib and tftpdLib
for details.
• The Target Server File System (TSFS) allows a target to access a host-
based file system using the target server - WDB agent connection. For
details, see the WindView chapter.
VxWorks
SERVER CLIENT
rlogin FTP
telnet NFS
nfsDrv netDrv
NFSFTP RSH
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 21/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-21
Remote Login and Telnet
• rlogin and telnet offer an alternative to cross-
development using the Tornado target server.
rlogin(UNIX)
andtelnet
(Internetprotocol)
Include /network components/networking
protocols/network applications/RLOGIN server/
TELNET server
The target resident shell is required: /development tool components/ target shell
components/target shell
Additional tools can also be linked:Target resident symbol table.
Target resident show routines.Target resident module loader/unloader.
• Target-based tools may be useful for in-the-field debugging and
upgrading when a Tornado target server is unavailable. Inclusion of
these tools increases your image size significantly.
• Security can be installed:
q Add the component /network components/networking protocols/networkapplications/RLOGIN|TELNET password protection
q Modify LOGIN_USER_NAME and LOGIN_PASSWORD parameters .q Add additional users with loginUserAdd( ).
• An example of initializing the user login table:
...
loginInit();
loginUserAdd(“marco”, “bcRzQdybze”);
...
In the above code, loginUserAdd( ) adds a user to the login table. Thesecond argument “bcRzQdybze” is the pasword “poloPonY” encryptedwith the vxencrypt tool.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 22/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-22
NFS Server Overview
• Allows remote hosts to access a target’s DOS file
systems using NFS protocol.
• By default no authentication is performed.
• Add the component /network components/networking
protocols/network filesystems/NFS server.
• NFS server configuration supports:
1. Create a mountable DOS file system:
dosFsDevInitOptionsSet (DOS_OPT_EXPORT);
2. Export DOS file system:
nfsExport (name, fsId, rdOnly, notUsed);
3. Mount file system on remote host.
• NFS server provides:
mountLib Implements Mount Protocol as defined in InternetRFC 1094.
nfsdLib Implements Network File System Protocol asdefined in Internet RFC 1094.
• NFS server requires the following tasks:
q tMountd Manages mount requestsq tNfsd Enqueues incoming NFS requestsq tNfsd0-tNfsd3 Process incoming NFS requests (number of
tasks configurable)• To access file systems other than DOS from a remote host, use the
VxWorks FTP server.
• Refer to your host documentation for details on mounting a NFS file
system on the remote system.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 23/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-23
VxWorks FTP Server
• The FTP server component is included by configuring/network components/networking protocols/network
filesystems/FTP server.
• When target is booted, should see tFtpdTask (serverdaemon) running.
• FTP security, which will require a valid user name andpassword from clients, can be included by configuring/network components/networking protocols/network
filesystems/FTP server security.
• The RLOGIN/TELNET password protection component allowsa single user name and encrypted password.Additional users can be added by callingloginUserAdd() in application initialization code.
Example: VxWorks Server and VxWorks Client
• Can also use FTP to boot one VxWorks target from another.
-> pBlkDev = ramDevCreate
(0, 512, 0, 400,0)
-> dosFsMkfs (“/RAM1”,
pBlkDev)
-> fd =
creat(“/RAM1/dataFile”,2)
-> write(fd,dataPtr,nBytes)
-> close (fd)
-> netDevCreate (“VxServer:”,
“VxServer”, 1)
-> fd = open(“VxServer:”
“/RAM1/dataFile”, 2)
-> read(fd, dataBuf, maxSize)
-> close (fd)
VxClientVxServer
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 24/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-24
NFS vs. FTP Server
• NFS Advantages:
q Efficient file access.q Configurable number of servers pre-spawned.
• FTP Advantages:
q Can access file systems other than DOS.q All network hosts have FTP client.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 25/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-25
NFS Client Service
• Network File System (NFS) was developed by Sun
Microsystems.
• Allows efficient access to files. NFS transfers and buffers files in pieces (usually 8 Kbytes).
• Remote file systems are mounted, then accessed as if
they were local file systems.
• VxWorks provides NFS client and server.
• The NFS client component can be found under /network
components/networking protocols/network filesystems/NFS client.
• Windows NT, Windows 98, and Windows 95 require additional
software to support NFS. Numerous third-party packages are available.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 26/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-26
NFS Client Configuration
To access files on a remote machine using NFS:
0. Export server’s file system:
Makes the local file system available to remote hostwith appropriate access permissions
1. Mount the file system on the client.nfsMount (host, fileSystem , localName)
2. Set the client’s authentication parameters:nfsAuthUnixSet (hostName, uid , gid , ngids,aup_gids)
Defaults (NFS_GROUP_ID = 100 and NFS_USER_ID =2001) will need to be changed. UNIX users can get therequired values using:
% iduid=219(marc) gid=700(training)
Exporting the server’s file system, is host-dependent:
• For UNIX hosts, exported file systems and access permissions are often
specified in /etc/exports. Under Solaris, the appropriate file is
/etc/dfs/dfstab. (UNIX Host)
• For PC hosts, export and access information are stored as specified by
NFS software. Authentication may not be necessary. (PC Host)
o find the remote host a file system is mounted from:
-> nfsDevShow
device name file system
----------- ---------------
/usrNfs styx:/usr
/dinoNfs columbia:/dino
value = 0 = 0x0
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 27/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-27
netDrv File Access Clients
• netDrv allows access to remote files:
q Entire file read into target memory on open( ).q
read( )/write( ) act on copy of file in memory.q File not written to remote host until close( ).
• Can’t access large files (constrained by available
memory).
• ioctl (fd, FIOSYNC, 0) is not supported.
• dirLib routines opendir / readdir do not work onnetDrv directories. stat / fstat are only partially
implemented.
• stat and fstat only work on regular files. The only fields that are filled
in are the file size, file type (always IFREG if netDrv can open it), and
device pointer
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 28/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-28
Creating network Devices
STATUS netDevCreate (devName, host,protocol)
devName Local name of device to create. Byconvention, ends with ‘:’.
host Name of remote machine (from previoushostAdd( )).
protocol Protocol to transfer files to/fromVxWorks (0=RSH or 1=FTP).
• Example
-> netDevCreate (“ohio:”, “ohio”, 1)
-> fd = open (“ohio:/u/teamN”, 2)
• FTP file access requires a name and a password set via remCurIdSet( )
or:
iam (“team8”, “team8Password”);
• RSH access requires your target name in ~/.rhosts.
• When using FTP, the netDrv routines call lower level functions
implemented in the FTP client library, ftpLib.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 29/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-29
Executing Remote Commands
• VxWorks programs can invoke remote shell (RSH)
commands on a UNIX host.
• A file descriptor called a socket is created. Can read( )
from this socket to get command output.
RSHclient
RSHserver
shell
shellcmd
socket
UNIX
VxWorks
• Commercial RSH servers are available for Windows machines, for
instance from Denicomp Systems. Shareware implementations are also
available on the web.
• Access permission requires a user name to be set on the target via
remCurIdSet( ) or iam().
• For RSH permission, can put target name in either ~/.rhosts, or in
/etc/hosts.equiv. The latter is dangerous, as it allows a VxWorks user to
set a name and access files arbitrarily. The former only allows a
VxWorks user to access files as a single, usually non-root, user.• rcmd() and rlogin() to UNIX also use the RSH protocol.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 30/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-30
UNIX: Remote Command Execution
int rcmd (host, remotePort, localUser,remoteUser, cmd, pFd2)
host Host name or inet number.
remotePort Remote port number to connect to,typically 514 (RSH server).
localUser Name of local user.
remoteUser User name on remote host.
cmd Shell command string to execute.pFd2 If non-zero, a socket for stderr is foreach
i (*.o)returned through this pointer.
• Returns a socket file descriptor or ERROR.
• The remoteUser parameter is used by the RSH server to find a .rhosts
file.
• The RSH server can restrict access by a target to a specific user name,i.e., the localUser parameter.
• For additional remote command execution routines see remLib in the
Reference Manual.
• Close the socket file descriptor when your task has finished using it.
UNIX
shell
RSH
client
stdout
stderr
fd1
fd2
int fd1, fd2;
...fd1 = rcmd (..., &fd2);...
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 31/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-31
netDrv Client Services Comparison
• Advantages of FTP over RSH:
q FTP is part of the TCP/IP protocol suite, so it is
available on all networked hosts.q FTP is faster on open/close, since there is no shell
delay.q FTP server is supplied with VxWorks.
• Advantages of RSH over FTP:
q FTP clear text password goes over the network on
eachopen( )
andclose( )
.
• A netDrv device for accessing files on the boot host is automatically
created at boot time.
• Remote shell protocol (RSH) is a UNIX protocol for executing
commands remotely. (UNIX Host)
• File transfer protocol (FTP) is an internet protocol for remote file
transfer.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 32/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-32
netDrv vs. nfsDrv
• Advantages of nfsDrv over netDrv:
q Reads and writes only needed parts of the file.q
Can access arbitrarily large files.q open( )/close( ) much faster.q Can use dirLib routines.q Can flush file changes with FIOSYNC.
• Advantages of netDrv over nfsDrv:
q All networked hosts have an FTP server.q Easier to configure.q read( )/write( ) slightly faster.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 33/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-33
Summary
• Internet Protocol for node-to-node routing.
• MUX layer decouples link-layer driver and network
protocol.
• Configuring the network
q Configure host name table using hostAdd() or useDNS resolver.
q Configure host’s routing table using mrouteAdd() oruse RIP/OSPF.
• Show routines are available to troubleshoot network
configuration.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 34/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-34
Summary
• DHCP allows a host to obtain IP address leases and
boot parameters from a remote server.
• DHCP components:
q DHCP Serverq DHCP Relay Agentq DHCP Client
• rlogin (UNIX Host) and telnet support.
• FTP and NFS servers allows local VxWorks files to beaccessed by a remote machine.
7/29/2019 12_networking1.pdf
http://slidepdf.com/reader/full/12networking1pdf 35/35
Wind River SystemsTornado Training Workshop © Copyright Wind River Systems 12-35
Summary
• nfsDrv mounts remote file systems with nfsMount( )
q Reads and writes portion of remote file.q File system must be exported by remote host.
• netDrv devices created with netDevCreate( ).
q Entire file is read into VxWorks on open( ), and notupdated until close( ).
q Uses either RSH (UNIX Host) or FTP for file transfer.q RSH requires name and entry in .rhosts. (UNIX Host)q FTP requires name and password.
• rcmd ( ) and rlogin() (UNIX Host)