What is the proper way to find which interface an IP routes through? (PHP)
-
As a part of a rewrite I'm working on for a certain part of filter.inc, it needs to know which interface would be used for connections to a given IP address outside of the router. Is there already a defined function or other existing way of doing it? Preferably the result should match with what the base system would decide, including if there are any additional routes that should be considered.
This work is on 2.0, so anything available in the latest code is fair game here.
update:
Actually, just finding which interface it is accessed through, of the networks directly accessible, probably would be fine.
-
The function guess_interface_from_ip seems to be what I was looking for.