VirtualBox

Changeset 15456 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Dec 14, 2008 10:28:37 AM (16 years ago)
Author:
vboxsync
Message:

#3282 HostNetIf API: Solaris implementaion is functional including IP V6 addresses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/solaris/NetIfList-solaris.cpp

    r15455 r15456  
    118118        RTStrPrintf(szNICDesc, sizeof(szNICDesc), "%s - Ethernet", szNICInstance);
    119119
     120    /*
     121     * Try to get IP V4 address and netmask as well as Ethernet address.
     122     */
    120123    NETIFINFO Info;
    121124    memset(&Info, 0, sizeof(Info));
     
    156159        close(Sock);
    157160    }
     161    /*
     162     * Try to get IP V6 address and netmask.
     163     */
     164    Sock = socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP);
     165    if (Sock > 0)
     166    {
     167        struct lifreq IfReq;
     168        strcpy(IfReq.lifr_name, szNICInstance);        if (ioctl(Sock, SIOCGLIFADDR, &IfReq) >= 0)
     169        {
     170            memcpy(Info.IPv6Address.au8, ((struct sockaddr_in6 *)&IfReq.lifr_addr)->sin6_addr.s6_addr,
     171                    sizeof(Info.IPv6Address.au8));
     172        }
     173        if (ioctl(Sock, SIOCGLIFNETMASK, &IfReq) >= 0)
     174        {
     175            memcpy(Info.IPv6NetMask.au8, ((struct sockaddr_in6 *)&IfReq.lifr_addr)->sin6_addr.s6_addr,
     176                    sizeof(Info.IPv6NetMask.au8));
     177        }
     178        close(Sock);
     179    }   
     180
    158181    /*
    159182     * Construct UUID with interface name and the MAC address if available.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette