Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-12868
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Aug 31, 2023
1 parent c1d4082 commit a17529d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/RADIUS_proxy_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,9 @@ namespace OpenWifi {
const Poco::Net::SocketAddress &RequestedAddress,
const RADIUS::RadiusPacket &P, bool &UseRADSEC,
std::string &Secret) {

bool IsV4 = RequestedAddress.family() == Poco::Net::SocketAddress::IPv4;
std::cout << __LINE__ << std::endl;

// find the realm...
auto UserName = P.UserName();
Expand All @@ -639,7 +641,9 @@ namespace OpenWifi {
}
}

std::cout << __LINE__ << std::endl;
if (DefaultIsRADSEC_) {
std::cout << __LINE__ << std::endl;
UseRADSEC = true;
return (IsV4 ? Pools_[DefaultPoolIndex_].AuthV4[0].Addr
: Pools_[DefaultPoolIndex_].AuthV6[0].Addr);
Expand All @@ -652,6 +656,7 @@ namespace OpenWifi {
RequestedAddress, Secret);
}
case radius_type::coa: {
std::cout << __LINE__ << std::endl;
return ChooseAddress(IsV4 ? Pools_[DefaultPoolIndex_].CoaV4
: Pools_[DefaultPoolIndex_].CoaV6,
RequestedAddress, Secret);
Expand Down Expand Up @@ -690,6 +695,7 @@ namespace OpenWifi {

std::cout << __LINE__ << std::endl;
if (useDefault) {
std::cout << __LINE__ << std::endl;
return DefaultRoute(rtype, RequestedAddress, P, UseRADSEC, Secret);
}

Expand Down Expand Up @@ -737,11 +743,14 @@ namespace OpenWifi {
const Poco::Net::SocketAddress &OriginalAddress,
std::string &Secret) {

std::cout << __LINE__ << std::endl;
if (Pool.size() == 1) {
std::cout << __LINE__ << std::endl;
Secret = Pool[0].secret;
return Pool[0].Addr;
}

std::cout << __LINE__ << std::endl;
if (Pool[0].strategy == "weighted") {
bool found = false;
uint64_t cur_state = std::numeric_limits<uint64_t>::max();
Expand Down Expand Up @@ -792,13 +801,16 @@ namespace OpenWifi {
return Pool[index].Addr;
} else if (Pool[0].strategy == "random") {
if (Pool.size() > 1) {
std::cout << __LINE__ << std::endl;
auto index = std::rand() % Pool.size();
Secret = Pool[index].secret;
return Pool[index].Addr;
} else {
std::cout << __LINE__ << std::endl;
return OriginalAddress;
}
}
std::cout << __LINE__ << std::endl;
return OriginalAddress;
}

Expand Down

0 comments on commit a17529d

Please sign in to comment.