Skip to content

Commit

Permalink
Move getting ifconfig_pool_remote_ip from client-connect to get_user_…
Browse files Browse the repository at this point in the history
…env() and add ifconfig_ipv6_remote support
  • Loading branch information
ValdikSS committed Nov 22, 2015
1 parent b8ac5f0 commit 8133021
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions radiusplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,6 @@ extern "C"
else
delete(tmpuser);

//set the assigned ip as Framed-IP-Attribute of the user (see RFC2866, chapter 4.1 for more information)
if (get_env ( "ifconfig_pool_remote_ip", envp ) !=NULL)
{
newuser->setFramedIp ( string ( get_env ( "ifconfig_pool_remote_ip", envp ) ) );
}
if ( DEBUG ( context->getVerbosity() ) )
cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND: Set FramedIP to the IP (" << newuser->getFramedIp() << ") OpenVPN assigned to the user " << newuser->getUsername() << "\n";
//the user must be there and must be authenticated but not accounted
Expand Down Expand Up @@ -1239,6 +1234,17 @@ void get_user_env(PluginContext * context,const int type,const char * envp[], Us
user->setCallingStationId ( untrusted_ip );
//for OpenVPN option client cert not required, common_name is "UNDEF", see status.log

//set the assigned ip as Framed-IP-Attribute of the user (see RFC2866, chapter 4.1 for more information)
if (get_env ( "ifconfig_pool_remote_ip", envp ) !=NULL)
{
user->setFramedIp ( string ( get_env ( "ifconfig_pool_remote_ip", envp ) ) );
}

if (get_env ( "ifconfig_ipv6_remote", envp ) !=NULL)
{
user->setFramedIp6 ( string ( get_env ( "ifconfig_ipv6_remote", envp ) ) );
}

user->setUntrustedPort ( get_env ( "untrusted_port", envp ) );

if (untrusted_ip.find(":") == untrusted_ip.npos)
Expand Down

0 comments on commit 8133021

Please sign in to comment.