• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Any way to force traffic to a specific network interface?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to force traffic to a specific network interface?


  • Subject: Re: Any way to force traffic to a specific network interface?
  • From: Josh Graessley <email@hidden>
  • Date: Wed, 08 Apr 2009 17:01:25 -0700


On Apr 8, 2009, at 4:40 PM, Jamie Wood wrote:

Hello,

My system has a wireless interface and an ethernet interface. The ethernet interface is the primary interface, so the default route goes through the ethernet interface. I have an 802.1x supplicant that replaces the native (Airport) supplicant. After authenticating via a wireless access point, I get a new IP address from some DHCP server on the network that the access point is on. 

At this point my code creates a socket and binds it to the wireless interface. When the code uses connect() to open a connection to a server, the traffic is routed through the ethernet interface because it follows the default route. The server rejects the connection because it is expecting traffic from the interface that I bound to (the wireless interface), and my default route is over the ethernet.
 
When I do the same thing on Windows the operating system dynamically adds a route to the server over the wireless interface and my communication with the server proceeds over that interface. Likewise if I manually add a route on Mac OS X that routes traffic to the server over the wireless interface, everything works fine. Is there some way to configure the network stack to do this dynamic routing? I also tried setting the SO_DONTROUTE socket option but that doesn’t seem to work.

At this point, I see two options:
1. Once I have a valid IP address on the wireless interface, temporarily make the wireless interface the default using the SystemConfiguration API.
2. Programatically add a specific route to the server, with the wireless interface as the gateway. Of course, my code then has to make sure to clean up this route when it is finished, etc.

Are there any other approaches that are better?

If one has access to a certain pre-release build of an OS, one may be inclined to try it and see what happens though the results would have to remain off this list.

-josh

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Any way to force traffic to a specific network interface? (From: Jamie Wood <email@hidden>)

  • Prev by Date: Any way to force traffic to a specific network interface?
  • Next by Date: hi
  • Previous by thread: Any way to force traffic to a specific network interface?
  • Next by thread: hi
  • Index(es):
    • Date
    • Thread