We need a stable way of determining the:
1) remote hosts public IP address of a linux login session, if the session is indeed initiated remotely (ssh/telnet).
2) the TCP port of the destination public ip address;
The C code:
A) must deliver the same public IP address AND the destination TCP port even across sub-sessions like sudo/su/pbrun.
B) must be in the form of a C function or a set of utility functions written in C.
C) must be portable between different linux distributions.
Example: A user using public IP [login to view URL] connects to a server IP address [login to view URL]
On the server side I entered the command: netstat |grep -i [login to view URL]
tcp 0 0 li598-171.members.l:ssh [login to view URL] ESTABLISHED
The C code will need to provide: 1) remote host IP address: [login to view URL] and 2) the TCP port is 54205
To my understanding it is not possible to run netstat or ss because you can only see process groups you own.