]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Move extract_iv_proto to ssl_util.c/h
authorArne Schwabe <arne@rfc2549.org>
Fri, 19 Mar 2021 15:31:28 +0000 (16:31 +0100)
committerGert Doering <gert@greenie.muc.de>
Sat, 20 Mar 2021 15:25:07 +0000 (16:25 +0100)
This function is used by both NCP and push, so move it to a more proper
place.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20210319153129.8734-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21732.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/multi.c
src/openvpn/push.c
src/openvpn/push.h
src/openvpn/ssl_util.c
src/openvpn/ssl_util.h

index d10f188ce9720a9abe3eb67bd4e34045338f972e..f7e0f6805631c01ce077b2fd9718f8deb6a2bf26 100644 (file)
@@ -51,6 +51,7 @@
 
 
 #include "crypto_backend.h"
+#include "ssl_util.h"
 
 /*#define MULTI_DEBUG_EVENT_LOOP*/
 
index 320ad73795b72b64583d83add60351d4aceb98a0..a651955746c09623fe378072b0ba5361366ff69b 100644 (file)
@@ -37,6 +37,7 @@
 #include "manage.h"
 
 #include "memdbg.h"
+#include "ssl_util.h"
 
 #if P2MP
 
@@ -1057,21 +1058,4 @@ remove_iroutes_from_push_route_list(struct options *o)
         gc_free(&gc);
     }
 }
-
-unsigned int
-extract_iv_proto(const char *peer_info)
-{
-    const char *optstr = peer_info ? strstr(peer_info, "IV_PROTO=") : NULL;
-    if (optstr)
-    {
-        int proto = 0;
-        int r = sscanf(optstr, "IV_PROTO=%d", &proto);
-        if (r == 1 && proto > 0)
-        {
-            return proto;
-        }
-    }
-    return 0;
-}
-
 #endif /* if P2MP */
index 377f94a66c5283bae2df9a2167f15b86eb4d3712..bb787a62afdcae28ffaa2ef27123ae2252c02567 100644 (file)
@@ -91,16 +91,6 @@ void send_restart(struct context *c, const char *kill_msg);
  */
 void send_push_reply_auth_token(struct tls_multi *multi);
 
-
-/**
- * Extracts the IV_PROTO variable and returns its value or 0
- * if it cannot be extracted.
- *
- * @param peer_info     peer info string to search for IV_PROTO
- */
-unsigned int
-extract_iv_proto(const char *peer_info);
-
 /**
  * Parses an AUTH_PENDING message and if in pull mode extends the timeout
  *
index a74e3b723987810a64deb81ce3adff09dfa868cc..f6e66be466d39a6f1a27fc185d5ac1f7644206e4 100644 (file)
@@ -59,3 +59,19 @@ extract_var_peer_info(const char *peer_info, const char *var,
     var_value[var_end - var_start] = '\0';
     return var_value;
 }
+
+unsigned int
+extract_iv_proto(const char *peer_info)
+{
+    const char *optstr = peer_info ? strstr(peer_info, "IV_PROTO=") : NULL;
+    if (optstr)
+    {
+        int proto = 0;
+        int r = sscanf(optstr, "IV_PROTO=%d", &proto);
+        if (r == 1 && proto > 0)
+        {
+            return proto;
+        }
+    }
+    return 0;
+}
index bc2ae30dd24164b5056a4e4116d7475e7ffb3beb..741a77822a5a917d44b0fbdbf7b937aacc87fd01 100644 (file)
@@ -46,4 +46,12 @@ extract_var_peer_info(const char *peer_info,
                       const char *var,
                       struct gc_arena *gc);
 
+/**
+ * Extracts the IV_PROTO variable and returns its value or 0
+ * if it cannot be extracted.
+ *
+ * @param peer_info     peer info string to search for IV_PROTO
+ */
+unsigned int
+extract_iv_proto(const char *peer_info);
 #endif