5

Network Configuration Protocols



5.1    Introduction

This chapter describes the protocols used for retrieving network configuration information. These protocols are:

  • DHCP (Dynamic Host Configuration Protocol)
  • BOOTP (Bootstrap Protocol)
  • SNMP (Simple Network Management Protocol)

DHCP uses the BSD Packet Filter (BPF) in its boot scheme. For this reason, this chapter also discusses BPF.

Both a DHCP server and a BOOTP server can supply an Internet host with an IP address and related configuration information. When a BOOTP server assigns an IP address to an Internet host, the address is permanently assigned.

A DHCP server is more flexible. It assigns an IP address on either a permanent or leased basis. Leased IP addresses are an advantage in environments where large numbers of Internet hosts join the network for sessions of limited duration. Predicting the duration of such sessions is usually not possible at the time the leases are assigned.

Fortunately, a DHCP client has the ability to contact its server again and renegotiate the lease on an IP address (or request a replacement address). Unlike a BOOTP client, a DHCP client must remain active for as long as the target needs a current lease on an IP address.

Also included at the end of this section is a brief description of SNMP, an optional networking product that is compatible with VxWorks and purchased separately. For detailed usage information on SNMP, see the WindNet SNMP VxWorks Optional Product Supplement.

DHCP and BOOTP Work Only on Broadcast-capable MUX Devices

Both the DHCP and BOOTP clients use broadcasts to discover an appropriate server. Both protocols require network drivers that are capable of implementing some sort of broadcast. In addition, these drivers must be implemented using the MUX interface (in other words, as ENDs or NPT drivers).



5.2    BOOTP, Bootstrap Protocol

BOOTP is a basic bootstrap protocol implemented on top of the Internet User Datagram Protocol (UDP). The BOOTP client provided with VxWorks lets a target retrieve a single set of configuration parameters from a BOOTP server. Included among these configuration parameters is a permanently assigned IP address and a filename specifying a bootable image. To retrieve the boot file, the target can use a file transfer program, such as TFTP, FTP, or RSH.1


*      
NOTE: For many applications, the DHCP protocol can function as an alternative to BOOTP.

BOOTP offers centralized management of target boot parameters on the host system. Using BOOTP, the target can retrieve the boot parameters stored on a host system. This lets you set up systems that can automatically reboot without the need to enter the configuration parameters manually.

A BOOTP server must be running (with inetd on a UNIX system) on the boot host, and the boot parameters for the target must be entered into the BOOTP database (bootptab). The format of this database is server specific. An example bootptab file is described in The BOOTP Database, p.97.

BOOTP is a simple protocol based on single-packet exchanges. The client transmits a BOOTP request message on the network. The server gets the message, and looks up the client in the database. It searches for the client's IP address if that field is specified; if not, it searches for the client's hardware address.

If the server finds the client's entry in the database, it performs name translation on the boot file, and checks for the presence (and accessibility) of that file. If the file exists and is readable, the server sends a reply message to the client.

5.2.1   BOOTP Configuration

Using the BOOTP server to supply boot parameters requires that you edit the server's BOOTP database file, bootptab. However, the specifics of how to do this can vary from server to server. Refer to the manuals for your host's BOOTP server. If the host does not provide a BOOTP server as part of the operating system, a copy of the publicly available CMU BOOTP server is provided in target/unsupported/bootp2.1.

The following discussion of how to modify bootptab applies to the CMU BOOTP server.

The BOOTP Database

To register a VxWorks target with the BOOTP server, you must enter the target parameters in the host's BOOTP database (/etc/bootptab). The following is an example bootptab for the CMU version of the BOOTP server:

# /etc/bootptab: database for bootp server (/etc/bootpd) 
# Last update Mon 11/7/88 18:03
# Blank lines and lines beginning with '#' are ignored.
#
# Legend:
#
# first field -- hostname
#             (may be full domain name and probably should be)
#
#    hd -- home directory
#    bf -- boot file
#    cs -- cookie servers
#    ds -- domain name servers
#    gw -- gateways
#    ha -- hardware address
#    ht -- hardware type
#    im -- impress servers
#    ip -- host IP address
#    lg -- log servers
#    lp -- LPR servers
#    ns -- IEN-116 name servers
#    rl -- resource location protocol servers
#    sm -- subnet mask
#    tc -- template host (points to similar host entry)
#    to -- time offset (seconds)
#    ts -- time servers
#
# Be careful to include backslashes where they are needed. Weird (bad)
# things can happen when a backslash is omitted where one is intended.
#
# First, we define a global entry which specifies what every host uses.

