Browse code

Manually reformat some long trailing comments

When trying to reformat the code with a formatter
that actually checks line-lengths, these never
come out nice otherwise.

Change-Id: I7f0ba2261b61f6eed511cbd8bb2e880d774d1365
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250505105449.18826-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31561.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Frank Lichtenheld authored on 2025/05/05 19:54:43
Showing 9 changed files
... ...
@@ -31,10 +31,14 @@
31 31
 #define PLUGIN_NAME "base64.c"
32 32
 
33 33
 /* Exported plug-in v3 API functions */
34
-plugin_log_t ovpn_log = NULL;                      /**< Pointer to the OpenVPN log function.  See plugin_log() */
35
-plugin_vlog_t ovpn_vlog = NULL;                    /**< Pointer to the OpenVPN vlog function. See plugin_vlog() */
36
-plugin_base64_encode_t ovpn_base64_encode = NULL;  /**< Pointer to the openvpn_base64_encode () function */
37
-plugin_base64_decode_t ovpn_base64_decode = NULL;  /**< Pointer to the openvpn_base64_decode () function */
34
+/** Pointer to the OpenVPN log function.  See plugin_log() */
35
+plugin_log_t ovpn_log = NULL;
36
+/** Pointer to the OpenVPN vlog function. See plugin_vlog() */
37
+plugin_vlog_t ovpn_vlog = NULL;
38
+/** Pointer to the openvpn_base64_encode () function */
39
+plugin_base64_encode_t ovpn_base64_encode = NULL;
40
+/** Pointer to the openvpn_base64_decode () function */
41
+plugin_base64_decode_t ovpn_base64_decode = NULL;
38 42
 
39 43
 /**
40 44
  * Search the environment pointer for a specific env var name
... ...
@@ -36,20 +36,27 @@
36 36
  #define COMP_F_ADAPTIVE             (1<<0) / * COMP_ALG_LZO only * /
37 37
  #define COMP_F_ALLOW_COMPRESS       (1<<1) / * not only incoming is compressed but also outgoing * /
38 38
  */
39
-#define COMP_F_SWAP                 (1<<2) /* initial command byte is swapped with last byte in buffer to preserve payload alignment */
40
-#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3) /* tell server that we only support compression stubs */
41
-#define COMP_F_ALLOW_STUB_ONLY      (1<<4) /* Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
42
-                                            * we still accept other compressions to be pushed */
43
-#define COMP_F_MIGRATE              (1<<5) /* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
44
-#define COMP_F_ALLOW_ASYM           (1<<6) /* Compression was explicitly set to allow asymetric compression */
45
-#define COMP_F_ALLOW_NOCOMP_ONLY    (1<<7) /* Do not allow compression framing (breaks DCO) */
39
+/** initial command byte is swapped with last byte in buffer to preserve payload alignment */
40
+#define COMP_F_SWAP                 (1<<2)
41
+/** tell server that we only support compression stubs */
42
+#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3)
43
+/** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
44
+ * we still accept other compressions to be pushed */
45
+#define COMP_F_ALLOW_STUB_ONLY      (1<<4)
46
+/** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
47
+#define COMP_F_MIGRATE              (1<<5)
48
+/** Compression was explicitly set to allow asymetric compression */
49
+#define COMP_F_ALLOW_ASYM           (1<<6)
50
+/** Do not allow compression framing (breaks DCO) */
51
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1<<7)
46 52
 
47 53
 /* algorithms */
48 54
 #define COMP_ALG_UNDEF  0
49
-#define COMP_ALG_STUB   1 /* support compression command byte and framing without actual compression */
50
-#define COMP_ALG_LZO    2 /* LZO algorithm */
51
-#define COMP_ALG_SNAPPY 3 /* Snappy algorithm (no longer supported) */
52
-#define COMP_ALG_LZ4    4 /* LZ4 algorithm */
55
+/** support compression command byte and framing without actual compression */
56
+#define COMP_ALG_STUB   1
57
+#define COMP_ALG_LZO    2 /**< LZO algorithm */
58
+#define COMP_ALG_SNAPPY 3 /**< Snappy algorithm (no longer supported) */
59
+#define COMP_ALG_LZ4    4 /**< LZ4 algorithm */
53 60
 
54 61
 
55 62
 /* algorithm v2 */
... ...
@@ -106,7 +113,8 @@ check_compression_settings_valid(struct compress_options *info, int msglevel);
106 106
 #define LZO_COMPRESS_BYTE 0x66
107 107
 #define LZ4_COMPRESS_BYTE 0x69
108 108
 #define NO_COMPRESS_BYTE      0xFA
109
-#define NO_COMPRESS_BYTE_SWAP 0xFB /* to maintain payload alignment, replace this byte with last byte of packet */
109
+/** to maintain payload alignment, replace this byte with last byte of packet */
110
+#define NO_COMPRESS_BYTE_SWAP 0xFB
110 111
 
111 112
 /* V2 on wire code */
112 113
 #define COMP_ALGV2_INDICATOR_BYTE       0x50
... ...
@@ -143,7 +143,7 @@
143 143
 #define D_PACKET_TRUNC_DEBUG LOGLEV(7, 70, M_DEBUG)  /* PACKET_TRUNCATION_CHECK verbose */
144 144
 #define D_PING               LOGLEV(7, 70, M_DEBUG)  /* PING send/receive messages */
145 145
 #define D_PS_PROXY_DEBUG     LOGLEV(7, 70, M_DEBUG)  /* port share proxy debug */
146
-#define D_TLS_KEYSELECT      LOGLEV(7, 70, M_DEBUG)  /* show information on key selection for data channel */
146
+#define D_TLS_KEYSELECT      LOGLEV(7, 70, M_DEBUG)  /* show key selection for data channel */
147 147
 #define D_ARGV_PARSE_CMD     LOGLEV(7, 70, M_DEBUG)  /* show parse_line() errors in argv_parse_cmd */
148 148
 #define D_CRYPTO_DEBUG       LOGLEV(7, 70, M_DEBUG)  /* show detailed info from crypto.c routines */
149 149
 #define D_PID_DEBUG          LOGLEV(7, 70, M_DEBUG)  /* show packet-id debugging info */
... ...
@@ -153,7 +153,7 @@
153 153
 
154 154
 #define D_VLAN_DEBUG         LOGLEV(7, 74, M_DEBUG)  /* show VLAN tagging/untagging debug info */
155 155
 
156
-#define D_HANDSHAKE_VERBOSE  LOGLEV(8, 70, M_DEBUG)  /* show detailed description of each handshake */
156
+#define D_HANDSHAKE_VERBOSE  LOGLEV(8, 70, M_DEBUG)  /* show detailed description of handshake */
157 157
 #define D_TLS_DEBUG_MED      LOGLEV(8, 70, M_DEBUG)  /* limited info from tls_session routines */
158 158
 #define D_INTERVAL           LOGLEV(8, 70, M_DEBUG)  /* show interval.h debugging info */
159 159
 #define D_SCHEDULER          LOGLEV(8, 70, M_DEBUG)  /* show scheduler debugging info */
... ...
@@ -168,7 +168,7 @@
168 168
 #define D_PACKET_CONTENT     LOGLEV(9, 70, M_DEBUG)  /* show before/after encryption packet content */
169 169
 #define D_TLS_NO_SEND_KEY    LOGLEV(9, 70, M_DEBUG)  /* show when no data channel send-key exists */
170 170
 #define D_PID_PERSIST_DEBUG  LOGLEV(9, 70, M_DEBUG)  /* show packet-id persist debugging info */
171
-#define D_LINK_RW_VERBOSE    LOGLEV(9, 70, M_DEBUG)  /* show link reads/writes with greater verbosity */
171
+#define D_LINK_RW_VERBOSE    LOGLEV(9, 70, M_DEBUG)  /* increase link reads/writes verbosity */
172 172
 #define D_STREAM_DEBUG       LOGLEV(9, 70, M_DEBUG)  /* show TCP stream debug info */
173 173
 #define D_WIN32_IO           LOGLEV(9, 70, M_DEBUG)  /* win32 I/O debugging info */
174 174
 #define D_PKCS11_DEBUG       LOGLEV(9, 70, M_DEBUG)  /* show PKCS#11 debugging */
