mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
occtl: print the Local Device IP (the IP the user connected to)
This commit is contained in:
@@ -45,6 +45,7 @@ message user_info_rep
|
||||
optional string cstp_compr = 23;
|
||||
optional string dtls_compr = 24;
|
||||
repeated string no_routes = 25;
|
||||
optional string local_dev_ip = 26;
|
||||
}
|
||||
|
||||
message user_list_rep
|
||||
|
||||
@@ -266,6 +266,17 @@ static int append_user_info(method_ctx *ctx,
|
||||
strtmp = "";
|
||||
rep->ip = strtmp;
|
||||
|
||||
ipbuf = talloc_size(ctx->pool, IPBUF_SIZE);
|
||||
if (ipbuf == NULL)
|
||||
return -1;
|
||||
|
||||
strtmp =
|
||||
human_addr2((struct sockaddr *)&ctmp->our_addr,
|
||||
ctmp->our_addr_len, ipbuf, IPBUF_SIZE, 0);
|
||||
if (strtmp == NULL)
|
||||
strtmp = "";
|
||||
rep->local_dev_ip = strtmp;
|
||||
|
||||
rep->tun = ctmp->tun_lease.name;
|
||||
|
||||
ipbuf = talloc_size(ctx->pool, IPBUF_SIZE);
|
||||
|
||||
+6
-6
@@ -779,7 +779,12 @@ int common_info_cmd(UserListRep * args, FILE *out, cmd_params_st *params)
|
||||
groupname = NO_GROUP;
|
||||
|
||||
print_pair_value(out, params, "Username", username, "Groupname", groupname, 1);
|
||||
print_pair_value(out, params, "State", args->user[i]->status, "Remote IP", args->user[i]->ip, 1);
|
||||
print_single_value(out, params, "State", args->user[i]->status, 1);
|
||||
if (args->user[i]->has_mtu != 0)
|
||||
print_pair_value(out, params, "Device", args->user[i]->tun, "MTU", int2str(tmpbuf, args->user[i]->mtu), 1);
|
||||
else
|
||||
print_single_value(out, params, "Device", args->user[i]->tun, 1);
|
||||
print_pair_value(out, params, "Remote IP", args->user[i]->ip, "Local Device IP", args->user[i]->local_dev_ip, 1);
|
||||
|
||||
if (args->user[i]->local_ip != NULL && args->user[i]->local_ip[0] != 0 &&
|
||||
args->user[i]->remote_ip != NULL && args->user[i]->remote_ip[0] != 0) {
|
||||
@@ -790,11 +795,6 @@ int common_info_cmd(UserListRep * args, FILE *out, cmd_params_st *params)
|
||||
print_pair_value(out, params, "IPv6", args->user[i]->local_ip6, "P-t-P IPv6", args->user[i]->remote_ip6, 1);
|
||||
}
|
||||
|
||||
if (args->user[i]->has_mtu != 0)
|
||||
print_pair_value(out, params, "Device", args->user[i]->tun, "MTU", int2str(tmpbuf, args->user[i]->mtu), 1);
|
||||
else
|
||||
print_single_value(out, params, "Device", args->user[i]->tun, 1);
|
||||
|
||||
print_single_value(out, params, "User-Agent", args->user[i]->user_agent, 1);
|
||||
|
||||
if (args->user[i]->rx_per_sec > 0 || args->user[i]->tx_per_sec > 0) {
|
||||
|
||||
Reference in New Issue
Block a user