Operating System - HP-UX
1827713 Members
2743 Online
109967 Solutions
New Discussion

Issues with libnet library api : libnet_get_hwaddr()

 
RamyaSathyaMurthy
Occasional Contributor

Issues with libnet library api : libnet_get_hwaddr()

Hi,

In our project we are porting code from windows to HP-UX (PA-RISC and ITANIUM) systems. We are using the libnet library to get the hardware(MAC) address on the local system using libnet_get_hwaddr() api.

We are getting an run time error :
libnet_get_hwaddr(): send_request(): putmsg "physaddr": Not a stream.

We are invoking the function as below:
cp = (char*)libnet_get_hwaddr(libnet);

It would be helpful if anyone who had faced the same issue help us in this regard.

Thanks,
Ramya
2 REPLIES 2
Laurent Menase
Honored Contributor

Re: Issues with libnet library api : libnet_get_hwaddr()

check error code for libnet_init()
RamyaSathyaMurthy
Occasional Contributor

Re: Issues with libnet library api : libnet_get_hwaddr()

Hi,

libnet_init is successful and i am able to retrieve the host IP address. We are coding as below:

if (libnet) {
/* prolly going to switch interface from temp to real */
libnet_destroy(libnet);
libnet = 0;
}

if (!(libnet = libnet_init(LIBNET_RAW4,
(char*)ifname,
ebuf)))
{
printf("libnet_init failed with error:%s",ebuf);
exit(1);
}

if (-1 == (srcip = libnet_get_ipaddr4(libnet))) {
fprintf(stderr, "arping: libnet_get_ipaddr4(libnet): "
"%s\n", libnet_geterror(libnet));
exit(1);
}

if (!(cp = (char*)libnet_get_hwaddr(libnet))) {
fprintf(stderr, "arping: libnet_get_hwaddr(): %s\n",
libnet_geterror(libnet));
exit(1);
}

So i thing there is no issues with the libnet_init().

Thanks,
Ramya