rtrequest_gr Kernel Service

Purpose

Carries out a request to change the routing table.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/mbuf.h>
#include <net/if.h>
#include <net/af.h>
#include <net/route.h>

int rtrequest_gr ( req,  dst,  gateway,  netmask,  flags,  ret_nrt, rt_parm)
int req;
struct sockaddr *dst, *
gateway
, *netmask;
int flags;
struct rtentry **
ret_nrt;
struct rtreq_parm *
rt_parm;

Parameters

Item Description
req Specifies a request to add or delete a route.
dst Specifies the destination part of the route.
gateway Specifies the gateway part of the route.
netmask Specifies the network mask to apply to the route.
flags Identifies routing flags, as defined in the /usr/include/net/route.h file.
ret_nrt Specifies to return the resultant route.
rt_parm Points to the rtreq_parm structure. The /usr/include/net/radix.h file contains the rtreq_parm structure. Through this structure, the route attributes like group list, policy, weight, WPAR ID, interface can be specified.

Description

The rtrequest_gr kernel service carries out a request to change the routing table. Interfaces call the rtrequest_gr service at boot time to make their local routes known for routing table ioctl operations. Interfaces also call the rtrequest_gr service as the result of routing redirects. The request is either to add (if the req parameter has a value of RMT_ADD) or delete (the req parameter is a value of RMT_DELETE) the route.

Execution Environment

The rtrequest_gr kernel service can be called from either the process or interrupt environment.

Return Values

Item Description
0 Indicates a successful operation.
ESRCH Indicates that the route was not there to delete.
EEXIST Indicates that the entry the rtrequest_gr service tried to add already exists.
ENETUNREACH Indicates that the rtrequest_gr service cannot find the interface for the route.
ENOBUFS Indicates that the rtrequest_gr service cannot get an mbuf structure to add an entry.

Example

To carry out a request to change the routing table, invoke the rtrequest_gr kernel service as follows:

rtrequest_gr(RTM_ADD, dst, gateway, netmask, flags, &rtp, &rtreq);