• 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: how to tell a socket to use a specific interface...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to tell a socket to use a specific interface...


  • Subject: Re: how to tell a socket to use a specific interface...
  • From: Justin Walker <email@hidden>
  • Date: Fri, 20 May 2005 16:29:11 -0700


On May 20, 2005, at 15:11, Philip George wrote:


On May 20, 2005, at 4:51 PM, Josh Graessley wrote:

SO_DONTROUTE probably isn't nearly as useful as you might imagine.

SO_DONTROUTE means don't go through a router. The stack will look for a network directly accessible on one of the interfaces. This requires an address in that network assigned to an interface. When SO_DONTROUTE is set, the packet won't be sent through a gateway and the stack won't check the routing table determine if there are additional locally accessible networks. Since the destination you were trying to reach is not local to either interface, both attempts fail.

Mac OS X's routing is based only on the destination address. When you don't set the SO_DONTROUTE option, the packet is sent based on the destination address. Even though you bound to an address on en0, if the route says go out interface en1 to get to the destination, that is where the stack will send the packet. Sometimes this just works. Other times, this gets tripped when ingress filtering is enabled and a router drops the packet because it has the wrong source address or the source address is a private address that needed to be translated by a NAT.


Josh -

Thanks. That's all very helpful. I wondered why SO_DONTROUTE was causing no connections to get thru. I'm looking at the Darwin source for traceroute, which has code in it for binding to a specific local interface, but when I try traceroute at the commandline, I get strange results (not so strange I guess, considering what you just wrote about OS X's routing being based on only the destination address):

DEAD INTERFACE :  en0   192.168.1.106
GOOD INTERFACE :  en1   192.168.1.154

Without seeing netmasks, it's hard to tell, but note that IP routing rules require that you *not* have addresses in the same subnet on two different interfaces. What netmask are you using? If it's something like 255.255.255.0 (or anything ending in .0), I think that is (part of) your problem.


Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
When LuteFisk is outlawed,
Only outlaws will have LuteFisk
--------

_______________________________________________
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


  • Follow-Ups:
    • Re: how to tell a socket to use a specific interface...
      • From: Philip George <email@hidden>
References: 
 >how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: "Peter Lovell" <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Josh Graessley <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)

  • Prev by Date: Re: how to tell a socket to use a specific interface...
  • Next by Date: Re: how to tell a socket to use a specific interface...
  • Previous by thread: Re: how to tell a socket to use a specific interface...
  • Next by thread: Re: how to tell a socket to use a specific interface...
  • Index(es):
    • Date
    • Thread