@@ -1177,9 +1177,9 @@ process_incoming_link_part2(struct context *c, struct link_socket_info *lsi, con
*
* Also, update the persisted version of our packet-id.
*/
- if (!TLS_MODE(c))
+ if (!TLS_MODE(c) && c->c2.buf.len > 0)
{
- link_socket_set_outgoing_addr(&c->c2.buf, lsi, &c->c2.from, NULL, c->c2.es);
+ link_socket_set_outgoing_addr(lsi, &c->c2.from, NULL, c->c2.es);
}
/* reset packet received timer */
@@ -2450,8 +2450,7 @@ ipchange_fmt(const bool include_cmd, struct argv *argv, const struct link_socket
}
void
-link_socket_connection_initiated(const struct buffer *buf,
- struct link_socket_info *info,
+link_socket_connection_initiated(struct link_socket_info *info,
const struct link_socket_actual *act,
const char *common_name,
struct env_set *es)
@@ -435,8 +435,7 @@ in_addr_t link_socket_current_remote(const struct link_socket_info *info);
const struct in6_addr *link_socket_current_remote_ipv6
(const struct link_socket_info *info);
-void link_socket_connection_initiated(const struct buffer *buf,
- struct link_socket_info *info,
+void link_socket_connection_initiated(struct link_socket_info *info,
const struct link_socket_actual *addr,
const char *common_name,
struct env_set *es);
@@ -984,29 +983,25 @@ link_socket_get_outgoing_addr(struct buffer *buf,
}
static inline void
-link_socket_set_outgoing_addr(const struct buffer *buf,
- struct link_socket_info *info,
+link_socket_set_outgoing_addr(struct link_socket_info *info,
const struct link_socket_actual *act,
const char *common_name,
struct env_set *es)
{
- if (!buf || buf->len > 0)
+ struct link_socket_addr *lsa = info->lsa;
+ if (
+ /* new or changed address? */
+ (!info->connection_established
+ || !addr_match_proto(&act->dest, &lsa->actual.dest, info->proto)
+ )
+ &&
+ /* address undef or address == remote or --float */
+ (info->remote_float
+ || (!lsa->remote_list || addrlist_match_proto(&act->dest, lsa->remote_list, info->proto))
+ )
+ )
{
- struct link_socket_addr *lsa = info->lsa;
- if (
- /* new or changed address? */
- (!info->connection_established
- || !addr_match_proto(&act->dest, &lsa->actual.dest, info->proto)
- )
- &&
- /* address undef or address == remote or --float */
- (info->remote_float
- || (!lsa->remote_list || addrlist_match_proto(&act->dest, lsa->remote_list, info->proto))
- )
- )
- {
- link_socket_connection_initiated(buf, info, act, common_name, es);
- }
+ link_socket_connection_initiated(info, act, common_name, es);
}
}
@@ -2762,7 +2762,7 @@ tls_process(struct tls_multi *multi,
INCR_SUCCESS;
/* Set outgoing address for data channel packets */
- link_socket_set_outgoing_addr(NULL, to_link_socket_info, &ks->remote_addr, session->common_name, session->opt->es);
+ link_socket_set_outgoing_addr(to_link_socket_info, &ks->remote_addr, session->common_name, session->opt->es);
/* Flush any payload packets that were buffered before our state transitioned to S_ACTIVE */
flush_payload_buffer(ks);
This was only used in a check that is better suited in the calling functions. This also removes passing the buf argument to link_socket_connection_initiated that also does not use that parameter at all. Signed-off-by: Arne Schwabe <arne@rfc2549.org> --- src/openvpn/forward.c | 4 ++-- src/openvpn/socket.c | 3 +-- src/openvpn/socket.h | 35 +++++++++++++++-------------------- src/openvpn/ssl.c | 2 +- 4 files changed, 19 insertions(+), 25 deletions(-)