mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-02-11 00:00:08 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4db4b0b16 | ||
|
|
7f8dc34742 | ||
|
|
fe65f6e8dc | ||
|
|
01e05a6b0b | ||
|
|
c017621fe5 | ||
|
|
faa20d9006 | ||
|
|
9b48f3b650 | ||
|
|
a633990923 | ||
|
|
266fab991e | ||
|
|
fa98daeac9 | ||
|
|
580c8f3684 | ||
|
|
50a9e535d3 | ||
|
|
865f56794f | ||
|
|
c50ec0a6af |
@@ -60,6 +60,10 @@
|
|||||||
C97E5FEC24124B73005C2EBC /* mbedTLS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "OpenVPNAdapter::mbedTLS::Product" /* mbedTLS.framework */; };
|
C97E5FEC24124B73005C2EBC /* mbedTLS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "OpenVPNAdapter::mbedTLS::Product" /* mbedTLS.framework */; };
|
||||||
C9EABF3124110BE200D828D4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9EABF3024110BE200D828D4 /* SystemConfiguration.framework */; };
|
C9EABF3124110BE200D828D4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9EABF3024110BE200D828D4 /* SystemConfiguration.framework */; };
|
||||||
C9EABF772411215C00D828D4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9EABF642411189800D828D4 /* UIKit.framework */; platformFilter = ios; };
|
C9EABF772411215C00D828D4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9EABF642411189800D828D4 /* UIKit.framework */; platformFilter = ios; };
|
||||||
|
EDC86AE92516F50000504FFA /* OpenVPNDhcpOptionEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC86AE62516F50000504FFA /* OpenVPNDhcpOptionEntry.h */; };
|
||||||
|
EDC86AEA2516F50000504FFA /* OpenVPNDhcpOptionEntry.mm in Sources */ = {isa = PBXBuildFile; fileRef = EDC86AE72516F50000504FFA /* OpenVPNDhcpOptionEntry.mm */; };
|
||||||
|
EDC86AEB2516F50000504FFA /* OpenVPNDhcpOptionEntry+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC86AE82516F50000504FFA /* OpenVPNDhcpOptionEntry+Internal.h */; };
|
||||||
|
EDC86AF22516F52300504FFA /* OpenVPNDhcpOptionEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = EDC86AF12516F52300504FFA /* OpenVPNDhcpOptionEntry.h */; };
|
||||||
OBJ_250 /* lz4.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_16 /* lz4.c */; };
|
OBJ_250 /* lz4.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_16 /* lz4.c */; };
|
||||||
OBJ_251 /* lz4frame.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_17 /* lz4frame.c */; };
|
OBJ_251 /* lz4frame.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_17 /* lz4frame.c */; };
|
||||||
OBJ_252 /* lz4hc.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_18 /* lz4hc.c */; };
|
OBJ_252 /* lz4hc.c in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_18 /* lz4hc.c */; };
|
||||||
@@ -289,6 +293,10 @@
|
|||||||
C9EABF7424111D6100D828D4 /* OpenVPNAdapter.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OpenVPNAdapter.xcconfig; sourceTree = "<group>"; };
|
C9EABF7424111D6100D828D4 /* OpenVPNAdapter.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OpenVPNAdapter.xcconfig; sourceTree = "<group>"; };
|
||||||
C9EABF7524111E9C00D828D4 /* LZ4.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = LZ4.xcconfig; sourceTree = "<group>"; };
|
C9EABF7524111E9C00D828D4 /* LZ4.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = LZ4.xcconfig; sourceTree = "<group>"; };
|
||||||
C9EABF7624111F1600D828D4 /* mbedTLS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mbedTLS.xcconfig; sourceTree = "<group>"; };
|
C9EABF7624111F1600D828D4 /* mbedTLS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = mbedTLS.xcconfig; sourceTree = "<group>"; };
|
||||||
|
EDC86AE62516F50000504FFA /* OpenVPNDhcpOptionEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNDhcpOptionEntry.h; sourceTree = "<group>"; };
|
||||||
|
EDC86AE72516F50000504FFA /* OpenVPNDhcpOptionEntry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNDhcpOptionEntry.mm; sourceTree = "<group>"; };
|
||||||
|
EDC86AE82516F50000504FFA /* OpenVPNDhcpOptionEntry+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OpenVPNDhcpOptionEntry+Internal.h"; sourceTree = "<group>"; };
|
||||||
|
EDC86AF12516F52300504FFA /* OpenVPNDhcpOptionEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNDhcpOptionEntry.h; sourceTree = "<group>"; };
|
||||||
OBJ_100 /* debug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = debug.c; sourceTree = "<group>"; };
|
OBJ_100 /* debug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = debug.c; sourceTree = "<group>"; };
|
||||||
OBJ_101 /* des.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = des.c; sourceTree = "<group>"; };
|
OBJ_101 /* des.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = des.c; sourceTree = "<group>"; };
|
||||||
OBJ_102 /* dhm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dhm.c; sourceTree = "<group>"; };
|
OBJ_102 /* dhm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dhm.c; sourceTree = "<group>"; };
|
||||||
@@ -724,6 +732,9 @@
|
|||||||
OBJ_27 /* library */ = {
|
OBJ_27 /* library */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
EDC86AE62516F50000504FFA /* OpenVPNDhcpOptionEntry.h */,
|
||||||
|
EDC86AE72516F50000504FFA /* OpenVPNDhcpOptionEntry.mm */,
|
||||||
|
EDC86AE82516F50000504FFA /* OpenVPNDhcpOptionEntry+Internal.h */,
|
||||||
C97E5F752412300A005C2EBC /* OpenVPNAdapterEvent.h */,
|
C97E5F752412300A005C2EBC /* OpenVPNAdapterEvent.h */,
|
||||||
C97E5F7724123019005C2EBC /* OpenVPNAdapterPacketFlow.h */,
|
C97E5F7724123019005C2EBC /* OpenVPNAdapterPacketFlow.h */,
|
||||||
C97E5F7B24123036005C2EBC /* OpenVPNCompressionMode.h */,
|
C97E5F7B24123036005C2EBC /* OpenVPNCompressionMode.h */,
|
||||||
@@ -789,6 +800,7 @@
|
|||||||
OBJ_48 /* include */ = {
|
OBJ_48 /* include */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
EDC86AF12516F52300504FFA /* OpenVPNDhcpOptionEntry.h */,
|
||||||
OBJ_49 /* OpenVPNCompressionMode.h */,
|
OBJ_49 /* OpenVPNCompressionMode.h */,
|
||||||
OBJ_50 /* OpenVPNKeyType.h */,
|
OBJ_50 /* OpenVPNKeyType.h */,
|
||||||
OBJ_51 /* OpenVPNAdapterEvent.h */,
|
OBJ_51 /* OpenVPNAdapterEvent.h */,
|
||||||
@@ -996,6 +1008,7 @@
|
|||||||
C97E5F9E2412314A005C2EBC /* OpenVPNConfigurationEvaluation.h in Headers */,
|
C97E5F9E2412314A005C2EBC /* OpenVPNConfigurationEvaluation.h in Headers */,
|
||||||
C97E5FA62412317B005C2EBC /* OpenVPNReachabilityStatus.h in Headers */,
|
C97E5FA62412317B005C2EBC /* OpenVPNReachabilityStatus.h in Headers */,
|
||||||
OBJ_287 /* OpenVPNPrivateKey.h in Headers */,
|
OBJ_287 /* OpenVPNPrivateKey.h in Headers */,
|
||||||
|
EDC86AEB2516F50000504FFA /* OpenVPNDhcpOptionEntry+Internal.h in Headers */,
|
||||||
C97E5F7424122FE6005C2EBC /* OpenVPNAdapter.h in Headers */,
|
C97E5F7424122FE6005C2EBC /* OpenVPNAdapter.h in Headers */,
|
||||||
OBJ_288 /* OpenVPNInterfaceStats.h in Headers */,
|
OBJ_288 /* OpenVPNInterfaceStats.h in Headers */,
|
||||||
OBJ_290 /* OpenVPNReachability.h in Headers */,
|
OBJ_290 /* OpenVPNReachability.h in Headers */,
|
||||||
@@ -1012,6 +1025,7 @@
|
|||||||
OBJ_293 /* OpenVPNMinTLSVersion.h in Headers */,
|
OBJ_293 /* OpenVPNMinTLSVersion.h in Headers */,
|
||||||
C97E5F7224122F5C005C2EBC /* OpenVPNClient.h in Headers */,
|
C97E5F7224122F5C005C2EBC /* OpenVPNClient.h in Headers */,
|
||||||
OBJ_294 /* OpenVPNAdapter.h in Headers */,
|
OBJ_294 /* OpenVPNAdapter.h in Headers */,
|
||||||
|
EDC86AE92516F50000504FFA /* OpenVPNDhcpOptionEntry.h in Headers */,
|
||||||
OBJ_295 /* OpenVPNConnectionInfo.h in Headers */,
|
OBJ_295 /* OpenVPNConnectionInfo.h in Headers */,
|
||||||
OBJ_296 /* OpenVPNReachabilityStatus.h in Headers */,
|
OBJ_296 /* OpenVPNReachabilityStatus.h in Headers */,
|
||||||
C97E5F822412305C005C2EBC /* OpenVPNConnectionInfo.h in Headers */,
|
C97E5F822412305C005C2EBC /* OpenVPNConnectionInfo.h in Headers */,
|
||||||
@@ -1030,6 +1044,7 @@
|
|||||||
C910EAE724EBB5210081AF13 /* OpenVPNConfigurationEvaluation.h in Headers */,
|
C910EAE724EBB5210081AF13 /* OpenVPNConfigurationEvaluation.h in Headers */,
|
||||||
C97E5FAC241231AA005C2EBC /* OpenVPNServerEntry+Internal.h in Headers */,
|
C97E5FAC241231AA005C2EBC /* OpenVPNServerEntry+Internal.h in Headers */,
|
||||||
C97E5F90241230B3005C2EBC /* OpenVPNIPv6Preference.h in Headers */,
|
C97E5F90241230B3005C2EBC /* OpenVPNIPv6Preference.h in Headers */,
|
||||||
|
EDC86AF22516F52300504FFA /* OpenVPNDhcpOptionEntry.h in Headers */,
|
||||||
C97E5FE624124B0E005C2EBC /* Umbrella-Header.h in Headers */,
|
C97E5FE624124B0E005C2EBC /* Umbrella-Header.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -1215,6 +1230,7 @@
|
|||||||
OBJ_269 /* OpenVPNInterfaceStats.mm in Sources */,
|
OBJ_269 /* OpenVPNInterfaceStats.mm in Sources */,
|
||||||
OBJ_270 /* OpenVPNNetworkSettingsBuilder.m in Sources */,
|
OBJ_270 /* OpenVPNNetworkSettingsBuilder.m in Sources */,
|
||||||
OBJ_271 /* OpenVPNPacket.mm in Sources */,
|
OBJ_271 /* OpenVPNPacket.mm in Sources */,
|
||||||
|
EDC86AEA2516F50000504FFA /* OpenVPNDhcpOptionEntry.mm in Sources */,
|
||||||
OBJ_272 /* OpenVPNPacketFlowBridge.mm in Sources */,
|
OBJ_272 /* OpenVPNPacketFlowBridge.mm in Sources */,
|
||||||
OBJ_273 /* OpenVPNPrivateKey.m in Sources */,
|
OBJ_273 /* OpenVPNPrivateKey.m in Sources */,
|
||||||
OBJ_274 /* OpenVPNConfigurationEvaluation.mm in Sources */,
|
OBJ_274 /* OpenVPNConfigurationEvaluation.mm in Sources */,
|
||||||
|
|||||||
@@ -663,6 +663,14 @@ namespace openvpn {
|
|||||||
se.friendlyName = i->friendlyName;
|
se.friendlyName = i->friendlyName;
|
||||||
eval.serverList.push_back(se);
|
eval.serverList.push_back(se);
|
||||||
}
|
}
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
for (ParseClientConfig::DhcpOptionList::const_iterator i = cc.dhcpOptionList().begin(); i != cc.dhcpOptionList().end(); ++i)
|
||||||
|
{
|
||||||
|
DhcpOptionEntry de;
|
||||||
|
de.type = i->type;
|
||||||
|
de.address = i->address;
|
||||||
|
eval.dhcpOptionList.push_back(de);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,15 @@ namespace openvpn {
|
|||||||
std::string friendlyName;
|
std::string friendlyName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
// Represents an "dhcp-option" with its type (DNS, WINS, etc) and its address
|
||||||
|
// (client reads)
|
||||||
|
struct DhcpOptionEntry
|
||||||
|
{
|
||||||
|
std::string type;
|
||||||
|
std::string address;
|
||||||
|
};
|
||||||
|
|
||||||
// return properties of config
|
// return properties of config
|
||||||
// (client reads)
|
// (client reads)
|
||||||
struct EvalConfig
|
struct EvalConfig
|
||||||
@@ -91,6 +100,10 @@ namespace openvpn {
|
|||||||
|
|
||||||
// optional list of user-selectable VPN servers
|
// optional list of user-selectable VPN servers
|
||||||
std::vector<ServerEntry> serverList;
|
std::vector<ServerEntry> serverList;
|
||||||
|
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
// optional list of "dhcp-option"
|
||||||
|
std::vector<DhcpOptionEntry> dhcpOptionList;
|
||||||
};
|
};
|
||||||
|
|
||||||
// used to pass credentials to VPN core
|
// used to pass credentials to VPN core
|
||||||
|
|||||||
@@ -59,6 +59,17 @@ namespace openvpn {
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
struct DhcpOptionEntry {
|
||||||
|
std::string type;
|
||||||
|
std::string address;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
struct DhcpOptionList : public std::vector<DhcpOptionEntry>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
struct RemoteItem {
|
struct RemoteItem {
|
||||||
std::string host;
|
std::string host;
|
||||||
std::string port;
|
std::string port;
|
||||||
@@ -283,6 +294,30 @@ namespace openvpn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
// dhpc-option
|
||||||
|
{
|
||||||
|
const OptionList::IndexList *dhcpList = options.get_index_ptr("dhcp-option");
|
||||||
|
|
||||||
|
if (dhcpList)
|
||||||
|
{
|
||||||
|
for (OptionList::IndexList::const_iterator i = dhcpList->begin(); i != dhcpList->end(); ++i)
|
||||||
|
{
|
||||||
|
const Option& o = options[*i];
|
||||||
|
o.touch();
|
||||||
|
|
||||||
|
const std::string arg1 = o.get_optional(1, 256);
|
||||||
|
const std::string arg2 = o.get_optional(2, 256);
|
||||||
|
|
||||||
|
DhcpOptionEntry dhcp;
|
||||||
|
dhcp.type = arg1;
|
||||||
|
dhcp.address = arg2;
|
||||||
|
|
||||||
|
dhcpOptionList_.push_back(std::move(dhcp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// protocol configuration
|
// protocol configuration
|
||||||
{
|
{
|
||||||
protoConfig.reset(new ProtoContext::Config());
|
protoConfig.reset(new ProtoContext::Config());
|
||||||
@@ -435,6 +470,10 @@ namespace openvpn {
|
|||||||
|
|
||||||
// return first remote directive in config
|
// return first remote directive in config
|
||||||
const RemoteItem& firstRemoteListItem() const { return firstRemoteListItem_; }
|
const RemoteItem& firstRemoteListItem() const { return firstRemoteListItem_; }
|
||||||
|
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
// dhpc-option
|
||||||
|
const DhcpOptionList& dhcpOptionList() const { return dhcpOptionList_; }
|
||||||
|
|
||||||
std::string to_string() const
|
std::string to_string() const
|
||||||
{
|
{
|
||||||
@@ -524,6 +563,18 @@ namespace openvpn {
|
|||||||
|
|
||||||
root["mode"] = Json::Value("client");
|
root["mode"] = Json::Value("client");
|
||||||
root["dev"] = Json::Value(dev);
|
root["dev"] = Json::Value(dev);
|
||||||
|
// Added by Dener Araújo - 2020-09-06
|
||||||
|
root["dhcp-options"] = Json::Value(Json::arrayValue);
|
||||||
|
for (size_t i = 0; i < dhcpOptionList_.size(); i++)
|
||||||
|
{
|
||||||
|
const DhcpOptionEntry& item = dhcpOptionList_[i];
|
||||||
|
|
||||||
|
Json::Value el = Json::Value(Json::objectValue);
|
||||||
|
el["type"] = Json::Value(item.type);
|
||||||
|
el["address"] = Json::Value(item.address);
|
||||||
|
|
||||||
|
root["dhcp-options"].append(el);
|
||||||
|
}
|
||||||
root["dev-type"] = Json::Value(protoConfig->layer.dev_type());
|
root["dev-type"] = Json::Value(protoConfig->layer.dev_type());
|
||||||
root["remotes"] = Json::Value(Json::arrayValue);
|
root["remotes"] = Json::Value(Json::arrayValue);
|
||||||
for (size_t i = 0; i < remoteList->size(); i++)
|
for (size_t i = 0; i < remoteList->size(); i++)
|
||||||
@@ -716,6 +767,7 @@ namespace openvpn {
|
|||||||
ProtoContext::Config::Ptr protoConfig;
|
ProtoContext::Config::Ptr protoConfig;
|
||||||
SSLLib::SSLAPI::Config::Ptr sslConfig;
|
SSLLib::SSLAPI::Config::Ptr sslConfig;
|
||||||
std::string dev;
|
std::string dev;
|
||||||
|
DhcpOptionList dhcpOptionList_; // Added by Dener Araújo - 2020-09-06
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ FOUNDATION_EXPORT const unsigned char OpenVPNAdapterVersionString[];
|
|||||||
#import <OpenVPNAdapter/OpenVPNConfiguration.h>
|
#import <OpenVPNAdapter/OpenVPNConfiguration.h>
|
||||||
#import <OpenVPNAdapter/OpenVPNCredentials.h>
|
#import <OpenVPNAdapter/OpenVPNCredentials.h>
|
||||||
#import <OpenVPNAdapter/OpenVPNServerEntry.h>
|
#import <OpenVPNAdapter/OpenVPNServerEntry.h>
|
||||||
|
#import <OpenVPNAdapter/OpenVPNDhcpOptionEntry.h> // Added by Dener Araújo - 2020-09-06
|
||||||
#import <OpenVPNAdapter/OpenVPNConfigurationEvaluation.h>
|
#import <OpenVPNAdapter/OpenVPNConfigurationEvaluation.h>
|
||||||
#import <OpenVPNAdapter/OpenVPNConnectionInfo.h>
|
#import <OpenVPNAdapter/OpenVPNConnectionInfo.h>
|
||||||
#import <OpenVPNAdapter/OpenVPNSessionToken.h>
|
#import <OpenVPNAdapter/OpenVPNSessionToken.h>
|
||||||
|
|||||||
1
Sources/OpenVPNAdapter/include/OpenVPNDhcpOptionEntry.h
Symbolic link
1
Sources/OpenVPNAdapter/include/OpenVPNDhcpOptionEntry.h
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../library/OpenVPNDhcpOptionEntry.h
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
typedef NS_ENUM(NSInteger, OpenVPNTransportProtocol);
|
typedef NS_ENUM(NSInteger, OpenVPNTransportProtocol);
|
||||||
@class OpenVPNServerEntry;
|
@class OpenVPNServerEntry;
|
||||||
|
@class OpenVPNDhcpOptionEntry; //Added by Dener Araújo - 2020-09-06
|
||||||
|
|
||||||
@interface OpenVPNConfigurationEvaluation : NSObject
|
@interface OpenVPNConfigurationEvaluation : NSObject
|
||||||
|
|
||||||
@@ -78,6 +79,12 @@ typedef NS_ENUM(NSInteger, OpenVPNTransportProtocol);
|
|||||||
*/
|
*/
|
||||||
@property (nullable, readonly, nonatomic) NSArray<OpenVPNServerEntry *> *servers;
|
@property (nullable, readonly, nonatomic) NSArray<OpenVPNServerEntry *> *servers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Added by Dener Araújo - 2020-09-06
|
||||||
|
Optional list of "dhcp-option"
|
||||||
|
*/
|
||||||
|
@property (nullable, readonly, nonatomic) NSArray<OpenVPNDhcpOptionEntry *> *dhcpOptions;
|
||||||
|
|
||||||
- (nonnull instancetype) init NS_UNAVAILABLE;
|
- (nonnull instancetype) init NS_UNAVAILABLE;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#import "OpenVPNConfiguration+Internal.h"
|
#import "OpenVPNConfiguration+Internal.h"
|
||||||
#import "OpenVPNServerEntry+Internal.h"
|
#import "OpenVPNServerEntry+Internal.h"
|
||||||
|
#import "OpenVPNDhcpOptionEntry+Internal.h" //Added by Dener Araújo - 2020-09-06
|
||||||
|
|
||||||
using namespace openvpn;
|
using namespace openvpn;
|
||||||
|
|
||||||
@@ -56,6 +57,20 @@ using namespace openvpn;
|
|||||||
|
|
||||||
_servers = servers;
|
_servers = servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Added by Dener Araújo - 2020-09-06
|
||||||
|
_dhcpOptions = nil;
|
||||||
|
|
||||||
|
if (!eval.dhcpOptionList.empty()) {
|
||||||
|
NSMutableArray *dhcpOptions = [NSMutableArray new];
|
||||||
|
|
||||||
|
for (ClientAPI::DhcpOptionEntry entry : eval.dhcpOptionList) {
|
||||||
|
OpenVPNDhcpOptionEntry *dhcpOptionEntry = [[OpenVPNDhcpOptionEntry alloc] initWithDhcpOptionEntry:entry];
|
||||||
|
[dhcpOptions addObject:dhcpOptionEntry];
|
||||||
|
}
|
||||||
|
|
||||||
|
_dhcpOptions = dhcpOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// OpenVPNDhcpOptionEntry+Internal.h
|
||||||
|
// Pods
|
||||||
|
//
|
||||||
|
// Created by Dener Araújo on 06/09/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OpenVPNDhcpOptionEntry.h"
|
||||||
|
|
||||||
|
#include <ovpnapi.hpp>
|
||||||
|
|
||||||
|
using namespace openvpn;
|
||||||
|
|
||||||
|
@interface OpenVPNDhcpOptionEntry (Internal)
|
||||||
|
|
||||||
|
- (instancetype)initWithDhcpOptionEntry:(ClientAPI::DhcpOptionEntry)entry;
|
||||||
|
|
||||||
|
@end
|
||||||
17
Sources/OpenVPNAdapter/library/OpenVPNDhcpOptionEntry.h
Normal file
17
Sources/OpenVPNAdapter/library/OpenVPNDhcpOptionEntry.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// OpenVPNDhcpOptionEntry.h
|
||||||
|
// Pods
|
||||||
|
//
|
||||||
|
// Created by Dener Araújo on 06/09/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface OpenVPNDhcpOptionEntry : NSObject
|
||||||
|
|
||||||
|
@property (nullable, readonly, nonatomic) NSString *type;
|
||||||
|
@property (nullable, readonly, nonatomic) NSString *address;
|
||||||
|
|
||||||
|
- (nonnull instancetype) init NS_UNAVAILABLE;
|
||||||
|
|
||||||
|
@end
|
||||||
21
Sources/OpenVPNAdapter/library/OpenVPNDhcpOptionEntry.mm
Normal file
21
Sources/OpenVPNAdapter/library/OpenVPNDhcpOptionEntry.mm
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// OpenVPNDhcpOptionEntry.mm
|
||||||
|
// OpenVPNAdapter
|
||||||
|
//
|
||||||
|
// Created by Dener Araújo on 06/09/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OpenVPNDhcpOptionEntry.h"
|
||||||
|
#import "OpenVPNDhcpOptionEntry+Internal.h"
|
||||||
|
|
||||||
|
@implementation OpenVPNDhcpOptionEntry
|
||||||
|
|
||||||
|
- (instancetype)initWithDhcpOptionEntry:(ClientAPI::DhcpOptionEntry)entry {
|
||||||
|
if (self = [super init]) {
|
||||||
|
_type = !entry.type.empty() ? [NSString stringWithUTF8String:entry.type.c_str()] : nil;
|
||||||
|
_address = !entry.address.empty() ? [NSString stringWithUTF8String:entry.address.c_str()] : nil;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -22,6 +22,6 @@
|
|||||||
#ifndef OVPNAPI_H
|
#ifndef OVPNAPI_H
|
||||||
#define OVPNAPI_H
|
#define OVPNAPI_H
|
||||||
|
|
||||||
#include "ovpncli.hpp"
|
#include <ovpncli.hpp>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ int mbedtls_entropy_update_manual( mbedtls_entropy_context *ctx,
|
|||||||
*/
|
*/
|
||||||
static int entropy_gather_internal( mbedtls_entropy_context *ctx )
|
static int entropy_gather_internal( mbedtls_entropy_context *ctx )
|
||||||
{
|
{
|
||||||
int ret, i, have_one_strong = 0;
|
int ret = 0, i, have_one_strong = 0; // Updated by Dener Araújo - 2020-09-06
|
||||||
unsigned char buf[MBEDTLS_ENTROPY_MAX_GATHER];
|
unsigned char buf[MBEDTLS_ENTROPY_MAX_GATHER];
|
||||||
size_t olen;
|
size_t olen;
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ int mbedtls_hmac_drbg_update_ret( mbedtls_hmac_drbg_context *ctx,
|
|||||||
unsigned char rounds = ( additional != NULL && add_len != 0 ) ? 2 : 1;
|
unsigned char rounds = ( additional != NULL && add_len != 0 ) ? 2 : 1;
|
||||||
unsigned char sep[1];
|
unsigned char sep[1];
|
||||||
unsigned char K[MBEDTLS_MD_MAX_SIZE];
|
unsigned char K[MBEDTLS_MD_MAX_SIZE];
|
||||||
int ret;
|
int ret = 0; // Updated by Dener Araújo - 2020-09-06
|
||||||
|
|
||||||
for( sep[0] = 0; sep[0] < rounds; sep[0]++ )
|
for( sep[0] = 0; sep[0] < rounds; sep[0]++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ int mbedtls_x509_crl_parse( mbedtls_x509_crl *chain, const unsigned char *buf, s
|
|||||||
{
|
{
|
||||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||||
int ret;
|
int ret;
|
||||||
size_t use_len;
|
size_t use_len = 0; // Updated by Dener Araújo - 2020-09-06
|
||||||
mbedtls_pem_context pem;
|
mbedtls_pem_context pem;
|
||||||
int is_pem = 0;
|
int is_pem = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user