global.dummy:\
:sm=255.255.255.0:\
:hd=/usr/wind/target/vxBoot:\
:bf=vxWorks:

vx240:ht=ethernet:ha=00DD00CB1E05:ip=150.12.1.240:tc=global.dummy
vx241:ht=ethernet:ha=00DD00FE2D01:ip=150.12.1.241:tc=global.dummy
vx242:ht=ethernet:ha=00DD00CB1E02:ip=150.12.1.242:tc=global.dummy
vx243:ht=ethernet:ha=00DD00CB1E03:ip=150.12.1.243:tc=global.dummy
vx244:ht=ethernet:ha=0000530e0018:ip=150.12.1.244:tc=global.dummy

Note that common data is described in the entry global.dummy. Any target entries that want to use the common data use tc=global.dummy. Any target-specific information is listed separately on the target line. For example, in the previous file, the entry for the target vx244 specifies only its Ethernet address (0000530e0018) and IP address (150.12.1.244). The subnet mask (255.255.255.0), home directory (/usr/wind/target/vxBoot), and boot file (VxWorks) are taken from the common entry global.dummy.

Editing the BOOTP Database to Register a Target

To register a target with the BOOTP server, log onto the host machine, edit the BOOTP database file to include an entry that specifies the target address (ha=), IP address (ip=), and boot file (bf=). For example, to add a target called vx245, with Ethernet address 00:00:4B:0B:B3:A8, IP address 150.12.1.245, and boot file /usr/wind/target/vxBoot/vxWorks, you would add the following line to the file:

vx245:ht=ethernet:ha=00004B0BB3A8:ip=150.12.1.245:tc=global.dummy

Note that you do not need to specify the boot filename explicitly. The home directory (hd) and the boot file (bf) are taken from global.dummy.

When performing the boot filename translation, the BOOTP server uses the value specified in the boot file field of the client request message as well as the bf (boot file) and the hd (home directory) field in the database. If the form of the filename calls for it (for example, if it is relative), the server prepends the home directory to the filename. The server checks for the existence of the file; if the file is not found, it sends no reply. For more information, see bootpd in the manual for your host.

When the server checks for the existence of the file, it also checks whether its read-access bit is set to public, because this is required by tftpd(8) to permit the file transfer. All filenames are first tried as filename.hostname and then as filename, thus providing for individual per-host boot files.

In the previous example, the server first searches for the file /usr/wind/target/vxBoot/vxWorks.vx245. If the file does not exist, the server looks for /usr/wind/target/vxBoot/vxWorks.



5.3    DHCP, Dynamic Host Configuration Protocol

DHCP, an extension of BOOTP, is designed to supply clients with all of the Internet configuration parameters defined in the Host Requirements documents (RFCs 1122 and 1123) without manual intervention. Like BOOTP, DHCP allows the permanent allocation of configuration parameters to specific clients. However, DHCP also supports the assignment of a network address for a finite lease period. This feature allows the serial reassignment of network addresses to different clients. This feature is useful when IP addresses are limited and the clients connect to the network for limited periods, such as is usually the case with clients that connect to the network over a modem.

The DHCP implementation provided with VxWorks conforms to the Internet standard RFC 2131.

VxWorks DHCP Components

VxWorks includes a DHCP client, server, and relay agent. The DHCP client can retrieve one or more sets of configuration parameters from either a DHCP or BOOTP server. The VxWorks DHCP client also maintains any leases it has retrieved. Likewise, the VxWorks DHCP server can process both BOOTP and DHCP messages. Both the client and server implementations support all options described in RFC 2132. The DHCP relay agent provides forwarding of DHCP and BOOTP messages across subnet boundaries.

Interface Settings Retrieved Using DHCP

If the server is configured to provide them, a lease can include configuration parameters in addition to an assigned IP address. To minimize network traffic, the DHCP client sets configuration values to the defaults specified in the Host Requirements documents (RFCs 1122 and 1123) if the server does not specify values for the corresponding parameters.

