query whether IP address is bound?
Felipe Gasper <felipe-c4PQK5fb7feI/[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I’m looking for a way to query whether the (Linux) kernel has a specific IP address bound. Forking is not an option. I’d like to avoid directly enumerating every IP address on the machine, which appears to be the only way that RtNetlink facilitates this. (I’d love to be contradicted on that!) Normally we’d use bind() and check for EADDRNOTAVAIL or EADDRINUSE, but if /proc/sys/net/ipv4/ip_nonlocal_bind is turned on, then bind() will succeed where we want it to fail. There is a socket option (IP_FREEBIND) for setting ip_nonlocal_bind per individual socket, but it only appears to _enable_ the behaviour; i.e., if the /proc flag is on, then disabling this socket option appears to have no effect. Does the usual suite of D-Bus interfaces on a Linux machine have any function that checks this? I’m looking through NetworkManager but only see logic for listing the addresses. Or do folks here have any other ideas for how I might approach this? Thank you! -Felipe Gasper Mississauga, Ontario _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus