mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-12-27 10:39:53 +03:00
Cedar: implement detailed protocol info
This commit is contained in:
parent
ab57ef3f54
commit
9aaa9a7f15
@ -9655,6 +9655,12 @@ void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UNDERLAY_PROTOCOL"), tmp);
|
||||
}
|
||||
|
||||
if (IsEmptyStr(s->ProtocolDetails) == false)
|
||||
{
|
||||
StrToUni(tmp, sizeof(tmp), s->ProtocolDetails);
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_PROTOCOL_DETAILS"), tmp);
|
||||
}
|
||||
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UDP_ACCEL_ENABLED"), (s->IsUdpAccelerationEnabled ? _UU("CM_ST_YES") : _UU("CM_ST_NO")));
|
||||
LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UDP_ACCEL_USING"), (s->IsUsingUdpAcceleration ? _UU("CM_ST_YES") : _UU("CM_ST_NO")));
|
||||
|
||||
|
@ -5818,6 +5818,9 @@ void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s)
|
||||
st->IsRUDPSession = s->IsRUDPSession;
|
||||
// Physical communication protocol
|
||||
StrCpy(st->UnderlayProtocol, sizeof(st->UnderlayProtocol), s->UnderlayProtocol);
|
||||
// Protocol details
|
||||
StrCpy(st->ProtocolDetails, sizeof(st->ProtocolDetails), s->ProtocolDetails);
|
||||
Trim(st->ProtocolDetails);
|
||||
// UDP acceleration function
|
||||
st->IsUdpAccelerationEnabled = s->UseUdpAcceleration;
|
||||
st->IsUsingUdpAcceleration = s->IsUsingUdpAcceleration;
|
||||
|
@ -341,6 +341,7 @@ struct RPC_CLIENT_GET_CONNECTION_STATUS
|
||||
bool UseCompress; // Use of compression
|
||||
bool IsRUDPSession; // R-UDP session
|
||||
char UnderlayProtocol[64]; // Physical communication protocol
|
||||
char ProtocolDetails[256]; // Protocol details
|
||||
bool IsUdpAccelerationEnabled; // The UDP acceleration is enabled
|
||||
bool IsUsingUdpAcceleration; // Using the UDP acceleration function
|
||||
char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name
|
||||
|
@ -15155,6 +15155,12 @@ void CmdPrintStatusToListViewEx(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s, boo
|
||||
CtInsert(ct, _UU("CM_ST_UNDERLAY_PROTOCOL"), tmp);
|
||||
}
|
||||
|
||||
if (IsEmptyStr(s->ProtocolDetails) == false)
|
||||
{
|
||||
StrToUni(tmp, sizeof(tmp), s->ProtocolDetails);
|
||||
CtInsert(ct, _UU("CM_ST_PROTOCOL_DETAILS"), tmp);
|
||||
}
|
||||
|
||||
CtInsert(ct, _UU("CM_ST_UDP_ACCEL_ENABLED"), (s->IsUdpAccelerationEnabled ? _UU("CM_ST_YES") : _UU("CM_ST_NO")));
|
||||
CtInsert(ct, _UU("CM_ST_UDP_ACCEL_USING"), (s->IsUsingUdpAcceleration ? _UU("CM_ST_YES") : _UU("CM_ST_NO")));
|
||||
|
||||
|
@ -1479,8 +1479,8 @@ bool ServerAccept(CONNECTION *c)
|
||||
{
|
||||
if (IsEmptyStr(c->InProcPrefix) == false)
|
||||
{
|
||||
Format(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol),
|
||||
SOCK_UNDERLAY_INPROC_EX, c->InProcPrefix);
|
||||
Format(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol), SOCK_UNDERLAY_INPROC_EX, c->InProcPrefix);
|
||||
AddProtocolDetailsStr(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol), c->InProcPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2807,7 +2807,8 @@ bool ServerAccept(CONNECTION *c)
|
||||
// R-UDP session
|
||||
s->IsRUDPSession = true;
|
||||
s->RUdpMss = c->FirstSock->RUDP_OptimizedMss;
|
||||
Debug("Optimized MSS Value for R-UDP: %u\n", s->RUdpMss);
|
||||
Debug("ServerAccept(): Optimized MSS Value for R-UDP: %u\n", s->RUdpMss);
|
||||
AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_MSS", s->RUdpMss);
|
||||
}
|
||||
|
||||
if (enable_bulk_on_rudp)
|
||||
@ -2821,6 +2822,8 @@ bool ServerAccept(CONNECTION *c)
|
||||
|
||||
StrCpy(s->UnderlayProtocol, sizeof(s->UnderlayProtocol), c->FirstSock->UnderlayProtocol);
|
||||
|
||||
AddProtocolDetailsStr(s->ProtocolDetails, sizeof(s->ProtocolDetails), c->FirstSock->ProtocolDetails);
|
||||
|
||||
if (server != NULL)
|
||||
{
|
||||
s->NoSendSignature = server->NoSendSignature;
|
||||
@ -2912,6 +2915,7 @@ bool ServerAccept(CONNECTION *c)
|
||||
if (s->AdjustMss != 0)
|
||||
{
|
||||
Debug("AdjustMSS: %u\n", s->AdjustMss);
|
||||
AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "AdjustMSS", s->AdjustMss);
|
||||
}
|
||||
|
||||
s->IsBridgeMode = (policy->NoBridge == false) || (policy->NoRouting == false);
|
||||
@ -2957,8 +2961,7 @@ bool ServerAccept(CONNECTION *c)
|
||||
{
|
||||
char ip[128];
|
||||
IPToStr(ip, sizeof(ip), &c->FirstSock->RemoteIP);
|
||||
HLog(hub, "LH_NEW_SESSION", c->Name, s->Name, ip, c->FirstSock->RemotePort,
|
||||
c->FirstSock->UnderlayProtocol);
|
||||
HLog(hub, "LH_NEW_SESSION", c->Name, s->Name, ip, c->FirstSock->RemotePort, c->FirstSock->UnderlayProtocol, c->FirstSock->ProtocolDetails);
|
||||
}
|
||||
|
||||
c->Session = s;
|
||||
@ -4704,9 +4707,13 @@ REDIRECTED:
|
||||
// Physical communication protocol
|
||||
StrCpy(c->Session->UnderlayProtocol, sizeof(c->Session->UnderlayProtocol), s->UnderlayProtocol);
|
||||
|
||||
AddProtocolDetailsStr(c->Session->ProtocolDetails, sizeof(c->Session->ProtocolDetails), s->ProtocolDetails);
|
||||
|
||||
if (c->Session->IsAzureSession)
|
||||
{
|
||||
StrCpy(c->Session->UnderlayProtocol, sizeof(c->Session->UnderlayProtocol), SOCK_UNDERLAY_AZURE);
|
||||
|
||||
AddProtocolDetailsStr(c->Session->ProtocolDetails, sizeof(c->Session->ProtocolDetails), "VPN Azure");
|
||||
}
|
||||
|
||||
if (c->Protocol == CONNECTION_UDP)
|
||||
|
@ -157,6 +157,7 @@ struct SESSION
|
||||
UINT NumDisconnected; // Number of socket disconnection
|
||||
bool NoReconnectToSession; // Disable to reconnect to the session
|
||||
char UnderlayProtocol[64]; // Physical communication protocol
|
||||
char ProtocolDetails[256]; // Protocol details
|
||||
/* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */
|
||||
UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection
|
||||
UINT64 CurrentConnectionEstablishTime; // Completion time of this connection
|
||||
|
@ -2528,14 +2528,17 @@ SOCK *AcceptRUDP(SOCK *s)
|
||||
{
|
||||
case RUDP_PROTOCOL_UDP:
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NAT_T);
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/UDP");
|
||||
break;
|
||||
|
||||
case RUDP_PROTOCOL_DNS:
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_DNS);
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/DNS");
|
||||
break;
|
||||
|
||||
case RUDP_PROTOCOL_ICMP:
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_ICMP);
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/ICMP");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -12759,6 +12762,8 @@ SOCK *Accept(SOCK *sock)
|
||||
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NATIVE_V4);
|
||||
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "IPv4");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -12869,6 +12874,8 @@ SOCK *Accept6(SOCK *sock)
|
||||
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NATIVE_V6);
|
||||
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "IPv6");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -14070,6 +14077,7 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
|
||||
if (nat_t_sock != NULL)
|
||||
{
|
||||
StrCpy(nat_t_sock->UnderlayProtocol, sizeof(nat_t_sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T);
|
||||
AddProtocolDetailsStr(nat_t_sock->ProtocolDetails, sizeof(nat_t_sock->ProtocolDetails), "RUDP");
|
||||
}
|
||||
|
||||
Copy(ret_ip, &ip4, sizeof(IP));
|
||||
@ -14294,8 +14302,8 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
|
||||
Disconnect(p4.Result_Nat_T_Sock);
|
||||
ReleaseSock(p4.Result_Nat_T_Sock);
|
||||
|
||||
StrCpy(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol),
|
||||
SOCK_UNDERLAY_NAT_T);
|
||||
StrCpy(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T);
|
||||
AddProtocolDetailsStr(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/UDP");
|
||||
|
||||
Copy(ret_ip, &ip4, sizeof(IP));
|
||||
|
||||
@ -14308,8 +14316,8 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
|
||||
Disconnect(p3.Result_Nat_T_Sock);
|
||||
ReleaseSock(p3.Result_Nat_T_Sock);
|
||||
|
||||
StrCpy(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol),
|
||||
SOCK_UNDERLAY_DNS);
|
||||
StrCpy(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_DNS);
|
||||
AddProtocolDetailsStr(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/DNS");
|
||||
|
||||
Copy(ret_ip, &ip4, sizeof(IP));
|
||||
|
||||
@ -14318,8 +14326,8 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
|
||||
else if (p3.Ok)
|
||||
{
|
||||
// Use this if over ICMP success
|
||||
StrCpy(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol),
|
||||
SOCK_UNDERLAY_ICMP);
|
||||
StrCpy(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_ICMP);
|
||||
AddProtocolDetailsStr(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/ICMP");
|
||||
|
||||
Copy(ret_ip, &ip4, sizeof(IP));
|
||||
|
||||
@ -14383,8 +14391,8 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
|
||||
sock->Type = SOCK_TCP;
|
||||
sock->ServerMode = false;
|
||||
|
||||
StrCpy(sock->UnderlayProtocol, sizeof(sock->UnderlayProtocol),
|
||||
(is_ipv6 ? SOCK_UNDERLAY_NATIVE_V6 : SOCK_UNDERLAY_NATIVE_V4));
|
||||
StrCpy(sock->UnderlayProtocol, sizeof(sock->UnderlayProtocol), is_ipv6 ? SOCK_UNDERLAY_NATIVE_V6 : SOCK_UNDERLAY_NATIVE_V4);
|
||||
AddProtocolDetailsStr(sock->ProtocolDetails, sizeof(sock->ProtocolDetails), is_ipv6 ? "IPv6" : "IPv4");
|
||||
|
||||
// Host name resolution
|
||||
if (no_get_hostname || (GetHostName(tmp, sizeof(tmp), ¤t_ip) == false))
|
||||
@ -14434,6 +14442,59 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
|
||||
return sock;
|
||||
}
|
||||
|
||||
// Add a protocol details strings
|
||||
void AddProtocolDetailsStr(char *dst, UINT dst_size, char *str)
|
||||
{
|
||||
TOKEN_LIST *t1, *t2;
|
||||
UINT i, j;
|
||||
if (dst == NULL || str == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
t1 = ParseTokenWithoutNullStr(dst, " ");
|
||||
t2 = ParseTokenWithoutNullStr(str, " ");
|
||||
|
||||
for (i = 0;i < t2->NumTokens;i++)
|
||||
{
|
||||
bool exists = false;
|
||||
for (j = 0;j < t1->NumTokens;j++)
|
||||
{
|
||||
if (StrCmpi(t1->Token[j], t2->Token[i]) == 0)
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (exists == false)
|
||||
{
|
||||
StrCat(dst, dst_size, t2->Token[i]);
|
||||
StrCat(dst, dst_size, " ");
|
||||
}
|
||||
}
|
||||
|
||||
FreeToken(t1);
|
||||
FreeToken(t2);
|
||||
}
|
||||
|
||||
void AddProtocolDetailsKeyValueStr(char *dst, UINT dst_size, char *key, char *value)
|
||||
{
|
||||
char tmp[128];
|
||||
StrCpy(tmp, sizeof(tmp), key);
|
||||
StrCat(tmp, sizeof(tmp), "=");
|
||||
StrCat(tmp, sizeof(tmp), value);
|
||||
AddProtocolDetailsStr(dst, dst_size, tmp);
|
||||
}
|
||||
|
||||
void AddProtocolDetailsKeyValueInt(char *dst, UINT dst_size, char *key, UINT value)
|
||||
{
|
||||
char tmp[128];
|
||||
ToStr(tmp, value);
|
||||
AddProtocolDetailsKeyValueStr(dst, dst_size, key, tmp);
|
||||
}
|
||||
|
||||
|
||||
// Setting the buffer size of the socket
|
||||
bool SetSocketBufferSize(SOCKET s, bool send, UINT size)
|
||||
{
|
||||
@ -19445,6 +19506,8 @@ SOCK *AcceptReverse(SOCK *s)
|
||||
{
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_AZURE);
|
||||
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "VPN Azure");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -19493,6 +19556,8 @@ SOCK *AcceptInProc(SOCK *s)
|
||||
{
|
||||
StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_INPROC);
|
||||
|
||||
AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "InProc");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -209,6 +209,7 @@ struct SOCK
|
||||
UINT CurrentTtl; // Current TTL value
|
||||
RUDP_STACK *R_UDP_Stack; // R-UDP stack
|
||||
char UnderlayProtocol[64]; // Underlying protocol
|
||||
char ProtocolDetails[256]; // Protocol details
|
||||
QUEUE *ReverseAcceptQueue; // Accept queue for the reverse socket
|
||||
EVENT *ReverseAcceptEvent; // Accept event for the reverse socket
|
||||
bool IsReverseAcceptedSocket; // Whether it is a reverse socket
|
||||
@ -1238,6 +1239,9 @@ void RouteToStr(char *str, UINT str_size, ROUTE_ENTRY *e);
|
||||
void DebugPrintRoute(ROUTE_ENTRY *e);
|
||||
void DebugPrintRouteTable(ROUTE_TABLE *r);
|
||||
bool IsIPv6LocalNetworkAddress(IP *ip);
|
||||
void AddProtocolDetailsStr(char *dst, UINT dst_size, char *str);
|
||||
void AddProtocolDetailsKeyValueStr(char *dst, UINT dst_size, char *key, char *value);
|
||||
void AddProtocolDetailsKeyValueInt(char *dst, UINT dst_size, char *key, UINT value);
|
||||
|
||||
#ifdef ENABLE_SSL_LOGGING
|
||||
void SockEnableSslLogging(SOCK *s);
|
||||
|
Loading…
Reference in New Issue
Block a user