VPN SERVERのコンソールログ抜粋(IPsecWin7InitDriverInner()で発生)
|
FwpmCalloutAdd0 for IPv4 Failed: 0x80320009
FwpmCalloutAdd0 for IPv6 Failed: 0x80320009
|
Code: Select all
1.テスト
1.1構成
INTERNET---ONU-----BL900HW-----WX3000HP(ルータ、DHCPサーバ)-----NIC3=====PC2
|
|
---NIC1=====PC1
①BL900HW:
デュアルスタック
②WX3000HP:
デュアルスタック
①OS:WIN10 PRO 21H2
②VPNTEST.EXEをVPN SERVERとして実行
③SoftEther VPN Server Developer Edition Version 5.02 Build 5180 (Japanese)
④DDNSを有効に設定
⑤NIC1をローカルブリッジに設定
1.3 PC2:
①OS:WIN10 HOME 21H2
②VPN CLIENT:BUILT IN L2TP/IPSEC
③サーバ名またはアドレスにSOFTETHER VPN SERVERのIPV6のDDNS名(*.v6.*)を設定
2.ソースコード(IPsecWin7InitDriverInner())
Code: Select all
bool IPsecWin7InitDriverInner()
{
char sys_filename[MAX_PATH];
bool install_driver = true;
HANDLE hEngine;
UINT ret;
FWPM_SESSION0 session;
UINT id;
FWPM_CALLOUT0 callout;
Format(sys_filename, sizeof(sys_filename), IPSEC_WIN7_DST_SYS, MsGetSystem32Dir());
if (IsFileExists(sys_filename) && MsIsServiceInstalled(IPSEC_WIN7_DRIVER_NAME))
{
if (GetCurrentIPsecWin7DriverBuild() >= CEDAR_VERSION_BUILD)
{
// Not to install since the latest version has been already installed
install_driver = false;
}
}
install_driver = true;// by hiura <ーーー強制実行
if (install_driver)
{
char src_filename[MAX_PATH];
if (MsIsWindows10() == false)
{
Format(src_filename, sizeof(src_filename),
"|DriverPackages\\Wfp\\%s\\pxwfp_%s.sys",
(MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86"));
}
else
{
Format(src_filename, sizeof(src_filename),
"|DriverPackages\\Wfp_Win10\\%s\\pxwfp_%s.sys",
// "|DriverPackages/Wfp_Win10/%s/pxwfp_%s.sys",// by HIURA
(MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86"));
}
// Copy the driver
if (FileCopy(src_filename, sys_filename) == false)
{
Debug("%s copy failed. %u\n", sys_filename, GetLastError());
Debug("_____ IPsecWin7InitDriverInner()_____src_filename=%s\n", src_filename);// by HIURA
if (IsFileExists(sys_filename) == false)
{
Debug("%s failed. Abort.\n", sys_filename);
return false;
}
}
else
{
Debug("%s copied.\n", sys_filename);
}
// Set the build number
SetCurrentIPsecWin7DriverBuild();
}
// Get whether the device drivers is already installed
if (MsIsServiceInstalled(IPSEC_WIN7_DRIVER_NAME) == false)
{
wchar_t sys_filename_w[MAX_PATH];
StrToUni(sys_filename_w, sizeof(sys_filename_w), sys_filename);
// Run a new installation
if (MsInstallDeviceDriverW(IPSEC_WIN7_DRIVER_NAME, IPSEC_WIN7_DRIVER_TITLE,
sys_filename_w, NULL) == false)
{
// Installation failed
Debug("MsInstallDeviceDriverW failed.\n");
return false;
}
}
// Start if the device driver is stopped
if (MsIsServiceRunning(IPSEC_WIN7_DRIVER_NAME) == false)
{
if (MsStartService(IPSEC_WIN7_DRIVER_NAME) == false)
{
// Start failure
Debug("MsStartService failed.\n");
return false;
}
Debug("%s service started.\n", IPSEC_WIN7_DRIVER_NAME);
}
else
{
Debug("%s service was already started.\n", IPSEC_WIN7_DRIVER_NAME);
}
// Open the WFP
Zero(&session, sizeof(session));
ret = api->FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &session, &hEngine);
if (ret)
{
Debug("FwpmEngineOpen0 failed.\n");
return false;
}
// Create the Callout Driver (IPv4)
Zero(&callout, sizeof(callout));
callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4;
callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V4;
callout.displayData.name = IPSEC_WIN7_DRIVER_TITLE_V4;
ret = api->FwpmCalloutAdd0(hEngine, &callout, NULL, &id);
if (ret)
{
Debug("FwpmCalloutAdd0 for IPv4 Failed: 0x%X\n", ret);<ーーーエラー発生
}
else
{
Debug("FwpmCalloutAdd0 for IPv4 Ok.\n");
}
// Create the Callout Driver (IPv6)
Zero(&callout, sizeof(callout));
callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6;
callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V6;
callout.displayData.name = IPSEC_WIN7_DRIVER_TITLE_V6;
ret = api->FwpmCalloutAdd0(hEngine, &callout, NULL, &id);
if (ret)
{
Debug("FwpmCalloutAdd0 for IPv6 Failed: 0x%X\n", ret);<ーーーエラー発生
}
else
{
Debug("FwpmCalloutAdd0 for IPv6 Ok.\n");
}
api->FwpmEngineClose0(hEngine);
return true;
}