Simple question on ip address monitoring

Manthei, Mark Manthei_Mark at shure.com
Fri Jun 15 11:05:17 EDT 2012


I have a simple use case but I still haven't found how to accomplish this:

I want to loop through all known interface cards and collect information.
I have figured out how to get basic info (interface name, MAC address) but I am unable to get the IP address.

I thought the following would obtain the IP but appears to get the MAC address:

                     // now do ip address stuff with address cache
                        struct rtnl_link *pAddrLink = rtnl_link_get( pLinkCache, idx );
                        if(pAddrLink)
                        {
                           addr = rtnl_link_get_addr(pAddrLink);
                           int addressguess = nl_addr_guess_family(addr);
                           std::cout << "addr2 guess: " << addressguess << std::endl;



                           nl_addr2str( addr,  buf,  128 );
                           std::cout << " ipaddress: " << buf << std::endl;
                        }


Is there an example I'm missing that might shed some light on how to accomplish this?

Thanks

------------------------------------------------------------

This e-mail message (including any attachments) contains confidential, non-public information. It also may be protected by the attorney/client or other applicable privileges. It is intended to be communicated only to the designated recipient(s). Unauthorized use, reproduction, dissemination, or communication of this message or any information contained in this message is strictly prohibited and may be unlawful. If you are not an intended recipient of this message, please notify the sender promptly by e-mail or telephone at the sender's location indicated above or contact Shure Incorporated at info at shure.com or 800-25-SHURE (800-257-4873).

------------------------------------------------------------



More information about the libnl mailing list