[SOLVED]Network adapter data

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
jpl
Posts: 7
Joined: Mon Jan 25, 2021 11:08 am

[SOLVED]Network adapter data

Post by jpl » Tue Feb 16, 2021 10:48 am

Hi,

I would like to know where the data about the network adapters is obtained, that is, when executing the BridgeDeviceList command, an id that represents the adapter is shown, where does it come from?

Is there any way to use the BridgeCreate command using the actual name of the network adapter? (BridgeCreate hubname /DEVICE:X)
Last edited by jpl on Thu Apr 08, 2021 8:58 am, edited 1 time in total.

rashawn
Posts: 1
Joined: Wed Feb 17, 2021 7:47 am

Re: Network adapter data

Post by rashawn » Wed Feb 17, 2021 7:54 am

This procedure can't identify the adapter if there's no driver installed. If you need the latest driver, choose your Windows version from the Drivers and Software list. These downloads cover most Intel® Ethernet Adapters and install the latest drivers when you run them. 2 player games

jpl
Posts: 7
Joined: Mon Jan 25, 2021 11:08 am

Re: Network adapter data

Post by jpl » Wed Feb 17, 2021 8:15 am

Firstly thanks for repliying!
I have installed a Microsoft KM-TEST Loopback Adapter and I have the latest drivers updated, however when i try to create a Local Bridge using BridgeCreate command in vpncmd I can´t identify the network adapter with the name I have assigned in the control panel of windows. The real name of the network adapter is ETH0 but when i execute BridgeDeviceList to check the name that SoftEther uses to identify it, it is shown as "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)", so i wanted to know where does this name come from.

hjyuk
Posts: 4
Joined: Wed Feb 17, 2021 10:49 pm

Re: Network adapter data

Post by hjyuk » Wed Feb 17, 2021 11:03 pm

If you need the latest driver, choose your Windows version from the Drivers and Software list. 192.168.100.1 192.168.1.1
Last edited by hjyuk on Thu Feb 18, 2021 6:48 pm, edited 1 time in total.

jpl
Posts: 7
Joined: Mon Jan 25, 2021 11:08 am

Re: Network adapter data

Post by jpl » Thu Feb 18, 2021 6:54 am

I dont need the latest diver.
What I need is to know how SoftEther generates the name of the network adapters in windows. Exmp: "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)"

MikeL
Posts: 10
Joined: Fri Jan 05, 2018 11:51 pm

Re: Network adapter data

Post by MikeL » Sat Feb 20, 2021 10:34 pm

Are you asking how to query the system programmatically to access network adapter data? If so the following vbscript shows you how to do it.

SET WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject(_
"winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter")

For Each objItem in colItems
WScript.Echo objItem.Description
WScript.Echo objItem.NetConnectionID
Next

For a full list of properties that about the adapter you can refer to this link

https://docs.microsoft.com/en-us/window ... orkadapter

Now SoftEther is not written in vbscript but there are mechanisms in other programming languages to get the same information from Windows.

Is this the kind of information you were looking for?

Mike

solo
Posts: 59
Joined: Sun Feb 14, 2021 10:31 am

Re: Network adapter data

Post by solo » Sun Feb 21, 2021 9:46 am

jpl wrote:
Thu Feb 18, 2021 6:54 am
an id that represents the adapter is shown, where does it come from?
...
how SoftEther generates the name of the network adapters in windows. Exmp: "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)"
Here are the SoftEther steps to generate ID=x:
  1. call the "EnumEthernet" method of RPC API
  2. get GUID of Network Adapter
  3. hash it
You can generate it manually yourself:
get GUID: netsh lan show interfaces
compile this short code from SoftEther's BridgeWin32.c

Code: Select all

// Generate an ID from GUID
UINT Win32EthGenIdFromGuid(char *guid)
{
	char tmp[MAX_SIZE];
	UCHAR hash[SHA1_SIZE];
	UINT i;
	// Validate arguments
	if (guid == NULL)
	{
		return 0;
	}

	StrCpy(tmp, sizeof(tmp), guid);
	Trim(tmp);
	StrUpper(tmp);

	HashSha1(hash, tmp, StrLen(tmp));

	Copy(&i, hash, sizeof(UINT));

	i = Endian32(i);

	if (i == 0)
	{
		i = 1;
	}

	return i;
}

jpl
Posts: 7
Joined: Mon Jan 25, 2021 11:08 am

Re: Network adapter data

Post by jpl » Mon Feb 22, 2021 4:03 pm

solo wrote:
Sun Feb 21, 2021 9:46 am
jpl wrote:
Thu Feb 18, 2021 6:54 am
an id that represents the adapter is shown, where does it come from?
...
how SoftEther generates the name of the network adapters in windows. Exmp: "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)"
Here are the SoftEther steps to generate ID=x:
  1. call the "EnumEthernet" method of RPC API
  2. get GUID of Network Adapter
  3. hash it
You can generate it manually yourself:
get GUID: netsh lan show interfaces
compile this short code from SoftEther's BridgeWin32.c

Code: Select all

// Generate an ID from GUID
UINT Win32EthGenIdFromGuid(char *guid)
{
	char tmp[MAX_SIZE];
	UCHAR hash[SHA1_SIZE];
	UINT i;
	// Validate arguments
	if (guid == NULL)
	{
		return 0;
	}

	StrCpy(tmp, sizeof(tmp), guid);
	Trim(tmp);
	StrUpper(tmp);

	HashSha1(hash, tmp, StrLen(tmp));

	Copy(&i, hash, sizeof(UINT));

	i = Endian32(i);

	if (i == 0)
	{
		i = 1;
	}

	return i;
}
Thank you very much, this was what I was looking for!

Post Reply