mirror of
https://github.com/OpenVPN/openvpn.git
synced 2025-05-08 21:25:53 +08:00
Added actual remote address used to the ">STATE" alert
in the management interface (Rolf Fokkens). git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@701 e7ae566f-a301-0410-adde-c780ea21d3b5
This commit is contained in:
parent
dd1047f521
commit
5ad84585de
@ -18,6 +18,8 @@ $Id$
|
||||
interface to provide a general interface for sending
|
||||
alerts to the end-user. Used by the PKCS#11 code
|
||||
to send Token Insertion Requests to the user.
|
||||
* Added actual remote address used to the ">STATE" alert
|
||||
in the management interface (Rolf Fokkens).
|
||||
|
||||
2005.10.17 -- Version 2.1-beta4
|
||||
|
||||
|
@ -194,6 +194,7 @@ check_connection_established_dowork (struct context *c)
|
||||
management_set_state (management,
|
||||
OPENVPN_STATE_GET_CONFIG,
|
||||
NULL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
|
6
init.c
6
init.c
@ -627,15 +627,18 @@ initialization_sequence_completed (struct context *c, const unsigned int flags)
|
||||
if (management)
|
||||
{
|
||||
in_addr_t tun_local = 0;
|
||||
in_addr_t tun_remote = 0; /* FKS */
|
||||
const char *detail = "SUCCESS";
|
||||
if (c->c1.tuntap)
|
||||
tun_local = c->c1.tuntap->local;
|
||||
tun_remote = htonl (c->c1.link_socket_addr.actual.dest.sa.sin_addr.s_addr);
|
||||
if (flags & ISC_ERRORS)
|
||||
detail = "ERROR";
|
||||
management_set_state (management,
|
||||
OPENVPN_STATE_CONNECTED,
|
||||
detail,
|
||||
tun_local);
|
||||
tun_local,
|
||||
tun_remote);
|
||||
if (tun_local)
|
||||
management_post_tunnel_open (management, tun_local);
|
||||
}
|
||||
@ -2304,6 +2307,7 @@ open_management (struct context *c)
|
||||
management_set_state (management,
|
||||
OPENVPN_STATE_CONNECTING,
|
||||
NULL,
|
||||
(in_addr_t)0,
|
||||
(in_addr_t)0);
|
||||
}
|
||||
|
||||
|
10
manage.c
10
manage.c
@ -451,7 +451,8 @@ man_state (struct management *man, const char *parm)
|
||||
"state",
|
||||
man->persist.state,
|
||||
&man->connection.state_realtime,
|
||||
LOG_PRINT_INT_DATE|LOG_PRINT_STATE|LOG_PRINT_LOCAL_IP);
|
||||
LOG_PRINT_INT_DATE|LOG_PRINT_STATE|
|
||||
LOG_PRINT_LOCAL_IP|LOG_PRINT_REMOTE_IP);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1357,7 +1358,8 @@ void
|
||||
management_set_state (struct management *man,
|
||||
const int state,
|
||||
const char *detail,
|
||||
const in_addr_t tun_local_ip)
|
||||
const in_addr_t tun_local_ip,
|
||||
const in_addr_t tun_remote_ip)
|
||||
{
|
||||
if (man->persist.state && (!man->settings.server || state < OPENVPN_STATE_CLIENT_BASE))
|
||||
{
|
||||
@ -1371,6 +1373,7 @@ management_set_state (struct management *man,
|
||||
e.u.state = state;
|
||||
e.string = detail;
|
||||
e.local_ip = tun_local_ip;
|
||||
e.remote_ip = tun_remote_ip;
|
||||
|
||||
log_history_add (man->persist.state, &e);
|
||||
|
||||
@ -1379,6 +1382,7 @@ management_set_state (struct management *man,
|
||||
| LOG_PRINT_INT_DATE
|
||||
| LOG_PRINT_STATE
|
||||
| LOG_PRINT_LOCAL_IP
|
||||
| LOG_PRINT_REMOTE_IP
|
||||
| LOG_PRINT_CRLF, &gc);
|
||||
|
||||
if (out)
|
||||
@ -2087,6 +2091,8 @@ log_entry_print (const struct log_entry *e, unsigned int flags, struct gc_arena
|
||||
buf_printf (&out, "%s", e->string);
|
||||
if (flags & LOG_PRINT_LOCAL_IP)
|
||||
buf_printf (&out, ",%s", print_in_addr_t (e->local_ip, IA_EMPTY_IF_UNDEF, gc));
|
||||
if (flags & LOG_PRINT_REMOTE_IP)
|
||||
buf_printf (&out, ",%s", print_in_addr_t (e->remote_ip, IA_EMPTY_IF_UNDEF, gc));
|
||||
if (flags & LOG_PRINT_CRLF)
|
||||
buf_printf (&out, "\r\n");
|
||||
return BSTR (&out);
|
||||
|
6
manage.h
6
manage.h
@ -97,6 +97,7 @@ struct log_entry
|
||||
time_t timestamp;
|
||||
const char *string;
|
||||
in_addr_t local_ip;
|
||||
in_addr_t remote_ip;
|
||||
union log_entry_union u;
|
||||
};
|
||||
|
||||
@ -114,6 +115,8 @@ struct log_entry
|
||||
|
||||
#define LOG_PRINT_INTVAL (1<<9)
|
||||
|
||||
#define LOG_PRINT_REMOTE_IP (1<<10)
|
||||
|
||||
const char *log_entry_print (const struct log_entry *e, unsigned int flags, struct gc_arena *gc);
|
||||
|
||||
struct log_history
|
||||
@ -325,7 +328,8 @@ management_query_user_pass_enabled (const struct management *man)
|
||||
void management_set_state (struct management *man,
|
||||
const int state,
|
||||
const char *detail,
|
||||
const in_addr_t tun_local_ip);
|
||||
const in_addr_t tun_local_ip,
|
||||
const in_addr_t tun_remote_ip);
|
||||
|
||||
/*
|
||||
* The management object keeps track of OpenVPN --echo
|
||||
|
@ -314,9 +314,10 @@ The output format consists of 4 comma-separated parameters:
|
||||
(a) the integer unix date/time,
|
||||
(b) the state name,
|
||||
(c) optional descriptive string (used mostly on RECONNECTING
|
||||
and EXITING to show the reason for the disconnect), and
|
||||
and EXITING to show the reason for the disconnect),
|
||||
(d) optional TUN/TAP local IP address (shown for ASSIGN_IP
|
||||
and CONNECTED).
|
||||
and CONNECTED), and
|
||||
(e) optional address of remote server (OpenVPN 2.1 or higher).
|
||||
|
||||
Real-time state notifications will have a ">STATE:" prefix
|
||||
prepended to them.
|
||||
|
1
route.c
1
route.c
@ -622,6 +622,7 @@ add_routes (struct route_list *rl, const struct tuntap *tt, unsigned int flags,
|
||||
management_set_state (management,
|
||||
OPENVPN_STATE_ADD_ROUTES,
|
||||
NULL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
|
1
sig.c
1
sig.c
@ -167,6 +167,7 @@ signal_restart_status (const struct signal_info *si)
|
||||
management_set_state (management,
|
||||
state,
|
||||
si->signal_text ? si->signal_text : signal_name (si->signal_received, true),
|
||||
(in_addr_t)0,
|
||||
(in_addr_t)0);
|
||||
}
|
||||
#endif
|
||||
|
2
ssl.c
2
ssl.c
@ -2878,6 +2878,7 @@ tls_process (struct tls_multi *multi,
|
||||
management_set_state (management,
|
||||
OPENVPN_STATE_WAIT,
|
||||
NULL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
@ -3562,6 +3563,7 @@ tls_pre_decrypt (struct tls_multi *multi,
|
||||
management_set_state (management,
|
||||
OPENVPN_STATE_AUTH,
|
||||
NULL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user