aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-10-20 19:00:56 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-10-20 19:00:56 +0000
commit5ad84585debfe8ce3569be759d2f34a261a38a54 (patch)
treebd765379f20dfd5bbb23eaa374abbd464645daf7
parentSome changes to GET_USER_PASS_NEED_OK flag to (diff)
downloadopenvpn-5ad84585debfe8ce3569be759d2f34a261a38a54.tar.xz
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
-rw-r--r--ChangeLog2
-rw-r--r--forward.c1
-rw-r--r--init.c6
-rw-r--r--manage.c10
-rw-r--r--manage.h6
-rw-r--r--management/management-notes.txt5
-rw-r--r--route.c1
-rw-r--r--sig.c1
-rw-r--r--ssl.c2
-rw-r--r--tun.c3
10 files changed, 30 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index cef9c09..d7ca65d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/forward.c b/forward.c
index 23edfc8..9146aa1 100644
--- a/forward.c
+++ b/forward.c
@@ -194,6 +194,7 @@ check_connection_established_dowork (struct context *c)
management_set_state (management,
OPENVPN_STATE_GET_CONFIG,
NULL,
+ 0,
0);
}
#endif
diff --git a/init.c b/init.c
index 156be8e..fa57a33 100644
--- a/init.c
+++ b/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);
}
diff --git a/manage.c b/manage.c
index 89e115e..a645b02 100644
--- a/manage.c
+++ b/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);
diff --git a/manage.h b/manage.h
index 310f460..dce08e8 100644
--- a/manage.h
+++ b/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
diff --git a/management/management-notes.txt b/management/management-notes.txt
index 1dc2913..292f733 100644
--- a/management/management-notes.txt
+++ b/management/management-notes.txt
@@ -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.
diff --git a/route.c b/route.c
index a0ae19b..5bde6a6 100644
--- a/route.c
+++ b/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
diff --git a/sig.c b/sig.c
index a827d1d..7279b82 100644
--- a/sig.c
+++ b/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
diff --git a/ssl.c b/ssl.c
index 8a7f0a3..a9d4daa 100644
--- a/ssl.c
+++ b/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
diff --git a/tun.c b/tun.c
index 7fd0c51..a518e4e 100644
--- a/tun.c
+++ b/tun.c
@@ -546,7 +546,8 @@ do_ifconfig (struct tuntap *tt,
management_set_state (management,
OPENVPN_STATE_ASSIGN_IP,
NULL,
- tt->local);
+ tt->local,
+ 0);
}
#endif