29#ifdef ENABLE_MANAGEMENT
53#define MANAGEMENT_ECHO_PULL_INFO 0
55#if MANAGEMENT_ECHO_PULL_INFO
56#define MANAGEMENT_ECHO_FLAGS LOG_PRINT_INTVAL
58#define MANAGEMENT_ECHO_FLAGS 0
76 msg(
M_CLIENT,
"auth-retry t : Auth failure retry mode (none,interact,nointeract).");
77 msg(
M_CLIENT,
"bytecount n : Show bytes in/out, update every n secs (0=off).");
78 msg(
M_CLIENT,
"echo [on|off] [N|all] : Like log, but only show messages in echo buffer.");
80 "cr-response response : Send a challenge response answer via CR_RESPONSE to server");
81 msg(
M_CLIENT,
"exit|quit : Close management session.");
82 msg(
M_CLIENT,
"forget-passwords : Forget passwords entered so far.");
84 msg(
M_CLIENT,
"hold [on|off|release] : Set/show hold flag to on/off state, or");
85 msg(
M_CLIENT,
" release current hold and start tunnel.");
86 msg(
M_CLIENT,
"kill cn : Kill the client instance(s) having common name cn.");
87 msg(
M_CLIENT,
"kill IP:port : Kill the client instance connecting from IP:port.");
88 msg(
M_CLIENT,
"load-stats : Show global server load stats.");
89 msg(
M_CLIENT,
"log [on|off] [N|all] : Turn on/off realtime log display");
90 msg(
M_CLIENT,
" + show last N lines or 'all' for entire history.");
92 "mute [n] : Set log mute level to n, or show level if n is absent.");
93 msg(
M_CLIENT,
"needok type action : Enter confirmation for NEED-OK request of 'type',");
95 msg(
M_CLIENT,
"needstr type action : Enter confirmation for NEED-STR request of 'type',");
97 msg(
M_CLIENT,
"net : (Windows only) Show network info and routing table.");
98 msg(
M_CLIENT,
"password type p : Enter password p for a queried OpenVPN password.");
99 msg(
M_CLIENT,
"remote type [host port] : Override remote directive, type=ACCEPT|MOD|SKIP.");
100 msg(
M_CLIENT,
"remote-entry-count : Get number of available remote entries.");
101 msg(
M_CLIENT,
"remote-entry-get i|all [j]: Get remote entry at index = i to to j-1 or all.");
102 msg(
M_CLIENT,
"proxy type [host port flags] : Enter dynamic proxy server info.");
103 msg(
M_CLIENT,
"pid : Show process ID of the current OpenVPN process.");
105 msg(
M_CLIENT,
"pkcs11-id-count : Get number of available PKCS#11 identities.");
106 msg(
M_CLIENT,
"pkcs11-id-get index : Get PKCS#11 identity at index.");
108 msg(
M_CLIENT,
"client-auth CID KID : Authenticate client-id/key-id CID/KID (MULTILINE)");
109 msg(
M_CLIENT,
"client-auth-nt CID KID : Authenticate client-id/key-id CID/KID");
111 "client-deny CID KID R [CR] : Deny auth client-id/key-id CID/KID with log reason");
112 msg(
M_CLIENT,
" text R and optional client reason text CR");
114 "client-pending-auth CID KID MSG timeout : Instruct OpenVPN to send AUTH_PENDING and INFO_PRE msg");
116 " to the client and wait for a final client-auth/client-deny");
117 msg(
M_CLIENT,
"client-kill CID [M] : Kill client instance CID with message M (def=RESTART)");
118 msg(
M_CLIENT,
"env-filter [level] : Set env-var filter level");
119 msg(
M_CLIENT,
"rsa-sig : Enter a signature in response to >RSA_SIGN challenge");
121 " Enter signature base64 on subsequent lines followed by END");
122 msg(
M_CLIENT,
"pk-sig : Enter a signature in response to >PK_SIGN challenge");
124 " Enter signature base64 on subsequent lines followed by END");
126 "certificate : Enter a client certificate in response to >NEED-CERT challenge");
128 " Enter certificate base64 on subsequent lines followed by END");
129 msg(
M_CLIENT,
"signal s : Send signal s to daemon,");
130 msg(
M_CLIENT,
" s = SIGHUP|SIGTERM|SIGUSR1|SIGUSR2.");
131 msg(
M_CLIENT,
"state [on|off] [N|all] : Like log, but show state history.");
132 msg(
M_CLIENT,
"status [n] : Show current daemon status info using format #n.");
133 msg(
M_CLIENT,
"test n : Produce n lines of output for testing/debugging.");
134 msg(
M_CLIENT,
"username type u : Enter username u for a queried OpenVPN username.");
135 msg(
M_CLIENT,
"verb [n] : Set log verbosity level to n, or show if n is absent.");
136 msg(
M_CLIENT,
"version [n] : Set client's version to n or show current version of daemon.");
137 msg(
M_CLIENT,
"push-update-broad options : Broadcast a message to update the specified options.");
138 msg(
M_CLIENT,
" Ex. push-update-broad \"route something, -dns\"");
139 msg(
M_CLIENT,
"push-update-cid CID options : Send an update message to the client identified by CID.");
173 return "RECONNECTING";
182 return "TCP_CONNECT";
185 return "AUTH_PENDING";
195 msg(
M_CLIENT,
">INFO:OpenVPN Management Interface Version %d -- type 'help' for more info",
231 msg(
M_WARN,
"MAN: client connection rejected after %d failed password attempts",
263 volatile int signal_received = 0;
310 msg(
M_CLIENT,
"SUCCESS: %s command succeeded", command);
314 msg(
M_CLIENT,
"ERROR: %s command failed", command);
324 socket_delete_unix(&man->
settings.local_unix);
349 static int recursive_level = 0;
351#define AF_DID_PUSH (1 << 0)
352#define AF_DID_RESET (1 << 1)
353 if (recursive_level < 5)
357 const char *out = NULL;
358 unsigned int action_flags = 0;
423 printf(
"virtual_output: message to management interface "
424 "dropped due to recursion: <%s>\n",
451 if (s == SIGHUP || s == SIGUSR1)
473 msg(
M_CLIENT,
"ERROR: signal '%s' is currently ignored", name);
482 msg(
M_CLIENT,
"ERROR: signal '%s' is not a known signal type", name);
489 msg(
M_CLIENT,
"ERROR: The '%s' command is not supported by the current daemon mode",
516 if (update_seconds > 0)
548 msg(
M_CLIENT,
"SUCCESS: bytecount interval changed");
601 const int port =
atoi(
p3);
606 if ((port > 0 && port < 65536) && (proto !=
PROTO_NONE))
608 n_killed = (*
man->persist.callback.kill_by_addr)(
man->persist.callback.arg,
618 msg(
M_CLIENT,
"ERROR: client at address %s:%s:%d not found",
625 msg(
M_CLIENT,
"ERROR: port number or protocol out of range: %s %s",
p3,
p1);
636 n_killed = (*
man->persist.callback.kill_by_cn)(
man->persist.callback.arg,
p1);
670 if (
streq(parm,
"on"))
673 msg(
M_CLIENT,
"SUCCESS: real-time %s notification set to ON", type);
675 else if (
streq(parm,
"off"))
678 msg(
M_CLIENT,
"SUCCESS: real-time %s notification set to OFF", type);
680 else if (
streq(parm,
"all") || (n = atoi(parm)) > 0)
683 const int start = (n ? n : size) - 1;
686 for (
i = start;
i >= 0; --
i)
699 msg(
M_CLIENT,
"ERROR: %s parameter must be 'on' or 'off' or some number n or 'all'", type);
758 const char *prompt,
char *dest,
int len)
767 msg(
M_CLIENT,
"SUCCESS: '%s' %s entered, but not yet verified", type, prompt);
771 msg(
M_CLIENT,
"ERROR: %s of type '%s' entered, but we need one of type '%s'", prompt,
777 msg(
M_CLIENT,
"ERROR: no %s is currently needed at this time", prompt);
827 msg(
M_CLIENT,
"SUCCESS: Passwords were forgotten");
849 message, parameters);
869 msg(
M_CLIENT,
">PKCS11ID-COUNT:%d", pkcs11_management_id_count());
873man_pkcs11_id_get(
struct management *man,
const int index)
878 if (pkcs11_management_id_get(index, &
id, &base64))
880 msg(
M_CLIENT,
">PKCS11ID-ENTRY:'%d', ID:'%s', BLOB:'%s'", index,
id, base64);
918 unsigned int from = (
unsigned int)atoi(p1);
919 unsigned int to = p2 ? (
unsigned int)atoi(p2) : from + 1;
921 if (!strcmp(p1,
"all"))
927 for (
unsigned int i = from;
i <
min_uint(to, count);
i++)
951 if (
streq(cmd,
"on"))
956 else if (
streq(cmd,
"off"))
961 else if (
streq(cmd,
"release"))
968 msg(
M_CLIENT,
"ERROR: bad hold command parameter");
1043 if (sscanf(str,
"%lu", cid) == 1)
1057 if (sscanf(str,
"%u", uint) == 1)
1081 const char *extra,
const char *timeout_str)
1083 unsigned long cid = 0;
1084 unsigned int kid = 0;
1085 unsigned int timeout = 0;
1087 &&
parse_uint(timeout_str,
"TIMEOUT", &timeout))
1092 kid, extra, timeout);
1096 msg(
M_CLIENT,
"SUCCESS: client-pending-auth command succeeded");
1100 msg(
M_CLIENT,
"ERROR: client-pending-auth command failed."
1101 " Extra parameter might be too long");
1130 const char *reason,
const char *client_reason)
1132 unsigned long cid = 0;
1133 unsigned int kid = 0;
1142 msg(
M_CLIENT,
"SUCCESS: client-deny command succeeded");
1146 msg(
M_CLIENT,
"ERROR: client-deny command failed");
1159 unsigned long cid = 0;
1168 msg(
M_CLIENT,
"SUCCESS: client-kill command succeeded");
1172 msg(
M_CLIENT,
"ERROR: client-kill command failed");
1200 msg(
M_CLIENT,
"SUCCESS: env_filter_level=%d", level);
1216 msg(
M_CLIENT,
"ERROR: The %s command is not currently available", cmd_name);
1232 msg(
M_CLIENT,
"ERROR: The certificate command is not currently available");
1251#define MN_AT_LEAST (1 << 0)
1267 for (
i = 1;
i <= n; ++
i)
1271 msg(
M_CLIENT,
"ERROR: the '%s' command requires %s%d parameter%s", p[0],
1272 (flags &
MN_AT_LEAST) ?
"at least " :
"", n, n > 1 ?
"s" :
"");
1307#ifdef TARGET_ANDROID
1309man_network_change(
struct management *man,
bool samenetwork)
1320 msg(
M_CLIENT,
"PROTECTFD: fd '%d' sent to be protected", fd);
1361 unsigned long cid = 0;
1365 msg(
M_CLIENT,
"ERROR: push-update-cid fail during cid parsing");
1374 msg(
M_CLIENT,
"SUCCESS: push-update command succeeded");
1377 msg(
M_CLIENT,
"ERROR: push-update command failed");
1387 if (
streq(p[0],
"exit") ||
streq(p[0],
"quit"))
1392 else if (
streq(p[0],
"help"))
1396 else if (
streq(p[0],
"version") && p[1])
1400 else if (
streq(p[0],
"version"))
1406 else if (
streq(p[0],
"pid"))
1410 else if (
streq(p[0],
"nclients"))
1414 else if (
streq(p[0],
"env-filter"))
1423 else if (
streq(p[0],
"signal"))
1430#ifdef TARGET_ANDROID
1431 else if (
streq(p[0],
"network-change"))
1433 bool samenetwork =
false;
1434 if (p[1] &&
streq(p[1],
"samenetwork"))
1439 man_network_change(man, samenetwork);
1442 else if (
streq(p[0],
"load-stats"))
1446 else if (
streq(p[0],
"status"))
1451 version = atoi(p[1]);
1455 else if (
streq(p[0],
"kill"))
1462 else if (
streq(p[0],
"verb"))
1466 const int level = atoi(p[1]);
1473 msg(
M_CLIENT,
"ERROR: verb level is out of range");
1481 else if (
streq(p[0],
"mute"))
1485 const int level = atoi(p[1]);
1492 msg(
M_CLIENT,
"ERROR: mute level is out of range");
1500 else if (
streq(p[0],
"auth-retry"))
1506 msg(
M_CLIENT,
"SUCCESS: auth-retry parameter changed");
1518 else if (
streq(p[0],
"state"))
1536 else if (
streq(p[0],
"log"))
1550 else if (
streq(p[0],
"echo"))
1564 else if (
streq(p[0],
"username"))
1571 else if (
streq(p[0],
"password"))
1578 else if (
streq(p[0],
"forget-passwords"))
1582 else if (
streq(p[0],
"needok"))
1589 else if (
streq(p[0],
"needstr"))
1596 else if (
streq(p[0],
"cr-response"))
1603 else if (
streq(p[0],
"net"))
1607 else if (
streq(p[0],
"hold"))
1611 else if (
streq(p[0],
"bytecount"))
1618 else if (
streq(p[0],
"client-kill"))
1625 else if (
streq(p[0],
"client-deny"))
1632 else if (
streq(p[0],
"client-auth-nt"))
1639 else if (
streq(p[0],
"client-auth"))
1646 else if (
streq(p[0],
"client-pending-auth"))
1653 else if (
streq(p[0],
"rsa-sig"))
1657 else if (
streq(p[0],
"pk-sig"))
1661 else if (
streq(p[0],
"certificate"))
1666 else if (
streq(p[0],
"pkcs11-id-count"))
1668 man_pkcs11_id_count(man);
1670 else if (
streq(p[0],
"pkcs11-id-get"))
1674 man_pkcs11_id_get(man, atoi(p[1]));
1678 else if (
streq(p[0],
"remote-entry-count"))
1682 else if (
streq(p[0],
"remote-entry-get"))
1689 else if (
streq(p[0],
"proxy"))
1696 else if (
streq(p[0],
"remote"))
1703 else if (
streq(p[0],
"push-update-broad"))
1710 else if (
streq(p[0],
"push-update-cid"))
1718 else if (
streq(p[0],
"test"))
1723 const int n = atoi(p[1]);
1724 for (
i = 0;
i < n; ++
i)
1727 "[%d] The purpose of this command is to generate large amounts of output.",
i);
1734 msg(
M_CLIENT,
"ERROR: unknown command [%s], enter 'help' for more options", p[0]);
1797#if UNIX_SOCK_SUPPORT
1801 sockaddr_unix_name(&man->
settings.local_unix,
"NULL"));
1812 struct sockaddr_storage addr;
1813 socklen_t addrlen =
sizeof(addr);
1814 if (!getpeername(man->
connection.
sd_cli, (
struct sockaddr *)&addr, &addrlen))
1837#if UNIX_SOCK_SUPPORT
1843 static const char err_prefix[] =
1844 "MANAGEMENT: unix domain socket client connection rejected --";
1851 "%s UID of socket peer (%d) doesn't match required value (%d) as given by --management-client-user",
1858 "%s GID of socket peer (%d) doesn't match required value (%d) as given by --management-client-group",
1865 msg(
D_MANAGEMENT,
"%s cannot get UID/GID of socket peer", err_prefix);
1882#if UNIX_SOCK_SUPPORT
1885 struct sockaddr_un remote;
1929#if UNIX_SOCK_SUPPORT
1941 "MANAGEMENT",
false);
1949 msg(
M_ERR,
"MANAGEMENT: listen() failed");
1957#if UNIX_SOCK_SUPPORT
1961 sockaddr_unix_name(&man->
settings.local_unix,
"NULL"));
1966 const struct sockaddr *man_addr = man->
settings.
local->ai_addr;
1967 struct sockaddr_storage addr;
1968 socklen_t addrlen =
sizeof(addr);
1969 if (!getsockname(man->
connection.
sd_top, (
struct sockaddr *)&addr, &addrlen))
1971 man_addr = (
struct sockaddr *)&addr;
1994 int signal_received = 0;
2002#if UNIX_SOCK_SUPPORT
2025 if (signal_received)
2033#if UNIX_SOCK_SUPPORT
2037 sockaddr_unix_name(&man->
settings.local_unix,
"NULL"));
2121 if (parms[0] &&
streq(parms[0],
"password"))
2125 else if (!
streq(line,
"load-stats"))
2134 for (
i = 0;
i < nparms; ++
i)
2155 bool crt_error =
false;
2161 msg(
D_MANAGEMENT,
"MANAGEMENT: TCP %s error: %s", prefix, strerror(err));
2171#ifdef TARGET_ANDROID
2173man_send_with_fd(
int fd,
void *ptr,
size_t nbytes,
int flags,
int sendfd)
2175 struct msghdr
msg = { 0 };
2176 struct iovec iov[1];
2181 char control[CMSG_SPACE(
sizeof(
int))];
2183 struct cmsghdr *cmptr;
2185 msg.msg_control = control_un.control;
2186 msg.msg_controllen =
sizeof(control_un.control);
2188 cmptr = CMSG_FIRSTHDR(&
msg);
2189 cmptr->cmsg_len = CMSG_LEN(
sizeof(
int));
2190 cmptr->cmsg_level = SOL_SOCKET;
2191 cmptr->cmsg_type = SCM_RIGHTS;
2192 *((
int *)CMSG_DATA(cmptr)) = sendfd;
2194 msg.msg_name = NULL;
2195 msg.msg_namelen = 0;
2197 iov[0].iov_base = ptr;
2198 iov[0].iov_len = nbytes;
2202 return (sendmsg(fd, &
msg, flags));
2206man_recv_with_fd(
int fd,
void *ptr,
size_t nbytes,
int flags,
int *recvfd)
2208 struct msghdr msghdr = { 0 };
2209 struct iovec iov[1];
2215 char control[CMSG_SPACE(
sizeof(
int))];
2217 struct cmsghdr *cmptr;
2219 msghdr.msg_control = control_un.control;
2220 msghdr.msg_controllen =
sizeof(control_un.control);
2222 msghdr.msg_name = NULL;
2223 msghdr.msg_namelen = 0;
2225 iov[0].iov_base = ptr;
2226 iov[0].iov_len = nbytes;
2227 msghdr.msg_iov = iov;
2228 msghdr.msg_iovlen = 1;
2230 if ((n = recvmsg(fd, &msghdr, flags)) <= 0)
2235 if ((cmptr = CMSG_FIRSTHDR(&msghdr)) != NULL && cmptr->cmsg_len == CMSG_LEN(
sizeof(
int)))
2237 if (cmptr->cmsg_level != SOL_SOCKET)
2239 msg(
M_ERR,
"control level != SOL_SOCKET");
2241 if (cmptr->cmsg_type != SCM_RIGHTS)
2243 msg(
M_ERR,
"control type != SCM_RIGHTS");
2245 *recvfd = *((
int *)CMSG_DATA(cmptr));
2259management_android_control(
struct management *man,
const char *command,
const char *
msg)
2263 msg(
M_FATAL,
"Required management interface not available.");
2267 strncpy(up.username,
msg,
sizeof(up.username) - 1);
2270 return strcmp(
"ok", up.password) == 0;
2280managment_android_persisttun_action(
struct management *man)
2284 strcpy(up.username,
"tunmethod");
2287 if (!strcmp(
"NOACTION", up.password))
2289 return ANDROID_KEEP_OLD_TUN;
2291 else if (!strcmp(
"OPEN_BEFORE_CLOSE", up.password))
2293 return ANDROID_OPEN_BEFORE_CLOSE;
2297 msg(
M_ERR,
"Got unrecognised '%s' from management for PERSIST_TUN_ACTION query",
2302 return ANDROID_OPEN_BEFORE_CLOSE;
2314 unsigned char buf[256];
2317#ifdef TARGET_ANDROID
2334 bool processed_command =
false;
2336 ASSERT(len <= (
int)
sizeof(buf));
2353 if (!strcmp(line,
"END"))
2371 processed_command =
true;
2385 if (processed_command)
2405 const int size_hint = 1024;
2407 const struct buffer *buf;
2411 if (buf &&
BLEN(buf))
2414#ifdef TARGET_ANDROID
2415 if (
man->connection.fdtosend > 0)
2418 man->connection.fdtosend);
2419 man->connection.fdtosend = -1;
2460 const int state_buffer_size)
2518 const char *pass_file,
const char *client_user,
const char *client_group,
2519 const int log_history_cache,
const int echo_buffer_size,
2520 const int state_buffer_size,
const int remap_sigusr1,
const unsigned int flags)
2558#if UNIX_SOCK_SUPPORT
2561 sockaddr_unix_init(&ms->local_unix, addr);
2600 if (remap_sigusr1 == SIGHUP)
2604 else if (remap_sigusr1 == SIGTERM)
2618 freeaddrinfo(ms->
local);
2714 const char *client_user,
const char *client_group,
const int log_history_cache,
2715 const int echo_buffer_size,
const int state_buffer_size,
const int remap_sigusr1,
2716 const unsigned int flags)
2725 log_history_cache, echo_buffer_size, state_buffer_size, remap_sigusr1, flags);
2779 const in_addr_t *tun_local_ip,
const struct in6_addr *tun_local_ip6,
2787 const char *out = NULL;
2834 static const char *env_names[] = {
"username=",
2840 "ifconfig_netmask=",
2841 "daemon_start_time=",
2844 "ifconfig_pool_remote_ip=",
2845 "ifconfig_pool_netmask=",
2852 if (env_filter_level == 0)
2856 else if (env_filter_level <= 1 && !strncmp(env_str,
"X509_", 5))
2860 else if (env_filter_level <= 2)
2863 for (
i = 0;
i <
SIZE(env_names); ++
i)
2865 const char *en = env_names[
i];
2866 const size_t len = strlen(en);
2867 if (!strncmp(env_str, en, len))
2925 msg(
M_CLIENT,
">NOTIFY:%s,%s,%s", severity, type, text);
2940 const char *peer_info =
2955 msg(
D_MANAGEMENT,
"validation failed on peer_info line received from client");
2968 const char *mode =
"CONNECT";
2986 const struct env_set *
es,
const char *response)
2993 msg(
M_CLIENT,
">CLIENT:CR_RESPONSE,%lu,%u,%s", mdac->
cid, mda_key_id, response);
3028 const struct mroute_addr *addr,
const bool primary)
3046 const char *out = NULL;
3085 char buf[INET_ADDRSTRLEN];
3087 ia.s_addr = htonl(tun_local_ip);
3088 inet_ntop(AF_INET, &ia, buf,
sizeof(buf));
3110 msg(
M_CLIENT,
">PASSWORD:Verification Failed: '%s' ['%s']", type, reason);
3114 msg(
M_CLIENT,
">PASSWORD:Verification Failed: '%s'", type);
3129 if (*persistent == (
unsigned int)n)
3142 unsigned int *persistent)
3187 if (net_events & FD_CLOSE)
3195 if (net_events & FD_ACCEPT)
3204 if (net_events & FD_READ)
3212 if (net_events & FD_WRITE)
3216 if (
status < 0 && WSAGetLastError() == WSAEWOULDBLOCK)
3230 unsigned int *persistent)
3299 if (signal_received)
3302 if (*signal_received)
3350 else if (expire &&
now >= expire)
3354 if (signal_received)
3356 *signal_received = SIGINT;
3384 if (signal_received && *signal_received)
3397 const time_t expire)
3411#define MWCC_PASSWORD_WAIT (1 << 0)
3412#define MWCC_HOLD_WAIT (1 << 1)
3413#define MWCC_OTHER_WAIT (1 << 2)
3420 const time_t expire,
unsigned int flags)
3427 msg(
D_MANAGEMENT,
"Need password(s) from management interface, waiting...");
3431 msg(
D_MANAGEMENT,
"Need hold release from management interface, waiting...");
3435 msg(
D_MANAGEMENT,
"Need information from management interface, waiting...");
3440 if (signal_received && *signal_received)
3456 volatile int signal_received = 0;
3472 if (signal_received)
3481 if (!signal_received)
3485 if (signal_received)
3490 }
while (expire && expire >
now);
3506 const unsigned int flags,
const char *static_challenge)
3513 volatile int signal_received = 0;
3517 const char *prefix =
NULL;
3518 unsigned int up_query_mode = 0;
3522 man->persist.standalone_disabled =
false;
3523 man->persist.special_state_msg =
NULL;
3536 prefix =
"NEED-STR";
3542 prefix =
"PASSWORD";
3548 prefix =
"PASSWORD";
3571 if (signal_received)
3582 man->connection.up_query_mode = up_query_mode;
3583 man->connection.up_query_type = type;
3589 if (!signal_received)
3593 if (signal_received)
3598 }
while (!
man->connection.up_query.defined);
3603 man->connection.up_query_type =
NULL;
3605 man->persist.special_state_msg =
NULL;
3610 CLEAR(
man->connection.up_query.password);
3620 man->connection.up_query.nocache = up->
nocache;
3621 *up =
man->connection.up_query;
3636 volatile int signal_received = 0;
3651 alert_msg =
alloc_buf_gc(strlen(b64_data) + strlen(prompt) + 3, &
gc);
3652 buf_printf(&alert_msg,
">%s:%s", prompt, b64_data);
3662 if (signal_received)
3674 if (!signal_received)
3678 if (signal_received)
3690 msg(
M_CLIENT,
"SUCCESS: %s command succeeded", cmd);
3710 const char *prompt,
const char *cmd,
int *
state,
3714 char *result = NULL;
3722 if (buf &&
BLEN(buf) > 0)
3751 if (buf &&
BLEN(buf) > 0)
3770 const char *prompt =
"PK_SIGN";
3771 const char *
desc =
"pk-sign";
3774 if (
man->connection.client_version <= 1)
3776 prompt =
"RSA_SIGN";
3781 if (
man->connection.client_version > 2)
3787 &
man->connection.ext_key_state,
3788 &
man->connection.ext_key_input);
3796 const char prompt_1[] =
"NEED-CERTIFICATE:";
3827 volatile int signal_received = 0;
3838 if (!signal_received)
3842 man->persist.special_state_msg =
BSTR(&out);
3849 if (!signal_received)
3853 if (signal_received)
3857 }
while (!
man->persist.hold_release);
3862 man->persist.special_state_msg =
NULL;
3909 for (
i = 0;
i < len; ++
i)
3925 const char *ret = NULL;
3971 buf_printf(&out,
"%u,", (
unsigned int)
e->timestamp);
4025 free((
char *)
e->string);
4120 if (index >= 0 && index < h->size)
4185 struct timeval null;
bool buffer_list_defined(const struct buffer_list *ol)
Checks if the list is valid and non-empty.
void buffer_list_advance(struct buffer_list *ol, int n)
void free_buf(struct buffer *buf)
void buffer_list_aggregate_separator(struct buffer_list *bl, const size_t max_len, const char *sep)
Aggregates as many buffers as possible from bl in a new buffer of maximum length max_len .
void buf_clear(struct buffer *buf)
void buffer_list_reset(struct buffer_list *ol)
Empty the list ol and frees all the contained buffers.
void buffer_list_aggregate(struct buffer_list *bl, const size_t max)
Aggregates as many buffers as possible from bl in a new buffer of maximum length max_len .
bool buf_printf(struct buffer *buf, const char *format,...)
struct buffer_list * buffer_list_new(void)
Allocate an empty buffer list of capacity max_size.
struct buffer * buffer_list_peek(struct buffer_list *ol)
Retrieve the head buffer.
void buffer_list_free(struct buffer_list *ol)
Frees a buffer list and all the buffers in it.
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
struct buffer alloc_buf(size_t size)
bool buf_parse(struct buffer *buf, const int delim, char *line, const int size)
char * string_alloc(const char *str, struct gc_arena *gc)
void buffer_list_push(struct buffer_list *ol, const char *str)
Allocates and appends a new buffer containing str as data to ol.
void buf_chomp(struct buffer *buf)
bool char_class(const unsigned char c, const unsigned int flags)
int buf_substring_len(const struct buffer *buf, int delim)
static uint8_t * buf_bptr(const struct buffer *buf)
#define ALLOC_OBJ(dptr, type)
static struct buffer clear_buf(void)
Return an empty struct buffer.
static bool buf_copy(struct buffer *dest, const struct buffer *src)
#define ALLOC_ARRAY_CLEAR(dptr, type, n)
static bool buf_copy_excess(struct buffer *dest, struct buffer *src, int len)
#define CC_NEWLINE
newline
static int buf_len(const struct buffer *buf)
static void buf_set_read(struct buffer *buf, const uint8_t *data, size_t size)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
static bool buf_write(struct buffer *dest, const void *src, size_t size)
static bool buf_write_u8(struct buffer *dest, uint8_t data)
static void strncpynt(char *dest, const char *src, size_t maxlen)
static void check_malloc_return(void *p)
static void gc_free(struct gc_arena *a)
#define CC_PRINT
printable (>= 32, != 127)
#define ALLOC_OBJ_CLEAR(dptr, type)
static struct gc_arena gc_new(void)
int memcmp_constant_time(const void *a, const void *b, size_t size)
As memcmp(), but constant-time.
static int dco_get_peer_stats_multi(dco_context_t *dco, const bool raise_sigusr1_on_err)
static int dco_get_peer_stats(struct context *c, const bool raise_sigusr1_on_err)
void setenv_int(struct env_set *es, const char *name, int value)
struct env_set * env_set_create(struct gc_arena *gc)
#define D_MANAGEMENT_DEBUG
struct event_set * event_set_init(int *maxevents, unsigned int flags)
#define EVENT_METHOD_FAST
static void event_free(struct event_set *es)
static int event_wait(struct event_set *es, const struct timeval *tv, struct event_set_return *out, int outlen)
static void event_reset(struct event_set *es)
static void event_ctl(struct event_set *es, event_t event, unsigned int rwflags, void *arg)
void set_nonblock(socket_descriptor_t fd)
counter_type link_write_bytes_global
counter_type link_read_bytes_global
void reset_coarse_timers(struct context *c)
static unsigned int min_uint(unsigned int x, unsigned int y)
static int min_int(int x, int y)
static int modulo_add(int x, int y, int mod)
static SERVICE_STATUS status
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
This is the principal function for testing and triggering recurring timers.
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
void hash_iterator_free(struct hash_iterator *hi)
struct hash_element * hash_iterator_next(struct hash_iterator *hi)
void hash_iterator_init(struct hash *hash, struct hash_iterator *hi)
void management_pre_tunnel_close(struct management *man)
void management_auth_failure(struct management *man, const char *type, const char *reason)
void log_history_close(struct log_history *h)
struct management * management
static void man_status(struct management *man, const int version, struct status_output *so)
static void man_up_finalize(struct management *man)
static bool man_io_error(struct management *man, const char *prefix)
static void man_log(struct management *man, const char *parm)
static void man_reset_client_socket(struct management *man, const bool exiting)
static void man_bytecount(struct management *man, const int update_seconds)
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
static void man_connect(struct management *man)
static int man_write(struct management *man)
void management_check_bytecount_server(struct multi_context *multi)
static bool man_check_for_signals(volatile int *signal_received)
static void man_bytecount_output_server(const counter_type bytes_in_total, const counter_type bytes_out_total, struct man_def_auth_context *mdac)
static void man_output_list_push(struct management *man, const char *str)
void management_socket_set(struct management *man, struct event_set *es, void *arg, unsigned int *persistent)
void command_line_free(struct command_line *cl)
static int man_block(struct management *man, volatile int *signal_received, const time_t expire)
static void man_certificate(struct management *man)
void command_line_next(struct command_line *cl)
static void man_net(struct management *man)
void management_clear_callback(struct management *man)
static void man_persist_init(struct management *man, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size)
char * management_query_cert(struct management *man, const char *cert_name)
static bool man_standalone_ok(const struct management *man)
bool management_hold(struct management *man, int holdtime)
static void man_settings_init(struct man_settings *ms, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
static int log_index(const struct log_history *h, int i)
static void man_connection_clear(struct man_connection *mc)
static void man_start_ne32(struct management *man)
static void man_connection_settings_reset(struct management *man)
static void man_help(void)
static void man_update_io_state(struct management *man)
static void man_bytecount_stop(struct management *man)
static void man_check_password(struct management *man, const char *line)
static bool man_persist_state(unsigned int *persistent, const int n)
static bool man_need(struct management *man, const char **p, const int n, unsigned int flags)
Checks if the correct number of arguments to a management command are present and otherwise prints an...
static void man_connection_init(struct management *man)
static bool env_filter_match(const char *env_str, const int env_filter_level)
static void man_client_pending_auth(struct management *man, const char *cid_str, const char *kid_str, const char *extra, const char *timeout_str)
Will send a notification to the client that succesful authentication will require an additional step ...
static void man_connection_close(struct management *man)
static void man_query_password(struct management *man, const char *type, const char *string)
static void man_client_kill(struct management *man, const char *cid_str, const char *kill_msg)
struct log_history * log_history_init(const int capacity)
static void man_listen(struct management *man)
static void man_stop_ne32(struct management *man)
static void man_query_username(struct management *man, const char *type, const char *string)
static void man_push_update(struct management *man, const char **p, const push_update_type type)
#define MWCC_PASSWORD_WAIT
static void man_dispatch_command(struct management *man, struct status_output *so, const char **p, const int nparms)
static void virtual_output_callback_func(void *arg, const unsigned int flags, const char *str)
static void man_signal(struct management *man, const char *name)
static void man_prompt(struct management *man)
static void man_state(struct management *man, const char *parm)
static void man_client_deny(struct management *man, const char *cid_str, const char *kid_str, const char *reason, const char *client_reason)
static void man_echo(struct management *man, const char *parm)
void management_learn_addr(struct management *management, struct man_def_auth_context *mdac, const struct mroute_addr *addr, const bool primary)
static char * management_query_multiline_flatten(struct management *man, const char *b64_data, const char *prompt, const char *cmd, int *state, struct buffer_list **input)
static void man_proxy(struct management *man, const char **p)
struct command_line * command_line_new(const int buf_len)
struct management * management_init(void)
static void in_extra_reset(struct man_connection *mc, const int mode)
void command_line_reset(struct command_line *cl)
static void man_query_need_str(struct management *man, const char *type, const char *action)
bool management_would_hold(struct management *man)
static int man_read(struct management *man)
static void man_history(struct management *man, const char *parm, const char *type, struct log_history *log, bool *realtime, const unsigned int lep_flags)
bool management_query_user_pass(struct management *man, struct user_pass *up, const char *type, const unsigned int flags, const char *static_challenge)
void command_line_add(struct command_line *cl, const unsigned char *buf, const int len)
static void man_bytecount_output_client(counter_type bytes_in_total, counter_type bytes_out_total)
void log_history_add(struct log_history *h, const struct log_entry *le)
static void log_entry_free_contents(struct log_entry *e)
static int man_mod_signal(const struct management *man, const int signum)
void management_event_loop_n_seconds(struct management *man, int sec)
static void man_persist_close(struct man_persist *mp)
static void man_kill(struct management *man, const char *victim)
void management_close(struct management *man)
static void man_pk_sig(struct management *man, const char *cmd_name)
void management_set_state(struct management *man, const int state, const char *detail, const in_addr_t *tun_local_ip, const struct in6_addr *tun_local_ip6, const struct openvpn_sockaddr *local, const struct openvpn_sockaddr *remote)
static void man_output_list_push_finalize(struct management *man)
static void man_load_stats(struct management *man)
static bool man_password_needed(struct management *man)
static void set_client_version(struct management *man, const char *version)
const char * log_entry_print(const struct log_entry *e, unsigned int flags, struct gc_arena *gc)
void management_auth_token(struct management *man, const char *token)
static void man_accept(struct management *man)
static void man_client_auth(struct management *man, const char *cid_str, const char *kid_str, const bool extra)
static bool parse_cid(const char *str, unsigned long *cid)
static void man_send_cc_message(struct management *man, const char *message, const char *parameters)
static void man_delete_unix_socket(struct management *man)
void management_io(struct management *man)
static void man_wait_for_client_connection(struct management *man, volatile int *signal_received, const time_t expire, unsigned int flags)
static void man_output_peer_info_env(struct management *man, const struct man_def_auth_context *mdac)
bool management_open(struct management *man, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
static void man_welcome(struct management *man)
void management_notify_generic(struct management *man, const char *str)
void management_connection_established(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
static void man_query_need_ok(struct management *man, const char *type, const char *action)
static char * management_query_multiline_flatten_newline(struct management *man, const char *b64_data, const char *prompt, const char *cmd, int *state, struct buffer_list **input)
static void man_output_extra_env(struct management *man, const char *prefix)
void man_persist_client_stats(struct management *man, struct context *c)
static void man_new_connection_post(struct management *man, const char *description)
static void log_history_obj_init(struct log_history *h, int capacity)
static void report_command_status(const bool status, const char *command)
Small function to report the success or failure of a command to the management interface.
static void man_close_socket(struct management *man, const socket_descriptor_t sd)
static bool parse_uint(const char *str, const char *what, unsigned int *uint)
void management_set_callback(struct management *man, const struct management_callback *cb)
void management_notify_client_needing_auth(struct management *management, const unsigned int mda_key_id, struct man_def_auth_context *mdac, const struct env_set *es)
static void man_client_n_clients(struct management *man)
static void man_output_standalone(struct management *man, volatile int *signal_received)
void management_notify_client_cr_response(unsigned mda_key_id, const struct man_def_auth_context *mdac, const struct env_set *es, const char *response)
void management_echo(struct management *man, const char *string, const bool pull)
static const char blank_up[]
static void man_remote_entry_get(struct management *man, const char *p1, const char *p2)
const struct log_entry * log_history_ref(const struct log_history *h, const int index)
static void man_remote_entry_count(struct management *man)
static void man_settings_close(struct man_settings *ms)
void management_check_bytecount_client(struct context *c, struct management *man, struct timeval *timeval)
static void man_env_filter(struct management *man, const int level)
#define MANAGEMENT_ECHO_FLAGS
static void man_output_list_push_str(struct management *man, const char *str)
void management_up_down(struct management *man, const char *updown, const struct env_set *es)
char * management_query_pk_sig(struct management *man, const char *b64_data, const char *algorithm)
static void man_remote(struct management *man, const char **p)
static void man_forget_passwords(struct management *man)
static int man_standalone_event_loop(struct management *man, volatile int *signal_received, const time_t expire)
static void man_process_command(struct management *man, const char *line)
static int management_query_multiline(struct management *man, const char *b64_data, const char *prompt, const char *cmd, int *state, struct buffer_list **input)
static void man_output_env(const struct env_set *es, const bool tail, const int env_filter_level, const char *prefix)
const char * command_line_get(struct command_line *cl)
static void log_history_free_contents(struct log_history *h)
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
static const char * man_state_name(const int state)
void log_history_resize(struct log_history *h, const int capacity)
static void in_extra_dispatch(struct management *man)
static void man_command_unsupported(const char *command_name)
void management_notify(struct management *man, const char *severity, const char *type, const char *text)
void management_post_tunnel_open(struct management *man, const in_addr_t tun_local_ip)
static void man_query_user_pass(struct management *man, const char *type, const char *string, const bool needed, const char *prompt, char *dest, int len)
static void man_hold(struct management *man, const char *cmd)
#define MANSIG_MAP_USR1_TO_TERM
#define OPENVPN_STATE_ADD_ROUTES
#define UP_QUERY_USER_PASS
#define OPENVPN_STATE_INITIAL
#define MF_FORGET_DISCONNECT
#define UP_QUERY_DISABLED
#define MANAGEMENT_STATE_BUFFER_SIZE
#define MANAGEMENT_VERSION
#define OPENVPN_STATE_CONNECTING
#define LOG_PRINT_REMOTE_IP
#define LOG_PRINT_STATE_PREFIX
#define OPENVPN_STATE_RECONNECTING
#define LOG_PRINT_INT_DATE
#define MANSIG_MAP_USR1_TO_HUP
#define LOG_PRINT_ECHO_PREFIX
#define LOG_PRINT_LOCAL_IP
#define MANAGEMENT_ECHO_BUFFER_SIZE
#define DAF_CONNECTION_CLOSED
#define OPENVPN_STATE_CLIENT_BASE
#define OPENVPN_STATE_CONNECTED
#define OPENVPN_STATE_RESOLVE
#define UP_QUERY_NEED_STR
#define OPENVPN_STATE_EXITING
static bool management_connected(const struct management *man)
#define MANAGEMENT_LOG_HISTORY_INITIAL_SIZE
#define OPENVPN_STATE_AUTH_PENDING
static int log_history_size(const struct log_history *h)
#define MANSIG_IGNORE_USR1_HUP
#define OPENVPN_STATE_AUTH
#define LOG_PRINT_LOG_PREFIX
#define OPENVPN_STATE_WAIT
#define DAF_CONNECTION_ESTABLISHED
#define OPENVPN_STATE_ASSIGN_IP
#define MANAGEMENT_N_PASSWORD_RETRIES
#define OPENVPN_STATE_GET_CONFIG
#define MF_CONNECT_AS_CLIENT
#define OPENVPN_STATE_TCP_CONNECT
#define LOG_PRINT_MSG_FLAGS
bool validate_peer_info_line(char *line)
#define GET_USER_PASS_STATIC_CHALLENGE_CONCAT
indicates password and response should be concatenated
#define GET_USER_PASS_PASSWORD_ONLY
#define GET_USER_PASS_STATIC_CHALLENGE_ECHO
SCRV1 protocol – echo response.
#define GET_USER_PASS_NEED_OK
static bool get_user_pass(struct user_pass *up, const char *auth_file, const char *prefix, const unsigned int flags)
Retrieves the user credentials from various sources depending on the flags.
#define GET_USER_PASS_NEED_STR
const char * mroute_addr_print_ex(const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc)
Header file for server-mode related structures and functions.
int get_debug_level(void)
bool set_mute_cutoff(const int cutoff)
const char * msg_flags_string(const unsigned int flags, struct gc_arena *gc)
int get_mute_cutoff(void)
bool set_debug_level(const int level, const unsigned int flags)
static void msg_set_virtual_output(const struct virtual_output *vo)
static bool ignore_sys_error(const int err, bool crt_error)
static int openvpn_errno_maybe_crt(bool *crt_error)
bool auth_retry_set(const int msglevel, const char *option)
const char * auth_retry_print(void)
int parse_line(const char *line, char *p[], const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
const char title_string[]
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
static void update_time(void)
void throw_signal_soft(const int signum, const char *signal_text)
Throw a soft global signal.
const char * signal_name(const int sig, const bool upper)
void throw_signal(const int signum)
Throw a hard signal.
int parse_signal(const char *signame)
static void get_signal(volatile int *sig)
Copy the global signal_received (if non-zero) to the passed-in argument sig.
void sd_close(socket_descriptor_t *sd)
socket_descriptor_t socket_do_accept(socket_descriptor_t sd, struct link_socket_actual *act, const bool nowait)
int openvpn_connect(socket_descriptor_t sd, const struct sockaddr *remote, int connect_timeout, volatile int *signal_received)
void socket_bind(socket_descriptor_t sd, struct addrinfo *local, int ai_family, const char *prefix, bool ipv6only)
socket_descriptor_t create_socket_tcp(struct addrinfo *addrinfo)
in_addr_t getaddr(unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded, struct signal_info *sig_info)
Translate an IPv4 addr or hostname from string form to in_addr_t.
#define openvpn_close_socket(s)
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
int openvpn_getaddrinfo(unsigned int flags, const char *hostname, const char *servname, int resolve_retry_seconds, struct signal_info *sig_info, int ai_family, struct addrinfo **res)
const char * print_sockaddr_ex(const struct sockaddr *sa, const char *separator, const unsigned int flags, struct gc_arena *gc)
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
#define IA_EMPTY_IF_UNDEF
static const char * print_sockaddr(const struct sockaddr *addr, struct gc_arena *gc)
#define GETADDR_MSG_VIRT_OUT
#define GETADDR_HOST_ORDER
static bool addr_defined(const struct openvpn_sockaddr *addr)
#define PS_DONT_SHOW_FAMILY
#define GETADDR_WARN_ON_SIGNAL
void ssl_purge_auth(const bool auth_user_pass_only)
bool ssl_clean_auth_token(void)
Control Channel SSL/Data channel negotiation module.
struct status_output * status_open(const char *filename, const int refresh_freq, const int msglevel, const struct virtual_output *vout, const unsigned int flags)
bool status_close(struct status_output *so)
Wrapper structure for dynamically allocated memory.
int capacity
Size in bytes of memory allocated by malloc().
uint8_t * data
Pointer to the allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
struct tuntap * tuntap
Tun/tap virtual network interface.
Level 2 context containing state that is reset on both SIGHUP and SIGUSR1 restarts.
counter_type link_read_bytes
counter_type link_write_bytes
counter_type dco_read_bytes
struct man_def_auth_context mda_context
counter_type dco_write_bytes
Contains all state information for one tunnel.
struct context_2 c2
Level 2 context.
struct options options
Options loaded from command line or configuration file.
struct context_1 c1
Level 1 context.
Garbage collection arena used to keep track of dynamically allocated memory.
struct openvpn_sockaddr dest
struct in6_addr local_ip6
struct openvpn_sockaddr local_sock
struct openvpn_sockaddr remote_sock
unsigned long in_extra_cid
const char * up_query_type
struct user_pass up_query
socket_descriptor_t sd_top
struct buffer_list * ext_cert_input
unsigned int in_extra_kid
struct openvpn_sockaddr remote
socket_descriptor_t sd_cli
struct buffer_list * ext_key_input
int bytecount_update_seconds
struct buffer_list * in_extra
struct event_timeout bytecount_update_interval
struct net_event_win32 ne32
struct log_history * state
struct management_callback callback
struct virtual_output vout
struct log_history * echo
const char * special_state_msg
bool management_over_tunnel
char *(* get_peer_info)(void *arg, const unsigned long cid)
bool(* client_auth)(void *arg, const unsigned long cid, const unsigned int mda_key_id, const bool auth, const char *reason, const char *client_reason, struct buffer_list *cc_config)
void(* delete_event)(void *arg, event_t event)
bool(* push_update_broadcast)(void *arg, const char *options)
bool(* push_update_by_cid)(void *arg, unsigned long cid, const char *options)
int(* kill_by_addr)(void *arg, const in_addr_t addr, const int port, const int proto)
bool(* client_pending_auth)(void *arg, const unsigned long cid, const unsigned int kid, const char *extra, unsigned int timeout)
int(* n_clients)(void *arg)
void(* status)(void *arg, const int version, struct status_output *so)
bool(* remote_entry_get)(void *arg, unsigned int index, char **remote)
unsigned int(* remote_entry_count)(void *arg)
bool(* send_cc_message)(void *arg, const char *message, const char *parameter)
bool(* proxy_cmd)(void *arg, const char **p)
bool(* remote_cmd)(void *arg, const char **p)
int(* kill_by_cn)(void *arg, const char *common_name)
bool(* kill_by_cid)(void *arg, const unsigned long cid, const char *kill_msg)
void(* show_net)(void *arg, const int msglevel)
struct man_persist persist
struct man_connection connection
struct man_settings settings
Main OpenVPN server state structure.
struct hash * hash
VPN tunnel instances indexed by real address of the remote peer.
struct context top
Storage structure for process-wide configuration.
Server-mode state structure for one single VPN tunnel.
struct context context
The context structure storing state for this VPN tunnel.
char password[USER_PASS_LEN]
char username[USER_PASS_LEN]
unsigned int flags_default
void(* func)(void *arg, const unsigned int flags, const char *str)
SOCKET socket_descriptor_t
static int socket_defined(const socket_descriptor_t sd)
void net_event_win32_init(struct net_event_win32 *ne)
void net_event_win32_close(struct net_event_win32 *ne)
void net_event_win32_reset_write(struct net_event_win32 *ne)
void net_event_win32_start(struct net_event_win32 *ne, long network_events, socket_descriptor_t sd)
void win32_sleep(const int n)
void net_event_win32_reset(struct net_event_win32 *ne)
void net_event_win32_stop(struct net_event_win32 *ne)
static long net_event_win32_get_event_mask(const struct net_event_win32 *ne)
static void net_event_win32_clear_selected_events(struct net_event_win32 *ne, long selected_events)
static struct rw_handle * net_event_win32_get_event(struct net_event_win32 *ne)