... ...
@@ -92,25 +92,28 @@ struct fragment {
92 92
  * List of fragment structures for reassembling multiple incoming packets
93 93
  * concurrently.
94 94
  */
95
-struct fragment_list {
96
-    int seq_id;                 /**< Highest fragmentation sequence ID of
97
-                                 *   the packets currently being
98
-                                 *   reassembled. */
99
-    int index;                  /**< Index of the packet being reassembled
100
-                                 *   with the highest fragmentation
101
-                                 *   sequence ID into the \c
102
-                                 *   fragment_list.fragments array. */
103
-
104
-/** Array of reassembly structures, each can contain one whole packet.
105
- *
106
- *  The fragmentation sequence IDs of the packets being reassembled in
107
- *  this array are linearly increasing. \c
108
- *  fragment_list.fragments[fragment_list.index] has an ID of \c
109
- *  fragment_list.seq_id.  This means that one of these \c fragment_list
110
- *  structures can at any one time contain at most packets with the
111
- *  fragmentation sequence IDs in the range \c fragment_list.seq_id \c -
112
- *  \c N_FRAG_BUF \c + \c 1 to \c fragment_list.seq_id, inclusive.
113
- */
95
+struct fragment_list
96
+{
97
+    /** Highest fragmentation sequence ID of
98
+     *  the packets currently being
99
+     *  reassembled. */
100
+    int seq_id;
101
+    /** Index of the packet being reassembled
102
+     *   with the highest fragmentation
103
+     *   sequence ID into the \c
104
+     *   fragment_list.fragments array. */
105
+    int index;
106
+
107
+    /** Array of reassembly structures, each can contain one whole packet.
108
+     *
109
+     *  The fragmentation sequence IDs of the packets being reassembled in
110
+     *  this array are linearly increasing. \c
111
+     *  fragment_list.fragments[fragment_list.index] has an ID of \c
112
+     *  fragment_list.seq_id.  This means that one of these \c fragment_list
113
+     *  structures can at any one time contain at most packets with the
114
+     *  fragmentation sequence IDs in the range \c fragment_list.seq_id \c -
115
+     *  \c N_FRAG_BUF \c + \c 1 to \c fragment_list.seq_id, inclusive.
116
+     */
114 117
     struct fragment fragments[N_FRAG_BUF];
115 118
 };
116 119
 
... ...
@@ -149,9 +152,7 @@ struct fragment_master {
149 149
                                  *   the remote OpenVPN peer can determine
150 150
                                  *   which parts belong to which original
151 151
                                  *   packet. */
152
-#define MAX_FRAG_PKT_SIZE 65536
153
-    /**< (Not used) Maximum packet size before
154
-     *   fragmenting. */
152
+#define MAX_FRAG_PKT_SIZE 65536 /**< (Not used) Maximum packet size before fragmenting. */
155 153
     int outgoing_frag_size;     /**< Size in bytes of each part to be
156 154
                                  *   sent, except for the last part which
157 155
                                  *   may be smaller.
... ...
@@ -183,45 +184,37 @@ struct fragment_master {
183 183
 /**************************************************************************/
184 184
 /** @name Fragment header
185 185
  *  @todo Add description of %fragment header format.
186
- *//** @{ *//*************************************/
186
+ */
187
+/** @{ */ /*************************************/
187 188
 
188 189
 typedef uint32_t fragment_header_type;
189
-/**< Fragmentation information is stored in
190
- *   a 32-bit packet header. */
190
+/**< Fragmentation information is stored in a 32-bit packet header. */
191 191
 
192 192
 #define hton_fragment_header_type(x) htonl(x)
193
-/**< Convert a fragment_header_type from
194
- *   host to network order. */
193
+/**< Convert a fragment_header_type from host to network order. */
195 194
 
196 195
 #define ntoh_fragment_header_type(x) ntohl(x)
197
-/**< Convert a \c fragment_header_type
198
- *   from network to host order. */
199
-
200
-#define FRAG_TYPE_MASK        0x00000003
201
-/**< Bit mask for %fragment type info. */
202
-#define FRAG_TYPE_SHIFT       0 /**< Bit shift for %fragment type info. */
203
-
204
-#define FRAG_WHOLE            0 /**< Fragment type indicating packet is
205
-                                 *   whole. */
206
-#define FRAG_YES_NOTLAST      1 /**< Fragment type indicating packet is
207
-                                 *   part of a fragmented packet, but not
208
-                                 *   the last part in the sequence. */
209
-#define FRAG_YES_LAST         2 /**< Fragment type indicating packet is
210
-                                 *   the last part in the sequence of
211
-                                 *   parts. */
212
-#define FRAG_TEST             3 /**< Fragment type not implemented yet.
213
-                                 *   In the future might be used as a
214
-                                 *   control packet for establishing MTU
215
-                                 *   size. */
216
-
217
-#define FRAG_SEQ_ID_MASK      0x000000ff
218
-/**< Bit mask for %fragment sequence ID. */
219
-#define FRAG_SEQ_ID_SHIFT     2 /**< Bit shift for %fragment sequence ID. */
220
-
221
-#define FRAG_ID_MASK          0x0000001f
222
-/**< Bit mask for %fragment ID. */
223
-#define FRAG_ID_SHIFT         10
224
-/**< Bit shift for %fragment ID. */
196
+/**< Convert a \c fragment_header_type from network to host order. */
197
+
198
+#define FRAG_TYPE_MASK               0x00000003 /**< Bit mask for %fragment type info. */
199
+#define FRAG_TYPE_SHIFT              0          /**< Bit shift for %fragment type info. */
200
+
201
+#define FRAG_WHOLE                   0          /**< Fragment type indicating packet is whole. */
202
+#define FRAG_YES_NOTLAST             1
203
+/**< Fragment type indicating packet is part of a fragmented packet, but not
204
+ *   the last part in the sequence. */
205
+#define FRAG_YES_LAST                2
206
+/**< Fragment type indicating packet is the last part in the sequence of parts. */
207
+#define FRAG_TEST                    3
208
+/**< Fragment type not implemented yet.
209
+ * In the future might be used as a control packet for establishing MTU size. */
210
+
211
+#define FRAG_SEQ_ID_MASK             0x000000ff /**< Bit mask for %fragment sequence ID. */
212
+#define FRAG_SEQ_ID_SHIFT            2          /**< Bit shift for %fragment sequence ID. */
213
+
214
+#define FRAG_ID_MASK                 0x0000001f /**< Bit mask for %fragment ID. */
215
+#define FRAG_ID_SHIFT                10         /**< Bit shift for %fragment ID. */
216
+
225 217
 
226 218
 /*
227 219
  * FRAG_SIZE  14 bits
... ...
@@ -232,12 +225,10 @@ typedef uint32_t fragment_header_type;
232 232
  *   max_frag_size is only sent over the wire if FRAG_LAST is set.  Otherwise it is assumed
233 233
  *   to be the actual %fragment size received.
234 234
  */
235
-#define FRAG_SIZE_MASK        0x00003fff
236
-/**< Bit mask for %fragment size. */
237
-#define FRAG_SIZE_SHIFT       15
238
-/**< Bit shift for %fragment size. */
239
-#define FRAG_SIZE_ROUND_SHIFT 2 /**< Bit shift for %fragment size rounding. */
240
-#define FRAG_SIZE_ROUND_MASK ((1 << FRAG_SIZE_ROUND_SHIFT) - 1)
235
+#define FRAG_SIZE_MASK               0x00003fff /**< Bit mask for %fragment size. */
236
+#define FRAG_SIZE_SHIFT              15         /**< Bit shift for %fragment size. */
237
+#define FRAG_SIZE_ROUND_SHIFT        2          /**< Bit shift for %fragment size rounding. */
238
+#define FRAG_SIZE_ROUND_MASK         ((1 << FRAG_SIZE_ROUND_SHIFT) - 1)
241 239
 /**< Bit mask for %fragment size rounding. */
242 240
 
243 241
 /*
... ...
@@ -245,10 +236,8 @@ typedef uint32_t fragment_header_type;
245 245
  *
246 246
  * IF FRAG_WHOLE or FRAG_YES_NOTLAST, these 16 bits are available (not currently used)
247 247
  */
248
-#define FRAG_EXTRA_MASK         0x0000ffff
249
-/**< Bit mask for extra bits. */
250
-#define FRAG_EXTRA_SHIFT        15
251
-/**< Bit shift for extra bits. */
248
+#define FRAG_EXTRA_MASK              0x0000ffff /**< Bit mask for extra bits. */
249
+#define FRAG_EXTRA_SHIFT             15         /**< Bit shift for extra bits. */
252 250
 
253 251
 /** @} name Fragment header *//********************************************/
254 252
 
... ...
@@ -983,7 +983,8 @@ init_options_dev(struct options *options)
983 983
 {
984 984
     if (!options->dev && options->dev_node)
985 985
     {
986
-        char *dev_node = string_alloc(options->dev_node, NULL); /* POSIX basename() implementations may modify its arguments */
986
+        /* POSIX basename() implementations may modify its arguments */
987
+        char *dev_node = string_alloc(options->dev_node, NULL);
987 988
         options->dev = basename(dev_node);
988 989
     }
989 990
 }
... ...
@@ -2572,12 +2573,14 @@ do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
2572 2572
             }
2573 2573
             else
2574 2574
             {
2575
-                initialization_sequence_completed(c, error_flags); /* client/p2p --route-delay undefined */
2575
+                /* client/p2p --route-delay undefined */
2576
+                initialization_sequence_completed(c, error_flags);
2576 2577
             }
2577 2578
         }
2578 2579
         else if (c->options.mode == MODE_POINT_TO_POINT)
2579 2580
         {
2580
-            initialization_sequence_completed(c, error_flags); /* client/p2p restart with --persist-tun */
2581
+            /* client/p2p restart with --persist-tun */
2582
+            initialization_sequence_completed(c, error_flags);
2581 2583
         }
2582 2584
 
2583 2585
         tls_print_deferred_options_results(c);
... ...
@@ -3447,7 +3447,8 @@ management_event_loop_n_seconds(struct management *man, int sec)
3447 3447
         const bool standalone_disabled_save = man->persist.standalone_disabled;
3448 3448
         time_t expire = 0;
3449 3449
 
3450
-        man->persist.standalone_disabled = false; /* This is so M_CLIENT messages will be correctly passed through msg() */
3450
+        /* This is so M_CLIENT messages will be correctly passed through msg() */
3451
+        man->persist.standalone_disabled = false;
3451 3452
 
3452 3453
         /* set expire time */
3453 3454
         update_time();
... ...
@@ -3510,7 +3511,8 @@ management_query_user_pass(struct management *man,
3510 3510
         unsigned int up_query_mode = 0;
3511 3511
         const char *sc = NULL;
3512 3512
         ret = true;
3513
-        man->persist.standalone_disabled = false; /* This is so M_CLIENT messages will be correctly passed through msg() */
3513
+        /* This is so M_CLIENT messages will be correctly passed through msg() */
3514
+        man->persist.standalone_disabled = false;
3514 3515
         man->persist.special_state_msg = NULL;
3515 3516
 
3516 3517
         CLEAR(man->connection.up_query);
... ...
@@ -3634,7 +3636,8 @@ management_query_multiline(struct management *man,
3634 3634
 
3635 3635
     if (man_standalone_ok(man))
3636 3636
     {
3637
-        man->persist.standalone_disabled = false; /* This is so M_CLIENT messages will be correctly passed through msg() */
3637
+        /* This is so M_CLIENT messages will be correctly passed through msg() */
3638
+        man->persist.standalone_disabled = false;
3638 3639
         man->persist.special_state_msg = NULL;
3639 3640
 
3640 3641
         *state = EKS_SOLICIT;
... ...
@@ -114,12 +114,14 @@ struct static_challenge_info {};
114 114
 #define GET_USER_PASS_NEED_STR      (1<<5)
115 115
 #define GET_USER_PASS_PREVIOUS_CREDS_FAILED (1<<6)
116 116
 
117
-#define GET_USER_PASS_DYNAMIC_CHALLENGE      (1<<7) /* CRV1 protocol  -- dynamic challenge */
118
-#define GET_USER_PASS_STATIC_CHALLENGE       (1<<8) /* SCRV1 protocol -- static challenge */
119
-#define GET_USER_PASS_STATIC_CHALLENGE_ECHO  (1<<9) /* SCRV1 protocol -- echo response */
120
-
121
-#define GET_USER_PASS_INLINE_CREDS (1<<10)  /* indicates that auth_file is actually inline creds */
122
-#define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1<<11)  /* indicates password and response should be concatenated */
117
+#define GET_USER_PASS_DYNAMIC_CHALLENGE      (1<<7) /**< CRV1 protocol  -- dynamic challenge */
118
+#define GET_USER_PASS_STATIC_CHALLENGE       (1<<8) /**< SCRV1 protocol -- static challenge */
119
+#define GET_USER_PASS_STATIC_CHALLENGE_ECHO  (1<<9) /**< SCRV1 protocol -- echo response */
120
+
121
+/** indicates that auth_file is actually inline creds */
122
+#define GET_USER_PASS_INLINE_CREDS (1<<10)
123
+/** indicates password and response should be concatenated */
124
+#define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1<<11)
123 125
 
124 126
 /**
125 127
  * Retrieves the user credentials from various sources depending on the flags.
... ...
@@ -853,7 +853,8 @@ init_options(struct options *o, const bool init_gc)
853 853
     o->tuntap_options.ip_win32_type = IPW32_SET_DHCP_MASQ;
854 854
 #endif
855 855
     o->tuntap_options.dhcp_lease_time = 31536000; /* one year */
856
-    o->tuntap_options.dhcp_masq_offset = 0;     /* use network address as internal DHCP server address */
856
+    /* use network address as internal DHCP server address */
857
+    o->tuntap_options.dhcp_masq_offset = 0;
857 858
     o->route_method = ROUTE_METHOD_ADAPTIVE;
858 859
     o->block_outside_dns = false;
859 860
     o->windows_driver = WINDOWS_DRIVER_UNSPECIFIED;
... ...
@@ -75,10 +75,10 @@
75 75
  *
76 76
  * @{
77 77
  */
78
-#define S_ERROR         (-2)     /**< Error state.  */
79
-#define S_ERROR_PRE     (-1)     /**< Error state but try to send out alerts
80
-                                  *  before killing the keystore and moving
81
-                                  *  it to S_ERROR */
78
+#define S_ERROR         (-2)    /**< Error state.  */
79
+#define S_ERROR_PRE     (-1)    /**< Error state but try to send out alerts
80
+                                 *  before killing the keystore and moving
81
+                                 *  it to S_ERROR */
82 82
 #define S_UNDEF           0     /**< Undefined state, used after a \c
83 83
                                  *   key_state is cleaned up. */
84 84
 #define S_INITIAL         1     /**< Initial \c key_state state after
... ...
@@ -567,18 +567,22 @@ struct tls_session
567 567
  * tls_session reaches S_ACTIVE, this state machine moves to CAS_PENDING (server)
568 568
  * or CAS_CONNECT_DONE (client/p2p) as clients skip the stages associated with
569 569
  * connect scripts/plugins */
570
-enum multi_status {
570
+enum multi_status
571
+{
571 572
     CAS_NOT_CONNECTED,
572
-    CAS_WAITING_AUTH,               /**< Initial TLS connection established but deferred auth is not yet finished */
573
-    CAS_PENDING,                    /**< Options import (Connect script/plugin, ccd,...) */
574
-    CAS_PENDING_DEFERRED,           /**< Waiting on an async option import handler */
575
-    CAS_PENDING_DEFERRED_PARTIAL,   /**< at least handler succeeded but another is still pending */
576
-    CAS_FAILED,                     /**< Option import failed or explicitly denied the client */
577
-    CAS_WAITING_OPTIONS_IMPORT,     /**< client with pull or p2p waiting for first time options import */
578
-    CAS_RECONNECT_PENDING,          /**< session has already successful established (CAS_CONNECT_DONE)
579
-                                     * but has a reconnect and needs to redo some initialisation, this state is
580
-                                     * similar CAS_WAITING_OPTIONS_IMPORT but skips a few things. The normal connection
581
-                                     * skips this step. */
573
+    CAS_WAITING_AUTH, /**< Initial TLS connection established but deferred auth is not yet finished
574
+                       */
575
+    CAS_PENDING,      /**< Options import (Connect script/plugin, ccd,...) */
576
+    CAS_PENDING_DEFERRED,         /**< Waiting on an async option import handler */
577
+    CAS_PENDING_DEFERRED_PARTIAL, /**< at least handler succeeded but another is still pending */
578
+    CAS_FAILED,                   /**< Option import failed or explicitly denied the client */
579
+    CAS_WAITING_OPTIONS_IMPORT,   /**< client with pull or p2p waiting for first time options import
580
+                                   */
581
+    /** session has already successful established (CAS_CONNECT_DONE) but has a
582
+     * reconnect and needs to redo some initialisation, this state is similar
583
+     * CAS_WAITING_OPTIONS_IMPORT but skips a few things. The normal connection
584
+     * skips this step. */
585
+    CAS_RECONNECT_PENDING,
582 586
     CAS_CONNECT_DONE,
583 587
 };
584 588
 
... ...
@@ -626,8 +630,9 @@ struct tls_multi
626 626
     int n_hard_errors; /* errors due to TLS negotiation failure */
627 627
     int n_soft_errors; /* errors due to unrecognized or failed-to-authenticate incoming packets */
628 628
 
629
-    /*
630
-     * Our locked common name, username, and cert hashes (cannot change during the life of this tls_multi object)
629
+    /**
630
+     * Our locked common name, username, and cert hashes
631
+     * (cannot change during the life of this tls_multi object)
631 632
      */
632 633
     char *locked_cn;
633 634
 
... ...
@@ -642,43 +647,46 @@ struct tls_multi
642 642
 
643 643
     struct cert_hash_set *locked_cert_hash_set;
644 644
 
645
-    /** Time of last when we updated the cached state of
645
+    /**
646
+     * Time of last when we updated the cached state of
646 647
      * tls_authentication_status deferred files */
647 648
     time_t tas_cache_last_update;
648 649
 
649 650
     /** The number of times we updated the cache */
650 651
     unsigned int tas_cache_num_updates;
651 652
 
652
-    /*
653
-     * An error message to send to client on AUTH_FAILED
654
-     */
653
+    /** An error message to send to client on AUTH_FAILED */
655 654
     char *client_reason;
656 655
 
657
-    /*
656
+    /**
658 657
      * A multi-line string of general-purpose info received from peer
659 658
      * over control channel.
660 659
      */
661 660
     char *peer_info;
662
-    char *auth_token;    /**< If server sends a generated auth-token,
663
-                          *   this is the token to use for future
664
-                          *   user/pass authentications in this session.
665
-                          */
666
-    char *auth_token_initial;
667
-    /**< The first auth-token we sent to a client. We use this to remember
668
-     * the session ID and initial timestamp when generating new auth-token.
661
+    /**
662
+     * If server sends a generated auth-token,
663
+     * this is the token to use for future
664
+     * user/pass authentications in this session.
669 665
      */
670
-#define  AUTH_TOKEN_HMAC_OK              (1<<0)
671
-    /**< Auth-token sent from client has valid hmac */
672
-#define  AUTH_TOKEN_EXPIRED              (1<<1)
673
-    /**< Auth-token sent from client has expired */
674
-#define  AUTH_TOKEN_VALID_EMPTYUSER      (1<<2)
675
-    /**<
676
-     * Auth-token is only valid for an empty username
677
-     * and not the username actually supplied from the client
678
-     *
679
-     * OpenVPN 3 clients sometimes wipes or replaces the username with a
680
-     * username hint from their config.
666
+    char *auth_token;
667
+    /**
668
+     * The first auth-token we sent to a client. We use this to remember
669
+     * the session ID and initial timestamp when generating new auth-token.
681 670
      */
671
+    char *auth_token_initial;
672
+
673
+/** Auth-token sent from client has valid hmac */
674
+#define AUTH_TOKEN_HMAC_OK         (1 << 0)
675
+/** Auth-token sent from client has expired */
676
+#define AUTH_TOKEN_EXPIRED         (1 << 1)
677
+/**
678
+ * Auth-token is only valid for an empty username
679
+ * and not the username actually supplied from the client
680
+ *
681
+ * OpenVPN 3 clients sometimes wipes or replaces the username with a
682
+ * username hint from their config.
683
+ */
684
+#define AUTH_TOKEN_VALID_EMPTYUSER (1 << 2)
682 685
 
683 686
     /* For P_DATA_V2 */
684 687
     uint32_t peer_id;
... ...
@@ -690,10 +698,10 @@ struct tls_multi
690 690
     /*
691 691
      * Our session objects.
692 692
      */
693
+    /** Array of \c tls_session objects
694
+     *  representing control channel
695
+     *  sessions with the remote peer. */
693 696
     struct tls_session session[TM_SIZE];
694
-    /**< Array of \c tls_session objects
695
-     *   representing control channel
696
-     *   sessions with the remote peer. */
697 697
 
698 698
     /* Only used when DCO is used to remember how many keys we installed
699 699
      * for this session */