Windows Routing API: What API calls are needed to create a managed version of route.exe for Windows?

To provide the correct routes for the various vpn connections, we usually run a batch file that invokes commands similar to the following:

route add xxx.xxx.xxx.xxx mask 255.255.255.0 yyy.yyy.yyy.yyy

We have a C # application that uses the class NetworkInterfacesto listen for network events and runs this command with the command Process.

This is not ideal, and I was wondering if there is a specific set of Win32 API calls, which would mean that I can add / remove routes without going around in the console application. In word order, what API calls route.exedo this?

I think that CreateIpForwardEntrythis may be colleagues, but I'm not sure. I read about it here: http://msdn.microsoft.com/en-us/library/aa365860(VS.85).aspx

+3
source share
1 answer

No doubt IP Helper Functions are those used to implement the ROUTE command. Check GetIpForwardTable () and the documentation for the MIB_IPFORWARDROW structure, and for a sample ROUTE clone, check the IPRoute subdirectory (in the IPHelp directory) in the directory of your Microsoft Platform SDK.

+5
source

Source: https://habr.com/ru/post/1731843/


All Articles