aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe2020-08-10 16:36:55 +0200
committerGert Doering2020-08-10 17:45:23 +0200
commit60200b9e1a977c32e64907ed67406dd4208e8abf (patch)
tree0f9135508b48e112302d9040eafef30f449e3e23
parent33773a02082e7602053938ce5d0af284214dabc4 (diff)
downloadopenvpn-60200b9e1a977c32e64907ed67406dd4208e8abf.zip
openvpn-60200b9e1a977c32e64907ed67406dd4208e8abf.tar.gz
Remove buf argument from link_socket_set_outgoing_addr
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> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20200810143707.5834-6-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20677.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
-rw-r--r--src/openvpn/forward.c4
-rw-r--r--src/openvpn/socket.c3
-rw-r--r--src/openvpn/socket.h35
-rw-r--r--src/openvpn/ssl.c2
4 files changed, 19 insertions, 25 deletions
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 79c07e4..8a0d63f 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -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 */
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 61463bc..c486327 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -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)
diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h
index 8db9e8b..7aeae52 100644
--- a/src/openvpn/socket.h
+++ b/src/openvpn/socket.h
@@ -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);
}
}
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 416e4fd..70e397c 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -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);