Unlike the configuration parameters supplied by BOOTP, the DHCP-assigned configuration parameters can expire. Although the DHCP server can duplicate BOOTP behavior and issue a permanent IP address to the client, the lease granted is usually temporary. To continue using the assigned parameters, the client must periodically contact the issuing server to renew the lease.


*      
WARNING: The Tornado tools do not currently have any way to discover or respond to a change in the target's IP address. Such a change breaks the network connection. In response, you must manually reconnect the Tornado tools to the target's new IP address. During development, this is rarely a serious problem, and you can avoid it by having the DHCP server issue an infinite lease on the target's IP address.

5.3.1   Including DHCP Components in an Image

The VxWorks DHCP implementation includes a server, a client, and a relay agent. You can configure your image to include all, two, one, or none of these components using the following configuration parameters:

INCLUDE_DHCPS

INCLUDE_DHCPC

INCLUDE_DHCPR

After setting any of the above configuration parameters, rebuild VxWorks.


*      
NOTE: If you are building a non-AE VxWorks image from the command line (that is, using a BSP without the project facility), you can add network components such as the DHCP client and server by editing the config.h header file for the BSP. For example, to include the DHCP client, you could edit the BSP config.h to include the line:
#define INCLUDE_DHCPC

However, the location of this line in the file is critical. The config.h file also includes configAll.h, which contains statements that defines other constants depending upon whether INCLUDE_DHCP is defined. Therefore, the INCLUDE_DHCP statement must come before the inclusion of configAll.h. Otherwise, the BSP build will likely fail.


5.3.2   Configuring the DHCP Client

The following configuration parameters are set by default for the DHCP client:

DHCPC_SPORT--DHCP Client Target Port

DHCPC_CPORT--DHCP Client Host Port

DHCPC_MAX_LEASES--DHCP Client Maximum Leases

DHCPC_OFFER_TIMEOUT--DHCP Client Timeout Value

DHCPC_DEFAULT_LEASE--DHCP Client Default Lease

DHCPC_MIN_LEASE--DHCP Client Minimum Lease

DHCPC_MAX_MSGSIZE--DHCP Client Maximum Message Size

When setting values for these parameters, keep in mind that the DHCP client rejects all offers whose duration is less than the minimum lease. Therefore, setting the DHCP Client Minimum Lease value too high could prevent the retrieval of any configuration parameters. In addition, if the DHCP client is used at boot time, the values for DHCP Client Target Port and DHCP Client Host Port used in the boot program and run-time image must match.

Finally, the DHCP Client Maximum Leases limit on multiple concurrent leases includes a lease established at boot time. For example, if this limit has a value of four, and if a boot-time DHCP client retrieves a lease, the run-time DHCP client is limited to three additional sets of configuration parameters (until the boot-time lease expires).


*      
NOTE: In addition to setting values for the defines mentioned above, asynchronous use of DHCP requires that you provide an event hook routine to handle lease events. For more information, see the dhcpcEventHookAdd( ) reference entry.

5.3.3   Configuring DHCP Servers

Configuring the DHCP server requires that you create a pool of configuration parameter sets. Each parameter set must include an IP address. When a DHCP client makes a request of the server, the server can then assign a parameter set to the client (either permanently or on a leased basis). To store and maintain this pool of configuration parameter sets, some DHCP servers use one or more files. This approach is analogous to the use of the bootptab file associated with SunOS BOOTP servers. The unsupported DHCP server distributed with VxWorks takes this approach.

However, some VxWorks targets do not include a file system. The supported target-resident DHCP server does not use a file-based mechanism for parameter storage. Instead, the target-resident server maintains configuration parameters in memory-resident structures. To control the contents of these memory-resident structures, you can add entries using dhcpLeaseEntryAdd( ), or you can modify the source code that defines these structures.

The following sections describe how to configure the supported DHCP server. Also included are pointers to reference information on configuring the unsupported DHCP server. If you decide to use a third-party DHCP server, consult the configuration information in the vendor-supplied documentation.

Configuring the Supported DHCP Server

Configuring the supported (target-resident) DHCP server involves setting appropriate values for certain configuration parameters. For more information on configuring VxWorks, see the Tornado User's Guide: Customizing VxWorks AE. The relevant configuration parameters follow:

