Use of the SIOCSVIPA or SIOCSVIPA6 ioctl command

An ioctl command, SIOCSVIPA or SIOCSVIPA6, allows an application to create or delete a dynamic VIPA on the stack where the application is running. The application can issue the IOCTL call by using the run time XL C/C++ or by using the UNIX System Services Callable Services BPX1IOC API. The application that is issuing the SIOCSVIPA or SIOCSVIPA6 ioctl command must be APF-authorized. If there is no security product, or if the security product indicates that no profile for MODDVIPA is defined, the application must be running under a user ID with superuser authority. If the profile for the MODDVIPA program is defined, the user ID must be permitted READ access to the profile even if the ID has superuser authority. Some security products indicate that there is no access available when no profile is defined. If you are not using RACF®, you might need to define the profile to use these ioctl commands. For more information, see Defining a security profile for SIOCSVIPA, SIOCSVIPA6, and MODDVIPA.

To create a new dynamic VIPA, the requested IP address must be within a subnet that is previously specified by a VIPARANGE configuration statement in the PROFILE.TCPIP data set for this stack. The SIOCSVIPA or SIOCSVIPA6 ioctl command can be used to delete any existing dynamic VIPA on the stack, except for distributed DVIPAs. A dynamic VIPA can be created by using the DVR_DEFINE option or the DVR_DEFINE_AFFINITY option. The DVR_DEFINE_AFFINITY option creates the DVIPA with affinity to the address space that created it. A connection request for a DVIPA that is created with affinity is sent to a TCP listener if the application instance that created the DVIPA issues the bind() call. If no matching listener is found, a TCP listener is selected by using the normal shareport load balancing.

The following example shows how to set up the SIOCSVIPA ioctl command for applications that are to use IPv4 addresses.
#include "ezbzdvpc.h"               /* header that contains 
                                      the structure for
                                      SIOCSVIPA ioctl
                                       and needed constants*/     
struct dvreq dv;                      /* the structure passed
                                         on the ioctl command*/  
dv.dvr_version = DVR_VER1;             /*version               */
dv.dvr_length = sizeof(struct dvreq);  /* structure length     */  
dv.dvr_option = DVR_DEFINE;            /* to define a new   
                                          dynamic VIPA.  Use 
                                          DVR_DELETE to delete
                                          a dynamic VIPA        */
dv.dvr_addr.s_addr = inet_addr(my_ipaddr);  /* where my_ipaddr is
                                                a character string
                                                in standard  
                                                dotted-decimal
                                                notation */ 
                                     

The ioctl command is then invoked as follows:

rc = ioctl(s, SIOCSVIPA, &dv);

The following example shows how to set up the SIOCSVIPA6 ioctl command with the input parameter list that supports IPv6 addresses.

#include "ezbzdvpc.h"           /* header that contains
                                    the structure for
                                    SIOCSVIPA6 ioctl
                                    and needed constants */
 struct dvreq6 dv6;              /* the structure passed on
                                    the ioctl command */
 dv6.dvr6_version = DVR_VER2;   /* version */
 dv6.dvr6_length = sizeof(struct dvreq6); /* structure length */
 dv6.dvr6_option = DVR_DEFINE;  /* to define a new dynamic
                                    VIPA.  Use DVR_DELETE to
                                    delete a dynamic VIPA. */
inet_pton(AF_INET6, my_ipv6addr, dv6.dvr6_addr6.s6_addr);
                                 /* where my_ipv6addr
                                    is a character string in 
                                    standard IPv6 address
                                    notation, representing a
                                    fully qualified IPv6 
                                    address */

The ioctl command is then invoked as follows:

rc = ioctl(s, SIOCSVIPA6, &dv6);

The SIOCSVIPA or SIOCSVIPA6 ioctl command sets nonzero errno and errnojr values to indicate error conditions. See z/OS Communications Server: IP and SNA Codes for a description of the errnojr values returned.