]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
clang-format: Switch to ColumnLimit 0
authorFrank Lichtenheld <frank@lichtenheld.com>
Tue, 5 Aug 2025 13:27:01 +0000 (15:27 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 5 Aug 2025 13:32:53 +0000 (15:32 +0200)
In some cases an actual ColumnLimit leads to unfortunate
formatting. So leave the decision to developers after all.

This commit contains:
 - changes that clang-format did as reaction to the config
   change
 - manual cleanups of these changes
 - manual cleanup of some previous changes done
   with ColumnLimit 100

Change-Id: Ibd900adfc775b7f785f1d5630184a124f5d8ff4b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250805132706.27619-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32523.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
19 files changed:
.clang-format
sample/sample-plugins/client-connect/sample-client-connect.c
sample/sample-plugins/log/log_v3.c
sample/sample-plugins/simple/base64.c
src/openvpn/crypto_openssl.c
src/openvpn/errlevel.h
src/openvpn/error.c
src/openvpn/mtu.c
src/openvpn/multi.c
src/openvpn/ntlm.c
src/openvpn/openvpn.c
src/openvpn/options.c
src/openvpn/options.h
src/openvpn/options_util.c
src/openvpn/run_command.h
src/openvpn/ssl_common.h
src/openvpn/xkey_helper.c
src/tapctl/tap.c
tests/unit_tests/openvpn/test_pkt.c

index c314fcac190050dde392273637433014d5a774b6..1cce4c36f09a2ca19f5dbc55e3056b388c71c480 100644 (file)
@@ -24,7 +24,7 @@ BreakBeforeBinaryOperators: NonAssignment
 BreakBeforeBraces: Allman
 BreakBeforeTernaryOperators: true
 BreakStringLiterals: false
-ColumnLimit: '100'
+ColumnLimit: '0'
 ContinuationIndentWidth: '4'
 DerivePointerAlignment: false
 IndentCaseLabels: true
index 7e3b5a903fa3e54bcabc5ca393ddd87719520475..eaa07d2f55005afc8541ec199ba7d9e6d6fa7a66 100644 (file)
@@ -128,9 +128,8 @@ openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in
     /* Check API compatibility -- struct version 5 or higher needed */
     if (v3structver < 5)
     {
-        fprintf(
-            stderr,
-            "sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n");
+        fprintf(stderr,
+                "sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n");
         return OPENVPN_PLUGIN_FUNC_ERROR;
     }
 
index cef22cf36a1463ad2b2b5e56a27c246b8c2b8756..1b4394746f3623988ca7b5475bd9bd0bd2db99a1 100644 (file)
@@ -80,8 +80,7 @@ openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in
     /* Check that we are API compatible */
     if (v3structver != OPENVPN_PLUGINv3_STRUCTVER)
     {
-        printf(
-            "log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
+        printf("log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
         return OPENVPN_PLUGIN_FUNC_ERROR;
     }
 
index 8a1dedd2e6690b4d33e1db76a6c769e49df96668..8ca08889a985d5daef95edc2480766d506a0769e 100644 (file)
@@ -104,8 +104,7 @@ openvpn_plugin_open_v3(const int v3structver, struct openvpn_plugin_args_open_in
     /* Check that we are API compatible */
     if (v3structver != OPENVPN_PLUGINv3_STRUCTVER)
     {
-        printf(
-            "base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
+        printf("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n");
         return OPENVPN_PLUGIN_FUNC_ERROR;
     }
 
index cfea3eb648c2280b803dc519f4366c15d9b81ad0..4fb63931e9481b3fc9c261f1dcbcc1b860ab4000 100644 (file)
@@ -1046,11 +1046,16 @@ md_valid(const char *digest)
  * this translation table for forward lookup, only for returning the name
  * with md_kt_name() */
 const cipher_name_pair digest_name_translation_table[] = {
-    { "BLAKE2s256", "BLAKE2S-256" },  { "BLAKE2b512", "BLAKE2B-512" },
-    { "RIPEMD160", "RIPEMD-160" },    { "SHA224", "SHA2-224" },
-    { "SHA256", "SHA2-256" },         { "SHA384", "SHA2-384" },
-    { "SHA512", "SHA2-512" },         { "SHA512-224", "SHA2-512/224" },
-    { "SHA512-256", "SHA2-512/256" }, { "SHAKE128", "SHAKE-128" },
+    { "BLAKE2s256", "BLAKE2S-256" },
+    { "BLAKE2b512", "BLAKE2B-512" },
+    { "RIPEMD160", "RIPEMD-160" },
+    { "SHA224", "SHA2-224" },
+    { "SHA256", "SHA2-256" },
+    { "SHA384", "SHA2-384" },
+    { "SHA512", "SHA2-512" },
+    { "SHA512-224", "SHA2-512/224" },
+    { "SHA512-256", "SHA2-512/256" },
+    { "SHAKE128", "SHAKE-128" },
     { "SHAKE256", "SHAKE-256" },
 };
 const size_t digest_name_translation_table_count =
index 2d33d558242809ae85ec7eef5d3c00f7ace54c28..f1ae8c580cdbe705953f37c616e8028483bee0db 100644 (file)
  * of output.
  */
 
-#define M_VERB0 LOGLEV(0, 0, 0) /* Messages displayed even at --verb 0 (fatal errors only) */
-
-#define M_INFO LOGLEV(1, 0, 0)  /* default informational messages */
-
-#define D_LINK_ERRORS    LOGLEV(1, 1, M_NONFATAL)  /* show link errors from main event loop */
-#define D_CRYPT_ERRORS   LOGLEV(1, 2, M_NONFATAL)  /* show errors from encrypt/decrypt */
-#define D_TLS_ERRORS     LOGLEV(1, 3, M_NONFATAL)  /* show TLS control channel errors */
-#define D_RESOLVE_ERRORS LOGLEV(1, 4, M_NONFATAL)  /* show hostname resolve errors */
-#define D_COMP_ERRORS    LOGLEV(1, 5, M_NONFATAL)  /* show compression errors */
-#define D_REPLAY_ERRORS  LOGLEV(1, 6, M_NONFATAL)  /* show packet replay errors */
-#define D_STREAM_ERRORS  LOGLEV(1, 7, M_NONFATAL)  /* TCP stream error requiring restart */
-#define D_IMPORT_ERRORS  LOGLEV(1, 8, M_NONFATAL)  /* show server import option errors */
-#define D_MULTI_ERRORS   LOGLEV(1, 9, M_NONFATAL)  /* show multi-client server errors */
-#define D_EVENT_ERRORS   LOGLEV(1, 10, M_NONFATAL) /* show event.[ch] errors */
-#define D_PUSH_ERRORS    LOGLEV(1, 11, M_NONFATAL) /* show push/pull errors */
-#define D_PID_PERSIST    LOGLEV(1, 12, M_NONFATAL) /* show packet_id persist errors */
-#define D_FRAG_ERRORS    LOGLEV(1, 13, M_NONFATAL) /* show fragmentation errors */
-#define D_ALIGN_ERRORS   LOGLEV(1, 14, M_NONFATAL) /* show bad struct alignments */
-
-#define D_HANDSHAKE LOGLEV(2, 20, 0)               /* show data & control channel handshakes */
-#define D_CLOSE     LOGLEV(2, 22, 0)               /* show socket and TUN/TAP close */
-#define D_PROXY     LOGLEV(2, 24, 0)               /* show http proxy control packets */
-#define D_ARGV      LOGLEV(2, 25, 0)               /* show struct argv errors */
-
-#define D_TLS_DEBUG_LOW LOGLEV(3, 20, 0)       /* low frequency info from tls_session routines */
-#define D_GREMLIN       LOGLEV(3, 30, 0)       /* show simulated outage info from gremlin module */
-#define D_GENKEY        LOGLEV(3, 31, 0)       /* print message after key generation */
-#define D_ROUTE         LOGLEV(3, 0, 0)        /* show routes added and deleted (don't mute) */
-#define D_TUNTAP_INFO   LOGLEV(3, 32, 0)       /* show debugging info from TUN/TAP driver */
-#define D_RESTART       LOGLEV(3, 33, 0)       /* show certain restart messages */
-#define D_PUSH          LOGLEV(3, 34, 0)       /* show push/pull info */
-#define D_IFCONFIG_POOL LOGLEV(3, 35, 0)       /* show ifconfig pool info */
-#define D_AUTH          LOGLEV(3, 37, 0)       /* show user/pass auth info */
-#define D_MULTI_LOW     LOGLEV(3, 38, 0)       /* show point-to-multipoint low-freq debug info */
-#define D_PLUGIN        LOGLEV(3, 39, 0)       /* show plugin calls */
-#define D_MANAGEMENT    LOGLEV(3, 40, 0)       /* show --management info */
-#define D_SCHED_EXIT    LOGLEV(3, 41, 0)       /* show arming of scheduled exit */
-#define D_ROUTE_QUOTA   LOGLEV(3, 42, 0)       /* show route quota exceeded messages */
-#define D_OSBUF         LOGLEV(3, 43, 0)       /* show socket/tun/tap buffer sizes */
-#define D_PS_PROXY      LOGLEV(3, 44, 0)       /* messages related to --port-share option */
-#define D_IFCONFIG      LOGLEV(3, 0, 0)        /* show ifconfig info (don't mute) */
-#define D_DCO           LOGLEV(3, 0, 0)        /* show DCO related messages */
-
-#define D_SHOW_PARMS       LOGLEV(4, 50, 0)    /* show all parameters on program initiation */
-#define D_LOW              LOGLEV(4, 52, 0)    /* miscellaneous low-frequency debug info */
-#define D_DHCP_OPT         LOGLEV(4, 53, 0)    /* show DHCP options binary string */
-#define D_MBUF             LOGLEV(4, 54, 0)    /* mbuf.[ch] routines */
-#define D_PACKET_TRUNC_ERR LOGLEV(4, 55, 0)    /* PACKET_TRUNCATION_CHECK */
-#define D_MULTI_DROPPED    LOGLEV(4, 57, 0)    /* show point-to-multipoint packet drops */
-#define D_MULTI_MEDIUM     LOGLEV(4, 58, 0)    /* show medium frequency multi messages */
-#define D_X509_ATTR        LOGLEV(4, 59, 0)    /* show x509-track attributes on connection */
-#define D_INIT_MEDIUM      LOGLEV(4, 60, 0)    /* show medium frequency init messages */
-#define D_MTU_INFO         LOGLEV(4, 61, 0)    /* show terse MTU info */
-#define D_PID_DEBUG_LOW    LOGLEV(4, 63, 0)    /* show low-freq packet-id debugging info */
-#define D_PID_DEBUG_MEDIUM LOGLEV(4, 64, 0)    /* show medium-freq packet-id debugging info */
-#define D_CIPHER_INIT      LOGLEV(4, 65, 0)    /* show messages about cipher init */
-
-#define D_LOG_RW LOGLEV(5, 0, 0)               /* Print 'R' or 'W' to stdout for read/write */
-
-#define D_RTNL          LOGLEV(6, 68, M_DEBUG) /* show RTNL low level operations */
-#define D_LINK_RW       LOGLEV(6, 69, M_DEBUG) /* show TCP/UDP reads/writes (terse) */
-#define D_TUN_RW        LOGLEV(6, 69, M_DEBUG) /* show TUN/TAP reads/writes */
-#define D_TAP_WIN_DEBUG LOGLEV(6, 69, M_DEBUG) /* show TAP-Windows driver debug info */
-#define D_CLIENT_NAT    LOGLEV(6, 69, M_DEBUG) /* show client NAT debug info */
-#define D_XKEY          LOGLEV(6, 69, M_DEBUG) /* show xkey-provider debug info */
-#define D_DCO_DEBUG     LOGLEV(6, 69, M_DEBUG) /* show DCO related lowlevel debug messages */
-#define D_SIGNAL_DEBUG  LOGLEV(6, 69, M_DEBUG) /* show signal related debug messages */
+#define M_VERB0 LOGLEV(0, 0, 0)                     /* Messages displayed even at --verb 0 (fatal errors only) */
+
+#define M_INFO LOGLEV(1, 0, 0)                      /* default informational messages */
+
+#define D_LINK_ERRORS    LOGLEV(1, 1, M_NONFATAL)   /* show link errors from main event loop */
+#define D_CRYPT_ERRORS   LOGLEV(1, 2, M_NONFATAL)   /* show errors from encrypt/decrypt */
+#define D_TLS_ERRORS     LOGLEV(1, 3, M_NONFATAL)   /* show TLS control channel errors */
+#define D_RESOLVE_ERRORS LOGLEV(1, 4, M_NONFATAL)   /* show hostname resolve errors */
+#define D_COMP_ERRORS    LOGLEV(1, 5, M_NONFATAL)   /* show compression errors */
+#define D_REPLAY_ERRORS  LOGLEV(1, 6, M_NONFATAL)   /* show packet replay errors */
+#define D_STREAM_ERRORS  LOGLEV(1, 7, M_NONFATAL)   /* TCP stream error requiring restart */
+#define D_IMPORT_ERRORS  LOGLEV(1, 8, M_NONFATAL)   /* show server import option errors */
+#define D_MULTI_ERRORS   LOGLEV(1, 9, M_NONFATAL)   /* show multi-client server errors */
+#define D_EVENT_ERRORS   LOGLEV(1, 10, M_NONFATAL)  /* show event.[ch] errors */
+#define D_PUSH_ERRORS    LOGLEV(1, 11, M_NONFATAL)  /* show push/pull errors */
+#define D_PID_PERSIST    LOGLEV(1, 12, M_NONFATAL)  /* show packet_id persist errors */
+#define D_FRAG_ERRORS    LOGLEV(1, 13, M_NONFATAL)  /* show fragmentation errors */
+#define D_ALIGN_ERRORS   LOGLEV(1, 14, M_NONFATAL)  /* show bad struct alignments */
+
+#define D_HANDSHAKE LOGLEV(2, 20, 0)                /* show data & control channel handshakes */
+#define D_CLOSE     LOGLEV(2, 22, 0)                /* show socket and TUN/TAP close */
+#define D_PROXY     LOGLEV(2, 24, 0)                /* show http proxy control packets */
+#define D_ARGV      LOGLEV(2, 25, 0)                /* show struct argv errors */
+
+#define D_TLS_DEBUG_LOW LOGLEV(3, 20, 0)            /* low frequency info from tls_session routines */
+#define D_GREMLIN       LOGLEV(3, 30, 0)            /* show simulated outage info from gremlin module */
+#define D_GENKEY        LOGLEV(3, 31, 0)            /* print message after key generation */
+#define D_ROUTE         LOGLEV(3, 0, 0)             /* show routes added and deleted (don't mute) */
+#define D_TUNTAP_INFO   LOGLEV(3, 32, 0)            /* show debugging info from TUN/TAP driver */
+#define D_RESTART       LOGLEV(3, 33, 0)            /* show certain restart messages */
+#define D_PUSH          LOGLEV(3, 34, 0)            /* show push/pull info */
+#define D_IFCONFIG_POOL LOGLEV(3, 35, 0)            /* show ifconfig pool info */
+#define D_AUTH          LOGLEV(3, 37, 0)            /* show user/pass auth info */
+#define D_MULTI_LOW     LOGLEV(3, 38, 0)            /* show point-to-multipoint low-freq debug info */
+#define D_PLUGIN        LOGLEV(3, 39, 0)            /* show plugin calls */
+#define D_MANAGEMENT    LOGLEV(3, 40, 0)            /* show --management info */
+#define D_SCHED_EXIT    LOGLEV(3, 41, 0)            /* show arming of scheduled exit */
+#define D_ROUTE_QUOTA   LOGLEV(3, 42, 0)            /* show route quota exceeded messages */
+#define D_OSBUF         LOGLEV(3, 43, 0)            /* show socket/tun/tap buffer sizes */
+#define D_PS_PROXY      LOGLEV(3, 44, 0)            /* messages related to --port-share option */
+#define D_IFCONFIG      LOGLEV(3, 0, 0)             /* show ifconfig info (don't mute) */
+#define D_DCO           LOGLEV(3, 0, 0)             /* show DCO related messages */
+
+#define D_SHOW_PARMS       LOGLEV(4, 50, 0)         /* show all parameters on program initiation */
+#define D_LOW              LOGLEV(4, 52, 0)         /* miscellaneous low-frequency debug info */
+#define D_DHCP_OPT         LOGLEV(4, 53, 0)         /* show DHCP options binary string */
+#define D_MBUF             LOGLEV(4, 54, 0)         /* mbuf.[ch] routines */
+#define D_PACKET_TRUNC_ERR LOGLEV(4, 55, 0)         /* PACKET_TRUNCATION_CHECK */
+#define D_MULTI_DROPPED    LOGLEV(4, 57, 0)         /* show point-to-multipoint packet drops */
+#define D_MULTI_MEDIUM     LOGLEV(4, 58, 0)         /* show medium frequency multi messages */
+#define D_X509_ATTR        LOGLEV(4, 59, 0)         /* show x509-track attributes on connection */
+#define D_INIT_MEDIUM      LOGLEV(4, 60, 0)         /* show medium frequency init messages */
+#define D_MTU_INFO         LOGLEV(4, 61, 0)         /* show terse MTU info */
+#define D_PID_DEBUG_LOW    LOGLEV(4, 63, 0)         /* show low-freq packet-id debugging info */
+#define D_PID_DEBUG_MEDIUM LOGLEV(4, 64, 0)         /* show medium-freq packet-id debugging info */
+#define D_CIPHER_INIT      LOGLEV(4, 65, 0)         /* show messages about cipher init */
+
+#define D_LOG_RW LOGLEV(5, 0, 0)                    /* Print 'R' or 'W' to stdout for read/write */
+
+#define D_RTNL          LOGLEV(6, 68, M_DEBUG)      /* show RTNL low level operations */
+#define D_LINK_RW       LOGLEV(6, 69, M_DEBUG)      /* show TCP/UDP reads/writes (terse) */
+#define D_TUN_RW        LOGLEV(6, 69, M_DEBUG)      /* show TUN/TAP reads/writes */
+#define D_TAP_WIN_DEBUG LOGLEV(6, 69, M_DEBUG)      /* show TAP-Windows driver debug info */
+#define D_CLIENT_NAT    LOGLEV(6, 69, M_DEBUG)      /* show client NAT debug info */
+#define D_XKEY          LOGLEV(6, 69, M_DEBUG)      /* show xkey-provider debug info */
+#define D_DCO_DEBUG     LOGLEV(6, 69, M_DEBUG)      /* show DCO related lowlevel debug messages */
+#define D_SIGNAL_DEBUG  LOGLEV(6, 69, M_DEBUG)      /* show signal related debug messages */
 
 #define D_SHOW_KEYS          LOGLEV(7, 70, M_DEBUG) /* show data channel encryption keys */
 #define D_SHOW_KEY_SOURCE    LOGLEV(7, 70, M_DEBUG) /* show data channel key source entropy */
 #define D_SHOW_OCC           LOGLEV(7, 74, M_DEBUG) /* show options compatibility string */
 
 
-#define D_VLAN_DEBUG LOGLEV(7, 74, M_DEBUG)        /* show VLAN tagging/untagging debug info */
-
-#define D_HANDSHAKE_VERBOSE LOGLEV(8, 70, M_DEBUG) /* show detailed description of handshake */
-#define D_TLS_DEBUG_MED     LOGLEV(8, 70, M_DEBUG) /* limited info from tls_session routines */
-#define D_INTERVAL          LOGLEV(8, 70, M_DEBUG) /* show interval.h debugging info */
-#define D_SCHEDULER         LOGLEV(8, 70, M_DEBUG) /* show scheduler debugging info */
-#define D_GREMLIN_VERBOSE   LOGLEV(8, 70, M_DEBUG) /* show verbose info from gremlin module */
-#define D_REL_DEBUG         LOGLEV(8, 70, M_DEBUG) /* show detailed info from reliable routines */
-#define D_EVENT_WAIT        LOGLEV(8, 70, M_DEBUG) /* show detailed info from event waits */
-#define D_MULTI_TCP         LOGLEV(8, 70, M_DEBUG) /* show debug info from mtcp.c */
-
-#define D_TLS_DEBUG         LOGLEV(9, 70, M_DEBUG) /* show detailed info from TLS routines */
-#define D_COMP              LOGLEV(9, 70, M_DEBUG) /* show compression info */
-#define D_READ_WRITE        LOGLEV(9, 70, M_DEBUG) /* show all tun/tcp/udp reads/writes/opens */
-#define D_PACKET_CONTENT    LOGLEV(9, 70, M_DEBUG) /* show before/after encryption packet content */
-#define D_TLS_NO_SEND_KEY   LOGLEV(9, 70, M_DEBUG) /* show when no data channel send-key exists */
-#define D_PID_PERSIST_DEBUG LOGLEV(9, 70, M_DEBUG) /* show packet-id persist debugging info */
-#define D_LINK_RW_VERBOSE   LOGLEV(9, 70, M_DEBUG) /* increase link reads/writes verbosity */
-#define D_STREAM_DEBUG      LOGLEV(9, 70, M_DEBUG) /* show TCP stream debug info */
-#define D_WIN32_IO          LOGLEV(9, 70, M_DEBUG) /* win32 I/O debugging info */
-#define D_PKCS11_DEBUG      LOGLEV(9, 70, M_DEBUG) /* show PKCS#11 debugging */
-
-#define D_SHAPER_DEBUG LOGLEV(10, 70, M_DEBUG)     /* show traffic shaper info */
-
-#define D_REGISTRY     LOGLEV(11, 70, M_DEBUG)     /* win32 registry debugging info */
-#define D_OPENSSL_LOCK LOGLEV(11, 70, M_DEBUG)     /* show OpenSSL locks */
+#define D_VLAN_DEBUG LOGLEV(7, 74, M_DEBUG)             /* show VLAN tagging/untagging debug info */
+
+#define D_HANDSHAKE_VERBOSE LOGLEV(8, 70, M_DEBUG)      /* show detailed description of handshake */
+#define D_TLS_DEBUG_MED     LOGLEV(8, 70, M_DEBUG)      /* limited info from tls_session routines */
+#define D_INTERVAL          LOGLEV(8, 70, M_DEBUG)      /* show interval.h debugging info */
+#define D_SCHEDULER         LOGLEV(8, 70, M_DEBUG)      /* show scheduler debugging info */
+#define D_GREMLIN_VERBOSE   LOGLEV(8, 70, M_DEBUG)      /* show verbose info from gremlin module */
+#define D_REL_DEBUG         LOGLEV(8, 70, M_DEBUG)      /* show detailed info from reliable routines */
+#define D_EVENT_WAIT        LOGLEV(8, 70, M_DEBUG)      /* show detailed info from event waits */
+#define D_MULTI_TCP         LOGLEV(8, 70, M_DEBUG)      /* show debug info from mtcp.c */
+
+#define D_TLS_DEBUG         LOGLEV(9, 70, M_DEBUG)      /* show detailed info from TLS routines */
+#define D_COMP              LOGLEV(9, 70, M_DEBUG)      /* show compression info */
+#define D_READ_WRITE        LOGLEV(9, 70, M_DEBUG)      /* show all tun/tcp/udp reads/writes/opens */
+#define D_PACKET_CONTENT    LOGLEV(9, 70, M_DEBUG)      /* show before/after encryption packet content */
+#define D_TLS_NO_SEND_KEY   LOGLEV(9, 70, M_DEBUG)      /* show when no data channel send-key exists */
+#define D_PID_PERSIST_DEBUG LOGLEV(9, 70, M_DEBUG)      /* show packet-id persist debugging info */
+#define D_LINK_RW_VERBOSE   LOGLEV(9, 70, M_DEBUG)      /* increase link reads/writes verbosity */
+#define D_STREAM_DEBUG      LOGLEV(9, 70, M_DEBUG)      /* show TCP stream debug info */
+#define D_WIN32_IO          LOGLEV(9, 70, M_DEBUG)      /* win32 I/O debugging info */
+#define D_PKCS11_DEBUG      LOGLEV(9, 70, M_DEBUG)      /* show PKCS#11 debugging */
+
+#define D_SHAPER_DEBUG LOGLEV(10, 70, M_DEBUG)          /* show traffic shaper info */
+
+#define D_REGISTRY     LOGLEV(11, 70, M_DEBUG)          /* win32 registry debugging info */
+#define D_OPENSSL_LOCK LOGLEV(11, 70, M_DEBUG)          /* show OpenSSL locks */
 
 /*#define D_THREAD_DEBUG       LOGLEV(4, 70, M_DEBUG)*/ /* show pthread debug information */
 
index dacfa8f63f58dbfa87c43e84ac13de492738a58f..1b98235b1466237ee72620ef9dacde464f951400 100644 (file)
@@ -175,7 +175,7 @@ error_reset(void)
     {
         openvpn_exit(OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE); /* exit point */
     }
-#else /* ifdef OPENVPN_DEBUG_COMMAND_LINE */
+#else
     msgfp = NULL;
 #endif
 }
index c9d3389b90f5ac9e11d81dd9c303a033d3a506ce..a419e32d62a1004a76c0f54930e59611416e7a9a 100644 (file)
@@ -266,7 +266,7 @@ translate_mtu_discover_type_name(const char *name)
         return IP_PMTUDISC_DONT;
     }
     msg(M_FATAL, "invalid --mtu-disc type: '%s' -- valid types are 'yes', 'maybe', or 'no'", name);
-#else /* if defined(IP_PMTUDISC_DONT) && defined(IP_PMTUDISC_WANT) && defined(IP_PMTUDISC_DO) */
+#else
     msg(M_FATAL, MTUDISC_NOT_SUPPORTED_MSG);
 #endif
     return -1; /* NOTREACHED */
index 8b352e95a75f54b08c5d15b1347e1a52acfbbcb9..e1ce32ab083346abdf3fdf553ffe10ec6a3e9ad5 100644 (file)
@@ -1006,9 +1006,7 @@ multi_print_status(struct multi_context *m, struct status_output *so, const int
 
 #ifdef PACKET_TRUNCATION_CHECK
         {
-            status_printf(
-                so,
-                "HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc");
+            status_printf(so, "HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc");
             hash_iterator_init(m->hash, &hi);
             while ((he = hash_iterator_next(&hi)))
             {
index dc5c93ff64d148d4fa15e40562028832d644c321..c2a93e85443bf4127b355d8dee5c7d9510d7c280 100644 (file)
@@ -208,7 +208,7 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2, struct gc_are
     uint8_t ntlmv2_hmacmd5[16];
     uint8_t *ntlmv2_blob = ntlmv2_response + 16; /* inside ntlmv2_response, length: 128 */
     int ntlmv2_blob_size = 0;
-    int phase3_bufpos = 0x40; /* offset to next security buffer data to be added */
+    int phase3_bufpos = 0x40;                    /* offset to next security buffer data to be added */
     size_t len;
 
     char domain[128];
index f1e1f76b310c8d90d9d6e9e929f3fda956733630..64b4f8c03d0e2f4cfc3987bfd39c35b600167406 100644 (file)
@@ -160,9 +160,7 @@ openvpn_main(int argc, char *argv[])
     struct context c;
 
 #if PEDANTIC
-    fprintf(
-        stderr,
-        "Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n");
+    fprintf(stderr, "Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n");
     return 1;
 #endif
 
index 672b9545aa5e6c95e2b55761ead5e207d1ce3577..c54032d84c4854a60f804ff11f2fe0ad7923d97a 100644 (file)
@@ -3931,7 +3931,8 @@ options_postprocess_mutate(struct options *o, struct env_set *es)
  *  Check file/directory sanity
  *
  */
-#ifndef ENABLE_SMALL /* Expect people using the stripped down version to know what they do */
+/* Expect people using the stripped down version to know what they do */
+#ifndef ENABLE_SMALL
 
 #define CHKACC_FILE       (1 << 0) /**< Check for a file/directory presence */
 #define CHKACC_DIRPATH    (1 << 1) /**< Check for directory presence where a file should reside */
@@ -6243,7 +6244,7 @@ add_option(struct options *options, char *p[], bool is_inline, const char *file,
         print_default_gateway(M_INFO, &rgi, &rgi6);
         openvpn_exit(OPENVPN_EXIT_STATUS_GOOD); /* exit point */
     }
-#endif /* if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) */
+#endif
     else if (streq(p[0], "echo") || streq(p[0], "parameter"))
     {
         struct buffer string = alloc_buf_gc(OPTION_PARM_SIZE, &gc);
index 51468ddc0b11d4315589bd21caa2d2f5235dcffb..38e67c8d14255f4b7d933734b95a826562918b0f 100644 (file)
@@ -133,16 +133,16 @@ struct connection_entry
     int tls_mtu;           /* Maximum MTU for the control channel messages */
 
     /* Advanced MTU negotiation and datagram fragmentation options */
-    int mtu_discover_type; /* used if OS supports setting Path MTU discovery options on socket */
-
-    int fragment;          /* internal fragmentation size */
-    bool fragment_encap;   /* true if --fragment had the "mtu" parameter to
-                            * include overhead from IP and TCP/UDP encapsulation */
-    int mssfix;            /* Upper bound on TCP MSS */
-    bool mssfix_default;   /* true if --mssfix should use the default parameters */
-    bool mssfix_encap;     /* true if --mssfix had the "mtu" parameter to include
-                            * overhead from IP and TCP/UDP encapsulation */
-    bool mssfix_fixed;     /* use the mssfix value without any encapsulation adjustments */
+    int mtu_discover_type;          /* used if OS supports setting Path MTU discovery options on socket */
+
+    int fragment;                   /* internal fragmentation size */
+    bool fragment_encap;            /* true if --fragment had the "mtu" parameter to
+                                     * include overhead from IP and TCP/UDP encapsulation */
+    int mssfix;                     /* Upper bound on TCP MSS */
+    bool mssfix_default;            /* true if --mssfix should use the default parameters */
+    bool mssfix_encap;              /* true if --mssfix had the "mtu" parameter to include
+                                     * overhead from IP and TCP/UDP encapsulation */
+    bool mssfix_fixed;              /* use the mssfix value without any encapsulation adjustments */
 
     int explicit_exit_notification; /* Explicitly tell peer when we are exiting via OCC_EXIT or
                                        [RESTART] message */
index 5251b2113bc8598e0700b62033a1e6c7c9cc3a2b..c3938a7dcf8d7584b86feff908ca3c8bd3881cc2 100644 (file)
@@ -146,14 +146,14 @@ atoi_warn(const char *str, int msglevel)
     return (int)i;
 }
 
-static const char *updatable_options[] = { "block-ipv6",        "block-outside-dns",
-                                           "dhcp-option",       "dns",
-                                           "ifconfig",          "ifconfig-ipv6",
+static const char *updatable_options[] = { "block-ipv6", "block-outside-dns",
+                                           "dhcp-option", "dns",
+                                           "ifconfig", "ifconfig-ipv6",
                                            "push-continuation", "redirect-gateway",
-                                           "redirect-private",  "route",
-                                           "route-gateway",     "route-ipv6",
-                                           "route-metric",      "topology",
-                                           "tun-mtu",           "keepalive" };
+                                           "redirect-private", "route",
+                                           "route-gateway", "route-ipv6",
+                                           "route-metric", "topology",
+                                           "tun-mtu", "keepalive" };
 
 bool
 check_push_update_option_flags(char *line, int *i, unsigned int *flags)
index 4b74f221d4795a91aabd0f93b7a3904e7d83c4ef..afd1b88a643e35c786b8ab04b791e1bd6f0520c6 100644 (file)
 #include "env_set.h"
 
 /* Script security */
-#define SSEC_NONE     0 /* strictly no calling of external programs */
-#define SSEC_BUILT_IN 1 /* only call built-in programs such as ifconfig, route, netsh, etc.*/
-#define SSEC_SCRIPTS  2 /* allow calling of built-in programs and user-defined scripts */
-#define SSEC_PW_ENV                                                                              \
-    3 /* allow calling of built-in programs and user-defined scripts that may receive a password \
-         as an environmental variable */
+/** strictly no calling of external programs */
+#define SSEC_NONE     0
+/** only call built-in programs such as ifconfig, route, netsh, etc.*/
+#define SSEC_BUILT_IN 1
+/** allow calling of built-in programs and user-defined scripts */
+#define SSEC_SCRIPTS  2
+/** allow calling of built-in programs and user-defined scripts that may receive a password
+    as an environmental variable */
+#define SSEC_PW_ENV   3
 
 #define OPENVPN_EXECVE_ERROR       -1  /* generic error while forking to run an external program */
 #define OPENVPN_EXECVE_NOT_ALLOWED -2  /* external program not run due to script security */
index cd5293afe29640d44157f667d4ddf0cef94728e2..e8fde86abfcabd4872e3829fe993f6cdca41641a 100644 (file)
@@ -222,15 +222,15 @@ struct key_state
      */
     uint32_t peer_id;
 
-    struct key_state_ssl ks_ssl; /* contains SSL object and BIOs for the control channel */
+    struct key_state_ssl ks_ssl;           /* contains SSL object and BIOs for the control channel */
 
-    time_t initial;              /* when we created this session */
-    time_t established;          /* when our state went S_ACTIVE */
-    time_t must_negotiate;       /* key negotiation times out if not finished before this time */
-    time_t must_die;             /* this object is destroyed at this time */
-    time_t peer_last_packet;     /* Last time we received a packet in this control session */
+    time_t initial;                        /* when we created this session */
+    time_t established;                    /* when our state went S_ACTIVE */
+    time_t must_negotiate;                 /* key negotiation times out if not finished before this time */
+    time_t must_die;                       /* this object is destroyed at this time */
+    time_t peer_last_packet;               /* Last time we received a packet in this control session */
 
-    int initial_opcode;          /* our initial P_ opcode */
+    int initial_opcode;                    /* our initial P_ opcode */
     struct session_id session_id_remote;   /* peer's random session ID */
     struct link_socket_actual remote_addr; /* peer's IP addr */
 
@@ -579,9 +579,8 @@ struct tls_session
 enum multi_status
 {
     CAS_NOT_CONNECTED,
-    CAS_WAITING_AUTH, /**< Initial TLS connection established but deferred auth is not yet finished
-                       */
-    CAS_PENDING,      /**< Options import (Connect script/plugin, ccd,...) */
+    CAS_WAITING_AUTH,             /**< Initial TLS connection established but deferred auth is not yet finished */
+    CAS_PENDING,                  /**< Options import (Connect script/plugin, ccd,...) */
     CAS_PENDING_DEFERRED,         /**< Waiting on an async option import handler */
     CAS_PENDING_DEFERRED_PARTIAL, /**< at least handler succeeded but another is still pending */
     CAS_FAILED,                   /**< Option import failed or explicitly denied the client */
index f4a99482438369989c83d444b841447ba4e8ec05..3820808dbdf81ec73b9596a729b6c4f1f41132d9 100644 (file)
@@ -329,10 +329,12 @@ encode_pkcs1(unsigned char *enc, size_t *enc_len, const char *mdname, const unsi
 
 #define MAKE_DI(x) { NID_##x, x, sizeof(x) }
 
+    /* clang-format off */
     DIG_INFO dinfo[] = {
         MAKE_DI(sha1),   MAKE_DI(sha256),     MAKE_DI(sha384),     MAKE_DI(sha512),
         MAKE_DI(sha224), MAKE_DI(sha512_224), MAKE_DI(sha512_256), { 0, NULL, 0 }
     };
+    /* clang-format on */
 
     size_t out_len = 0;
     bool ret = false;
index 09be7e821cf9c84c51635394c7f16bd4bed1266a..b633e77641b671d3cf67a55f39e944275c37324d 100644 (file)
@@ -225,10 +225,8 @@ static DWORD
 delete_device(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData,
               _Inout_ LPBOOL pbRebootRequired)
 {
-    SP_REMOVEDEVICE_PARAMS params =
-    {
-        .ClassInstallHeader =
-        {
+    SP_REMOVEDEVICE_PARAMS params = {
+        .ClassInstallHeader = {
             .cbSize = sizeof(SP_CLASSINSTALL_HEADER),
             .InstallFunction = DIF_REMOVE,
         },
@@ -281,10 +279,8 @@ static DWORD
 change_device_state(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData,
                     _In_ BOOL bEnable, _Inout_ LPBOOL pbRebootRequired)
 {
-    SP_PROPCHANGE_PARAMS params =
-    {
-        .ClassInstallHeader =
-        {
+    SP_PROPCHANGE_PARAMS params = {
+        .ClassInstallHeader = {
             .cbSize = sizeof(SP_CLASSINSTALL_HEADER),
             .InstallFunction = DIF_PROPERTYCHANGE,
         },
@@ -768,10 +764,8 @@ cleanup_remove_device:
     if (dwResult != ERROR_SUCCESS)
     {
         /* The adapter was installed. But, the adapter ID was unobtainable. Clean-up. */
-        SP_REMOVEDEVICE_PARAMS removedevice_params =
-        {
-            .ClassInstallHeader =
-            {
+        SP_REMOVEDEVICE_PARAMS removedevice_params = {
+            .ClassInstallHeader = {
                 .cbSize = sizeof(SP_CLASSINSTALL_HEADER),
                 .InstallFunction = DIF_REMOVE,
             },
index 3823d3982afc9ef870c3106cd480a3ce1cb7c2a0..65b31e7808aa393b0d05a9cfb571324f2b67bea2 100644 (file)
@@ -219,7 +219,7 @@ test_tls_decrypt_lite_crypt(void **ut_state)
     {
         buf_reset_len(&buf);
         buf_write(&buf, client_reset_v2_tls_crypt, sizeof(client_reset_v2_tls_crypt));
-        BPTR(&buf)[i] = 0x23;
+        (BPTR(&buf))[i] = 0x23;
         verdict = tls_pre_decrypt_lite(&tas, &state, &from, &buf);
         assert_int_equal(verdict, VERDICT_INVALID);
         free_tls_pre_decrypt_state(&state);
@@ -274,7 +274,7 @@ test_tls_decrypt_lite_auth(void **ut_state)
     free_tls_pre_decrypt_state(&state);
 
     /* flip a byte in the hmac */
-    BPTR(&buf)[20] = 0x23;
+    (BPTR(&buf))[20] = 0x23;
     verdict = tls_pre_decrypt_lite(&tas, &state, &from, &buf);
     assert_int_equal(verdict, VERDICT_INVALID);
     free_tls_pre_decrypt_state(&state);