DHCPS_LEASE_HOOK -- DHCP Server Lease Storage Routine
Default: None. This constant specifies the name of the routine that handles non-volatile storage of the active leases. For more information, see Storing and Retrieving Active Network Configurations, p.106.

DHCPS_ADDRESS_HOOK -- DHCP Server Address Storage Routine
Default: None. This constant specifies the name of an optional storage routine. For more information, see Storing and Retrieving Active Network Configurations, p.106.

DHCPS_DEFAULT_LEASE -- DHCP Server Standard Lease Length
Default: 3600. This constant specifies the default lease length in seconds. This value applies if no explicit value is set in the address pool.

DHCP_MAX_HOPS -- DHCP Server/Relay Agent Network Radius
Default: 4. This value limits the number of subnets that a DHCP message can cross (prevents network flooding). The maximum valid value is 16.

DHCP_SPORT -- DHCP Server/Relay Agent Host Port
Default: 67. This value specifies the port monitored by DHCP servers.

DHCPS_CPORT -- DHCP Server/Relay Agent Target Port
Default: 68. This value specifies the port monitored by DHCP clients.

DHCPS_MAX_MSGSIZE -- DHCP Server/Relay Agent Maximum Message Size
Maximum size (in bytes) for a DHCP message. Default: 590.
The default value is the minimum DHCP message in an Ethernet frame.

Configuring the Lease Table in the Supported DHCP Server

To determine its initial configuration data, the supported DHCP server uses the dhcpsLeaseTbl[ ] defined in target/config/comps/src/net/usrNetDhcpsCfg.c. This table describes the server's pool of network configuration parameter sets. It has the following format:

DHCPS_LEASE_DESC dhcpsLeaseTbl [] = 
    {
    /* {"Name", "Start IP", "End IP", "parameters"} */

    {"dflt", NULL, NULL, DHCPS_DEFAULT_ENTRY},

    /* Sample database entries. */

/*  {"ent1", "90.11.42.24", "90.11.42.24", 
     "clid=\"1:0x08003D21FE90\":maxl=90:dfl l=60"},   */

/*  {"ent2", "90.11.42.25", "90.11.42.26", 
     "snmk=255.255.255.0:maxl=90:dfll=70:file=/vxWorks"},*/

/*  {"ent3", "90.11.42.27", "90.11.42.27", 
     "maxl=0xffffffff:file=/vxWorks"}, */

/*  {"entry4", "90.11.42.28", "90.11.42.29", 
     "albp=true:file=/vxWorks"} */

    };

Each entry in this lease table must include a unique entry name of up to eight characters and an IP address range for assignment to requesting clients. The parameters field contains a colon-separated list of optional parameters for inclusion in the DHCP server's response. If subnetting is in effect, a critical entry in the parameters field is the subnet mask (snmk). The server does not issue addresses to clients that would change their current subnet. The address pool must specify a correct subnet mask if the default class-based mask is not valid.

A complete description of the parameters field is found in the manual pages for the DHCP server. Any parameters not specified take default values according to the Host Requirements Documents (RFC 1122 and 1123). The server can also read additional entries from an optional storage hook (Storing and Retrieving Active Network Configurations, p.106). The most commonly used lease table parameters are:

clid
Indicates that this is a manual lease. Such a lease is issued only to the client with the matching type:id pair. The address range for these entries must specify a single IP address. The sample shown for "ent1" uses the hardware address that the supported DHCP client uses for an identifier.

maxl
Indicates that this lease is dynamic. This parameter specifies the maximum lease duration granted to any requesting client. The automatic lease illustrated in the third sample entry is implied by the assignment of an infinite value for maxl.

albp
Indicates a special type of automatic lease. Setting the albp parameter to true in the fourth entry marks this lease as suitable for BOOTP clients that contact this DHCP server.

siad
Specifies the (boot) server Internet address, the IP address of the boot host.

Of the parameters shown above, the first three, clid, max1, and albp, indicate lease types. The server uses the lease type to select one of the three supported mechanisms for IP address allocation. With manual allocation, DHCP simply conveys the related manual lease to the client. If dynamic allocation is used, the protocol assigns one of the dynamic leases to the client for a finite period. Automatic allocation assigns a permanent IP address from the corresponding automatic leases.

Dynamic allocation is the only method that allows reuse of addresses. The allocation type defines the priority for assigning an IP address to a DHCP client. Manual allocations have the highest priority, and automatic allocations the lowest. Among automatic leases, the preferred configurations are those available only to DHCP clients.

Configuring the Relay Agent Table in the Supported DHCP Server

If the DHCP server expects messages from relay agents, you must list those agents (identified by IP address and subnet number) in the dhcpsRelayTbl[ ]. This table acts as an authorization list. If messages arrive from relay agents not listed in the table, the messages are ignored.

DHCPS_RELAY_DESC dhcpsRelayTbl [] = 
{
/*
IP address of agent Subnet Number
-------------------- -------------
*/
/* {"90.11.42.254", "90.11.42.0"}, */
};

Adding Entries to the Database of a Running DHCP Server

After the server has started, use the following routine to add new entries to the lease database:

STATUS dhcpsLeaseEntryAdd 
    (
    char *      pName,        /* Name of lease entry */
    char *      pStartIp,     /* First IP address to assign */
    char *      pEndIp,       /* Last IP address in assignment range */
    char *      pParams       /* Formatted string of lease parameters */
    )

As input, dhcpsLeaseEntryAdd( ) expects to receive an entry name, starting and ending IP addresses for assignment to clients, and a formatted string containing lease parameters. If the entry is added successfully, the routine returns OK or ERROR otherwise. This routine allows the expansion of the address pool without rebuilding the image whenever new entries are needed. If you provide an appropriate storage hook, these entries are preserved across server restarts.

Storing and Retrieving Active Network Configurations

To store and retrieve network configuration information, you need to implement an address storage routine and a lease storage routine. The lease storage routine uses the prototype:

STATUS dhcpsLeaseStorageHook 
(
int    op, /* requested storage operation */
char * pBuffer, /* memory location for record of active lease */
int    dataLen /* amount of lease record data */
)


*      
CAUTION: Not providing the storage routine could cause DHCP to fail.

Your lease storage routine must store and retrieve active network configurations. To install the routine you created, set DHCPS_LEASE_HOOK (a configuration parameter) to a string containing the routine name. The address storage routine uses the following prototype:

STATUS dhcpsAddressStorageHook 
(
int op, /* requested storage operation */
char * pName, /* name of address pool entry */
char * pStartIp, /* first IP address in range */
char * pEndIp, /* last IP address in range */
char * pParams /* lease parameters for each address */
)

Your address storage routine (optional) stores and retrieves additional address-pool entries created using dhcpsLeaseEntryAdd( ). To preserve these entries, set DHCPS_ADDRESS_HOOK (a configuration parameter) to the name of your storage routine. If you don't do this, any active leases using alternate entries are not renewed when the server is restarted.

The op parameters of both storage routines expect one of the following values:2

DHCPS_STORAGE_START

DHCPS_STORAGE_STOP

DHCPS_STORAGE_WRITE




DHCPS_STORAGE_READ


DHCPS_STORAGE_CLEAR


*      
NOTE: Under VxWorks AE, all code you want to include in a target requires a component description file. This is true also for the code you write for your storage hooks. A .cdf file for an address storage hook would look as follows:
/* 00comp_dhcpstest.cdf - Component configuration file */ 
/* Copyright 1984 - 2000 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,18jul00,spm written
*/

Component INCLUDE_DHCPS_STORE
{
NAME DHCP dynamic address pool hook
SYNOPSIS Provides permanent storage for potential DHCP leases
MODULES dhcpsTestHook.o
PREF_DOMAIN KERNEL
}

Module dhcpsTestHook.o {
ENTRY_POINTS sampleAddressStorageHook
}

EntryPoint sampleAddressStorageHook {
SYNOPSIS Dummy routine for displaying storage operations
}

Configuring the Unsupported DHCP Server

The files in target/unsupported/dhcp-1.3beta/server contain a port of a public domain server available from the WIDE project. This port modifies the original code so that it supports Solaris as well as SunOS.

Unlike the supported VxWorks DHCP server, the unsupported server uses files to store the databases that track the IP addresses and the other configuration parameters that it distributes.

You can specify the names of these files in the dhcps command that you use to start the DHCP server. If you do not specify the configuration files by name, the server uses the following defaults: /etc/dhcpdb.pool, and /etc/dhcpdb.bind (or /var/db/dhcpdb.bind for BSD/OS). If the server supports a relay agent, it also maintains an extra database with the default name of /etc/dhcpdb.relay. The server also creates other files as needed in the /etc directory, but you do not need to edit these files to configure the server.

