remote-entry-get <start> [<end>]
-Retrieve remote entry (host, port and protocol) for index
-<start> or indices from <start> to <end>+1. Alternatively
-<start> = "all" retrieves all remote entries.
+Retrieve remote entry (host, port, protocol, and status) for index
+<start> or indices from <start> to <end>-1. Alternatively
+<start> = "all" retrieves all remote entries. The index is 0-based.
+If the entry is disabled due to protocol or proxy restrictions
+(i.e., ce->flag & CE_DISABLED == 1), the status is returned as "disabled",
+otherwise it reads "enabled" without quotes.
Example 1:
OpenVPN daemon responds with
- 1,vpn.example.com,1194,udp
- END
+ 1,vpn.example.com,1194,udp,enabled
+ END
Example 2:
OpenVPN daemon responds with
- 1,vpn.example.com,1194,udp
- 2,vpn.example.net,443,tcp-client
+ 1,vpn.example.com,1194,udp,enabled
+ 2,vpn.example.net,443,tcp-client,disabled
END
Example 3:
OpenVPN daemon with 3 connection entries responds with
- 1,vpn.example.com,1194,udp
- 2,vpn.example.com,443,tcp-client
- 3,vpn.example.net,443,udp
+ 0,vpn.example.com,1194,udp,enabled
+ 1,vpn.example.com,443,tcp-client,enabled
+ 2,vpn.example.net,443,udp,enabled
END
COMMAND -- remote (OpenVPN AS 2.1.5/OpenVPN 2.3 or higher)
{
struct connection_entry *ce = l->array[index];
const char *proto = proto2ascii(ce->proto, ce->af, false);
+ const char *status = (ce->flags & CE_DISABLED) ? "disabled" : "enabled";
- /* space for output including 2 commas and a nul */
- int len = strlen(ce->remote) + strlen(ce->remote_port) + strlen(proto) + 2 + 1;
+ /* space for output including 3 commas and a nul */
+ int len = strlen(ce->remote) + strlen(ce->remote_port) + strlen(proto)
+ + strlen(status) + 3 + 1;
char *out = malloc(len);
check_malloc_return(out);
- openvpn_snprintf(out, len, "%s,%s,%s", ce->remote, ce->remote_port, proto);
+ openvpn_snprintf(out, len, "%s,%s,%s,%s", ce->remote, ce->remote_port, proto, status);
*remote = out;
}
else