Static MAC address for user patch

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
slim8020
Posts: 5
Joined: Thu Aug 23, 2018 12:02 pm

Static MAC address for user patch

Post by slim8020 » Thu Aug 23, 2018 2:06 pm

Hi!
I've made a patch for SoftEtherVPN v4.27-9668-beta (Stable) 29.05.2018 windows-x86_x64

Now you can assign a static MAC address to the user, just fill the user note with it XX-XX-XX-XX-XX-XX. If user note is empty or contains text <>17 symbols length it will work as usual and generate MAC address using build in SEVPN function.

You can download it here(SEVPN_static_MAC.zip):
https://www.dropbox.com/s/rcsfj2j8ntu44 ... C.zip?dl=0

Check attched files: readme.txt and Session.c for details.

By the way, If I add a line to account.c(and account.h) with new policy like "Use User Note as MAC address", what else should I modify to make it work?
You do not have the required permissions to view the files attached to this post.

slim8020
Posts: 5
Joined: Thu Aug 23, 2018 12:02 pm

Re: Static MAC address for user patch

Post by slim8020 » Mon Sep 17, 2018 7:35 am

Unregistered users are unable to download attachments(readme.txt), so here it is:

STATIC MAC ADDRESS FOR USER PATCH(beta) 23.08.2018 by Slim8020

DISCLAIMER: Use at your own risk.

REQUIREMENTS: SoftEtherVPN v4.27-9668-beta (Stable) 29.05.2018 windows-x86_x64

DESCRIPTION:
Now you can assign a static MAC address to the user, just fill the user note with it XX-XX-XX-XX-XX-XX. If user note is empty or contains text <>17 symbols length it will work as usual and generate MAC address using build in SEVPN function.

INSTALLATION:
1. Stop SoftEther VPN Server service (Start->All Programs->SoftEther VPN Server->Configuration Tools->Services Running on this Computer);
2. Rename %program files%\SoftEther VPN Server\vpnserver_x64.exe (*) to vpnserver_x64.bak;
3. Copy patched vpnserver_x64.exe (*) to %program files%\SoftEther VPN Server\;
4. Start SoftEther VPN Server service (Start->All Programs->SoftEther VPN Server->Configuration Tools->Services Running on this Computer);

(*) - vpnserver.exe if you using x86 version.

SETTINGS:
Run SoftEther VPN Server Manager-> connect to your server-> manage your virtual hub->manage users->edit User->fill the user note with MAC XX-XX-XX-XX-XX-XX.
To avoid conflicts I recommend to set security policy:
Deny MAC Addresses Duplication = Enabled;
Maximum Number of MAC Addresses = 1;

SOURCE CODE:
If you want more details, please compare it with original source code lines №2344-2375: https://github.com/SoftEtherVPN/SoftEth ... on.c#L2344

PATCH CODE:
Session.c has modifed lines № 2344-2386:

Code: Select all

AcLock(h);
		{
			USER *u = AcGetUser(h, username);
			if (u != NULL && wcslen(u->Note) == 17)      //check User Note
			{	
				UCHAR strNote[19];
				wcstombs(strNote, u->Note, 19);
				sscanf( strNote, "%x-%x-%x-%x-%x-%x",&s->IpcMacAddress[0], &s->IpcMacAddress[1], &s->IpcMacAddress[2],&s->IpcMacAddress[3], &s->IpcMacAddress[4], &s->IpcMacAddress[5] ) ;				
			}else{

				Hash(hash, tmp, StrLen(tmp), true);

				s->IpcMacAddress[0] = 0xCA;
				s->IpcMacAddress[1] = hash[1];
				s->IpcMacAddress[2] = hash[2];
				s->IpcMacAddress[3] = hash[3];
				s->IpcMacAddress[4] = hash[4];
				s->IpcMacAddress[5] = hash[5];
			}
			ReleaseUser(u);	
			MacToStr(tmp, sizeof(tmp), s->IpcMacAddress);
			Debug("MAC Address for IPC: %s\n", tmp);
		}
		AcUnlock(h);
	}

	return s;
}

// Check whether the specified MAC address is IPC address
bool IsIpcMacAddress(UCHAR *mac)
{
	// Validate arguments
	if (mac == NULL)
	{
		return false;
	}
	//if (mac[0] == 0xCA)
	//{
		return true;
	//}
	
	//return false;

PiStAcIuS
Posts: 3
Joined: Mon Sep 17, 2018 1:09 pm

Re: Static MAC address for user patch

Post by PiStAcIuS » Wed Mar 20, 2019 7:09 am

God bless you!!!
I was searching for this thing for month. Thank you very much!
You´ve made my day :D

ashar2017
Posts: 1
Joined: Thu Apr 04, 2019 7:48 am

Re: Static MAC address for user patch

Post by ashar2017 » Thu Apr 04, 2019 8:29 am

Hi
first of all thanks for making patch.
i am facing issue, every time i connect the client. in server MAC address last 2 characters change and due to this my external dhcp server takes this client as new , i have attached every possible screenshot in one file.

I hope someone guide me what i am doing wrong.
i installed the archive version v4.27-9668-beta (Stable) 29.05.2018
Regards,


vpn.png
You do not have the required permissions to view the files attached to this post.

Post Reply