Operating System - HP-UX
1827810 Members
1952 Online
109969 Solutions
New Discussion

how to check interface status on HPUX by using the C program.

 
jagobbur
Occasional Advisor

how to check interface status on HPUX by using the C program.

Hi,
I am using the ioctl call with 'SIOCGIFCONF' to check the status of interface whether up/down.
Could you tell me how to use that in C.
4 REPLIES 4
Laurent Menase
Honored Contributor

Re: how to check interface status on HPUX by using the C program.

struct ifconf ifconf;
struct ifreq *ibuf;
fd = socket(AF_INET, SOCK_DGRAM, 0)
ioctl(fd, SIOCGIFNUM, &numif)

ibuf = (struct ifreq *) malloc (numif * sizeof(struct ifreq));
bzero ( ibuf, numif * sizeof( struct ifreq ));
ifconf.ifc_len = numif * sizeof(struct ifreq);
ifconf.ifc_buf = (caddr_t)ibuf;
ioctl (fd, SIOCGIFCONF, &ifconf)

Dennis Handly
Acclaimed Contributor

Re: how to check interface status on HPUX by using the C program.

Any reason you aren't continuing your questions in your other thread?
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1293065
Laurent Menase
Honored Contributor

Re: how to check interface status on HPUX by using the C program.

Dennis,
this question is to consult interface config
the other looks to be to configure vips
so for me it is better to make different questions
rick jones
Honored Contributor

Re: how to check interface status on HPUX by using the C program.

There may also be a separation of "status" between the "interface layer" which resides in the transport, and the underlying device. For the latter I suspect you would make some DLPI calls to extract status information. I don't have the call sequences handy, but assuming they are documented (it is what lanadmin does when showing the Administrative and Operational (aka desired and actual respectively) states of the physical interface.)
there is no rest for the wicked yet the virtuous have no pillows