For the specifics of how you should edit these files, see the DHCPS(5), DHCPDB.POOL(5), and DHCPDB.RELAY(5) man pages included with the source code for the unsupported DHCP server.

5.3.4   Configuring the Supported DHCP Relay Agent

To include the VxWorks DHCP relay agent in an image, use the INCLUDE_DHCPR configuration parameter. The relay agent uses some of the same configuration parameters as the DHCP server:

DHCP_MAX_HOPS -- DHCP Server/Relay Agent Network Radius

DHCPS_SPORT--DHCP Server/Relay Agent Host Port

DHCPS_CPORT--DHCP Server/Relay Agent Target Port

DHCPS_MAX_MSGSIZE--DHCP Server/Relay Agent Maximum Message Size

To find other DHCP relay agents or servers, the relay agent reads the dhcpTargetTbl[ ] table defined in usrNetDhcprCfg.c. This table is of the form:

DHCP_TARGET_DESC dhcpTargetTbl [] = 
    {
    /*
     IP address of DHCP target servers
     ---------------------------------
     */
     /* {"90.11.42.2"}, */
     };

Each entry in the table must specify a valid IP address for a DHCP server on a different subnet than the relay agent. The relay agent transmits a copy of all DHCP messages sent by clients to each of the specified addresses. The agent does not set the IP routing tables so that the specified target addresses are reachable.

The relay agent forwards DHCP client messages through only a limited number of targets: the DHCP Server/Relay Agent Network Radius. When the configured value is exceeded, the message is silently discarded. This value is increased only when a DHCP agent forwards the message. It is completely independent of the similar value used by IP routers. RFC 1542 specifies the maximum value of 16 for this constant. The default hops value is four.

Beyond providing the list of target addresses, and optionally changing the maximum number of hops permitted, no further action is necessary. The DHCP relay agent executes automatically whenever it is included in the image.

5.3.5   DHCP within an Application

The target-resident DHCP client can retrieve multiple sets of configuration information. These retrieval requests can execute either synchronously or asynchronously. In addition, the retrieved network configuration information can be applied directly to the underlying network interface or used for some other purpose. The following example demonstrates the asynchronous execution of a DHCP request for a lease with a 30-minute duration in which the retrieved configuration parameters are applied to the network interface used to contact the DHCP server.3

    pIf = ifunit ("net0");     /* Access network device. */ 

/* Initialize lease variables for automatic configuration. */

pLeaseCookie = dhcpcInit (pIf, TRUE);
if (pLeaseCookie == NULL)
return (ERROR);

/* Set any lease options here. */

dhcpcOptionAdd (pLeaseCookie, _DHCP_LEASE_TIME_TAG, 4, 1800);

result = dhcpcBind (pLeaseCookie, FALSE); /* Asynchronous execution. */
if (result != OK)
return (ERROR);

In the code above, the dhcpcInit( ) call used a value of TRUE for the autoconfig parameter. This automatically includes a request for a subnet mask and broadcast address in the cookie (pLeaseCookie). To request additional options for this lease the code makes a call to dhcpcOptionSet( ). Because the DHCP protocol requires that all requested parameters be specified before a lease is established, both the dhcpcOptionSet( ) and dhcpcOptionAdd( ) calls must precede the asynchronous dhcpcBind( ) call that establishes the lease.

Although it is omitted from the example, you can use a dhcpcLeaseHookAdd( ) call to associate a lease event hook routine with this lease. That way, you can note the DHCPC_LEASE_NEW event that occurs when the asynchronous dhcpcBind( ) completes its negotiations with the DHCP server.

To query the local DHCP client for a parameter value from the lease information it has retrieved, call dhcpcOptionGet( ). This routine checks whether the lease associated with a particular lease cookie is valid and whether the server provided the requested parameter. If so, dhcpcOptionGet( ) copies the parameter value into a buffer. Otherwise, it returns ERROR. A call to dhcpcOptionGet( ) generates no network traffic; it queries the local DHCP client for the information it needs. The following sample demonstrates the use of this routine:

inet_addr webServer; 
STATUS result;
int lenght=4;
...
result = dhcpcOptionGet (pLeaseCookie, _DHCP_DFLT_WWW_SERVER_TAG,
&length, &webServer);
if (result == OK)
    printf("Primary web server: %s", inet_ntoa (webServer));
...


*      
NOTE: To check on configuration parameters associated with a lease established at boot time, use the pDhcpcBootCookie global variable as the lease cookie in a call to dhcpcOptionGet( ).

In addition to dhcpcOptionGet( ), you can use dhcpcParamsGet( ) to retrieve multiple lease parameter values simultaneously. The DHCP client library also provides other routines that you can use to get the values of particular parameters (such as the lease timers) without supplying their option tags.

For more information on DHCP client features, see the dhcpcLib manual pages.


*      
NOTE: If you already have an IP address and do not want another but want to query the server for any other information it has for you, call dhcpInformGet( ).



5.4    Boot Parameters for DHCP, BOOTP, and Network Initialization

Before the boot program can use a DHCP or BOOTP client to retrieve additional boot parameters from a remote server, the boot program needs appropriate values for bootDev, unitNum, procNum, and flags. See Table 5-1. Because the boot program does not yet have network access, the target must be able to find these parameter values in the default boot line, a user-provided boot line, or NVRAM boot line.4

Table 5-1 :   Boot Parameters Needed for DHCP, BOOTP, and Network Device Initialization   


Parameter Name from
BOOT_PARAMS
Parameter Name from p Command Listing
(followed by description)

bootDev
boot device
Contains the name of the network device from which to boot. For example, ln specifies the Lance driver. Which device you specify determines the physical medium over which the boot program attempts a networked boot. To add support for another medium, write a MUX-based driver for the new network and include the driver in your boot program. For more information on writing a driver that uses the MUX interface, see the 10. Integrating a New Network Interface Driver.
unitNum
unit number
Contains the unit number for the network device. In boot prompts that reference the network device, the target appends this to the bootDev. For example, if you see an "ln0", the "ln" refers to the Lance driver, and the "0" is the network device unit number. If you do not specify a unit number, the boot program defaults to using 0.
procNum
processor number
Contains the backplane processor number of the target CPU. This value is critical to the shared-memory network. The shared memory master must be processor number zero.
flags
flags (f)
Contains a value composed of flags (ORed in values) that configure the boot process. The predefined significance of each bit is as follows:
0x01
Disables system controller for processor 0 (not supported on all boards).
0x02
Loads the local symbols as well as the global symbols into the target-based symbol table. This has consequences for tools such as the target shell. If the target-based symbol contains local variables, the target shell has access to both locally and globally declared symbols. Setting this bit means you must also reconfigure VxWorks to include a downloaded symbol table. The relevant configuration parameter is INCLUDE_NET_SYM_TBL. The VxWorks startup code assumes that the file containing the symbol table is resident on the same host as the boot image. The VxWorks startup code also assumes that the name of the symbol table file is the boot file name with an appended .sym suffix. When reading the .sym file, the VxWorks image has the option of loading local symbols as well as global symbols into its target-resident symbol table.
0x04
Prevents autoboot.
0x08
Enables quick autoboot (no countdown).
0x20
Disables login security.
0x40
Specifies automatic configuration using BOOTP or DHCP. VxWorks tries first to use a DHCP client. If the boot ROM does not include the DHCP client, then the target uses the BOOTP client to retrieve information. When the 0x40 flag is set, e or ead (inet on ethernet) should be blank.
0x80
Tells the target to use TFTP to get VxWorks image. Otherwise, the target uses either RSH or FTP. The target uses FTP if you enter a non-empty value for the passwd parameter. Otherwise, the target uses RSH.
0x100
Makes target register as a Proxy ARP client.

5.4.1   Boot Parameters Returned from DHCP or BOOTP

If the 0x40 bit in the flags parameter is set, the boot program uses either DHCP or BOOTP client to retrieve the following parameters: ead (from which the boot program also derives a value for bad), had, gad, and bootFile.5 See Table 5-2.

Table 5-2 :   Boot Parameters Returned from DHCP or BOOTP   


Parameter Name from
BOOT_PARAMS
Parameter Name from p Command Listing
(followed by description)

