extend management interface command "state"
PATCH 1/1 extend management interface command "state"
Currently the state command shows only the tun/tap IPv4 address. The IPv4 address of the remote peer is also displayed. In case you connect via IPv6 it just shows the first 4 bytes of the address in IPv4 notation.
This patch extends the state command, so it handles IPv6 addresses. In addition it also displays the local address and the both port numbers of the connection, e.g.
1447250958,CONNECTED,SUCCESS,10.0.0.2,fd00::1,1193,fd00::2,6492,fdff::1002
--- doc/management-notes.txt | 17 ++++++++++---- src/openvpn/forward.c | 6 +++-- src/openvpn/init.c | 55 +++++++++++++++++++++++++++++++++------------- src/openvpn/manage.c | 27 ++++++++++++++++++----- src/openvpn/manage.h | 10 ++++++--- src/openvpn/route.c | 6 +++-- src/openvpn/sig.c | 6 +++-- src/openvpn/socket.c | 23 +++++++++++++------ src/openvpn/socket.h | 1 + src/openvpn/ssl.c | 12 ++++++---- src/openvpn/tun.c | 6 +++-- 11 files changed, 122 insertions(+), 47 deletions(-)
doc/management-notes.txt +13 -4
@@ -366,14 +366,23 @@ Command examples: same time enable real-time state notification of future state transitions. -The output format consists of 4 comma-separated parameters: +The output format consists of up to 9 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), - (d) optional TUN/TAP local IP address (shown for ASSIGN_IP - and CONNECTED), and - (e) optional address of remote server (OpenVPN 2.1 or higher). + (d) optional TUN/TAP local IPv4 address + (e) optional address of remote server, + (f) optional port of remote server, + (g) optional local address, + (h) optional local port, and + (i) optional TUN/TAP local IPv6 address. + +Fields (e)-(h) are shown for CONNECTED state, +(d) and (i) are shown for ASSIGN_IP and CONNECTED states. + +(e) is available starting from OpenVPN 2.1 +(f)-(i) are available starting from OpenVPN 2.4 Real-time state notifications will have a ">STATE:" prefix prepended to them.
src/openvpn/forward.c +4 -2
@@ -208,8 +208,10 @@ check_connection_established_dowork (struct context *c)management_set_state (management,OPENVPN_STATE_GET_CONFIG ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif /* fire up push request right away (already 1s delayed) */
src/openvpn/init.c +40 -15
80 lines not on this page · raw message
src/openvpn/manage.c +21 -6
@@ -2422,8 +2422,10 @@ 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_remote_ip) + const in_addr_t *tun_local_ip, + const struct in6_addr *tun_local_ip6, + const struct openvpn_sockaddr *local, + const struct openvpn_sockaddr *remote) { if (man->persist.state && (!(man->settings.flags & MF_SERVER) || state < OPENVPN_STATE_CLIENT_BASE)) {
@@ -2436,9 +2438,15 @@ management_set_state (struct management *man, e.timestamp = now; e.u.state = state; e.string = detail; - e.local_ip = tun_local_ip; - e.remote_ip = tun_remote_ip; - +if (tun_local_ip) + e.local_ip = *tun_local_ip; +if (tun_local_ip6) + e.local_ip6 = *tun_local_ip6; +if (local) + e.local_sock = *local; +if (remote) + e.remote_sock = *remote; +log_history_add (man->persist.state, &e);if (man->connection.state_realtime)
@@ -3460,7 +3468,14 @@ log_entry_print (const struct log_entry *e, unsigned int flags, struct gc_arenaif (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)); + { +buf_printf (&out,",%s" ,print_sockaddr_ex (&e->remote_sock.addr.sa,"," , +PS_DONT_SHOW_FAMILY |PS_SHOW_PORT , gc)); +buf_printf (&out,",%s" ,print_sockaddr_ex (&e->local_sock.addr.sa,"," , +PS_DONT_SHOW_FAMILY |PS_SHOW_PORT , gc)); + } +if (flags &LOG_PRINT_LOCAL_IP && !IN6_IS_ADDR_UNSPECIFIED (&e->local_ip6)) +buf_printf (&out,",%s" ,print_in6_addr (e->local_ip6,IA_EMPTY_IF_UNDEF , gc));if (flags &LOG_ECHO_TO_LOG )msg (D_MANAGEMENT ,"MANAGEMENT: %s" ,BSTR (&out));if (flags &LOG_PRINT_CRLF )
src/openvpn/manage.h +7 -3
@@ -88,7 +88,9 @@ struct log_entrytime_t timestamp;const char *string;in_addr_t local_ip; -in_addr_t remote_ip; +struct in6_addr local_ip6; +struct openvpn_sockaddr local_sock; +struct openvpn_sockaddr remote_sock;union log_entry_union u; };
@@ -496,8 +498,10 @@ management_enable_def_auth (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_remote_ip); +const in_addr_t *tun_local_ip, +const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr);/* * The management object keeps track of OpenVPN --echo
src/openvpn/route.c +4 -2
@@ -1092,8 +1092,10 @@ add_routes (struct route_list *rl, struct route_ipv6_list *rl6, const struct tunmanagement_set_state (management,OPENVPN_STATE_ADD_ROUTES ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif
src/openvpn/sig.c +4 -2
@@ -189,8 +189,10 @@ 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); +NULL , +NULL , +NULL , + NULL); }#endif }
src/openvpn/socket.c +16 -7
@@ -363,8 +363,10 @@ openvpn_getaddrinfo (unsigned int flags,management_set_state (management,OPENVPN_STATE_RESOLVE ,NULL , - (in_addr_t )0 , - (in_addr_t)0); +NULL , +NULL , +NULL , + NULL); }#endif
@@ -1244,8 +1246,10 @@ socket_connect (socket_descriptor_t* sd,management_set_state (management,OPENVPN_STATE_TCP_CONNECT ,NULL , - (in_addr_t )0 , - (in_addr_t )0 ); +NULL , +NULL , +NULL , +NULL );#endif /* Set the actual address */
@@ -2368,17 +2372,22 @@ print_sockaddr_ex (const struct sockaddr *sa,switch (sa->sa_family) {case AF_INET : -buf_puts (&out,"[AF_INET]" ); +if (!(flags &PS_DONT_SHOW_FAMILY )) +buf_puts (&out,"[AF_INET]" ); salen =sizeof (struct sockaddr_in ); addr_is_defined = ((struct sockaddr_in *) sa)->sin_addr.s_addr !=0 ;break ;case AF_INET6 : -buf_puts (&out,"[AF_INET6]" ); +if (!(flags &PS_DONT_SHOW_FAMILY )) +buf_puts (&out,"[AF_INET6]" ); salen =sizeof (struct sockaddr_in6 ); addr_is_defined = !IN6_IS_ADDR_UNSPECIFIED (&((struct sockaddr_in6 *) sa)->sin6_addr);break ;case AF_UNSPEC : -return "[AF_UNSPEC]" ; +if (!(flags &PS_DONT_SHOW_FAMILY )) +return "[AF_UNSPEC]" ; +else +return "" ;default :ASSERT (0 ); }
src/openvpn/socket.h +1 -0
@@ -344,6 +344,7 @@ void sd_close (socket_descriptor_t *sd);#define PS_SHOW_PORT (1<<1)#define PS_SHOW_PKTINFO (1<<2)#define PS_DONT_SHOW_ADDR (1<<3) +#define PS_DONT_SHOW_FAMILY (1<<4) const char *print_sockaddr_ex (const struct sockaddr *addr, const char* separator,
src/openvpn/ssl.c +8 -4
@@ -2307,8 +2307,10 @@ tls_process (struct tls_multi *multi,management_set_state (management,OPENVPN_STATE_WAIT ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif }
@@ -3016,8 +3018,10 @@ tls_pre_decrypt (struct tls_multi *multi,management_set_state (management,OPENVPN_STATE_AUTH ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif
src/openvpn/tun.c +4 -2
@@ -709,8 +709,10 @@ do_ifconfig (struct tuntap *tt,management_set_state (management,OPENVPN_STATE_ASSIGN_IP ,NULL , - tt->local, - 0); + &tt->local, + &tt->local_ipv6, +NULL , + NULL); }#endif
--
1.7.9.5
Sophos Technology GmbH, Amalienbadstraẞe 41/Bau 52, D-76227 Karlsruhe, Deutschland
Tel +49 (0)721 25516 0 Fax +49 (0)721 25516 200 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Karlsruhe, Amtsgericht Mannheim HRB 712658
Geschäftsführer: Nicholas Bray, Pino von Kienlin, Wolfgang Hilpert, Jennifer Onslow.
Sophos GmbH, Gustav-Stresemann-Ring 1, 65189 Wiesbaden, Deutschland
Tel +49 (0) 611 5858-0 Fax +49 (0) 611 5858-1042 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 25915 Geschäftsführer: Nicholas Bray, Wolfgang Hilpert, Pino von Kienlin, Jennifer Onslow
PATCH v2 1/1 extend management interface command "state"
Currently the state command shows only the tun/tap IPv4 address. The IPv4 address of the remote peer is also displayed. In case you connect via IPv6 it just shows the first 4 bytes of the address in IPv4 notation.
This patch extends the state command, so it handles IPv6 addresses. In addition it also displays the local address and the both port numbers of the connection, e.g.
1447250958,CONNECTED,SUCCESS,10.0.0.2,fd00::1,1193,fd00::2,6492,fdff::1002
---
Changelog for v2:
Found an issue when the local address on a (UDP) client is not defined. Then a comma is missing from the output because print_sockaddr_ex() is not putting out anything. So, the IPv6 pool address is in the field of the local port if you use a IPv6 pool.
doc/management-notes.txt | 17 ++++++++++---- src/openvpn/forward.c | 6 +++-- src/openvpn/init.c | 55 +++++++++++++++++++++++++++++++++------------- src/openvpn/manage.c | 27 ++++++++++++++++++----- src/openvpn/manage.h | 10 ++++++--- src/openvpn/route.c | 6 +++-- src/openvpn/sig.c | 6 +++-- src/openvpn/socket.c | 23 +++++++++++++------ src/openvpn/socket.h | 1 + src/openvpn/ssl.c | 12 ++++++---- src/openvpn/tun.c | 6 +++-- 11 files changed, 122 insertions(+), 47 deletions(-)
doc/management-notes.txt +13 -4
@@ -366,14 +366,23 @@ Command examples: same time enable real-time state notification of future state transitions. -The output format consists of 4 comma-separated parameters: +The output format consists of up to 9 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), - (d) optional TUN/TAP local IP address (shown for ASSIGN_IP - and CONNECTED), and - (e) optional address of remote server (OpenVPN 2.1 or higher). + (d) optional TUN/TAP local IPv4 address + (e) optional address of remote server, + (f) optional port of remote server, + (g) optional local address, + (h) optional local port, and + (i) optional TUN/TAP local IPv6 address. + +Fields (e)-(h) are shown for CONNECTED state, +(d) and (i) are shown for ASSIGN_IP and CONNECTED states. + +(e) is available starting from OpenVPN 2.1 +(f)-(i) are available starting from OpenVPN 2.4 Real-time state notifications will have a ">STATE:" prefix prepended to them.
src/openvpn/forward.c +4 -2
@@ -208,8 +208,10 @@ check_connection_established_dowork (struct context *c)management_set_state (management,OPENVPN_STATE_GET_CONFIG ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif /* fire up push request right away (already 1s delayed) */
src/openvpn/init.c +40 -15
80 lines not on this page · raw message
src/openvpn/manage.c +21 -6
@@ -2422,8 +2422,10 @@ 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_remote_ip) + const in_addr_t *tun_local_ip, + const struct in6_addr *tun_local_ip6, + const struct openvpn_sockaddr *local, + const struct openvpn_sockaddr *remote) { if (man->persist.state && (!(man->settings.flags & MF_SERVER) || state < OPENVPN_STATE_CLIENT_BASE)) {
@@ -2436,9 +2438,15 @@ management_set_state (struct management *man, e.timestamp = now; e.u.state = state; e.string = detail; - e.local_ip = tun_local_ip; - e.remote_ip = tun_remote_ip; - +if (tun_local_ip) + e.local_ip = *tun_local_ip; +if (tun_local_ip6) + e.local_ip6 = *tun_local_ip6; +if (local) + e.local_sock = *local; +if (remote) + e.remote_sock = *remote; +log_history_add (man->persist.state, &e);if (man->connection.state_realtime)
@@ -3460,7 +3468,14 @@ log_entry_print (const struct log_entry *e, unsigned int flags, struct gc_arenaif (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)); + { +buf_printf (&out,",%s" , (!addr_defined (&e->remote_sock) ?"," : +print_sockaddr_ex (&e->remote_sock.addr.sa,"," ,PS_DONT_SHOW_FAMILY |PS_SHOW_PORT , gc))); +buf_printf (&out,",%s" , (!addr_defined (&e->local_sock) ?"," : +print_sockaddr_ex (&e->local_sock.addr.sa,"," ,PS_DONT_SHOW_FAMILY |PS_SHOW_PORT , gc))); + } +if (flags &LOG_PRINT_LOCAL_IP && !IN6_IS_ADDR_UNSPECIFIED (&e->local_ip6)) +buf_printf (&out,",%s" ,print_in6_addr (e->local_ip6,IA_EMPTY_IF_UNDEF , gc));if (flags &LOG_ECHO_TO_LOG )msg (D_MANAGEMENT ,"MANAGEMENT: %s" ,BSTR (&out));if (flags &LOG_PRINT_CRLF )
src/openvpn/manage.h +7 -3
@@ -88,7 +88,9 @@ struct log_entrytime_t timestamp;const char *string;in_addr_t local_ip; -in_addr_t remote_ip; +struct in6_addr local_ip6; +struct openvpn_sockaddr local_sock; +struct openvpn_sockaddr remote_sock;union log_entry_union u; };
@@ -496,8 +498,10 @@ management_enable_def_auth (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_remote_ip); +const in_addr_t *tun_local_ip, +const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr);/* * The management object keeps track of OpenVPN --echo
src/openvpn/route.c +4 -2
@@ -1093,8 +1093,10 @@ add_routes (struct route_list *rl, struct route_ipv6_list *rl6, const struct tunmanagement_set_state (management,OPENVPN_STATE_ADD_ROUTES ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif
src/openvpn/sig.c +4 -2
@@ -189,8 +189,10 @@ 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); +NULL , +NULL , +NULL , + NULL); }#endif }
src/openvpn/socket.c +16 -7
@@ -363,8 +363,10 @@ openvpn_getaddrinfo (unsigned int flags,management_set_state (management,OPENVPN_STATE_RESOLVE ,NULL , - (in_addr_t )0 , - (in_addr_t)0); +NULL , +NULL , +NULL , + NULL); }#endif
@@ -1244,8 +1246,10 @@ socket_connect (socket_descriptor_t* sd,management_set_state (management,OPENVPN_STATE_TCP_CONNECT ,NULL , - (in_addr_t )0 , - (in_addr_t )0 ); +NULL , +NULL , +NULL , +NULL );#endif /* Set the actual address */
@@ -2371,17 +2375,22 @@ print_sockaddr_ex (const struct sockaddr *sa,switch (sa->sa_family) {case AF_INET : -buf_puts (&out,"[AF_INET]" ); +if (!(flags &PS_DONT_SHOW_FAMILY )) +buf_puts (&out,"[AF_INET]" ); salen =sizeof (struct sockaddr_in ); addr_is_defined = ((struct sockaddr_in *) sa)->sin_addr.s_addr !=0 ;break ;case AF_INET6 : -buf_puts (&out,"[AF_INET6]" ); +if (!(flags &PS_DONT_SHOW_FAMILY )) +buf_puts (&out,"[AF_INET6]" ); salen =sizeof (struct sockaddr_in6 ); addr_is_defined = !IN6_IS_ADDR_UNSPECIFIED (&((struct sockaddr_in6 *) sa)->sin6_addr);break ;case AF_UNSPEC : -return "[AF_UNSPEC]" ; +if (!(flags &PS_DONT_SHOW_FAMILY )) +return "[AF_UNSPEC]" ; +else +return "" ;default :ASSERT (0 ); }
src/openvpn/socket.h +1 -0
@@ -344,6 +344,7 @@ void sd_close (socket_descriptor_t *sd);#define PS_SHOW_PORT (1<<1)#define PS_SHOW_PKTINFO (1<<2)#define PS_DONT_SHOW_ADDR (1<<3) +#define PS_DONT_SHOW_FAMILY (1<<4) const char *print_sockaddr_ex (const struct sockaddr *addr, const char* separator,
src/openvpn/ssl.c +8 -4
@@ -2307,8 +2307,10 @@ tls_process (struct tls_multi *multi,management_set_state (management,OPENVPN_STATE_WAIT ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif }
@@ -3016,8 +3018,10 @@ tls_pre_decrypt (struct tls_multi *multi,management_set_state (management,OPENVPN_STATE_AUTH ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif
src/openvpn/tun.c +4 -2
@@ -711,8 +711,10 @@ do_ifconfig (struct tuntap *tt,management_set_state (management,OPENVPN_STATE_ASSIGN_IP ,NULL , - tt->local, - 0); + &tt->local, + &tt->local_ipv6, +NULL , + NULL); }#endif
--
1.7.9.5
Sophos Technology GmbH, Amalienbadstraẞe 41/Bau 52, D-76227 Karlsruhe, Deutschland
Tel +49 (0)721 25516 0 Fax +49 (0)721 25516 200 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Karlsruhe, Amtsgericht Mannheim HRB 712658
Geschäftsführer: Nicholas Bray, Pino von Kienlin, Wolfgang Hilpert, Jennifer Onslow.
Sophos GmbH, Gustav-Stresemann-Ring 1, 65189 Wiesbaden, Deutschland
Tel +49 (0) 611 5858-0 Fax +49 (0) 611 5858-1042 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 25915 Geschäftsführer: Nicholas Bray, Wolfgang Hilpert, Pino von Kienlin, Jennifer Onslow
PATCH v3 1/1 extend management interface command "state"
Currently the state command shows only the tun/tap IPv4 address. The IPv4 address of the remote peer is also displayed. In case you connect via IPv6 it just shows the first 4 bytes of the address in IPv4 notation.
This patch extends the state command, so it handles IPv6 addresses. In addition it also displays the local address and the both port numbers of the connection, e.g.
1447250958,CONNECTED,SUCCESS,10.0.0.2,fd00::1,1193,fd00::2,6492,fdff::1002
--- doc/management-notes.txt | 17 ++++++++++---- src/openvpn/forward.c | 6 +++-- src/openvpn/init.c | 55 +++++++++++++++++++++++++++++++++------------- src/openvpn/manage.c | 27 ++++++++++++++++++----- src/openvpn/manage.h | 10 ++++++--- src/openvpn/route.c | 6 +++-- src/openvpn/sig.c | 6 +++-- src/openvpn/socket.c | 23 +++++++++++++------ src/openvpn/socket.h | 1 + src/openvpn/ssl.c | 12 ++++++---- src/openvpn/tun.c | 6 +++-- 11 files changed, 122 insertions(+), 47 deletions(-)
doc/management-notes.txt +13 -4
@@ -366,14 +366,23 @@ Command examples: same time enable real-time state notification of future state transitions. -The output format consists of 4 comma-separated parameters: +The output format consists of up to 9 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), - (d) optional TUN/TAP local IP address (shown for ASSIGN_IP - and CONNECTED), and - (e) optional address of remote server (OpenVPN 2.1 or higher). + (d) optional TUN/TAP local IPv4 address + (e) optional address of remote server, + (f) optional port of remote server, + (g) optional local address, + (h) optional local port, and + (i) optional TUN/TAP local IPv6 address. + +Fields (e)-(h) are shown for CONNECTED state, +(d) and (i) are shown for ASSIGN_IP and CONNECTED states. + +(e) is available starting from OpenVPN 2.1 +(f)-(i) are available starting from OpenVPN 2.4 Real-time state notifications will have a ">STATE:" prefix prepended to them.
src/openvpn/forward.c +4 -2
@@ -208,8 +208,10 @@ check_connection_established_dowork (struct context *c)management_set_state (management,OPENVPN_STATE_GET_CONFIG ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif /* fire up push request right away (already 1s delayed) */
src/openvpn/init.c +40 -15
80 lines not on this page · raw message
src/openvpn/manage.c +21 -6
@@ -2422,8 +2422,10 @@ 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_remote_ip) + const in_addr_t *tun_local_ip, + const struct in6_addr *tun_local_ip6, + const struct openvpn_sockaddr *local, + const struct openvpn_sockaddr *remote) { if (man->persist.state && (!(man->settings.flags & MF_SERVER) || state < OPENVPN_STATE_CLIENT_BASE)) {
@@ -2436,9 +2438,15 @@ management_set_state (struct management *man, e.timestamp = now; e.u.state = state; e.string = detail; - e.local_ip = tun_local_ip; - e.remote_ip = tun_remote_ip; - +if (tun_local_ip) + e.local_ip = *tun_local_ip; +if (tun_local_ip6) + e.local_ip6 = *tun_local_ip6; +if (local) + e.local_sock = *local; +if (remote) + e.remote_sock = *remote; +log_history_add (man->persist.state, &e);if (man->connection.state_realtime)
@@ -3460,7 +3468,14 @@ log_entry_print (const struct log_entry *e, unsigned int flags, struct gc_arenaif (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)); + { +buf_printf (&out,",%s" , (!addr_defined (&e->remote_sock) ?"," : +print_sockaddr_ex (&e->remote_sock.addr.sa,"," ,PS_DONT_SHOW_FAMILY |PS_SHOW_PORT , gc))); +buf_printf (&out,",%s" , (!addr_defined (&e->local_sock) ?"," : +print_sockaddr_ex (&e->local_sock.addr.sa,"," ,PS_DONT_SHOW_FAMILY |PS_SHOW_PORT , gc))); + } +if (flags &LOG_PRINT_LOCAL_IP && !IN6_IS_ADDR_UNSPECIFIED (&e->local_ip6)) +buf_printf (&out,",%s" ,print_in6_addr (e->local_ip6,IA_EMPTY_IF_UNDEF , gc));if (flags &LOG_ECHO_TO_LOG )msg (D_MANAGEMENT ,"MANAGEMENT: %s" ,BSTR (&out));if (flags &LOG_PRINT_CRLF )
src/openvpn/manage.h +7 -3
@@ -88,7 +88,9 @@ struct log_entrytime_t timestamp;const char *string;in_addr_t local_ip; -in_addr_t remote_ip; +struct in6_addr local_ip6; +struct openvpn_sockaddr local_sock; +struct openvpn_sockaddr remote_sock;union log_entry_union u; };
@@ -496,8 +498,10 @@ management_enable_def_auth (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_remote_ip); +const in_addr_t *tun_local_ip, +const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr);/* * The management object keeps track of OpenVPN --echo
src/openvpn/route.c +4 -2
@@ -1093,8 +1093,10 @@ add_routes (struct route_list *rl, struct route_ipv6_list *rl6, const struct tunmanagement_set_state (management,OPENVPN_STATE_ADD_ROUTES ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif
src/openvpn/sig.c +4 -2
@@ -189,8 +189,10 @@ 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); +NULL , +NULL , +NULL , + NULL); }#endif }
src/openvpn/socket.c +16 -7
@@ -363,8 +363,10 @@ openvpn_getaddrinfo (unsigned int flags,management_set_state (management,OPENVPN_STATE_RESOLVE ,NULL , - (in_addr_t )0 , - (in_addr_t)0); +NULL , +NULL , +NULL , + NULL); }#endif
@@ -1244,8 +1246,10 @@ socket_connect (socket_descriptor_t* sd,management_set_state (management,OPENVPN_STATE_TCP_CONNECT ,NULL , - (in_addr_t )0 , - (in_addr_t )0 ); +NULL , +NULL , +NULL , +NULL );#endif /* Set the actual address */
@@ -2371,17 +2375,22 @@ print_sockaddr_ex (const struct sockaddr *sa,switch (sa->sa_family) {case AF_INET : -buf_puts (&out,"[AF_INET]" ); +if (!(flags &PS_DONT_SHOW_FAMILY )) +buf_puts (&out,"[AF_INET]" ); salen =sizeof (struct sockaddr_in ); addr_is_defined = ((struct sockaddr_in *) sa)->sin_addr.s_addr !=0 ;break ;case AF_INET6 : -buf_puts (&out,"[AF_INET6]" ); +if (!(flags &PS_DONT_SHOW_FAMILY )) +buf_puts (&out,"[AF_INET6]" ); salen =sizeof (struct sockaddr_in6 ); addr_is_defined = !IN6_IS_ADDR_UNSPECIFIED (&((struct sockaddr_in6 *) sa)->sin6_addr);break ;case AF_UNSPEC : -return "[AF_UNSPEC]" ; +if (!(flags &PS_DONT_SHOW_FAMILY )) +return "[AF_UNSPEC]" ; +else +return "" ;default :ASSERT (0 ); }
src/openvpn/socket.h +1 -0
@@ -344,6 +344,7 @@ void sd_close (socket_descriptor_t *sd);#define PS_SHOW_PORT (1<<1)#define PS_SHOW_PKTINFO (1<<2)#define PS_DONT_SHOW_ADDR (1<<3) +#define PS_DONT_SHOW_FAMILY (1<<4) const char *print_sockaddr_ex (const struct sockaddr *addr, const char* separator,
src/openvpn/ssl.c +8 -4
@@ -2307,8 +2307,10 @@ tls_process (struct tls_multi *multi,management_set_state (management,OPENVPN_STATE_WAIT ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif }
@@ -3016,8 +3018,10 @@ tls_pre_decrypt (struct tls_multi *multi,management_set_state (management,OPENVPN_STATE_AUTH ,NULL , -0 , - 0); +NULL , +NULL , +NULL , + NULL); }#endif
src/openvpn/tun.c +4 -2
@@ -711,8 +711,10 @@ do_ifconfig (struct tuntap *tt,management_set_state (management,OPENVPN_STATE_ASSIGN_IP ,NULL , - tt->local, - 0); + &tt->local, + &tt->local_ipv6, +NULL , + NULL); }#endif
Signature · 1 line
1.7.9.5
[Openvpn-devel] [PATCH applied] Re: extend management interface command state
Your patch has been applied to the master branch.
commit 2191c4716537b3d3e81b0e746f666dd365b65abd
Author: Heiko Hund Date: Wed Nov 25 13:57:00 2015 +0100
extend management interface command state
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10603
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Re: [Openvpn-devel] [PATCH applied] Re: extend management interface command state
hi,
Quoted 5 lines · Gert Doering
Your patch has been applied to the master branch.
commit
2191c4716537b3d3e81b0e746f666dd365b65abdAuthor: Heiko Hund Date: Wed Nov 25 13:57:00 2015 +0100
... and while it works nicely on Linux, it blows off all the BSDs...
+init.o init.cinit.c: In function 'initialization_sequence_completed':
init.c:1296: error: 'struct in_addr' has no member named 'ipi_spec_dst' *** Error code 1
socket.c suggests that there are two variants of this; IP_PKTINFO and IP_RECVDSTADDR, and ipi_spec_dst belongs to IP_PKTINFO...
case AF_INET:
{
struct openvpn_sockaddr sa;
CLEAR (sa);
sa.addr.in4.sin_family = AF_INET;
#ifdef IP_PKTINFO
sa.addr.in4.sin_addr = act->pi.in4.ipi_spec_dst;
if_indextoname(act->pi.in4.ipi_ifindex, ifname);
#elif defined(IP_RECVDSTADDR)
sa.addr.in4.sin_addr = act->pi.in4;
ifname[0]=0;(don't we all love socket programming?)
can you send a followup patch, or shall I tackle this (having the BSDs to test)? How can I see if this actually works?
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Re: [Openvpn-devel] [PATCH applied] Re: extend management interface command state
Quoted 2 lines · On Saturday 28 November 2015 15:07:44 Gert Doering wrote:
can you send a followup patch, or shall I tackle this (having the BSDs to test)? How can I see if this actually works?
I can do the fix, but would send it to you for verification first because I have no BSDs around. OK?
Heiko
Re: [Openvpn-devel] [PATCH applied] Re: extend management interface command state
Quoted 6 lines · On Tuesday 8 December 2015 16:48:56 Heiko Hund wrote:
Quoted 2 lines · On Saturday 28 November 2015 15:07:44 Gert Doering wrote:
can you send a followup patch, or shall I tackle this (having the BSDs to test)? How can I see if this actually works?
I can do the fix, but would send it to you for verification first because I have no BSDs around. OK?
Ok, nevermind. Caught up with the list and discovered that you already took care of it. Thanks and sorry for the troubles.
Heiko
Gert Doering
Acked-by Arne SchwabeRe: [Openvpn-devel] [PATCH applied] Re: extend management interface command state
In reply to Heiko HundHi,
Quoted 6 lines · Heiko Hund
Quoted 2 lines · On Saturday 28 November 2015 15:07:44 Gert Doering wrote:
can you send a followup patch, or shall I tackle this (having the BSDs to test)? How can I see if this actually works?
I can do the fix, but would send it to you for verification first because I have no BSDs around. OK?
commit 4a82a9ac0bef6db58858a42b4dc500ae9e09682d
Author: Gert Doering <[email protected]...> Date: Sat Nov 28 20:58:37 2015 +0100
Un-break compilation on *BSD
Commit 2191c47165 introduced code to handle IP address query on multihoming hosts for IP_PKTINFO-supporting OSes, but all the BSDs need the "#elsif IP_RECVDSTADDR" variant... add code equivalent to what we have in socket.c/print_link_socket_actual_ex()
Tested on FreeBSD 9.3/sparc64
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10648
So, "already done" ;-)
(And it uncovered that --multihome is actually broken for IPv6 on some of the BSDs today, while it works correctly for IPv4... opened trac #634 on it)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...PATCH 1/1 Un-break compilation on *BSD
In reply to Heiko HundCommit 2191c47165 introduced code to handle IP address query on multihoming hosts for IP_PKTINFO-supporting OSes, but all the BSDs need the "#elsif IP_RECVDSTADDR" variant... add code equivalent to what we have in socket.c/print_link_socket_actual_ex()
Tested on FreeBSD 9.3/sparc64
--- src/openvpn/init.c | 4 ++++ 1 file changed, 4 insertions(+)
src/openvpn/init.c +4 -0
@@ -1293,7 +1293,11 @@ initialization_sequence_completed (struct context *c, const unsigned int flags)switch (local.addr.sa.sa_family) {case AF_INET : +#ifdef IP_PKTINFO local.addr.in4.sin_addr = actual->pi.in4.ipi_spec_dst; +#else + local.addr.in4.sin_addr = actual->pi.in4; +#endif break ;case AF_INET6 : local.addr.in6.sin6_addr = actual->pi.in6.ipi6_addr;
Signature · 1 line
2.6.2
Re: [Openvpn-devel] [PATCH] Un-break compilation on *BSD
Am 28.11.15 um 20:58 schrieb Gert Doering:
Quoted 5 lines
Commit
2191c47165introduced code to handle IP address query on multihoming hosts for IP_PKTINFO-supporting OSes, but all the BSDs need the "#elsifIP_RECVDSTADDR" variant... add code equivalent to what we have in socket.c/print_link_socket_actual_ex()
ACK code looks sane.
Arne
[Openvpn-devel] [PATCH applied] Re: Un-break compilation on *BSD
In reply to Gert DoeringThanks for review. Patch has been applied to the master branch.
commit 4a82a9ac0bef6db58858a42b4dc500ae9e09682d (master)
Author: Gert Doering Date: Sat Nov 28 20:58:37 2015 +0100
Un-break compilation on *BSD
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/10648--
kind regards,
Gert Doering
A message that is not in the archive (sent off-list or not yet received): [email protected]...
Quoted 13 lines · On Wednesday 25 November 2015 16:14:49 Arne Schwabe wrote:
Am 11.11.15 um 16:09 schrieb Heiko Hund:
Quoted 12 lines
and EXITING to show the reason for the disconnect),
doc/management-notes.txt +7
-3- (d) optional TUN/TAP local IP address (shown for ASSIGN_IP - and CONNECTED), and - (e) optional address of remote server (OpenVPN 2.1 or higher). + (d) optional TUN/TAP local IPv4 address + (e) optional address of remote server, + (f) optional port of remote server, + (g) optional local address, + (h) optional local port, and + (i) optional TUN/TAP local IPv6 address. +
Quoted 8 lines
doc/management-notes.txt Command examples: · line 385
Quoted 5 lines
doc/management-notes.txt +5
-0+Fields (e)-(h) are shown for CONNECTED state, +(d) and (i) are shown for ASSIGN_IP and CONNECTED states. + +(e) is available starting from OpenVPN 2.1 +(f)-(i) are available starting from OpenVPN 2.4Should we add a note that e,f are the connect time and changed because of --float? Otherwise ACK from me.
I don't know, anyone else? Another option could be to "connect" again after floating if this is not done at the moment. But then I think think that would be outside of the scope of this patch.
Heiko
Sophos Technology GmbH, Amalienbadstraẞe 41/Bau 52, D-76227 Karlsruhe, Deutschland
Tel +49 (0)721 25516 0 Fax +49 (0)721 25516 200 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Karlsruhe, Amtsgericht Mannheim HRB 712658
Geschäftsführer: Nicholas Bray, Pino von Kienlin, Wolfgang Hilpert, Jennifer Onslow.
Sophos GmbH, Gustav-Stresemann-Ring 1, 65189 Wiesbaden, Deutschland
Tel +49 (0) 611 5858-0 Fax +49 (0) 611 5858-1042 E-Mail [email protected]... www.sophos.de
Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 25915 Geschäftsführer: Nicholas Bray, Wolfgang Hilpert, Pino von Kienlin, Jennifer Onslow
Am 11.11.15 um 16:09 schrieb Heiko Hund:
Quoted 6 lines
and EXITING to show the reason for the disconnect),
doc/management-notes.txt +2
-3- (d) optional TUN/TAP local IP address (shown for ASSIGN_IP - and CONNECTED), and - (e) optional address of remote server (OpenVPN 2.1 or higher). + (d) optional TUN/TAP local IPv4 address + (e) optional address of remote server,
doc/management-notes.txt Command examples: · line 385
Quoted 10 lines
doc/management-notes.txt +10
-0+ (f) optional port of remote server, + (g) optional local address, + (h) optional local port, and + (i) optional TUN/TAP local IPv6 address. + +Fields (e)-(h) are shown for CONNECTED state, +(d) and (i) are shown for ASSIGN_IP and CONNECTED states. + +(e) is available starting from OpenVPN 2.1 +(f)-(i) are available starting from OpenVPN 2.4
Should we add a note that e,f are the connect time and changed because of --float? Otherwise ACK from me.
Arne