Andrew Gallatin wrote:
Hi,

I'm porting a IP offload software package from Linux to {Open,}Solaris.
I need to determine if a local IP address belongs to one of our
NICs for the purpose of offloading a connection. This happens
in a library, and should not require root access.

On Linux, this boils down to calling getifaddrs() to find the
interface name that matches the sockaddr's IP. Then we use
use ioctl(..SIOCGIFHWADDR) to get that interface's HW address and match
it against a list of valid MAC addresses (obtained from private ioctl
to our driver).

As I recall, SIOCGIFHWADDR does not work in {Open,}Solaris, and
the workarounds (dlpi/streams) are very ugly and require root
access. Is this recollection correct?

If yes, is there anything I can do from inside a driver to convert
from IP address to MAC address?

For Solaris 9 and earlier, yes, you need to dlpi.

There's probably libdlpi or mac function to get this information as well, but I think that probably requires root privilege too.

What you *might* be able to do that doesn't require root privilege is to look in the arp table. (See "arp -an"). Then you could look for your adapter's phys addr (or even interface) and match its IP address that way.

- Garrett

Thanks,

Drew
_______________________________________________
networking-discuss mailing list
[email protected]

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to