ead
inet on ethernet (e)
This value is the unique Internet address of this target on the Ethernet or, if you are booting from SLIP, the local end of a SLIP connection. You can also specify a subnet mask (as described in 4.5.2 Assigning an IP Address and Network Mask to an Interface, p.61). If no mask is specified, the standard mask for the address class will be used. If ead is empty, the target does not attach the Ethernet interface. This is acceptable if the target is booting over the backplane.
bad
inet on backplane (b)
Actually, neither BOOTP nor DHCP supply this value directly, the backplane Internet address. If this parameter contains a non-empty value, the target attaches the backplane interface. Typically, the boot program uses sequential and proxy default addressing conventions to derive a bad value from the ead parameter (which BOOTP can provide) and the CPU number. However, the use of sequential addressing makes booting from the shared-memory backplane incompatible with DHCP. This parameter should be empty if no shared-memory network is required. To specify a subnet mask for bad, see 4.5.2 Assigning an IP Address and Network Mask to an Interface, p.61).
had
host inet (h)
The Internet address of the host from which to retrieve the boot file.
gad
gateway inet (g)
The Internet address of the gateway through which to boot if the host is not on the same network as the target. If gad has a non-empty value, a routing entry is added indicating that the address is a gateway to the network of the specified boot host. NOTE: do not use this field to enter the default gateway (the router's address) if the host and the target are on the same subnet. Instead, use routeAdd( ) in your application startup code or startup script.
bootFile
file name
The full path name of the file containing the VxWorks run-time image.

  


*      
WARNING: If you decide to change the subnet mask for the target's address (ead), you must be careful to call the appropriate functions in the correct order:
  1. ifRouteDelete( ) - to delete the existing network route for the device
  1. ifMaskSet( ) - to enter a new mask
  1. ifAddrSet( ) - to set the IP address, whereupon the new network route is created

Failing to call these functions in the correct order results in a misconfigured route table.




5.5    SNMP, Simple Network Management Protocol

The Simple Network Management Protocol (SNMP) lets you use a Network Management Station (NMS) to remotely configure, monitor, and manage any networked device that runs an SNMP agent. The SNMP protocol is based on an exchange of messages that set or get the value of variables in the agent's Management Information Base (MIB). Standard MIBs exist for well known protocols and network devices. By adding variables to an agent's MIB, you can accommodate new network devices and protocols as necessary.

SNMP is a Separately Purchasable Option

The VxWorks stack does not bundle in SNMP support. If you need SNMP, purchase one of the following options:

  • Envoy SNMP Source Code

This option provides a complete SNMP v1/v2c solution. You have the option of enhancing Envoy with Envoy+3 and Envoy+X.

  • Envoy+3

This option provides SNMP v3 functionality. SNMP v3 enhances the security of the management protocol through the addition of encryption and authentication. SNMPv3 uses industry-standard protocols such as MD5 (Message Digest 5), SHA (Secure Hash Algorithm), and DES (Data Encryption Standard) to secure the communications channel. Envoy's SNMP v3 implementation also provides support for the Target and Notify MIBs.

  • Envoy+X

This option provides AgentX functionality for implementing SNMP master agent/subagent systems. AgentX lets users create dynamically extensible SNMP agents. AgentX master agents communicate directly with network management stations. Subagents dynamically register with a master agent. Such functionality allows developers to design a modularly extensible system, such as a multi-blade switching chassis, that can be managed as a single device.

  • WindNet SNMP

This option provides a binary version of the Envoy portable source code product.

For more information, see the Envoy Programmer's Guide and the Envoy Porting Guide.


1:  For the complete BOOTP protocol specification, see RFC 951 "Bootstrap Protocol (BOOTP)," RFC 1542 "Clarifications and Extensions for BOOTP," and RFC 1048 "BOOTP Vendor Information Extensions."

2:  These symbolic constants are defined in dhcpsLib.h.

3:  The limit on the number of concurrent leases is the "DHCP Client Maximum Leases" value set during configuration (Configuration parameter: DHCPC_MAX_LEASES). When setting this value, remember to count the lease (if any) that the client retrieved at boot time.

4:  If the target has NVRAM, and the user specified these parameters in a previous boot session, the boot program knows to save these parameters to an NVRAM boot line for the use of the next boot session.

5:  If you accidentally include both a DHCP and BOOTP client in a boot program, the program uses the DHCP client. If neither is present and 0x40 is set, booting fails.