Re: Networks and wireless etc



Alun Jones [MSFT] wrote:
> "Eugene Gershnik" <gershnik@xxxxxxxxxxx> wrote in message
> news:uYD3juNfFHA.484@xxxxxxxxxxxxxxxxxxxxxxx
>> Alun Jones [MSFT] wrote:

Well I just made a simple test of my scenarios 1 and 2 on XP SP2. I am happy
to report that as far as I could determine we both were somewhat right and
somewhat wrong. ;-) (Disclaimer: my test may be wrong or I could do
something stupid. What follows is "as far as I could determine")

I tried various cases including the ones mentioned in my post and the end
result seems to be this:

When bind() assigns an interface that contradicts the routing table the
connect() always fails with WSAEHOSTUNREACH *regardless* of whether a good
route exist to the destination host. *No* SYN is sent on an interface
different from the one assigned by bind() and *no* SYN is sent on the bound
interface.

IOW neither my expectations nor yours were entirely correct

The only correct conslusion is what I said in one of my older posts "The way
I see it you need *both* to bind correctly and have a workable routing
table." (Of course we agree that the best thing is not to bind() at all)

That calms my worries about usability and security ("if I said use X than
use X or fail").

> Here's an article from December 2001 detailing IP routing for IPv4:
>
> http://www.microsoft.com/technet/community/columns/cableguy/cg1201.mspx
>
> The wrinkle comes in IPv6, where it acts more like you want:
>
> http://www.microsoft.com/technet/community/columns/cableguy/cg1002.mspx

These are nice articles which explain what I know pretty well i.e. how the
routing table works. What the first one doesn't mention and the second one
mentiones in a non-conclusive way (i.e. "interface assigned the source
address") is how Winsock level bind() interacts with routing.

I beleive that the following text from the second article applies both to
IPv4 and IPv6 on Winsock

"For a sending host, if the source address is specified by the sending
application, the only routes that are checked are those that apply to the
interface assigned the source address. For a sending host, if the source
address is not specified by the sending application, or for a forwarding
router, all the routes are checked"

> Note - this is one more reason why it's a bad idea to call bind()
> before calling connect().

Agreed. Still, very rarely you may want to force the client to talk only on
a given interface.

--
Eugene
http://www.gershnik.com



.



Relevant Pages

  • Re: Traffic NOT moving through the correct network interface?
    ... Kernel IP routing table ... loopback interface, but that's not part of this problem. ... Everything is done by the kernel. ... Policy based routing requires you ...
    (alt.os.linux)
  • Re: Fedora as Router - cannot get past gateway
    ... >> command so much, I am suprised any routing works at all. ... Are you using dhcp or is all config manual? ... > This is your interface to ISP? ... we all have that feeling when we can't get routing set up. ...
    (comp.os.linux.networking)
  • Re: Bind Problem - with multihomed
    ... You must add an entry to the routing table. ... See this excerpt under the "Multihoming" section from "Microsoft ... Stack Components and the TDI Interface" at ... to disjoint networks (networks that are separate from and unaware of ...
    (microsoft.public.win32.programmer.networks)
  • Re: Re[6]: mpd pppoe client problems
    ... I used to use ipfw as a firewall.. ... and natd makes too heavy cpu load. ... your interface goes up. ... How can I make those applications bind to the new ...
    (freebsd-net)
  • intervlan routing and policy routing C3750 or C 4948
    ... routing) and for some vlans i need different gateways. ... interface Vlan10 ... route-map, 2) routing table. ... the packet will be routed according to the routing table (standard IOS ...
    (comp.dcom.sys.cisco)