1

In my computer, there are two network adapters, connecting to different subnet. As below:

adapter A: 10.20.30.201 adapter B: 10.20.31.201

I want to make all outgoing data of a special process (for example Process A) through adapter A. That is I want to make adapter A as the process's default route.

I know, I can modify route table for some special destination, But what I want to do here is very different. Process A may communicate with many different IP and I don't know in advance.

Winsock2 provides LSP as a way to lay a dll in TCP/IP stack. I'm not familiar with LSP and don't know whether LSP can do what I want to do.

Can anybody give me some suggestion, Thanks.

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
xjdrew
  • 373
  • 4
  • 13
  • 1
    If you can modify Processes A and B, see [Using a specific network interface for a socket in windows](http://stackoverflow.com/questions/2065495/using-a-specific-network-interface-for-a-socket-in-windows). – ephemient Jan 31 '11 at 03:22
  • Thanks for your information. My situation is a little different. I want to know if LSP can help. I know LSP can redirect a connection, but don't know if it can choose a NIC. – xjdrew Jan 31 '11 at 07:04

1 Answers1

1

A quick background on LSP:

An application, which uses Winsock2 API, calls a combination of WSA-prefix functions, eg WSAConnect, WSASocket, WSASend, WSARecv, etc.

If an application still use old winsock functions, these functions are mapped to Winsock2 behind the scene anyway. For instances: send() is mapped to WSASend(), recv() to WSARecv(), etc

WSA-prefix functions will internally call their corresponding WSP-prefix functions provided by LSP. For instances WSASend() calls WSPSend(), WSASocket() call WSPSocket(), etc. In short, WSAWhateverFunction() will calls WSPWhateverFunction(). Their parameters/returns are also the same (Not quite, but kind of).

LSP is a dll with these WSP-prefix functions implemented, eg. modify outbound/inbound traffic, filtering, etc. However an LSP is still a userspace dll. It's as limited as other userspace programs, and has no higher privilege than its host application, eg internet browsers. It has access to same set of system functions that is available to other programs, eg. winsock etc.

Conclusion is if your program can direct out-coming traffic to specific NIC, LSP can do it too. If it can't, neither can LSP. LSP therefore is irrelevant to your problem.

neo
  • 76
  • 2