get remote MAC address from SESSION
Posted: Mon Apr 16, 2018 3:59 am
I did write a packet adapter nothing new just based on the existing
"PACKET_ADAPTER" struct source which's method does get called and resave
the "SESSION" struct pointer so far so good but my question is that:
once we do connect to an SE server we need it's MAC address in
packet-adapter to be able to create L2 packets and send to the SE server
but where is that MAC address?
where ever that MAC address is please inform me too.
below is the session structure which you all may know:
// Session structure
struct SESSION
{
LOCK *lock; // Lock
REF *ref; // Reference counter
CEDAR *Cedar; // Cedar
BOOL LocalHostSession; // Local host session
BOOL ServerMode; // Server mode session
BOOL NormalClient; // Connecting session from a regular client (not
such as localbridge)
BOOL LinkModeClient; // Link mode client
BOOL LinkModeServer; // Link mode server
BOOL SecureNATMode; // SecureNAT session
BOOL BridgeMode; // Bridge session
BOOL BridgeIsEthLoopbackBlock; // Loopback is disabled on the Ethernet
level
BOOL VirtualHost; // Virtual host mode
BOOL L3SwitchMode; // Layer-3 switch mode
BOOL InProcMode; // In-process mode
THREAD *Thread; // Management thread
CONNECTION *Connection; // Connection
char ClientIP[64]; // Client IP
CLIENT_OPTION *ClientOption; // Client connection options
CLIENT_AUTH *ClientAuth; // Client authentication data
volatile BOOL Halt; // Halting flag
volatile BOOL CancelConnect; // Cancel the connection
EVENT *HaltEvent; // Halting event
UINT Err; // Error value
HUB *Hub; // HUB
CANCEL *Cancel1; // Cancel object 1
CANCEL *Cancel2; // Cancel object 2
PACKET_ADAPTER *PacketAdapter; // Packet adapter
UCHAR UdpSendKey[16]; // UDP encryption key for transmission
UCHAR UdpRecvKey[16]; // UDP encryption key for reception
UINT ClientStatus; // Client Status
BOOL RetryFlag; // Retry flag (client)
BOOL ForceStopFlag; // Forced stop flag (client)
UINT CurrentRetryCount; // Current retry counter (client)
UINT RetryInterval; // Retry interval (client)
BOOL ConnectSucceed; // Connection success flag (client)
BOOL SessionTimeOuted; // Session times out
UINT Timeout; // Time-out period
UINT64 NextConnectionTime; // Time to put next additional connection
IP ServerIP; // IP address of the server
BOOL ClientModeAndUseVLan; // Use a virtual LAN card in client mode
BOOL UseSSLDataEncryption; // Use SSL data encryption
LOCK *TrafficLock; // Traffic data lock
LINK *Link; // A reference to the link object
SNAT *SecureNAT; // A reference to the SecureNAT object
BRIDGE *Bridge; // A reference to the Bridge object
NODE_INFO NodeInfo; // Node information
UINT64 LastIncrementTraffic; // Last time that updated the traffic data of
the user
BOOL AdministratorMode; // Administrator mode
LIST *CancelList; // Cancellation list
L3IF *L3If; // Layer-3 interface
IP DefaultDns; // IP address of the default DNS server
BOOL IPv6Session; // IPv6 session (Physical communication is IPv6)
UINT VLanId; // VLAN ID
UINT UniqueId; // Unique ID
UCHAR IpcMacAddress[6]; // MAC address for IPC
UCHAR Padding[2];
IP ServerIP_CacheForNextConnect; // Server IP, cached for next connect
UINT64 CreatedTime; // Creation date and time
UINT64 LastCommTime; // Last communication date and time
UINT64 LastCommTimeForDormant; // Last communication date and time (for
dormant)
TRAFFIC *Traffic; // Traffic data
TRAFFIC *OldTraffic; // Old traffic data
UINT64 TotalSendSize; // Total transmitted data size
UINT64 TotalRecvSize; // Total received data size
UINT64 TotalSendSizeReal; // Total transmitted data size (no compression)
UINT64 TotalRecvSizeReal; // Total received data size (no compression)
char *Name; // Session name
char *Username; // User name
char UserNameReal[MAX_USERNAME_LEN + 1]; // User name (real)
char GroupName[MAX_USERNAME_LEN + 1]; // Group name
POLICY *Policy; // Policy
UCHAR SessionKey[SHA1_SIZE]; // Session key
UINT SessionKey32; // 32bit session key
char SessionKeyStr[64]; // Session key string
UINT MaxConnection; // Maximum number of concurrent TCP connections
BOOL UseEncrypt; // Use encrypted communication
BOOL UseFastRC4; // Use high speed RC4 encryption
BOOL UseCompress; // Use data compression
BOOL HalfConnection; // Half connection mode
BOOL QoS; // VoIP / QoS
BOOL NoSendSignature; // Do not send a signature
BOOL IsOpenVPNL3Session; // Whether OpenVPN L3 session
BOOL IsOpenVPNL2Session; // Whether OpenVPN L2 session
UINT NumDisconnected; // Number of socket disconnection
BOOL NoReconnectToSession; // Disable to reconnect to the session
char UnderlayProtocol[64]; // Physical communication protocol
UINT64 FirstConnectionEstablisiedTime; // Connection completion time of
the first connection
UINT64 CurrentConnectionEstablishTime; // Completion time of this
connection
UINT NumConnectionsEatablished; // Number of connections established so
far
UINT AdjustMss; // MSS adjustment value
BOOL IsVPNClientAndVLAN_Win32; // Is the VPN Client session with a VLAN
card (Win32)
BOOL IsRUDPSession; // Whether R-UDP session
UINT RUdpMss; // The value of the MSS should be applied while the
R-UDP is used
BOOL EnableBulkOnRUDP; // Allow the bulk transfer in the R-UDP session
BOOL EnableHMacOnBulkOfRUDP; // Use the HMAC to sign the bulk transfer of
R-UDP session
BOOL EnableUdpRecovery; // Enable the R-UDP recovery
BOOL UseUdpAcceleration; // Use of UDP acceleration mode
BOOL UseHMacOnUdpAcceleration; // Use the HMAC in the UDP acceleration
mode
UDP_ACCEL *UdpAccel; // UDP acceleration
BOOL IsUsingUdpAcceleration; // Flag of whether the UDP acceleration is
used
UINT UdpAccelMss; // MSS value to be applied while the UDP acceleration
is used
BOOL UdpAccelFastDisconnectDetect; // Fast disconnection detection is
enabled
BOOL IsAzureSession; // Whether the session via VPN Azure
IP AzureRealServerGlobalIp; // Real global IP of the server-side in the
case of session via VPN Azure
ACCOUNT *Account; // Client account
UINT VLanDeviceErrorCount; // Number of times that the error occurred in
the virtual LAN card
BOOL Win32HideConnectWindow; // Hide the status window
BOOL Win32HideNicInfoWindow; // Hide the NIC information window
BOOL UserCanceled; // Canceled by the user
UINT64 LastTryAddConnectTime; // Last time that attempted to add a
connection
BOOL IsMonitorMode; // Whether the monitor mode
BOOL IsBridgeMode; // Whether the bridge mode
BOOL UseClientLicense; // Number of assigned client licenses
BOOL UseBridgeLicense; // Number of assigned bridge licenses
COUNTER *LoggingRecordCount; // Counter for the number of logging records
BOOL FreeInfoShowed; // Whether a warning about Free Edition has already
displayed
BOOL Client_NoSavePassword; // Prohibit the password saving
wchar_t *Client_Message; // Message that has been sent from the server
LIST *DelayedPacketList; // Delayed packet list
UINT Flag1;
USER *NumLoginIncrementUserObject; // User objects to increment the nymber
of logins
HUB *NumLoginIncrementHubObject; // Virtual HUB object to increment the
number of logins
UINT64 NumLoginIncrementTick; // Time to perform increment a number of
log
BOOL FirstTimeHttpRedirect; // Redirect HTTP only for the first time
char FirstTimeHttpRedirectUrl[128]; // URL for redirection only the first
time
UINT FirstTimeHttpAccessCheckIp; // IP address for access checking
// To examine the maximum number of alowed logging target packets per
minute
UINT64 MaxLoggedPacketsPerMinuteStartTick; // Inspection start time
UINT CurrentNumPackets; // Current number of packets
// Measures for D-Link bug
UINT64 LastDLinkSTPPacketSendTick; // Last D-Link STP packet transmission
time
UCHAR LastDLinkSTPPacketDataHash[MD5_SIZE]; // Last D-Link STP packet hash
};
"PACKET_ADAPTER" struct source which's method does get called and resave
the "SESSION" struct pointer so far so good but my question is that:
once we do connect to an SE server we need it's MAC address in
packet-adapter to be able to create L2 packets and send to the SE server
but where is that MAC address?
where ever that MAC address is please inform me too.
below is the session structure which you all may know:
// Session structure
struct SESSION
{
LOCK *lock; // Lock
REF *ref; // Reference counter
CEDAR *Cedar; // Cedar
BOOL LocalHostSession; // Local host session
BOOL ServerMode; // Server mode session
BOOL NormalClient; // Connecting session from a regular client (not
such as localbridge)
BOOL LinkModeClient; // Link mode client
BOOL LinkModeServer; // Link mode server
BOOL SecureNATMode; // SecureNAT session
BOOL BridgeMode; // Bridge session
BOOL BridgeIsEthLoopbackBlock; // Loopback is disabled on the Ethernet
level
BOOL VirtualHost; // Virtual host mode
BOOL L3SwitchMode; // Layer-3 switch mode
BOOL InProcMode; // In-process mode
THREAD *Thread; // Management thread
CONNECTION *Connection; // Connection
char ClientIP[64]; // Client IP
CLIENT_OPTION *ClientOption; // Client connection options
CLIENT_AUTH *ClientAuth; // Client authentication data
volatile BOOL Halt; // Halting flag
volatile BOOL CancelConnect; // Cancel the connection
EVENT *HaltEvent; // Halting event
UINT Err; // Error value
HUB *Hub; // HUB
CANCEL *Cancel1; // Cancel object 1
CANCEL *Cancel2; // Cancel object 2
PACKET_ADAPTER *PacketAdapter; // Packet adapter
UCHAR UdpSendKey[16]; // UDP encryption key for transmission
UCHAR UdpRecvKey[16]; // UDP encryption key for reception
UINT ClientStatus; // Client Status
BOOL RetryFlag; // Retry flag (client)
BOOL ForceStopFlag; // Forced stop flag (client)
UINT CurrentRetryCount; // Current retry counter (client)
UINT RetryInterval; // Retry interval (client)
BOOL ConnectSucceed; // Connection success flag (client)
BOOL SessionTimeOuted; // Session times out
UINT Timeout; // Time-out period
UINT64 NextConnectionTime; // Time to put next additional connection
IP ServerIP; // IP address of the server
BOOL ClientModeAndUseVLan; // Use a virtual LAN card in client mode
BOOL UseSSLDataEncryption; // Use SSL data encryption
LOCK *TrafficLock; // Traffic data lock
LINK *Link; // A reference to the link object
SNAT *SecureNAT; // A reference to the SecureNAT object
BRIDGE *Bridge; // A reference to the Bridge object
NODE_INFO NodeInfo; // Node information
UINT64 LastIncrementTraffic; // Last time that updated the traffic data of
the user
BOOL AdministratorMode; // Administrator mode
LIST *CancelList; // Cancellation list
L3IF *L3If; // Layer-3 interface
IP DefaultDns; // IP address of the default DNS server
BOOL IPv6Session; // IPv6 session (Physical communication is IPv6)
UINT VLanId; // VLAN ID
UINT UniqueId; // Unique ID
UCHAR IpcMacAddress[6]; // MAC address for IPC
UCHAR Padding[2];
IP ServerIP_CacheForNextConnect; // Server IP, cached for next connect
UINT64 CreatedTime; // Creation date and time
UINT64 LastCommTime; // Last communication date and time
UINT64 LastCommTimeForDormant; // Last communication date and time (for
dormant)
TRAFFIC *Traffic; // Traffic data
TRAFFIC *OldTraffic; // Old traffic data
UINT64 TotalSendSize; // Total transmitted data size
UINT64 TotalRecvSize; // Total received data size
UINT64 TotalSendSizeReal; // Total transmitted data size (no compression)
UINT64 TotalRecvSizeReal; // Total received data size (no compression)
char *Name; // Session name
char *Username; // User name
char UserNameReal[MAX_USERNAME_LEN + 1]; // User name (real)
char GroupName[MAX_USERNAME_LEN + 1]; // Group name
POLICY *Policy; // Policy
UCHAR SessionKey[SHA1_SIZE]; // Session key
UINT SessionKey32; // 32bit session key
char SessionKeyStr[64]; // Session key string
UINT MaxConnection; // Maximum number of concurrent TCP connections
BOOL UseEncrypt; // Use encrypted communication
BOOL UseFastRC4; // Use high speed RC4 encryption
BOOL UseCompress; // Use data compression
BOOL HalfConnection; // Half connection mode
BOOL QoS; // VoIP / QoS
BOOL NoSendSignature; // Do not send a signature
BOOL IsOpenVPNL3Session; // Whether OpenVPN L3 session
BOOL IsOpenVPNL2Session; // Whether OpenVPN L2 session
UINT NumDisconnected; // Number of socket disconnection
BOOL NoReconnectToSession; // Disable to reconnect to the session
char UnderlayProtocol[64]; // Physical communication protocol
UINT64 FirstConnectionEstablisiedTime; // Connection completion time of
the first connection
UINT64 CurrentConnectionEstablishTime; // Completion time of this
connection
UINT NumConnectionsEatablished; // Number of connections established so
far
UINT AdjustMss; // MSS adjustment value
BOOL IsVPNClientAndVLAN_Win32; // Is the VPN Client session with a VLAN
card (Win32)
BOOL IsRUDPSession; // Whether R-UDP session
UINT RUdpMss; // The value of the MSS should be applied while the
R-UDP is used
BOOL EnableBulkOnRUDP; // Allow the bulk transfer in the R-UDP session
BOOL EnableHMacOnBulkOfRUDP; // Use the HMAC to sign the bulk transfer of
R-UDP session
BOOL EnableUdpRecovery; // Enable the R-UDP recovery
BOOL UseUdpAcceleration; // Use of UDP acceleration mode
BOOL UseHMacOnUdpAcceleration; // Use the HMAC in the UDP acceleration
mode
UDP_ACCEL *UdpAccel; // UDP acceleration
BOOL IsUsingUdpAcceleration; // Flag of whether the UDP acceleration is
used
UINT UdpAccelMss; // MSS value to be applied while the UDP acceleration
is used
BOOL UdpAccelFastDisconnectDetect; // Fast disconnection detection is
enabled
BOOL IsAzureSession; // Whether the session via VPN Azure
IP AzureRealServerGlobalIp; // Real global IP of the server-side in the
case of session via VPN Azure
ACCOUNT *Account; // Client account
UINT VLanDeviceErrorCount; // Number of times that the error occurred in
the virtual LAN card
BOOL Win32HideConnectWindow; // Hide the status window
BOOL Win32HideNicInfoWindow; // Hide the NIC information window
BOOL UserCanceled; // Canceled by the user
UINT64 LastTryAddConnectTime; // Last time that attempted to add a
connection
BOOL IsMonitorMode; // Whether the monitor mode
BOOL IsBridgeMode; // Whether the bridge mode
BOOL UseClientLicense; // Number of assigned client licenses
BOOL UseBridgeLicense; // Number of assigned bridge licenses
COUNTER *LoggingRecordCount; // Counter for the number of logging records
BOOL FreeInfoShowed; // Whether a warning about Free Edition has already
displayed
BOOL Client_NoSavePassword; // Prohibit the password saving
wchar_t *Client_Message; // Message that has been sent from the server
LIST *DelayedPacketList; // Delayed packet list
UINT Flag1;
USER *NumLoginIncrementUserObject; // User objects to increment the nymber
of logins
HUB *NumLoginIncrementHubObject; // Virtual HUB object to increment the
number of logins
UINT64 NumLoginIncrementTick; // Time to perform increment a number of
log
BOOL FirstTimeHttpRedirect; // Redirect HTTP only for the first time
char FirstTimeHttpRedirectUrl[128]; // URL for redirection only the first
time
UINT FirstTimeHttpAccessCheckIp; // IP address for access checking
// To examine the maximum number of alowed logging target packets per
minute
UINT64 MaxLoggedPacketsPerMinuteStartTick; // Inspection start time
UINT CurrentNumPackets; // Current number of packets
// Measures for D-Link bug
UINT64 LastDLinkSTPPacketSendTick; // Last D-Link STP packet transmission
time
UCHAR LastDLinkSTPPacketDataHash[MD5_SIZE]; // Last D-Link STP packet hash
};