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
management_set_state (management,
OPENVPN_STATE_GET_CONFIG,
NULL,
+ 0,
0);
}
#endif
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);
}
management_set_state (management,
OPENVPN_STATE_CONNECTING,
NULL,
+ (in_addr_t)0,
(in_addr_t)0);
}
"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
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))
{
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);
| LOG_PRINT_INT_DATE
| LOG_PRINT_STATE
| LOG_PRINT_LOCAL_IP
+ | LOG_PRINT_REMOTE_IP
| LOG_PRINT_CRLF, &gc);
if (out)
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);
time_t timestamp;
const char *string;
in_addr_t local_ip;
+ in_addr_t remote_ip;
union log_entry_union u;
};
#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
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
(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.
management_set_state (management,
OPENVPN_STATE_ADD_ROUTES,
NULL,
+ 0,
0);
}
#endif
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
management_set_state (management,
OPENVPN_STATE_WAIT,
NULL,
+ 0,
0);
}
#endif
management_set_state (management,
OPENVPN_STATE_AUTH,
NULL,
+ 0,
0);
}
#endif
management_set_state (management,
OPENVPN_STATE_ASSIGN_IP,
NULL,
- tt->local);
+ tt->local,
+ 0);
}
#endif