summaryrefslogtreecommitdiff
path: root/src/openvpn/socket.h
diff options
context:
space:
mode:
authorBernhard Schmidt <berni@debian.org>2020-08-15 21:29:50 +0200
committerBernhard Schmidt <berni@debian.org>2020-08-15 21:29:50 +0200
commit1079962e4c06f88a54e50d997c1b7e84303d30b4 (patch)
tree4d019426928435425214ccedd6f89b70dbdf035d /src/openvpn/socket.h
parent620785fe268a1221c1ba7a9cb5a70f3140a4f1ca (diff)
New upstream version 2.5~beta1upstream/2.5_beta1
Diffstat (limited to 'src/openvpn/socket.h')
-rw-r--r--src/openvpn/socket.h71
1 files changed, 28 insertions, 43 deletions
diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h
index 80e8128..7aeae52 100644
--- a/src/openvpn/socket.h
+++ b/src/openvpn/socket.h
@@ -99,7 +99,7 @@ struct link_socket_actual
#endif
};
-/* IP addresses which are persistant across SIGUSR1s */
+/* IP addresses which are persistent across SIGUSR1s */
struct link_socket_addr
{
struct addrinfo *bind_local;
@@ -138,7 +138,7 @@ struct stream_buf
int len; /* -1 if not yet known */
bool error; /* if true, fatal TCP error has occurred,
- * requiring that connection be restarted */
+ * requiring that connection be restarted */
#if PORT_SHARE
#define PS_DISABLED 0
#define PS_ENABLED 1
@@ -212,6 +212,7 @@ struct link_socket
#define SF_GETADDRINFO_DGRAM (1<<4)
unsigned int sockflags;
int mark;
+ const char *bind_dev;
/* for stream sockets */
struct stream_buf stream_buf;
@@ -296,7 +297,8 @@ int openvpn_connect(socket_descriptor_t sd,
/*
* Initialize link_socket object.
*/
-
+/* *INDENT-OFF* uncrustify misparses this function declarion because of
+ * embedded #if/#endif tell it to skip this section */
void
link_socket_init_phase1(struct link_socket *sock,
const char *local_host,
@@ -325,8 +327,10 @@ link_socket_init_phase1(struct link_socket *sock,
int rcvbuf,
int sndbuf,
int mark,
+ const char *bind_dev,
struct event_timeout *server_poll_timeout,
unsigned int sockflags);
+/* Reenable uncrustify *INDENT-ON* */
void link_socket_init_phase2(struct link_socket *sock,
const struct frame *frame,
@@ -431,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);
@@ -980,52 +983,33 @@ 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);
}
}
-/*
- * Stream buffer handling -- stream_buf is a helper class
- * to assist in the packetization of stream transport protocols
- * such as TCP.
- */
-
-void stream_buf_init(struct stream_buf *sb,
- struct buffer *buf,
- const unsigned int sockflags,
- const int proto);
-
-void stream_buf_close(struct stream_buf *sb);
-
-bool stream_buf_added(struct stream_buf *sb, int length_added);
+bool stream_buf_read_setup_dowork(struct link_socket *sock);
static inline bool
stream_buf_read_setup(struct link_socket *sock)
{
- bool stream_buf_read_setup_dowork(struct link_socket *sock);
-
if (link_socket_connection_oriented(sock))
{
return stream_buf_read_setup_dowork(sock);
@@ -1130,16 +1114,17 @@ link_socket_write_win32(struct link_socket *sock,
#else /* ifdef _WIN32 */
+size_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
+ struct buffer *buf,
+ struct link_socket_actual *to);
+
+
static inline size_t
link_socket_write_udp_posix(struct link_socket *sock,
struct buffer *buf,
struct link_socket_actual *to)
{
#if ENABLE_IP_PKTINFO
- size_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
- struct buffer *buf,
- struct link_socket_actual *to);
-
if (proto_is_udp(sock->info.proto) && (sock->sockflags & SF_USE_IP_PKTINFO)
&& addr_defined_ipi(to))
{