- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to determine number of interfaces on HPUX in I...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2006 06:56 AM
10-10-2006 06:56 AM
How to determine number of interfaces on HPUX in IPv6
I am having some problems determining the number of interfaces on my HPUX box with IPv6 configured.
Below is my code.
#include
#include
#include
extern int errno;
int main(){
int sd,n_ifs;
#ifdef A
sd=socket(AF_INET6,SOCK_DGRAM,0);
while (ioctl(sd, SIOCGLIFNUM, &n_ifs) < 0){
#else
sd=socket(AF_INET,SOCK_DGRAM,0);
while (ioctl(sd, SIOCGIFNUM, &n_ifs) < 0){
#endif
printf("errno = %d\n",errno);
perror("ioctl failed :");
if (errno != EINTR)
exit(-1);
break;
}
printf("socket descriptor = %d\n",sd);
printf("Retrieved # of interfaces=[%d]\n",n_ifs);
close(sd);
return 0;
}
Output from the above code is :
/home/katiyar> cc hello.c
/home/katiyar> ./a.out
socket descriptor = 3
Retrieved # of interfaces=[3]
/home/katiyar> cc -DA hello.c
/home/katiyar> ./a.out
socket descriptor = 3
Retrieved # of interfaces=[2]
As you can see the number of interfaces returned is different in both the cases. Shouldn't it be same ?? .
Also is there any way by which I can retrieve both the IPv4 and IPv6 addresses using a common data structure and the information of interfaces. Below is the information of my machine.
/# lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
10/0/12/0 0x0030D30128E0 0 UP lan0 snap0 1 ETHER Yes 119
/# ifconfig lan0
lan0: flags=843
inet 9.192.185.161 netmask fffffc00 broadcast 9.192.185.255
lan0: flags=4800841
inet6 fe80::230:d3ff:fe01:28e0 prefix 10
/# ifconfig lo0
lo0: flags=849
inet 127.0.0.1 netmask ff000000
lo0: flags=849
inet6 ::1 prefix 128
/#
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2006 12:48 PM
10-10-2006 12:48 PM
Re: How to determine number of interfaces on HPUX in IPv6
Those are IIRC interfaces in the mind of network layer not necessarily in the mind of the data-link. There can be for example lan0:1, lan0:2 etc etc or even "tunnel" interfaces which would not appear in lanscan output.
There can be interfaces in lanscan which are not ifconfig'd for either IPv4 or IPv6.
To see what the actual differences are, you might expand your program to print a bit about each interface it finds, perhaps that wil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2006 04:44 PM
10-10-2006 04:44 PM
Re: How to determine number of interfaces on HPUX in IPv6
Basically what i am looking for is a way to get and print all the available IP's on the system through a common data structure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 04:34 AM
10-11-2006 04:34 AM
Re: How to determine number of interfaces on HPUX in IPv6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2006 04:52 PM
10-11-2006 04:52 PM
Re: How to determine number of interfaces on HPUX in IPv6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2006 04:07 AM
10-12-2006 04:07 AM
Re: How to determine number of interfaces on HPUX in IPv6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2006 07:11 AM
10-12-2006 07:11 AM