• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

What is the proper way to find which interface an IP routes through? (PHP)

Scheduled Pinned Locked Moved Development
2 Posts 1 Posters 2.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    Efonnes
    last edited by Feb 3, 2010, 2:47 PM Feb 3, 2010, 12:57 PM

    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.

    1 Reply Last reply Reply Quote 0
    • E
      Efonnes
      last edited by Feb 5, 2010, 12:24 AM

      The function guess_interface_from_ip seems to be what I was looking for.

      1 Reply Last reply Reply Quote 0
      2 out of 2
      • First post
        2/2
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
        This community forum collects and processes your personal information.
        consent.not_received