Good day.
First all, thank you for viewing this thread.
Currently, I am porting my codes from Solaris 10 to RHEL 4 AS.
But, I am having trouble when it comes to creating "IPv6" virtual interfaces in the RHEL environment.
In Solaris, I was able to successfully create IPv4/IPv6 virtual interfaces by using the ioctl() in the following order.
1. ioctl (cli_LIFsd,
SIOCLIFADDIF, &stLIF); // Creating a logical interface
2. ioctl (cli_LIFsd,
SIOCSLIFADDR, &stLIF); // Defines the IP address of the new interface.
3. ioctl (cli_LIFsd,
SIOCSLIFNETMASK, &stLIF); // Defines the netmask of the new interface
4. ioctl(cli_LIFsd,
SIOCSLIFFLAGS, &stLIF); // Sets the new logical interface UP
I have inserted my RHEL test snippet below. Using the ioctl() SIOCSIFADDR request I was able to create an IPv4 virtual interface via AF_INET. But, was unsuccessful when creating an IPv6 via AF_INET6.
I can't even create a logical interface in IPv6. Kindly see the test snippet below.
# uname -a
Linux harrier 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
========================== RHEL Test Snippet ==========================
int cli_LIFsd;
struct ifreq stLIF;
struct sockaddr_in6 *stSockAddr6;
int rtnval;
/* create a stream-type socket in the Internet domain */
cli_LIFsd = socket(AF_INET6, SOCK_STREAM, 0);
/****** Creating a logical interface ******/
memset (&stLIF, 0x00, sizeof (struct ifreq));
strncpy( stLIF.ifr_name, argv[3], sizeof( stLIF.ifr_name ));
stLIF.ifr_addr.sa_family = AF_INET6;
stSockAddr6 = (struct sockaddr_in6 *)&(stLIF.ifr_addr);
inet_pton(AF_INET6, argv[1], &(stSockAddr6->sin6_addr));
rtnval = ioctl (cli_LIFsd, SIOCSIFADDR, &stLIF);
if (rtnval < 0)
{
perror("Perror message " );
printf ("Errno: %s [%d] \n", strerror( errno ), errno );
close (cli_LIFsd);
exit (1);
}
============================== Output ==============================
[root]# ./cli 2008:77:77::77 8888 eth0:777
Perror message : No such device
Errno: Illegal seek [29]
Added Questions:
1. Are there no problems when creating IPv6 virtual interfaces in RHEL?
Bugs.. maybe? need .. patch?
2. What are the RHEL ioctl requests (Ex. SIOCSIFADDR, etc.) needed to successfuly create an IPv6 virtual interface?
I am open to suggestions or you could point me to a site that would be very relevant.
Thank you very much.