uncrustify vs. operators
cover uncrustify vs. operators
There are several different uncrustify settings controlling the space around operators. This series presents a few options of what to set. Pick and choose ;)
Frank Lichtenheld (6):
uncrustify: add space around compare operators reformat for sp_compare=add
uncrustify: add space around "additive" operators reformat for sp_arith_additive=add
uncrustify: add space around all arithmetic operators reformat for sp_arith=add
config-msvc.h | 2 +- dev-tools/uncrustify.conf | 2 + include/openvpn-plugin.h.in | 2 +- .../client-connect/sample-client-connect.c | 32 +-- sample/sample-plugins/defer/multi-auth.c | 10 +- sample/sample-plugins/log/log.c | 18 +- sample/sample-plugins/log/log_v3.c | 18 +- sample/sample-plugins/simple/base64.c | 2 +- src/compat/compat-gettimeofday.c | 2 +- src/compat/compat-versionhelpers.h | 2 +- src/openvpn/auth_token.c | 22 +- src/openvpn/basic.h | 2 +- src/openvpn/buffer.c | 8 +- src/openvpn/buffer.h | 76 ++--- src/openvpn/common.h | 2 +- src/openvpn/comp.h | 18 +- src/openvpn/console_builtin.c | 2 +- src/openvpn/console_systemd.c | 2 +- src/openvpn/crypto.c | 12 +- src/openvpn/crypto.h | 16 +- src/openvpn/crypto_mbedtls.c | 28 +- src/openvpn/crypto_openssl.c | 6 +- src/openvpn/cryptoapi.c | 36 +-- src/openvpn/dco.c | 2 +- src/openvpn/dco_freebsd.c | 4 +- src/openvpn/dco_linux.c | 2 +- src/openvpn/dhcp.c | 14 +- src/openvpn/env_set.c | 2 +- src/openvpn/error.c | 12 +- src/openvpn/error.h | 26 +- src/openvpn/event.c | 22 +- src/openvpn/event.h | 4 +- src/openvpn/forward.c | 8 +- src/openvpn/forward.h | 44 +-- src/openvpn/gremlin.c | 8 +- src/openvpn/gremlin.h | 10 +- src/openvpn/httpdigest.c | 8 +- src/openvpn/httpdigest.h | 2 +- src/openvpn/init.c | 44 +-- src/openvpn/init.h | 16 +- src/openvpn/integer.h | 4 +- src/openvpn/list.c | 18 +- src/openvpn/list.h | 4 +- src/openvpn/manage.c | 66 ++--- src/openvpn/manage.h | 74 ++--- src/openvpn/mbuf.h | 4 +- src/openvpn/misc.c | 14 +- src/openvpn/misc.h | 28 +- src/openvpn/mroute.h | 26 +- src/openvpn/mss.c | 10 +- src/openvpn/mstats.c | 2 +- src/openvpn/mtcp.c | 10 +- src/openvpn/mtu.c | 2 +- src/openvpn/mudp.c | 4 +- src/openvpn/multi.c | 14 +- src/openvpn/multi.h | 16 +- src/openvpn/ntlm.c | 16 +- src/openvpn/openssl_compat.h | 2 +- src/openvpn/openvpn.c | 2 +- src/openvpn/openvpn.h | 6 +- src/openvpn/options.c | 260 +++++++++--------- src/openvpn/options.h | 74 ++--- src/openvpn/otime.c | 2 +- src/openvpn/perf.c | 2 +- src/openvpn/pkcs11.c | 32 +-- src/openvpn/pkcs11_openssl.c | 6 +- src/openvpn/platform.c | 8 +- src/openvpn/plugin.c | 4 +- src/openvpn/pool.c | 4 +- src/openvpn/proto.c | 2 +- src/openvpn/proto.h | 16 +- src/openvpn/proxy.c | 16 +- src/openvpn/ps.c | 12 +- src/openvpn/push.c | 12 +- src/openvpn/reliable.c | 6 +- src/openvpn/route.c | 32 +-- src/openvpn/route.h | 52 ++-- src/openvpn/run_command.h | 6 +- src/openvpn/schedule.c | 8 +- src/openvpn/shaper.h | 4 +- src/openvpn/socket.c | 44 +-- src/openvpn/socket.h | 56 ++-- src/openvpn/socks.c | 4 +- src/openvpn/ssl.c | 10 +- src/openvpn/ssl.h | 18 +- src/openvpn/ssl_common.h | 20 +- src/openvpn/ssl_mbedtls.c | 24 +- src/openvpn/ssl_ncp.c | 4 +- src/openvpn/ssl_openssl.c | 14 +- src/openvpn/ssl_pkt.c | 2 +- src/openvpn/ssl_verify.c | 6 +- src/openvpn/ssl_verify.h | 8 +- src/openvpn/ssl_verify_mbedtls.c | 14 +- src/openvpn/ssl_verify_openssl.c | 10 +- src/openvpn/status.c | 6 +- src/openvpn/status.h | 4 +- src/openvpn/syshead.h | 2 +- src/openvpn/tls_crypt.c | 2 +- src/openvpn/tls_crypt.h | 4 +- src/openvpn/tun.c | 46 ++-- src/openvpn/win32.c | 26 +- src/openvpn/win32.h | 4 +- src/openvpn/xkey_common.h | 2 +- src/openvpn/xkey_provider.c | 6 +- src/openvpnmsica/openvpnmsica.c | 8 +- src/openvpnserv/common.c | 2 +- src/openvpnserv/interactive.c | 28 +- src/openvpnserv/service.c | 4 +- src/openvpnserv/service.h | 6 +- src/plugins/auth-pam/auth-pam.c | 40 +-- src/plugins/auth-pam/pamdl.c | 2 +- src/plugins/auth-pam/utils.c | 6 +- src/plugins/down-root/down-root.c | 2 +- src/tapctl/basic.h | 2 +- src/tapctl/error.h | 28 +- src/tapctl/main.c | 2 +- tests/unit_tests/openvpn/test_auth_token.c | 26 +- tests/unit_tests/openvpn/test_buffer.c | 8 +- tests/unit_tests/openvpn/test_pkt.c | 6 +- tests/unit_tests/openvpn/test_provider.c | 4 +- tests/unit_tests/openvpn/test_tls_crypt.c | 10 +- 121 files changed, 975 insertions(+), 973 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/6 uncrustify: add space around compare operators
--- dev-tools/uncrustify.conf | 3 +++ 1 file changed, 3 insertions(+)
dev-tools/uncrustify.conf +3 -0
@@ -34,6 +34,9 @@ sp_inside_sparen=remove sp_cond_colon=add sp_cond_question=add sp_bool=add +sp_arith=ignore +sp_arith_additive=ignore +sp_compare=add sp_else_brace=add sp_brace_else=add sp_after_comma=add
Signature · 1 line
2.34.1
PATCH 2/6 reformat for sp_compare=add
In reply to Frank Lichtenheld--- config-msvc.h | 2 +- .../client-connect/sample-client-connect.c | 2 +- src/openvpn/crypto.c | 4 ++-- src/openvpn/crypto_mbedtls.c | 2 +- src/openvpn/init.c | 2 +- src/openvpn/integer.h | 4 ++-- src/openvpn/manage.c | 8 ++++---- src/openvpn/ntlm.c | 4 ++-- src/openvpn/options.c | 14 +++++++------- src/openvpn/pkcs11.c | 16 ++++++++-------- src/openvpn/pkcs11_openssl.c | 2 +- src/openvpn/ps.c | 2 +- src/openvpn/route.c | 2 +- src/openvpn/socket.c | 10 +++++----- src/openvpn/socks.c | 4 ++-- src/openvpn/ssl_ncp.c | 4 ++-- src/openvpn/ssl_verify.c | 2 +- src/openvpn/ssl_verify_mbedtls.c | 2 +- src/openvpn/ssl_verify_openssl.c | 2 +- src/openvpn/tun.c | 16 ++++++++-------- src/openvpn/xkey_provider.c | 2 +- tests/unit_tests/openvpn/test_pkt.c | 2 +- 22 files changed, 54 insertions(+), 54 deletions(-)
config-msvc.h +1 -1
@@ -56,7 +56,7 @@#define strncasecmp strnicmp#define strcasecmp _stricmp -#if _MSC_VER<1900 +#if _MSC_VER <1900 #define snprintf _snprintf#endif
sample/sample-plugins/client-connect/sample-client-connect.c +1 -1
@@ -350,7 +350,7 @@ openvpn_plugin_client_connect(struct plugin_context *context,/* log environment variables handed to us by OpenVPN, but * only if "setenv verb" is 3 or higher (arbitrary number) */ -if (context->verb>=3 ) +if (context->verb >=3 ) {for (int i =0 ; argv[i]; i++) {
src/openvpn/crypto.c +2 -2
@@ -1411,7 +1411,7 @@ write_key_file(const int nkeys, const char *filename)buf_printf (&out,"%s\n" , static_key_foot);/* write key file to stdout if no filename given */ -if (!filename ||strcmp (filename,"" )==0 ) +if (!filename ||strcmp (filename,"" ) ==0 ) {printf ("%.*s\n" ,BLEN (&out),BPTR (&out)); }
@@ -1738,7 +1738,7 @@ write_pem_key_file(const char *filename, const char *pem_name) goto cleanup; } -if (!filename ||strcmp (filename,"" )==0 ) +if (!filename ||strcmp (filename,"" ) ==0 ) {printf ("%.*s" ,BLEN (&server_key_pem),BPTR (&server_key_pem)); }
src/openvpn/crypto_mbedtls.c +1 -1
@@ -1105,7 +1105,7 @@ ssl_tls1_PRF(const uint8_t *label, int label_len, const uint8_t *sec,tls1_P_hash (md5,S1 , len, label, label_len, out1, olen);tls1_P_hash (sha1,S2 , len, label, label_len, out2, olen); -for (int i =0 ; i<olen; i++) +for (int i =0 ; i < olen; i++) { out1[i] ^= out2[i]; }
src/openvpn/init.c +1 -1
@@ -677,7 +677,7 @@ context_init_1(struct context *c) {int i;pkcs11_initialize (true, c->options.pkcs11_pin_cache_period); -for (i =0 ; i<MAX_PARMS && c->options.pkcs11_providers[i] !=NULL ; i++) +for (i =0 ; i <MAX_PARMS && c->options.pkcs11_providers[i] !=NULL ; i++) {pkcs11_addProvider (c->options.pkcs11_providers[i], c->options.pkcs11_protected_authentication[i], c->options.pkcs11_private_mode[i], c->options.pkcs11_cert_private[i]);
src/openvpn/integer.h +2 -2
@@ -27,12 +27,12 @@#include "error.h" #ifndef htonll -#define htonll (x) ((1==htonl(1)) ? (x) : \ +#define htonll (x) ((1 == htonl(1)) ? (x) : \ ((uint64_t)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32))#endif #ifndef ntohll -#define ntohll (x) ((1==ntohl(1)) ? (x) : \ +#define ntohll (x) ((1 == ntohl(1)) ? (x) : \ ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))#endif
src/openvpn/manage.c +4 -4
@@ -2111,7 +2111,7 @@ management_android_control(struct management *man, const char *command, const chstrncpy (up.username, msg,sizeof (up.username)-1 );management_query_user_pass (management, &up, command,GET_USER_PASS_NEED_OK , (void *)0 ); -return strcmp ("ok" , up.password)==0 ; +return strcmp ("ok" , up.password) ==0 ; }/*
@@ -2435,7 +2435,7 @@ man_settings_init(struct man_settings *ms, status =openvpn_getaddrinfo (resolve_flags, addr, port,0 ,NULL ,AF_UNSPEC , &ms->local); -ASSERT (status==0 ); +ASSERT (status ==0 ); } }
@@ -2848,7 +2848,7 @@ management_notify_client_needing_auth(struct management *management, }msg (M_CLIENT ,">CLIENT:%s,%lu,%u" , mode, mdac->cid, mda_key_id);man_output_extra_env (management,"CLIENT" ); -if (management->connection.env_filter_level>0 ) +if (management->connection.env_filter_level >0 ) {man_output_peer_info_env (management, mdac); }
@@ -2969,7 +2969,7 @@ management_post_tunnel_open(struct management *man, const in_addr_t tun_local_ip ia.s_addr =htonl (tun_local_ip); ret =openvpn_getaddrinfo (GETADDR_PASSIVE ,inet_ntoa (ia),NULL ,0 ,NULL ,AF_INET , &man->settings.local); -ASSERT (ret==0 ); +ASSERT (ret ==0 );man_connection_init (man); }
src/openvpn/ntlm.c +2 -2
@@ -122,7 +122,7 @@ gen_nonce(unsigned char *nonce)/* Generates 8 random bytes to be used as client nonce */ int i; -for (i =0 ; i<8 ; i++) +for (i =0 ; i <8 ; i++) { nonce[i] = (unsigned char )get_random (); }
@@ -263,7 +263,7 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2,* therefore buf2 needs to be (3/4 * 128) */ /* extract the challenge from bytes 24-31 */ -for (i =0 ; i<8 ; i++) +for (i =0 ; i <8 ; i++) { challenge[i] = buf2[i+24 ]; }
src/openvpn/options.c +7 -7
@@ -1976,7 +1976,7 @@ show_settings(const struct options *o)SHOW_INT (ns_cert_type); {int i; -for (i =0 ; i<MAX_PARMS ; i++) +for (i =0 ; i <MAX_PARMS ; i++) {SHOW_INT (remote_cert_ku[i]); }
@@ -2019,28 +2019,28 @@ show_settings(const struct options *o)#ifdef ENABLE_PKCS11 {int i; -for (i =0 ; i<MAX_PARMS && o->pkcs11_providers[i] !=NULL ; i++) +for (i =0 ; i <MAX_PARMS && o->pkcs11_providers[i] !=NULL ; i++) {SHOW_PARM (pkcs11_providers, o->pkcs11_providers[i],"%s" ); } } {int i; -for (i =0 ; i<MAX_PARMS ; i++) +for (i =0 ; i <MAX_PARMS ; i++) {SHOW_PARM (pkcs11_protected_authentication, o->pkcs11_protected_authentication[i] ?"ENABLED" :"DISABLED" ,"%s" ); } } {int i; -for (i =0 ; i<MAX_PARMS ; i++) +for (i =0 ; i <MAX_PARMS ; i++) {SHOW_PARM (pkcs11_private_mode, o->pkcs11_private_mode[i],"%08x" ); } } {int i; -for (i =0 ; i<MAX_PARMS ; i++) +for (i =0 ; i <MAX_PARMS ; i++) {SHOW_PARM (pkcs11_cert_private, o->pkcs11_cert_private[i] ?"ENABLED" :"DISABLED" ,"%s" ); }
@@ -2556,7 +2556,7 @@ options_postprocess_verify_ce(const struct options *options,/* <connection> blocks force to have a remote embedded, so we check * for the --remote and bail out if it is present */ -if (options->connection_list->len >1 +if (options->connection_list->len >1 || options->connection_list->array[0 ]->remote) {msg (M_USAGE ,"<connection> cannot be used with --mode server" );
@@ -6063,7 +6063,7 @@ add_option(struct options *options,for (j =1 ; p[j]; j++) {/* Allow the user to specify ignore-unknown-option --opt too */ -if (p[j][0 ]=='-' && p[j][1 ]=='-' ) +if (p[j][0 ] =='-' && p[j][1 ] =='-' ) { options->ignore_unknown_option[i] = (p[j]+2 ); }
src/openvpn/pkcs11.c +8 -8
@@ -198,7 +198,7 @@ _pkcs11_openvpn_token_prompt( (void )user_data; (void )retry; -ASSERT (token!=NULL ); +ASSERT (token !=NULL );CLEAR (token_resp); token_resp.defined = false;
@@ -245,7 +245,7 @@ _pkcs11_openvpn_pin_prompt( (void )user_data; (void )retry; -ASSERT (token!=NULL ); +ASSERT (token !=NULL );openvpn_snprintf (prompt,sizeof (prompt),"%s token" , token->label);
@@ -381,7 +381,7 @@ pkcs11_addProvider( {CK_RV rv =CKR_OK ; -ASSERT (provider!=NULL ); +ASSERT (provider !=NULL ); dmsg( D_PKCS11_DEBUG,
@@ -495,8 +495,8 @@ pkcs11_management_id_get(int count =0 ;bool success = false; -ASSERT (id!=NULL ); -ASSERT (base64!=NULL ); +ASSERT (id !=NULL ); +ASSERT (base64 !=NULL ); dmsg( D_PKCS11_DEBUG,
@@ -662,8 +662,8 @@ tls_ctx_use_pkcs11(bool ok = false; -ASSERT (ssl_ctx!=NULL ); -ASSERT (pkcs11_id_management || pkcs11_id!=NULL ); +ASSERT (ssl_ctx !=NULL ); +ASSERT (pkcs11_id_management || pkcs11_id !=NULL ); dmsg( D_PKCS11_DEBUG,
@@ -795,7 +795,7 @@ _pkcs11_openvpn_show_pkcs11_ids_pin_prompt( (void )user_data; (void )retry; -ASSERT (token!=NULL ); +ASSERT (token !=NULL );buf_printf (&pass_prompt,"Please enter '%s' token PIN or 'cancel': " , token->display); if (!query_user_SINGLE(BSTR(&pass_prompt), BLEN(&pass_prompt),
src/openvpn/pkcs11_openssl.c +1 -1
@@ -433,7 +433,7 @@ pkcs11_certificate_serial(pkcs11h_certificate_t certificate, char *serial,i2a_ASN1_INTEGER (bio,X509_get_serialNumber (x509)); n =BIO_read (bio, serial, serial_len-1 ); -if (n<0 ) +if (n <0 ) { serial[0 ] ='\x0' ; }
src/openvpn/ps.c +1 -1
@@ -839,7 +839,7 @@ port_share_open(const char *host, status =openvpn_getaddrinfo (GETADDR_RESOLVE |GETADDR_FATAL , host, port,0 ,NULL ,AF_INET , &ai); -ASSERT (status==0 ); +ASSERT (status ==0 ); hostaddr = *((struct sockaddr_in *) ai->ai_addr);freeaddrinfo (ai);
src/openvpn/route.c +1 -1
@@ -739,7 +739,7 @@ route_ipv6_match_host( const struct route_ipv6 *r6,int i;unsigned int mask; -if (bits>128 ) +if (bits >128 ) {return false; }
src/openvpn/socket.c +5 -5
@@ -191,7 +191,7 @@ getaddr(unsigned int flags, status =get_addr_generic (AF_INET , flags, hostname, &addr,NULL , resolve_retry_seconds, signal_received,M_WARN ); -if (status==0 ) +if (status ==0 ) {if (succeeded) {
@@ -1679,7 +1679,7 @@ resolve_bind_local(struct link_socket *sock, const sa_family_t af) NULL, af, &sock->info.lsa->bind_local); } -if (status !=0 ) +if (status !=0 ) { msg(M_FATAL, "getaddrinfo() failed for local \"%s:%s\": %s", sock->local_host, sock->local_port,
@@ -1781,7 +1781,7 @@ resolve_remote(struct link_socket *sock, goto done; } } -if (status!=0 ) +if (status !=0 ) {if (signal_received) {
@@ -2780,7 +2780,7 @@ print_sockaddr_ex(const struct sockaddr *sa, status =getnameinfo (sa, salen, hostaddr,sizeof (hostaddr), servname,sizeof (servname),NI_NUMERICHOST |NI_NUMERICSERV ); -if (status!=0 ) +if (status !=0 ) {buf_printf (&out,"[nameinfo() err: %s]" ,gai_strerror (status));return BSTR (&out);
@@ -2950,7 +2950,7 @@ add_in6_addr( struct in6_addr base, uint32_t add ) {int i; -for (i =15 ; i>=0 && add >0 ; i--) +for (i =15 ; i >=0 && add >0 ; i--) { registerint carry; registeruint32_t h;
src/openvpn/socks.c +2 -2
@@ -428,7 +428,7 @@ port_from_servname(const char *servname) {int port =0 ; port =atoi (servname); -if (port >0 && port <65536 ) +if (port >0 && port <65536 ) {return port; }
@@ -471,7 +471,7 @@ establish_socks_proxy_passthru(struct socks_proxy_info *p,memcpy (buf +5 , host, len);int port =port_from_servname (servname); -if (port ==0 ) +if (port ==0 ) {msg (D_LINK_ERRORS ,"establish_socks_proxy_passthrough: Cannot convert %s to port number" , servname); goto error;
src/openvpn/ssl_ncp.c +2 -2
@@ -146,7 +146,7 @@ mutate_ncp_cipher_list(const char *list, struct gc_arena *gc) ovpn_cipher_name ="none" ; } -if (buf_len (&new_list)>0 ) +if (buf_len (&new_list) >0 ) {/* The next if condition ensure there is always space for * a :
@@ -226,7 +226,7 @@ tls_peer_ncp_list(const char *peer_info, struct gc_arena *gc) {return iv_ciphers; } - else if (tls_peer_info_ncp_ver(peer_info)>=2) + else if (tls_peer_info_ncp_ver(peer_info) >= 2) {/* If the peer announces IV_NCP=2 then it supports the AES GCM * ciphers */
src/openvpn/ssl_verify.c +1 -1
@@ -1569,7 +1569,7 @@ verify_user_pass(struct user_pass *up, struct tls_multi *multi,/* check sizing of username if it will become our common name */ if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) - &&strlen (up->username)>TLS_USERNAME_LEN ) + &&strlen (up->username) >TLS_USERNAME_LEN ) { msg(D_TLS_ERRORS, "TLS Auth Error: --username-as-common name specified and username is longer than the maximum permitted Common Name length of %d characters",
src/openvpn/ssl_verify_mbedtls.c +1 -1
@@ -477,7 +477,7 @@ x509_verify_cert_ku(mbedtls_x509_crt *cert, const unsigned *const expected_ku, }result_t fFound =FAILURE ; -for (size_t i =0 ;SUCCESS != fFound && i<expected_len; i++) +for (size_t i =0 ;SUCCESS != fFound && i < expected_len; i++) {if (expected_ku[i] !=0 &&0 ==mbedtls_x509_crt_check_key_usage (cert, expected_ku[i]))
src/openvpn/ssl_verify_openssl.c +1 -1
@@ -150,7 +150,7 @@ extract_x509_extension(X509 *cert, char *fieldname, char *out, int size) numalts =sk_GENERAL_NAME_num (extensions);/* loop through all alternatives */ -for (i =0 ; i<numalts; i++) +for (i =0 ; i < numalts; i++) {/* get a handle to alternative name number i */ const GENERAL_NAME *name =sk_GENERAL_NAME_value (extensions, i );
src/openvpn/tun.c +8 -8
@@ -2057,7 +2057,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tunint android_method =managment_android_persisttun_action (management); -if (oldtunfd >=0 && android_method ==ANDROID_KEEP_OLD_TUN ) +if (oldtunfd >=0 && android_method ==ANDROID_KEEP_OLD_TUN ) {/* keep the old fd */ opentun = true;
@@ -2486,7 +2486,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun {msg (M_ERR ,"Can't set PPA %d" , ppa); } -if (ioctl (if_fd,SIOCGLIFFLAGS , &ifr) <0 ) +if (ioctl (if_fd,SIOCGLIFFLAGS , &ifr) <0 ) {msg (M_ERR ,"Can't get flags\n" ); }
@@ -3257,7 +3257,7 @@ open_darwin_utun(const char *dev, const char *dev_type, const char *dev_node, st fd =utun_open_helper (ctlInfo, utunnum);/* Break if the fd is valid, * or if early initialization failed (-2) */ -if (fd !=-1 ) +if (fd !=-1 ) {break ; }
@@ -3296,13 +3296,13 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun {#ifdef HAVE_NET_IF_UTUN_H /* If dev_node does not start start with utun assume regular tun/tap */ -if ((!dev_node && tt->type==DEV_TYPE_TUN ) +if ((!dev_node && tt->type ==DEV_TYPE_TUN ) || (dev_node && !strncmp (dev_node,"utun" ,4 ))) {/* Check if user has specific dev_type tap and forced utun with * dev-node utun */ -if (tt->type!=DEV_TYPE_TUN ) +if (tt->type !=DEV_TYPE_TUN ) {msg (M_FATAL ,"Cannot use utun devices with --dev-type %s" ,dev_type_string (dev, dev_type));
@@ -3336,7 +3336,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun* Unset dev_node variable prior to passing to open_tun_generic to * let open_tun_generic pick the first available tun device */ -if (dev_node &&strcmp (dev_node,"tun" )==0 ) +if (dev_node &&strcmp (dev_node,"tun" ) ==0 ) { dev_node =NULL ; }
@@ -3425,7 +3425,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tunif (strcmp ( dev,"tap" ) ==0 )/* find first free tap dev */ {/* (= no /dev/tapN node) */ int i; -for (i =0 ; i<99 ; i++) +for (i =0 ; i <99 ; i++) {openvpn_snprintf (tunname,sizeof (tunname),"/dev/tap%d" , i);if (access ( tunname,F_OK ) <0 && errno ==ENOENT )
@@ -5423,7 +5423,7 @@ netsh_set_dns6_servers(const struct in6_addr *addr_list, }/* Treat errors while adding as non-fatal as we do not check for duplicates */ -netsh_command (&argv,1 , (i==0 ) ?M_FATAL :M_NONFATAL ); +netsh_command (&argv,1 , (i ==0 ) ?M_FATAL :M_NONFATAL ); }argv_free (&argv);
src/openvpn/xkey_provider.c +1 -1
@@ -278,7 +278,7 @@ keymgmt_import(void *keydata, int selection, const OSSL_PARAM params[], const chEVP_PKEY_CTX *ctx =EVP_PKEY_CTX_new_from_name (key->prov->libctx, name,NULL );if (!ctx || (EVP_PKEY_fromdata_init (ctx) !=1 ) - || (EVP_PKEY_fromdata (ctx, &pkey, selection_pub, (OSSL_PARAM *) params) !=1 )) + || (EVP_PKEY_fromdata (ctx, &pkey, selection_pub, (OSSL_PARAM *) params) !=1 )) {msg (M_WARN ,"Error: keymgmt_import failed for key type <%s>" , name);if (pkey)
tests/unit_tests/openvpn/test_pkt.c +1 -1
@@ -231,7 +231,7 @@ test_tls_decrypt_lite_crypt(void **ut_state)free_tls_pre_decrypt_state (&state);/* flip a byte in various places */ -for (int i =0 ; i<sizeof (client_reset_v2_tls_crypt); i++) +for (int i =0 ; i <sizeof (client_reset_v2_tls_crypt); i++) {buf_reset_len (&buf);buf_write (&buf, client_reset_v2_tls_crypt,sizeof (client_reset_v2_tls_crypt));
Signature · 1 line
2.34.1
PATCH 3/6 uncrustify: add space around "additive" operators
In reply to Frank LichtenheldOnly '+' and '-' since sp_arith=add would be very
intrusive.
--- dev-tools/uncrustify.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dev-tools/uncrustify.conf +1 -1
@@ -35,7 +35,7 @@ sp_cond_colon=add sp_cond_question=add sp_bool=add sp_arith=ignore -sp_arith_additive=ignore +sp_arith_additive=add sp_compare=add sp_else_brace=add sp_brace_else=add
Signature · 1 line
2.34.1
PATCH 4/6 reformat for sp_arith_additive=add
In reply to Frank Lichtenheld--- src/openvpn/buffer.c | 6 +-- src/openvpn/buffer.h | 2 +- src/openvpn/console_systemd.c | 2 +- src/openvpn/crypto.c | 6 +-- src/openvpn/crypto_mbedtls.c | 10 ++--- src/openvpn/cryptoapi.c | 2 +- src/openvpn/dhcp.c | 14 +++---- src/openvpn/env_set.c | 2 +- src/openvpn/event.c | 8 ++-- src/openvpn/gremlin.c | 8 ++-- src/openvpn/httpdigest.c | 4 +- src/openvpn/httpdigest.h | 2 +- src/openvpn/init.c | 4 +- src/openvpn/list.h | 2 +- src/openvpn/manage.c | 14 +++---- src/openvpn/mbuf.h | 2 +- src/openvpn/misc.c | 12 +++--- src/openvpn/mroute.h | 8 ++-- src/openvpn/mss.c | 6 +-- src/openvpn/ntlm.c | 10 ++--- src/openvpn/openvpn.c | 2 +- src/openvpn/options.c | 48 +++++++++++------------ src/openvpn/otime.c | 2 +- src/openvpn/pkcs11.c | 2 +- src/openvpn/pkcs11_openssl.c | 2 +- src/openvpn/plugin.c | 2 +- src/openvpn/pool.c | 2 +- src/openvpn/proto.c | 2 +- src/openvpn/proxy.c | 16 ++++---- src/openvpn/push.c | 8 ++-- src/openvpn/reliable.c | 4 +- src/openvpn/route.c | 10 ++--- src/openvpn/route.h | 2 +- src/openvpn/schedule.c | 8 ++-- src/openvpn/socket.c | 6 +-- src/openvpn/ssl.c | 4 +- src/openvpn/ssl_mbedtls.c | 2 +- src/openvpn/ssl_openssl.c | 2 +- src/openvpn/ssl_pkt.c | 2 +- src/openvpn/ssl_verify.c | 2 +- src/openvpn/ssl_verify_mbedtls.c | 12 +++--- src/openvpn/ssl_verify_openssl.c | 4 +- src/openvpn/status.c | 2 +- src/openvpn/tun.c | 10 ++--- src/openvpn/win32.c | 2 +- src/openvpnmsica/openvpnmsica.c | 2 +- src/openvpnserv/interactive.c | 10 ++--- src/openvpnserv/service.c | 4 +- src/plugins/auth-pam/auth-pam.c | 8 ++-- src/plugins/auth-pam/utils.c | 6 +-- src/plugins/down-root/down-root.c | 2 +- tests/unit_tests/openvpn/test_tls_crypt.c | 10 ++--- 52 files changed, 162 insertions(+), 162 deletions(-)
src/openvpn/buffer.c +3 -3
@@ -862,7 +862,7 @@ buf_parse(struct buffer *buf, const int delim, char *line, const int size) }while (c); - line[size-1 ] ='\0' ; + line[size -1 ] ='\0' ;return !(eol && !strlen (line)); }
@@ -1148,7 +1148,7 @@ valign4(const struct buffer *buf, const char *file, const int line)int msglevel =D_ALIGN_DEBUG ;const unsigned int u = (unsigned int )BPTR (buf); -if (u & (PAYLOAD_ALIGN -1 )) +if (u & (PAYLOAD_ALIGN -1 )) { msglevel =D_ALIGN_ERRORS ; }
@@ -1216,7 +1216,7 @@ buffer_list_push(struct buffer_list *ol, const char *str)if (str) {const size_t len =strlen ((const char *)str); -struct buffer_entry *e =buffer_list_push_data (ol, str, len+1 ); +struct buffer_entry *e =buffer_list_push_data (ol, str, len +1 );if (e) { e->buf.len = (int )len;/* Don't count trailing '\0' as part of length */
src/openvpn/buffer.h +1 -1
@@ -349,7 +349,7 @@ strncpynt(char *dest, const char *src, size_t maxlen) {if (maxlen >0 ) { -strncpy (dest, src, maxlen-1 ); +strncpy (dest, src, maxlen -1 ); dest[maxlen -1 ] =0 ; } }
src/openvpn/console_systemd.c +1 -1
@@ -78,7 +78,7 @@ get_console_input_systemd(const char *prompt, const bool echo, char *input, consreturn false; }memset (input,0 , capacity); -if (read (std_out, input, capacity-1 ) !=0 ) +if (read (std_out, input, capacity -1 ) !=0 ) {chomp (input); ret = true;
src/openvpn/crypto.c +3 -3
@@ -720,8 +720,8 @@ unsigned intcrypto_max_overhead (void) {return packet_id_size (true) +OPENVPN_MAX_IV_LENGTH - +OPENVPN_MAX_CIPHER_BLOCK_SIZE - +max_int (OPENVPN_MAX_HMAC_SIZE ,OPENVPN_AEAD_TAG_LENGTH ); + +OPENVPN_MAX_CIPHER_BLOCK_SIZE + +max_int (OPENVPN_MAX_HMAC_SIZE ,OPENVPN_AEAD_TAG_LENGTH ); } static void
@@ -1535,7 +1535,7 @@ verify_fix_key2(struct key2 *key2, const struct key_type *kt, const char *sharedif (!check_key (&key2->keys[i], kt)) {msg (M_FATAL ,"Key #%d in '%s' is bad. Try making a new key with --genkey." , - i+1 , shared_secret_file); + i +1 , shared_secret_file); } } }
src/openvpn/crypto_mbedtls.c +5 -5
@@ -235,8 +235,8 @@ crypto_pem_encode(const char *name, struct buffer *dst, const struct buffer *src, struct gc_arena *gc) { /* 1000 chars is the PEM line length limit (+1 for tailing NUL) */ - char header[1000+1] = { 0 }; -char footer[1000 +1 ] = {0 }; + char header[1000 + 1] = { 0 }; +char footer[1000 +1 ] = {0 };if (!openvpn_snprintf (header,sizeof (header),"-----BEGIN %s-----\n" , name)) {
@@ -260,7 +260,7 @@ crypto_pem_encode(const char *name, struct buffer *dst, *dst =alloc_buf_gc (out_len, gc);if (!mbed_ok (mbedtls_pem_write_buffer (header, footer,BPTR (src),BLEN (src),BPTR (dst),BCAP (dst), &out_len)) - || !buf_inc_len (dst, out_len-1 )) + || !buf_inc_len (dst, out_len -1 )) {CLEAR (*dst);return false;
@@ -274,8 +274,8 @@ crypto_pem_decode(const char *name, struct buffer *dst, const struct buffer *src) {/* 1000 chars is the PEM line length limit (+1 for tailing NUL) */ -char header[1000 +1 ] = {0 }; -char footer[1000 +1 ] = {0 }; +char header[1000 +1 ] = {0 }; +char footer[1000 +1 ] = {0 };if (!openvpn_snprintf (header,sizeof (header),"-----BEGIN %s-----" , name)) {
src/openvpn/cryptoapi.c +1 -1
@@ -279,7 +279,7 @@ ecdsa_bin2sig(unsigned char *buf, int len)ECDSA_SIG *ecsig =NULL ;DWORD rlen = len/2 ;BIGNUM *r =BN_bin2bn (buf, rlen,NULL ); -BIGNUM *s =BN_bin2bn (buf+rlen, rlen,NULL ); +BIGNUM *s =BN_bin2bn (buf + rlen, rlen,NULL );if (!r || !s) { goto err;
src/openvpn/dhcp.c +7 -7
@@ -56,9 +56,9 @@ get_dhcp_message_type(const struct dhcp *dhcp, const int optlen) {if (room >=3 ) { -if (p[i+1 ] ==1 )/* option length should be 1 */ +if (p[i +1 ] ==1 )/* option length should be 1 */ { -return p[i+2 ];/* return message type */ +return p[i +2 ];/* return message type */ } }return -1 ;
@@ -67,7 +67,7 @@ get_dhcp_message_type(const struct dhcp *dhcp, const int optlen) {if (room >=2 ) { -const int len = p[i+1 ];/* get option length */ +const int len = p[i +1 ];/* get option length */ i += (len +1 );/* advance to next option */ } }
@@ -98,13 +98,13 @@ do_extract(struct dhcp *dhcp, int optlen) {if (room >=2 ) { -const int len = p[i+1 ];/* get option length */ -if (len <= (room-2 )) +const int len = p[i +1 ];/* get option length */ +if (len <= (room -2 )) {/* get router IP address */ if (!ret && len >=4 && (len &3 ) ==0 ) { -memcpy (&ret, p+i+2 ,4 ); +memcpy (&ret, p + i +2 ,4 ); ret =ntohl (ret); } {
@@ -135,7 +135,7 @@ do_extract(struct dhcp *dhcp, int optlen) {if (room >=2 ) { -const int len = p[i+1 ];/* get option length */ +const int len = p[i +1 ];/* get option length */ i += (len +2 );/* advance to next option */ }else
src/openvpn/env_set.c +1 -1
@@ -438,7 +438,7 @@ make_env_array(const struct env_set *es, }/* alloc return array */ - ALLOC_ARRAY_CLEAR_GC(ret, char *, n+1, gc); + ALLOC_ARRAY_CLEAR_GC(ret, char *, n + 1, gc);/* fill return array */ if (es)
src/openvpn/event.c +4 -4
@@ -179,8 +179,8 @@ we_del_index(struct we_set *wes, int index)ASSERT (index >=0 && index < wes->n_events);for (i = index; i < wes->n_events -1 ; ++i) { - wes->events[i] = wes->events[i+1 ]; - wes->esr[i] = wes->esr[i+1 ]; + wes->events[i] = wes->events[i +1 ]; + wes->esr[i] = wes->esr[i +1 ]; } --wes->n_events; }
@@ -734,8 +734,8 @@ po_del(struct event_set *es, event_t event)int j;for (j = i; j < pos->n_events -1 ; ++j) { - pos->events[j] = pos->events[j+1 ]; - pos->args[j] = pos->args[j+1 ]; + pos->events[j] = pos->events[j +1 ]; + pos->args[j] = pos->args[j +1 ]; } --pos->n_events;break ;
src/openvpn/gremlin.c +4 -4
@@ -150,12 +150,12 @@ ask_gremlin(int flags)int delta;if (up) { - delta =roll (down_low[up_down_level-1 ], down_high[up_down_level-1 ]); + delta =roll (down_low[up_down_level -1 ], down_high[up_down_level -1 ]); up = false; }else { - delta =roll (up_low[up_down_level-1 ], up_high[up_down_level-1 ]); + delta =roll (up_low[up_down_level -1 ], up_high[up_down_level -1 ]); up = true; }
@@ -169,7 +169,7 @@ ask_gremlin(int flags)if (drop_level) { -if (up &&flip (drop_freq[drop_level-1 ])) +if (up &&flip (drop_freq[drop_level -1 ])) {dmsg (D_GREMLIN_VERBOSE ,"GREMLIN: Random packet drop" );return false;
@@ -188,7 +188,7 @@ corrupt_gremlin(struct buffer *buf, int flags)const int corrupt_level =GREMLIN_CORRUPT_LEVEL (flags);if (corrupt_level) { -if (flip (corrupt_freq[corrupt_level-1 ])) +if (flip (corrupt_freq[corrupt_level -1 ])) { do {
src/openvpn/httpdigest.c +2 -2
@@ -57,11 +57,11 @@ CvtHex( j = Bin[i] &0xf ;if (j <=9 ) { - Hex[i*2 +1 ] = (j +'0' ); + Hex[i*2 +1 ] = (j +'0' ); }else { - Hex[i*2 +1 ] = (j +'a' -10 ); + Hex[i*2 +1 ] = (j +'a' -10 ); } } Hex[HASHHEXLEN ] ='\0' ;
src/openvpn/httpdigest.h +1 -1
@@ -26,7 +26,7 @@#define HASHLEN 16typedef unsigned char HASH [HASHLEN ];#define HASHHEXLEN 32 -typedef unsigned char HASHHEX [HASHHEXLEN +1 ]; +typedef unsigned char HASHHEX [HASHHEXLEN +1 ];#undef IN#undef OUT#define IN const
src/openvpn/init.c +2 -2
@@ -2977,8 +2977,8 @@ do_init_crypto_tls(struct context *c, const unsigned int flags) {/* Add user-specified jitter to reneg-sec */ to.renegotiate_seconds = options->renegotiate_seconds - -(get_random () %max_int (options->renegotiate_seconds - - options->renegotiate_seconds_min,1 )); + - (get_random () %max_int (options->renegotiate_seconds + - options->renegotiate_seconds_min,1 )); } to.single_session = options->single_session; to.mode = options->mode;
src/openvpn/list.h +1 -1
@@ -40,7 +40,7 @@#include "buffer.h" #define hashsize (n) ((uint32_t)1<<(n)) -#define hashmask (n) (hashsize(n)-1) +#define hashmask (n) (hashsize(n) - 1)struct hash_element {
src/openvpn/manage.c +7 -7
@@ -1952,7 +1952,7 @@ man_process_command(struct management *man, const char *line)struct gc_arena gc =gc_new ();struct status_output *so;int nparms; -char *parms[MAX_PARMS +1 ]; +char *parms[MAX_PARMS +1 ];CLEAR (parms); so =status_open (NULL ,0 ,-1 , &man->persist.vout,0 );
@@ -2108,7 +2108,7 @@ management_android_control(struct management *man, const char *command, const ch {struct user_pass up;CLEAR (up); -strncpy (up.username, msg,sizeof (up.username)-1 ); +strncpy (up.username, msg,sizeof (up.username) -1 );management_query_user_pass (management, &up, command,GET_USER_PASS_NEED_OK , (void *)0 );return strcmp ("ok" , up.password) ==0 ;
@@ -3536,12 +3536,12 @@ management_query_multiline(struct management *man,if (b64_data) { - alert_msg =alloc_buf_gc (strlen (b64_data)+strlen (prompt)+3 , &gc); + alert_msg =alloc_buf_gc (strlen (b64_data) +strlen (prompt) +3 , &gc);buf_printf (&alert_msg,">%s:%s" , prompt, b64_data); }else { - alert_msg =alloc_buf_gc (strlen (prompt)+3 , &gc); + alert_msg =alloc_buf_gc (strlen (prompt) +3 , &gc);buf_printf (&alert_msg,">%s" , prompt); }
@@ -3608,7 +3608,7 @@ management_query_multiline_flatten_newline(struct management *man, buf =buffer_list_peek (*input);if (buf &&BLEN (buf) >0 ) { - result = (char *)malloc (BLEN (buf)+1 ); + result = (char *)malloc (BLEN (buf) +1 );check_malloc_return (result);memcpy (result, buf->data,BLEN (buf)); result[BLEN (buf)] ='\0' ;
@@ -3637,7 +3637,7 @@ management_query_multiline_flatten(struct management *man, buf =buffer_list_peek (*input);if (buf &&BLEN (buf) >0 ) { - result = (char *)malloc (BLEN (buf)+1 ); + result = (char *)malloc (BLEN (buf) +1 );check_malloc_return (result);memcpy (result, buf->data,BLEN (buf)); result[BLEN (buf)] ='\0' ;
@@ -3684,7 +3684,7 @@ management_query_cert(struct management *man, const char *cert_name)const char prompt_1[] ="NEED-CERTIFICATE:" ;struct buffer buf_prompt =alloc_buf (strlen (cert_name) +20 );buf_write (&buf_prompt, prompt_1,strlen (prompt_1)); -buf_write (&buf_prompt, cert_name,strlen (cert_name)+1 );/* +1 for \0 */ +buf_write (&buf_prompt, cert_name,strlen (cert_name) +1 );/* +1 for \0 */ char *result; result = management_query_multiline_flatten_newline(management,
src/openvpn/mbuf.h +1 -1
@@ -36,7 +36,7 @@struct multi_instance ; -#define MBUF_INDEX (head, offset, size) (((head) + (offset)) & ((size)-1)) +#define MBUF_INDEX (head, offset, size) (((head) + (offset)) & ((size) - 1))struct mbuf_buffer {
src/openvpn/misc.c +6 -6
@@ -87,7 +87,7 @@ hostname_randomize(const char *hostname, struct gc_arena *gc)uint8_t rnd_bytes[n_rnd_bytes];const char *rnd_str; -struct buffer hname =alloc_buf_gc (strlen (hostname)+sizeof (rnd_bytes)*2 +4 , gc); +struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes)*2 +4 , gc);prng_bytes (rnd_bytes,sizeof (rnd_bytes)); rnd_str =format_hex_ex (rnd_bytes,sizeof (rnd_bytes),40 ,0 ,NULL , gc);
@@ -289,7 +289,7 @@ get_user_pass_cr(struct user_pass *up,char *response = (char *)gc_malloc (USER_PASS_LEN , false, &gc);struct buffer packed_resp, challenge; - challenge =alloc_buf_gc (14 +strlen (ac->challenge_text), &gc); + challenge =alloc_buf_gc (14 +strlen (ac->challenge_text), &gc);buf_printf (&challenge,"CHALLENGE: %s" , ac->challenge_text);buf_set_write (&packed_resp, (uint8_t *)up->password,USER_PASS_LEN );
@@ -348,7 +348,7 @@ get_user_pass_cr(struct user_pass *up,struct buffer packed_resp, challenge;char *pw64 =NULL , *resp64 =NULL ; - challenge =alloc_buf_gc (14 +strlen (auth_challenge), &gc); + challenge =alloc_buf_gc (14 +strlen (auth_challenge), &gc);buf_printf (&challenge,"CHALLENGE: %s" , auth_challenge); if (!query_user_SINGLE(BSTR(&challenge), BLEN(&challenge),
@@ -401,7 +401,7 @@ get_auth_challenge(const char *auth_challenge, struct gc_arena *gc) {struct auth_challenge_info *ac;const int len =strlen (auth_challenge); -char *work = (char *)gc_malloc (len+1 , false, gc); +char *work = (char *)gc_malloc (len +1 , false, gc);char *cp;struct buffer b;
@@ -449,7 +449,7 @@ get_auth_challenge(const char *auth_challenge, struct gc_arena *gc) {return NULL ; } - ac->user = (char *)gc_malloc (strlen (work)+1 , true, gc); + ac->user = (char *)gc_malloc (strlen (work) +1 , true, gc);openvpn_base64_decode (work, (void *)ac->user,-1 );/* parse challenge text */
@@ -655,7 +655,7 @@ make_extended_arg_array(char **p, bool is_inline, struct gc_arena *gc)const char *sanitize_control_message (const char *src,struct gc_arena *gc) { -char *ret =gc_malloc (strlen (src)+1 , false, gc); +char *ret =gc_malloc (strlen (src) +1 , false, gc);char *dest = ret;bool redact = false;int skip =0 ;
src/openvpn/mroute.h +4 -4
@@ -40,10 +40,10 @@#define MROUTE_EXTRACT_MCAST (1<<2)#define MROUTE_EXTRACT_IGMP (1<<3) -#define MROUTE_SEC_EXTRACT_SUCCEEDED (1<<(0+MROUTE_SEC_SHIFT)) -#define MROUTE_SEC_EXTRACT_BCAST (1<<(1+MROUTE_SEC_SHIFT)) -#define MROUTE_SEC_EXTRACT_MCAST (1<<(2+MROUTE_SEC_SHIFT)) -#define MROUTE_SEC_EXTRACT_IGMP (1<<(3+MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_SUCCEEDED (1<<(0 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_BCAST (1<<(1 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_MCAST (1<<(2 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_IGMP (1<<(3 + MROUTE_SEC_SHIFT))#define MROUTE_SEC_SHIFT 4
src/openvpn/mss.c +3 -3
@@ -102,7 +102,7 @@ mss_fixup_ipv6(struct buffer *buf, int maxmss)/* do we have the full IPv6 packet? * "payload_len" does not include IPv6 header (+40 bytes) */ -if (BLEN (buf) != (int )ntohs (pip6->payload_len)+40 ) +if (BLEN (buf) != (int )ntohs (pip6->payload_len) +40 ) {return ; }
@@ -132,7 +132,7 @@ mss_fixup_ipv6(struct buffer *buf, int maxmss)struct openvpn_tcphdr *tc = (struct openvpn_tcphdr *)BPTR (&newbuf);if (tc->flags &OPENVPN_TCPH_SYN_MASK ) { -mss_fixup_dowork (&newbuf, (uint16_t ) maxmss-20 ); +mss_fixup_dowork (&newbuf, (uint16_t ) maxmss -20 ); } } }
@@ -193,7 +193,7 @@ mss_fixup_dowork(struct buffer *buf, uint16_t maxmss) {continue ; } - mssval = (opt[2 ]<<8 )+opt[3 ]; + mssval = (opt[2 ]<<8 ) + opt[3 ];if (mssval > maxmss) {dmsg (D_MSS ,"MSS: %d -> %d" , (int ) mssval, (int ) maxmss);
src/openvpn/ntlm.c +5 -5
@@ -228,14 +228,14 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2, separator =strchr (p->up.username,'\\' );if (separator ==NULL ) { -strncpy (username, p->up.username,sizeof (username)-1 ); - username[sizeof (username)-1 ] =0 ; +strncpy (username, p->up.username,sizeof (username) -1 ); + username[sizeof (username) -1 ] =0 ; domain[0 ] =0 ; }else { -strncpy (username, separator+1 ,sizeof (username)-1 ); - username[sizeof (username)-1 ] =0 ; +strncpy (username, separator +1 ,sizeof (username) -1 ); + username[sizeof (username) -1 ] =0 ; len = separator - p->up.username;if (len >sizeof (domain) -1 ) {
@@ -265,7 +265,7 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2,/* extract the challenge from bytes 24-31 */ for (i =0 ; i <8 ; i++) { - challenge[i] = buf2[i+24 ]; + challenge[i] = buf2[i +24 ]; }if (ntlmv2_enabled)/* Generate NTLMv2 response */
src/openvpn/openvpn.c +1 -1
@@ -363,7 +363,7 @@ wmain(int argc, wchar_t *wargv[])int ret;int i; -if ((argv =calloc (argc+1 ,sizeof (char *))) ==NULL ) +if ((argv =calloc (argc +1 ,sizeof (char *))) ==NULL ) {return 1 ; }
src/openvpn/options.c +24 -24
171 lines not on this page · raw message
src/openvpn/otime.c +1 -1
@@ -126,7 +126,7 @@ time_string(time_t t, int usec, bool show_usec, struct gc_arena *gc)struct tm *tm =localtime (&t);buf_printf (&out,"%04d-%02d-%02d %02d:%02d:%02d" , - tm->tm_year+1900 , tm->tm_mon+1 , tm->tm_mday, + tm->tm_year +1900 , tm->tm_mon +1 , tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);if (show_usec && tv.tv_usec)
src/openvpn/pkcs11.c +1 -1
@@ -178,7 +178,7 @@ _pkcs11_openvpn_log( (void )global_data;vsnprintf (Buffer,sizeof (Buffer), szFormat, args); - Buffer[sizeof (Buffer)-1 ] =0 ; + Buffer[sizeof (Buffer) -1 ] =0 ;msg (_pkcs11_msg_pkcs112openvpn (flags),"%s" , Buffer); }
src/openvpn/pkcs11_openssl.c +1 -1
@@ -431,7 +431,7 @@ pkcs11_certificate_serial(pkcs11h_certificate_t certificate, char *serial, }i2a_ASN1_INTEGER (bio,X509_get_serialNumber (x509)); - n =BIO_read (bio, serial, serial_len-1 ); + n =BIO_read (bio, serial, serial_len -1 );if (n <0 ) {
src/openvpn/plugin.c +1 -1
@@ -152,7 +152,7 @@ plugin_mask_string(const unsigned int type_mask, struct gc_arena *gc)static inline unsigned int plugin_supported_types (void ) { -return ((1 <<OPENVPN_PLUGIN_N )-1 ); +return ((1 <<OPENVPN_PLUGIN_N ) -1 ); } struct plugin_option_list *
src/openvpn/pool.c +1 -1
@@ -809,7 +809,7 @@ ifconfig_pool_test(in_addr_t start, in_addr_t end)ifconfig_pool_handle h;in_addr_t local, remote;char buf[256 ]; -snprintf (buf,sizeof (buf),"common-name-%d" , i+24 ); +snprintf (buf,sizeof (buf),"common-name-%d" , i +24 );#ifdef DUP_CN cn =NULL ;#else
src/openvpn/proto.c +1 -1
@@ -135,7 +135,7 @@ ip_checksum(const sa_family_t af, const uint8_t *payload, const int len_payload,for (int i =0 ; i < len_payload; i +=2 ) { sum += (uint16_t )(((payload[i] <<8 ) &0xFF00 ) - +((i +1 < len_payload) ? (payload[i +1 ] &0xFF ) :0 )); + + ((i +1 < len_payload) ? (payload[i +1 ] &0xFF ) :0 )); }
src/openvpn/proxy.c +8 -8
@@ -337,22 +337,22 @@ get_proxy_authenticate(socket_descriptor_t sd, }if (ret ==HTTP_AUTH_NONE && !strncmp (buf,"Proxy-Authenticate: " ,20 )) { -if (!strncmp (buf+20 ,"Basic " ,6 )) +if (!strncmp (buf +20 ,"Basic " ,6 )) {msg (D_PROXY ,"PROXY AUTH BASIC: '%s'" , buf); - *data =string_alloc (buf+26 ,NULL ); + *data =string_alloc (buf +26 ,NULL ); ret =HTTP_AUTH_BASIC ; }#if PROXY_DIGEST_AUTH - else if (!strncmp(buf+20, "Digest ", 7)) + else if (!strncmp(buf + 20, "Digest ", 7)) {msg (D_PROXY ,"PROXY AUTH DIGEST: '%s'" , buf); - *data =string_alloc (buf+27 ,NULL ); + *data =string_alloc (buf +27 ,NULL ); ret =HTTP_AUTH_DIGEST ; }#endif #if NTLM - else if (!strncmp(buf+20, "NTLM", 4)) + else if (!strncmp(buf + 20, "NTLM", 4)) {msg (D_PROXY ,"PROXY AUTH NTLM: '%s'" , buf); *data =NULL ;
@@ -386,7 +386,7 @@ get_key_value(const char *str, /* source string */bool starts_with_quote = false;bool escape = false; -for (c = max_key_len-1 ; (*str && (*str !='=' ) && c--); ) +for (c = max_key_len -1 ; (*str && (*str !='=' ) && c--); ) { *key++ = *str++; }
@@ -405,7 +405,7 @@ get_key_value(const char *str, /* source string */ starts_with_quote = true; } -for (c = max_value_len-1 ; *str && c--; str++) +for (c = max_value_len -1 ; *str && c--; str++) {switch (*str) {
@@ -900,7 +900,7 @@ establish_http_proxy_passthru(struct http_proxy_info *p,if (opaque) { -const int len =strlen (opaque)+16 ; +const int len =strlen (opaque) +16 ; opaque_kv =gc_malloc (len, false, &gc);openvpn_snprintf (opaque_kv, len,", opaque=\"%s\"" , opaque); }
src/openvpn/push.c +4 -4
@@ -353,7 +353,7 @@ send_auth_failed(struct context *c, const char *client_reason)schedule_exit (c, c->options.scheduled_exit_interval,SIGTERM ); - len = (client_reason ?strlen (client_reason)+1 :0 ) +sizeof (auth_failed); + len = (client_reason ?strlen (client_reason) +1 :0 ) +sizeof (auth_failed);if (len >PUSH_BUNDLE_SIZE ) { len =PUSH_BUNDLE_SIZE ;
@@ -699,7 +699,7 @@ send_push_reply(struct context *c, struct push_list *per_client_push_list)buf_printf (&buf,",push-continuation 1" ); } -if (BLEN (&buf) >sizeof (push_reply_cmd)-1 ) +if (BLEN (&buf) >sizeof (push_reply_cmd) -1 ) {const bool status =send_control_channel_string (c,BSTR (&buf),D_PUSH );if (!status)
@@ -802,7 +802,7 @@ push_option_fmt(struct gc_arena *gc, struct push_list *push_list,va_start (arglist, format); len =vsnprintf (tmp,sizeof (tmp), format, arglist);va_end (arglist); -if (len >sizeof (tmp)-1 ) +if (len >sizeof (tmp) -1 ) {return false; }
@@ -916,7 +916,7 @@ push_update_digest(md_ctx_t *ctx, struct buffer *buf, const struct options *opt) {continue ; } -md_ctx_update (ctx, (const uint8_t *) line,strlen (line)+1 ); +md_ctx_update (ctx, (const uint8_t *) line,strlen (line) +1 ); } }
src/openvpn/reliable.c +2 -2
@@ -58,7 +58,7 @@ reliable_pid_in_range1(const packet_id_type test, }else { -if ((test+0x80000000u ) - (base+0x80000000u ) < extent) +if ((test +0x80000000u ) - (base +0x80000000u ) < extent) {return true; }
@@ -84,7 +84,7 @@ reliable_pid_in_range2(const packet_id_type test, }else { -if ((test+0x80000000u ) < (base+0x80000000u ) + extent) +if ((test +0x80000000u ) < (base +0x80000000u ) + extent) {return true; }
src/openvpn/route.c +5 -5
@@ -563,11 +563,11 @@ add_block_local_item(struct route_list *rl, ALLOC_OBJ_GC(r2, struct route_ipv4, &rl->gc);/* split a route into two smaller blocking routes, and direct them to target */ - l2 = ((~gateway->netmask)+1 )>>1 ; + l2 = ((~gateway->netmask) +1 )>>1 ; r1->flags =RT_DEFINED ; r1->gateway = target; r1->network = gateway->addr & gateway->netmask; - r1->netmask = ~(l2-1 ); + r1->netmask = ~(l2 -1 ); r1->next = rl->routes; rl->routes = r1;
@@ -757,7 +757,7 @@ route_ipv6_match_host( const struct route_ipv6 *r6,return true; } - mask =0xff << (8 -bits); + mask =0xff << (8 - bits);if ( (r6->network.s6_addr[i] & mask) == (host->s6_addr[i] & mask )) {
@@ -1907,7 +1907,7 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,if (r6->iface !=NULL && gateway_needed &&IN6_IS_ADDR_LINKLOCAL (&r6->gateway) )/* fe80::...%intf */ { -int len =strlen (gateway) +1 +strlen (r6->iface)+1 ; +int len =strlen (gateway) +1 +strlen (r6->iface) +1 ;char *tmp =gc_malloc ( len, true, &gc );snprintf ( tmp, len,"%s%%%s" , gateway, r6->iface ); gateway = tmp;
@@ -2378,7 +2378,7 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,if (r6->iface !=NULL && gateway_needed &&IN6_IS_ADDR_LINKLOCAL (&r6->gateway) )/* fe80::...%intf */ { -int len =strlen (gateway) +1 +strlen (r6->iface)+1 ; +int len =strlen (gateway) +1 +strlen (r6->iface) +1 ;char *tmp =gc_malloc ( len, true, &gc );snprintf ( tmp, len,"%s%%%s" , gateway, r6->iface ); gateway = tmp;
src/openvpn/route.h +1 -1
@@ -380,7 +380,7 @@ netbits_to_netmask(const int netbits)in_addr_t mask =0 ;if (netbits >0 && netbits <= addrlen) { - mask =IPV4_NETMASK_HOST << (addrlen-netbits); + mask =IPV4_NETMASK_HOST << (addrlen - netbits); }return mask; }
src/openvpn/schedule.c +4 -4
@@ -496,13 +496,13 @@ schedule_debug_entry(const struct schedule_entry *e, *least = e->tv; } - d =schedule_debug_entry (e->lt, depth+1 , count, least, min, &e->tv); + d =schedule_debug_entry (e->lt, depth +1 , count, least, min, &e->tv);if (d > maxdepth) { maxdepth = d; } - d =schedule_debug_entry (e->gt, depth+1 , count, least, &e->tv, max); + d =schedule_debug_entry (e->gt, depth +1 , count, least, &e->tv, max);if (d > maxdepth) { maxdepth = d;
@@ -634,8 +634,8 @@ schedule_print_work(struct schedule_entry *e, int indent) (ptr_type )e->parent, (ptr_type )e->lt, (ptr_type)e->gt); -schedule_print_work (e->lt, indent+1 ); -schedule_print_work (e->gt, indent+1 ); +schedule_print_work (e->lt, indent +1 ); +schedule_print_work (e->gt, indent +1 ); }else {
src/openvpn/socket.c +3 -3
@@ -2921,7 +2921,7 @@ print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)if (memcmp (&a6, &in6addr_any,sizeof (a6)) !=0 || !(flags &IA_EMPTY_IF_UNDEF )) { -inet_ntop (AF_INET6 , &a6, tmp_out_buf,sizeof (tmp_out_buf)-1 ); +inet_ntop (AF_INET6 , &a6, tmp_out_buf,sizeof (tmp_out_buf) -1 );buf_printf (&out,"%s" , tmp_out_buf ); }return BSTR (&out);
@@ -2956,7 +2956,7 @@ add_in6_addr( struct in6_addr base, uint32_t add ) registeruint32_t h; h = (unsigned char ) base.s6_addr[i]; - base.s6_addr[i] = (h+add) &UINT8_MAX ; + base.s6_addr[i] = (h + add) &UINT8_MAX ;/* using explicit carry for the 8-bit additions will catch * 8-bit and(!) 32-bit overruns nicely
@@ -3814,7 +3814,7 @@ sockethandle_finalize(sockethandle_t sh,case sizeof (struct sockaddr_in6 ):/* TODO(jjo): for some reason (?) I'm getting 24,28 for AF_INET6 * under _WIN32*/ -case sizeof (struct sockaddr_in6 )-4 : +case sizeof (struct sockaddr_in6 ) -4 :break ;default :
src/openvpn/ssl.c +2 -2
@@ -1885,7 +1885,7 @@ read_string(struct buffer *buf, char *str, const unsigned int capacity) {return false; } - str[len-1 ] ='\0' ; + str[len -1 ] ='\0' ;return true; }
@@ -1906,7 +1906,7 @@ read_string_alloc(struct buffer *buf)free (str);return NULL ; } - str[len-1 ] ='\0' ; + str[len -1 ] ='\0' ;return str; }
src/openvpn/ssl_mbedtls.c +1 -1
@@ -307,7 +307,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)int cipher_count =get_num_elements (ciphers,':' );/* Allocate an array for them */ -ALLOC_ARRAY_CLEAR (ctx->allowed_ciphers, int, cipher_count+1 ) +ALLOC_ARRAY_CLEAR (ctx->allowed_ciphers, int, cipher_count +1 ) /* Parse allowed ciphers, getting IDs */int i =0 ;
src/openvpn/ssl_openssl.c +1 -1
@@ -429,7 +429,7 @@ convert_tls_list_to_openssl(char *openssl_ciphers, size_t len, const char *cipheif (openssl_ciphers_len >0 ) { - openssl_ciphers[openssl_ciphers_len-1 ] ='\0' ; + openssl_ciphers[openssl_ciphers_len -1 ] ='\0' ; } }
src/openvpn/ssl_pkt.c +1 -1
@@ -485,7 +485,7 @@ calculate_session_id_hmac(struct session_id client_sid,/* Get the valid time quantisation for our hmac, * we divide time by handwindow/2 and allow the previous * and future session time if specified by offset */ -uint32_t session_id_time = now/((handwindow+1 )/2 ) + offset; +uint32_t session_id_time = now/((handwindow +1 )/2 ) + offset;hmac_ctx_reset (hmac);/* We do not care about endian here since it does not need to be
src/openvpn/ssl_verify.c +1 -1
@@ -657,7 +657,7 @@ verify_cert(struct tls_session *session, openvpn_x509_cert_t *cert, int cert_depstruct buffer buf =alloc_buf_gc (256 , &gc);for (int i =0 ; opt->x509_username_field[i] !=NULL ; i++) { -char username[TLS_USERNAME_LEN +1 ] = {0 };/* null-terminated */ +char username[TLS_USERNAME_LEN +1 ] = {0 };/* null-terminated */ if (SUCCESS !=backend_x509_get_username (username,sizeof (username), opt->x509_username_field[i], cert))
src/openvpn/ssl_verify_mbedtls.c +6 -6
@@ -86,7 +86,7 @@ verify_callback(void *session_obj, mbedtls_x509_crt *cert, int cert_depth,char *subject =x509_get_subject (cert, &gc);char *serial =backend_x509_get_serial (cert, &gc); - ret =mbedtls_x509_crt_verify_info (errstr,sizeof (errstr)-1 ,"" , *flags); + ret =mbedtls_x509_crt_verify_info (errstr,sizeof (errstr) -1 ,"" , *flags);if (ret <=0 && !openvpn_snprintf (errstr,sizeof (errstr),"Could not retrieve error string, flags=%" PRIx32, *flags)) {
@@ -164,7 +164,7 @@ backend_x509_get_username(char *cn, int cn_len,else {memcpy ( cn, name->val.p, cn_len); - cn[cn_len-1 ] ='\0' ; + cn[cn_len -1 ] ='\0' ; }return SUCCESS ;
@@ -211,7 +211,7 @@ backend_x509_get_serial_hex(mbedtls_x509_crt *cert, struct gc_arena *gc) buf =gc_malloc (len, true, gc); -if (mbedtls_x509_serial_gets (buf, len-1 , &cert->serial) <0 ) +if (mbedtls_x509_serial_gets (buf, len -1 , &cert->serial) <0 ) { buf =NULL ; }
@@ -252,7 +252,7 @@ x509_get_subject(mbedtls_x509_crt *cert, struct gc_arena *gc)int ret =0 ; - ret =mbedtls_x509_dn_gets ( tmp_subject,MAX_SUBJECT_LENGTH -1 , &cert->subject ); + ret =mbedtls_x509_dn_gets ( tmp_subject,MAX_SUBJECT_LENGTH -1 , &cert->subject );if (ret >0 ) {/* Allocate the required space for the subject */
@@ -299,7 +299,7 @@ asn1_buf_to_c_string(const mbedtls_asn1_buf *orig, struct gc_arena *gc)return string_alloc ("ERROR: embedded null value" , gc); } } - val =gc_malloc (orig->len+1 , false, gc); + val =gc_malloc (orig->len +1 , false, gc);memcpy (val, orig->p, orig->len); val[orig->len] ='\0' ;return val;
@@ -392,7 +392,7 @@ x509_setenv(struct env_set *es, int cert_depth, mbedtls_x509_crt *cert)while (name !=NULL ) { -char name_expand[64 +8 ]; +char name_expand[64 +8 ];const char *shortname;if (0 ==mbedtls_oid_get_attr_short_name (&name->oid, &shortname) )
src/openvpn/ssl_verify_openssl.c +2 -2
@@ -264,7 +264,7 @@ backend_x509_get_username(char *common_name, int cn_len,#ifdef ENABLE_X509ALTUSERNAME if (strncmp ("ext:" , x509_username_field,4 ) ==0 ) { -if (!extract_x509_extension (peer_cert, x509_username_field+4 , common_name, cn_len)) +if (!extract_x509_extension (peer_cert, x509_username_field +4 , common_name, cn_len)) {return FAILURE ; }
@@ -276,7 +276,7 @@ backend_x509_get_username(char *common_name, int cn_len,char *serial =format_hex_ex (asn1_i->data, asn1_i->length,0 ,1 |FHE_CAPS ,NULL , &gc); -if (!serial || cn_len <=strlen (serial)+2 ) +if (!serial || cn_len <=strlen (serial) +2 ) {gc_free (&gc);return FAILURE ;
src/openvpn/status.c +1 -1
@@ -225,7 +225,7 @@ status_printf(struct status_output *so, const char *format, ...) {if (so && (so->flags &STATUS_OUTPUT_WRITE )) { -char buf[STATUS_PRINTF_MAXLEN +2 ];/* leave extra bytes for CR, LF */ +char buf[STATUS_PRINTF_MAXLEN +2 ];/* leave extra bytes for CR, LF */ va_list arglist;int stat;
src/openvpn/tun.c +5 -5
@@ -991,7 +991,7 @@ create_arbitrary_remote( struct tuntap *tt ) {in_addr_t remote; - remote = (tt->local & tt->remote_netmask) +1 ; + remote = (tt->local & tt->remote_netmask) +1 ;if (remote == tt->local) {
@@ -1867,7 +1867,7 @@ open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,msg (M_FATAL ,"Cannot query NetBSD TAP device name" ); }CLEAR (dynamic_name); -strncpy ( dynamic_name, ifr.ifr_name,sizeof (dynamic_name)-1 ); +strncpy ( dynamic_name, ifr.ifr_name,sizeof (dynamic_name) -1 ); dynamic_opened = true;openvpn_snprintf (tunname,sizeof (tunname),"/dev/%s" , dynamic_name ); }
@@ -3193,7 +3193,7 @@ utun_open_helper(struct ctl_info ctlInfo, int utunnum) sc.sc_family =AF_SYSTEM ; sc.ss_sysaddr =AF_SYS_CONTROL ; - sc.sc_unit = utunnum+1 ; + sc.sc_unit = utunnum +1 ;/* If the connect is successful, a utun%d device will be created, where "%d"
@@ -4151,7 +4151,7 @@ show_valid_win32_tun_subnets(void)for (i =0 ; i <256 ; i +=4 ) { -printf ("[%3d,%3d] " , i+1 , i+2 ); +printf ("[%3d,%3d] " , i +1 , i +2 );if (++col >4 ) { col =0 ;
@@ -5877,7 +5877,7 @@ write_dhcp_search_str(struct buffer *buf, const int type, const char *const *str {if (*ptr =='.' || *ptr =='\0' ) { - tmp_buf[label_length_pos] = (len-label_length_pos)-1 ; + tmp_buf[label_length_pos] = (len - label_length_pos) -1 ; label_length_pos = len;if (*ptr =='\0' ) {
src/openvpn/win32.c +1 -1
@@ -917,7 +917,7 @@ env_block(const struct env_set *es) nchars +=strlen (e->string) +1 ; } - nchars +=strlen (force_path)+1 ; + nchars +=strlen (force_path) +1 ; ret = (char *)malloc (nchars);check_malloc_return (ret);
src/openvpnmsica/openvpnmsica.c +1 -1
@@ -114,7 +114,7 @@ setup_sequence(static void _debug_popup(_In_z_ LPCSTR szFunctionName) { -TCHAR szTitle[0x100 ], szMessage[0x100 +MAX_PATH ], szProcessPath[MAX_PATH ]; +TCHAR szTitle[0x100 ], szMessage[0x100 +MAX_PATH ], szProcessPath[MAX_PATH ];/* Compose pop-up title. The dialog title will contain function name to ease the process * locating. Mind that Visual Studio displays window titles on the process list. */
src/openvpnserv/interactive.c +5 -5
@@ -416,11 +416,11 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options, WCHAR *continue ; } -if (!CheckOption (workdir, argc-i, &argv[i], &settings)) +if (!CheckOption (workdir, argc - i, &argv[i], &settings)) { -if (wcscmp (L"--config" , argv[i]) ==0 && argc-i >1 ) +if (wcscmp (L"--config" , argv[i]) ==0 && argc - i >1 ) { -openvpn_swprintf (errmsg, capacity, msg1, argv[i+1 ], workdir, +openvpn_swprintf (errmsg, capacity, msg1, argv[i +1 ], workdir, settings.ovpn_admin_group); }else
@@ -1198,8 +1198,8 @@ HandleDNSConfigMessage(const dns_cfg_message_t *msg, undo_lists_t *lists)/* use a non-const reference with limited scope to enforce null-termination of strings from client */ {dns_cfg_message_t *msgptr = (dns_cfg_message_t *) msg; - msgptr->iface.name[_countof (msg->iface.name)-1 ] ='\0' ; - msgptr->domains[_countof (msg->domains)-1 ] ='\0' ; + msgptr->iface.name[_countof (msg->iface.name) -1 ] ='\0' ; + msgptr->domains[_countof (msg->domains) -1 ] ='\0' ; }wchar_t *wide_name =utf8to16 (msg->iface.name);/* utf8 to wide-char */
src/openvpnserv/service.c +2 -2
@@ -260,7 +260,7 @@ _tmain(int argc, TCHAR *argv[]) }else if (argc > i +2 &&_wcsicmp (TEXT ("instance" ), argv[i] +1 ) ==0 ) { -if (_wcsicmp (TEXT ("interactive" ), argv[i+1 ]) ==0 ) +if (_wcsicmp (TEXT ("interactive" ), argv[i +1 ]) ==0 ) { dispatchTable = dispatchTable_interactive; service_instance = argv[i +2 ];
@@ -268,7 +268,7 @@ _tmain(int argc, TCHAR *argv[]) }else { -MsgToEventLog (M_ERR ,L"Invalid argument to -instance <%s>. Service not started." , argv[i+1 ]); +MsgToEventLog (M_ERR ,L"Invalid argument to -instance <%s>. Service not started." , argv[i +1 ]);return 1 ; } }
src/plugins/auth-pam/auth-pam.c +4 -4
@@ -172,7 +172,7 @@ recv_string(int fd, char *buffer, int len)ssize_t size;memset (buffer,0 , len); size =read (fd, buffer, len); - buffer[len-1 ] =0 ; + buffer[len -1 ] =0 ;if (size >=1 ) {return (int )size;
@@ -322,11 +322,11 @@ split_scrv1_password(struct user_pass *up) } *resp++ ='\0' ; -int n =plugin_base64_decode (pass, up->password,sizeof (up->password)-1 ); +int n =plugin_base64_decode (pass, up->password,sizeof (up->password) -1 );if (n >=0 ) { up->password[n] ='\0' ; - n =plugin_base64_decode (resp, up->response,sizeof (up->response)-1 ); + n =plugin_base64_decode (resp, up->response,sizeof (up->response) -1 );if (n >=0 ) { up->response[n] ='\0' ;
@@ -427,7 +427,7 @@ openvpn_plugin_open_v3(const int v3structver, {const int base = base_parms + i *2 ; name_value_list.data[i].name = argv[base]; - name_value_list.data[i].value = argv[base+1 ]; + name_value_list.data[i].value = argv[base +1 ]; } }
src/plugins/auth-pam/utils.c +3 -3
@@ -68,7 +68,7 @@ searchandreplace(const char *tosearch, const char *searchfor, const char *replacconst char *searching = tosearch;char *scratch; -char temp[templen+1 ]; +char temp[templen +1 ]; temp[0 ] =0 ; scratch =strstr (searching, searchfor);
@@ -79,10 +79,10 @@ searchandreplace(const char *tosearch, const char *searchfor, const char *replacwhile (scratch) { -strncat (temp, searching, scratch-searching); +strncat (temp, searching, scratch - searching);strcat (temp, replacewith); - searching = scratch+strlen (searchfor); + searching = scratch +strlen (searchfor); scratch =strstr (searching, searchfor); }return strdup (temp);
src/plugins/down-root/down-root.c +1 -1
@@ -322,7 +322,7 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char */* Ignore argv[0], as it contains just the plug-in file name */ for (i =1 ; i <string_array_len (argv); i++) { - context->command[i-1 ] = (char *) argv[i]; + context->command[i -1 ] = (char *) argv[i]; }/*
tests/unit_tests/openvpn/test_tls_crypt.c +5 -5
@@ -357,10 +357,10 @@ test_tls_crypt_v2_setup(void **state) ctx->gc =gc_new ();/* Slightly longer buffers to be able to test too-long data */ - ctx->metadata =alloc_buf_gc (TLS_CRYPT_V2_MAX_METADATA_LEN +16 , &ctx->gc); - ctx->unwrapped_metadata =alloc_buf_gc (TLS_CRYPT_V2_MAX_METADATA_LEN +16 , + ctx->metadata =alloc_buf_gc (TLS_CRYPT_V2_MAX_METADATA_LEN +16 , &ctx->gc); + ctx->unwrapped_metadata =alloc_buf_gc (TLS_CRYPT_V2_MAX_METADATA_LEN +16 , &ctx->gc); - ctx->wkc =alloc_buf_gc (TLS_CRYPT_V2_MAX_WKC_LEN +16 , &ctx->gc); + ctx->wkc =alloc_buf_gc (TLS_CRYPT_V2_MAX_WKC_LEN +16 , &ctx->gc);/* Generate server key */ rand_bytes ((void *)ctx->server_key2.keys,sizeof (ctx->server_key2.keys));
@@ -469,7 +469,7 @@ tls_crypt_v2_wrap_too_long_metadata(void **state)struct test_tls_crypt_v2_context *ctx = (struct test_tls_crypt_v2_context *) *state; -assert_true (buf_inc_len (&ctx->metadata,TLS_CRYPT_V2_MAX_METADATA_LEN +1 )); +assert_true (buf_inc_len (&ctx->metadata,TLS_CRYPT_V2_MAX_METADATA_LEN +1 )); assert_false(tls_crypt_v2_wrap_client_key(&ctx->wkc, &ctx->client_key2, &ctx->metadata, &ctx->server_keys.encrypt,
@@ -531,7 +531,7 @@ tls_crypt_v2_wrap_unwrap_dst_too_small(void **state)struct key2 unwrapped_client_key2 = {0 };struct buffer unwrapped_metadata = -alloc_buf_gc (TLS_CRYPT_V2_MAX_METADATA_LEN -1 , &ctx->gc); +alloc_buf_gc (TLS_CRYPT_V2_MAX_METADATA_LEN -1 , &ctx->gc);assert_false (tls_crypt_v2_unwrap_client_key (&unwrapped_client_key2, &unwrapped_metadata, ctx->wkc, &ctx->server_keys.decrypt));
Signature · 1 line
2.34.1
Re: [Openvpn-devel] [PATCH 4/6] reformat for sp_arith_additive=add
Quoted 1 line · Frank Lichtenheld
Signed-off-by Frank Lichtenheld <[email protected]...>
Note: This patch doesn't apply cleanly anymore due to a conflict in tun.c. But obviously it can trivially be recreated, since it is just a call to ./dev-tools/reformat-all.sh.
Let me know if you would like a v2 anyway.
Regards,
Signature · 1 line
Frank Lichtenheld
PATCH 5/6 uncrustify: add space around all arithmetic operators
In reply to Frank Lichtenheld--- dev-tools/uncrustify.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
dev-tools/uncrustify.conf +1 -2
@@ -34,8 +34,7 @@ sp_inside_sparen=remove sp_cond_colon=add sp_cond_question=add sp_bool=add -sp_arith=ignore -sp_arith_additive=add +sp_arith=add sp_compare=add sp_else_brace=add sp_brace_else=add
Signature · 1 line
2.34.1
Re: [Openvpn-devel] [PATCH 5/6] uncrustify: add space around all arithmetic operators
Quoted 11 lines · Frank Lichtenheld
Signed-off-by Frank Lichtenheld <[email protected]...>--- dev-tools/uncrustify.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)dev-tools/uncrustify.conf +0
-0
dev-tools/uncrustify.conf sp_inside_sparen=remove · line 40
Quoted 9 lines
dev-tools/uncrustify.conf +1
-2@@ -34,8 +34,7 @@ sp_inside_sparen=remove sp_cond_colon=add sp_cond_question=add sp_bool=add -sp_arith=ignore -sp_arith_additive=add +sp_arith=add sp_compare=add sp_else_brace=add sp_brace_else=add
Just for the benefit of the list: The NACK for 6/6 obviously also includes 5/6.
Regards,
Signature · 1 line
Frank Lichtenheld
PATCH 6/6 reformat for sp_arith=add
In reply to Frank Lichtenheld--- include/openvpn-plugin.h.in | 2 +- .../client-connect/sample-client-connect.c | 30 +-- sample/sample-plugins/defer/multi-auth.c | 10 +- sample/sample-plugins/log/log.c | 18 +- sample/sample-plugins/log/log_v3.c | 18 +- sample/sample-plugins/simple/base64.c | 2 +- src/compat/compat-gettimeofday.c | 2 +- src/compat/compat-versionhelpers.h | 2 +- src/openvpn/auth_token.c | 22 +- src/openvpn/basic.h | 2 +- src/openvpn/buffer.c | 2 +- src/openvpn/buffer.h | 74 +++---- src/openvpn/common.h | 2 +- src/openvpn/comp.h | 18 +- src/openvpn/console_builtin.c | 2 +- src/openvpn/crypto.c | 2 +- src/openvpn/crypto.h | 16 +- src/openvpn/crypto_mbedtls.c | 16 +- src/openvpn/crypto_openssl.c | 6 +- src/openvpn/cryptoapi.c | 34 +-- src/openvpn/dco.c | 2 +- src/openvpn/dco_freebsd.c | 4 +- src/openvpn/dco_linux.c | 2 +- src/openvpn/error.c | 12 +- src/openvpn/error.h | 26 +-- src/openvpn/event.c | 14 +- src/openvpn/event.h | 4 +- src/openvpn/forward.c | 8 +- src/openvpn/forward.h | 44 ++-- src/openvpn/gremlin.h | 10 +- src/openvpn/httpdigest.c | 8 +- src/openvpn/init.c | 38 ++-- src/openvpn/init.h | 16 +- src/openvpn/list.c | 18 +- src/openvpn/list.h | 2 +- src/openvpn/manage.c | 44 ++-- src/openvpn/manage.h | 74 +++---- src/openvpn/mbuf.h | 2 +- src/openvpn/misc.c | 4 +- src/openvpn/misc.h | 28 +-- src/openvpn/mroute.h | 26 +-- src/openvpn/mss.c | 6 +- src/openvpn/mstats.c | 2 +- src/openvpn/mtcp.c | 10 +- src/openvpn/mtu.c | 2 +- src/openvpn/mudp.c | 4 +- src/openvpn/multi.c | 14 +- src/openvpn/multi.h | 16 +- src/openvpn/ntlm.c | 2 +- src/openvpn/openssl_compat.h | 2 +- src/openvpn/openvpn.h | 6 +- src/openvpn/options.c | 198 +++++++++--------- src/openvpn/options.h | 74 +++---- src/openvpn/perf.c | 2 +- src/openvpn/pkcs11.c | 14 +- src/openvpn/pkcs11_openssl.c | 2 +- src/openvpn/platform.c | 8 +- src/openvpn/plugin.c | 4 +- src/openvpn/pool.c | 2 +- src/openvpn/proto.h | 16 +- src/openvpn/ps.c | 10 +- src/openvpn/push.c | 4 +- src/openvpn/reliable.c | 2 +- src/openvpn/route.c | 22 +- src/openvpn/route.h | 50 ++--- src/openvpn/run_command.h | 6 +- src/openvpn/shaper.h | 4 +- src/openvpn/socket.c | 28 +-- src/openvpn/socket.h | 56 ++--- src/openvpn/ssl.c | 6 +- src/openvpn/ssl.h | 18 +- src/openvpn/ssl_common.h | 20 +- src/openvpn/ssl_mbedtls.c | 22 +- src/openvpn/ssl_openssl.c | 12 +- src/openvpn/ssl_pkt.c | 2 +- src/openvpn/ssl_verify.c | 2 +- src/openvpn/ssl_verify.h | 8 +- src/openvpn/ssl_verify_openssl.c | 4 +- src/openvpn/status.c | 4 +- src/openvpn/status.h | 4 +- src/openvpn/syshead.h | 2 +- src/openvpn/tls_crypt.c | 2 +- src/openvpn/tls_crypt.h | 4 +- src/openvpn/tun.c | 20 +- src/openvpn/win32.c | 24 +-- src/openvpn/win32.h | 4 +- src/openvpn/xkey_common.h | 2 +- src/openvpn/xkey_provider.c | 4 +- src/openvpnmsica/openvpnmsica.c | 6 +- src/openvpnserv/common.c | 2 +- src/openvpnserv/interactive.c | 18 +- src/openvpnserv/service.h | 6 +- src/plugins/auth-pam/auth-pam.c | 32 +-- src/plugins/auth-pam/pamdl.c | 2 +- src/tapctl/basic.h | 2 +- src/tapctl/error.h | 28 +-- src/tapctl/main.c | 2 +- tests/unit_tests/openvpn/test_auth_token.c | 26 +-- tests/unit_tests/openvpn/test_buffer.c | 8 +- tests/unit_tests/openvpn/test_pkt.c | 4 +- tests/unit_tests/openvpn/test_provider.c | 4 +- 101 files changed, 768 insertions(+), 768 deletions(-)
include/openvpn-plugin.h.in +1 -1
@@ -133,7 +133,7 @@ extern "C" { /* * Build a mask out of a set of plug-in types. */ -#define OPENVPN_PLUGIN_MASK(x) (1<<(x)) +#define OPENVPN_PLUGIN_MASK(x) (1 << (x)) /* * A pointer to a plugin-defined object which contains
sample/sample-plugins/client-connect/sample-client-connect.c +15 -15
@@ -147,16 +147,16 @@ openvpn_plugin_open_v3(const int v3structver,*/ ret->type_mask =OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2 ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL ); + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2 ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL );/* Save global pointers to functions exported from openvpn */ plugin_log = args->callbacks->plugin_log;
@@ -259,13 +259,13 @@ cc_handle_deferred_v1(int seconds, const char *name, const char **envp)int fd =open (ccd_file,O_WRONLY );if (fd <0 ) { -plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"open('%s') failed" , ccd_file); +plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"open('%s') failed" , ccd_file);return OPENVPN_PLUGIN_FUNC_ERROR ; }if (write (fd,"2" ,1 ) !=1 ) { -plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"write to '%s' failed" , ccd_file ); +plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"write to '%s' failed" , ccd_file );close (fd);return OPENVPN_PLUGIN_FUNC_ERROR ; }
@@ -293,7 +293,7 @@ cc_handle_deferred_v1(int seconds, const char *name, const char **envp)pid_t p2 =fork ();if (p2 <0 ) { -plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"BACKGROUND: fork(2) failed" ); +plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"BACKGROUND: fork(2) failed" );exit (1 ); }if (p2 >0 )/* new parent: exit right away */
@@ -326,7 +326,7 @@ cc_handle_deferred_v1(int seconds, const char *name, const char **envp) fd =open (ccd_file,O_WRONLY );if (fd <0 ) { -plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"open('%s') failed" , ccd_file); +plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"open('%s') failed" , ccd_file);exit (1 ); }
@@ -335,7 +335,7 @@ cc_handle_deferred_v1(int seconds, const char *name, const char **envp)if (write (fd, (ret ==OPENVPN_PLUGIN_FUNC_SUCCESS ) ?"1" :"0" ,1 ) !=1 ) { -plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"write to '%s' failed" , ccd_file ); +plugin_log (PLOG_ERR |PLOG_ERRNO ,MODULE ,"write to '%s' failed" , ccd_file ); }close (fd);
sample/sample-plugins/defer/multi-auth.c +5 -5
@@ -318,7 +318,7 @@ auth_user_pass_verify(struct plugin_context *context,pid_t p2 =fork ();if (p2 <0 ) { -plog (context,PLOG_ERR |PLOG_ERRNO ,"BACKGROUND: fork(2) failed" ); +plog (context,PLOG_ERR |PLOG_ERRNO ,"BACKGROUND: fork(2) failed" );exit (1 ); }
@@ -335,14 +335,14 @@ auth_user_pass_verify(struct plugin_context *context,/* do mighty complicated work that will really take time here... */ plog (context,PLOG_NOTE ,"in async/deferred handler, usleep(%d)" , - context->test_deferred_auth*1000 ); -usleep (context->test_deferred_auth*1000 ); + context->test_deferred_auth *1000 ); +usleep (context->test_deferred_auth *1000 );/* now signal success state to openvpn */ int fd =open (auth_control_file,O_WRONLY );if (fd <0 ) { -plog (context,PLOG_ERR |PLOG_ERRNO , +plog (context,PLOG_ERR |PLOG_ERRNO ,"open('%s') failed" , auth_control_file);exit (1 ); }
@@ -355,7 +355,7 @@ auth_user_pass_verify(struct plugin_context *context,if (write (fd, result,1 ) !=1 ) { -plog (context,PLOG_ERR |PLOG_ERRNO ,"write to '%s' failed" , auth_control_file ); +plog (context,PLOG_ERR |PLOG_ERRNO ,"write to '%s' failed" , auth_control_file ); }close (fd);
sample/sample-plugins/log/log.c +9 -9
@@ -95,15 +95,15 @@ openvpn_plugin_open_v1(unsigned int *type_mask, const char *argv[], const char **/ *type_mask =OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL ); + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL );return (openvpn_plugin_handle_t ) context; }
sample/sample-plugins/log/log_v3.c +9 -9
@@ -100,15 +100,15 @@ openvpn_plugin_open_v3(const int v3structver,/* Which callbacks to intercept. */ ret->type_mask =OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_UP ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL ); + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_DOWN ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_ROUTE_UP ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_IPCHANGE ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_DISCONNECT ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_LEARN_ADDRESS ) + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_FINAL );/* Allocate our context */
sample/sample-plugins/simple/base64.c +1 -1
@@ -110,7 +110,7 @@ openvpn_plugin_open_v3(const int v3structver,/* Which callbacks to intercept. */ ret->type_mask =OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_TLS_VERIFY ) - |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 ); + |OPENVPN_PLUGIN_MASK (OPENVPN_PLUGIN_CLIENT_CONNECT_V2 );/* we don't need a plug-in context in this example, but OpenVPN expects "something" */ ret->handle =calloc (1 ,1 );
src/compat/compat-gettimeofday.c +1 -1
@@ -51,7 +51,7 @@ gettimeofday_calibrate(void) {const time_t t =time (NULL );const DWORD gtc =GetTickCount (); - gtc_base = t - gtc/1000 ; + gtc_base = t - gtc /1000 ; gtc_last = gtc; }
src/compat/compat-versionhelpers.h +1 -1
@@ -26,7 +26,7 @@ VERSIONHELPERAPI IsWindowsVersionOrGreater(WORD major, WORD minor, WORD servpack) { OSVERSIONINFOEXW vi = {sizeof(vi), major, minor, 0, 0, {0}, servpack}; - return VerifyVersionInfoW(&vi, VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR, + return VerifyVersionInfoW(&vi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL), VER_MINORVERSION, VER_GREATER_EQUAL),
src/openvpn/auth_token.c +11 -11
@@ -55,7 +55,7 @@ add_session_token_env(struct tls_session *session, struct tls_multi *multi, }else if (auth_token_state_flags &AUTH_TOKEN_HMAC_OK ) { -switch (auth_token_state_flags & (AUTH_TOKEN_VALID_EMPTYUSER |AUTH_TOKEN_EXPIRED )) +switch (auth_token_state_flags & (AUTH_TOKEN_VALID_EMPTYUSER |AUTH_TOKEN_EXPIRED )) {case 0 : state ="Authenticated" ;
@@ -109,9 +109,9 @@ add_session_token_env(struct tls_session *session, struct tls_multi *multi,* in the encoding */ -char session_id[AUTH_TOKEN_SESSION_ID_LEN *2 ] = {0 }; +char session_id[AUTH_TOKEN_SESSION_ID_LEN *2 ] = {0 };memcpy (session_id, session_id_source +strlen (SESSION_ID_PREFIX ), -AUTH_TOKEN_SESSION_ID_LEN *8 /6 ); +AUTH_TOKEN_SESSION_ID_LEN *8 /6 );setenv_str (session->opt->es,"session_id" , session_id); }
@@ -168,7 +168,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi)int64_t initial_timestamp = timestamp;hmac_ctx_t *ctx = multi->opt.auth_token_key.hmac; -ASSERT (hmac_ctx_size (ctx) ==256 /8 ); +ASSERT (hmac_ctx_size (ctx) ==256 /8 );uint8_t sessid[AUTH_TOKEN_SESSION_ID_LEN ];
@@ -184,7 +184,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi)char *initial_token_copy =string_alloc (multi->auth_token_initial, &gc);char *old_sessid = initial_token_copy +strlen (SESSION_ID_PREFIX ); -char *old_tsamp_initial = old_sessid +AUTH_TOKEN_SESSION_ID_LEN *8 /6 ; +char *old_tsamp_initial = old_sessid +AUTH_TOKEN_SESSION_ID_LEN *8 /6 ;/* * We null terminate the old token just after the session ID to let
@@ -215,7 +215,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi)* with \0 in them is asking for troubles in so many ways anyway that we * ignore that corner case here */ -uint8_t hmac_output[256 /8 ]; +uint8_t hmac_output[256 /8 ];hmac_ctx_reset (ctx);
@@ -240,7 +240,7 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi)/* Construct the unencoded session token */ struct buffer token =alloc_buf_gc ( -2 *sizeof (uint64_t ) +AUTH_TOKEN_SESSION_ID_LEN +256 /8 , &gc); +2 *sizeof (uint64_t ) +AUTH_TOKEN_SESSION_ID_LEN +256 /8 , &gc);ASSERT (buf_write (&token, sessid,sizeof (sessid)));ASSERT (buf_write (&token, &initial_timestamp,sizeof (initial_timestamp)));
@@ -282,16 +282,16 @@ generate_auth_token(const struct user_pass *up, struct tls_multi *multi)static bool check_hmac_token (hmac_ctx_t *ctx,const uint8_t *b64decoded,const char *username) { -ASSERT (hmac_ctx_size (ctx) ==256 /8 ); +ASSERT (hmac_ctx_size (ctx) ==256 /8 ); -uint8_t hmac_output[256 /8 ]; +uint8_t hmac_output[256 /8 ];hmac_ctx_reset (ctx);hmac_ctx_update (ctx, (uint8_t *) username, (int )strlen (username)); -hmac_ctx_update (ctx, b64decoded,TOKEN_DATA_LEN -256 /8 ); +hmac_ctx_update (ctx, b64decoded,TOKEN_DATA_LEN -256 /8 );hmac_ctx_final (ctx, hmac_output); -const uint8_t *hmac = b64decoded +TOKEN_DATA_LEN -256 /8 ; +const uint8_t *hmac = b64decoded +TOKEN_DATA_LEN -256 /8 ;return memcmp_constant_time (&hmac_output, hmac,32 ) ==0 ; }
src/openvpn/basic.h +1 -1
@@ -27,7 +27,7 @@#define BOOL_CAST (x) ((x) ? (true) : (false))/* size of an array */ -#define SIZE (x) (sizeof(x)/sizeof(x[0])) +#define SIZE (x) (sizeof(x) / sizeof(x[0]))/* clear an object (may be optimized away, use secure_memzero() to erase secrets) */ #define CLEAR (x) memset(&(x), 0, sizeof(x))
src/openvpn/buffer.c +1 -1
@@ -573,7 +573,7 @@ buf_chomp(struct buffer *buf) {break ; } -if (char_class (*last,CC_CRLF |CC_NULL )) +if (char_class (*last,CC_CRLF |CC_NULL )) {if (!buf_inc_len (buf,-1 )) {
src/openvpn/buffer.h +37 -37
88 lines not on this page · raw message
src/openvpn/common.h +1 -1
@@ -38,7 +38,7 @@ typedef int interval_t;/* * Used as an upper bound for timeouts. */ -#define BIG_TIMEOUT (60*60*24*7)/* one week (in seconds) */ +#define BIG_TIMEOUT (60 * 60 * 24 * 7)/* one week (in seconds) */ /* * Printf formats for special types
src/openvpn/comp.h +9 -9
@@ -52,14 +52,14 @@*/ /* Compression flags */ -#define COMP_F_ADAPTIVE (1<<0)/* COMP_ALG_LZO only */ -#define COMP_F_ALLOW_COMPRESS (1<<1)/* not only downlink is compressed but also uplink */ -#define COMP_F_SWAP (1<<2)/* initial command byte is swapped with last byte in buffer to preserve payload alignment */ -#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3)/* tell server that we only support compression stubs */ -#define COMP_F_ALLOW_STUB_ONLY (1<<4)/* Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY -* we still accept other compressions to be pushed */ -#define COMP_F_MIGRATE (1<<5)/* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */ -#define COMP_F_ALLOW_ASYM (1<<6)/* Compression was explicitly set to allow asymetric compression */ +#define COMP_F_ADAPTIVE (1 << 0)/* COMP_ALG_LZO only */ +#define COMP_F_ALLOW_COMPRESS (1 << 1)/* not only downlink is compressed but also uplink */ +#define COMP_F_SWAP (1 << 2)/* initial command byte is swapped with last byte in buffer to preserve payload alignment */ +#define COMP_F_ADVERTISE_STUBS_ONLY (1 << 3)/* tell server that we only support compression stubs */ +#define COMP_F_ALLOW_STUB_ONLY (1 << 4)/* Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY +* we still accept other compressions to be pushed */ +#define COMP_F_MIGRATE (1 << 5)/* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */ +#define COMP_F_ALLOW_ASYM (1 << 6)/* Compression was explicitly set to allow asymetric compression */ /*
@@ -92,7 +92,7 @@* Snappy: len + len/6 + 32 * LZ4: len + len/255 + 16 (LZ4_COMPRESSBOUND(len)) */ -#define COMP_EXTRA_BUFFER (len) ((len)/6 + 128 + 3 + COMP_PREFIX_LEN) +#define COMP_EXTRA_BUFFER (len) ((len) / 6 + 128 + 3 + COMP_PREFIX_LEN)/* * Don't try to compress any packet smaller than this.
src/openvpn/console_builtin.c +1 -1
@@ -74,7 +74,7 @@ get_console_input_win32(const char *prompt, const bool echo, char *input, const || win32_service_interrupt(&win32_signal) || (_write(orig_stderr, prompt, strlen(prompt)) == -1)) { -msg (M_WARN |M_ERRNO ,"get_console_input_win32(): unexpected error" ); +msg (M_WARN |M_ERRNO ,"get_console_input_win32(): unexpected error" );return false; }
src/openvpn/crypto.c +1 -1
@@ -734,7 +734,7 @@ warn_insecure_key_type(const char *ciphername)"using a --cipher with a larger block size (e.g. AES-256-CBC). " "Support for these insecure ciphers will be removed in " "OpenVPN 2.7." , - ciphername, cipher_kt_block_size(ciphername)*8); + ciphername, cipher_kt_block_size(ciphername) * 8); } }
src/openvpn/crypto.h +8 -8
@@ -240,27 +240,27 @@ struct crypto_options* keeping state between successive * OpenVPN process startups. */ -#define CO_PACKET_ID_LONG_FORM (1<<0) +#define CO_PACKET_ID_LONG_FORM (1 << 0)/**< Bit-flag indicating whether to use * OpenVPN's long packet ID format. */ -#define CO_IGNORE_PACKET_ID (1<<1) +#define CO_IGNORE_PACKET_ID (1 << 1)/**< Bit-flag indicating whether to ignore * the packet ID of a received packet. * This flag is used during processing * of the first packet received from a * client. */ -#define CO_MUTE_REPLAY_WARNINGS (1<<2) +#define CO_MUTE_REPLAY_WARNINGS (1 << 2)/**< Bit-flag indicating not to display * replay warnings. */ -#define CO_USE_TLS_KEY_MATERIAL_EXPORT (1<<3) +#define CO_USE_TLS_KEY_MATERIAL_EXPORT (1 << 3)/**< Bit-flag indicating that data channel key derivation * is done using TLS keying material export [RFC5705] */ -#define CO_RESEND_WKC (1<<4) +#define CO_RESEND_WKC (1 << 4)/**< Bit-flag indicating that the client is expected to * resend the wrapped client key with the 2nd packet (packet-id 1) * like with the HARD_RESET_CLIENT_V3 packet */ -#define CO_FORCE_TLSCRYPTV2_COOKIE (1<<5) +#define CO_FORCE_TLSCRYPTV2_COOKIE (1 << 5)/**< Bit-flag indicating that we do not allow clients that do * not support resending the wrapped client key (WKc) with the * third packet of the three-way handshake */
@@ -277,8 +277,8 @@ struct crypto_options*/ #define OPENVPN_AEAD_MIN_IV_LEN (sizeof(packet_id_type) + 8) -#define RKF_MUST_SUCCEED (1<<0) -#define RKF_INLINE (1<<1) +#define RKF_MUST_SUCCEED (1 << 0) +#define RKF_INLINE (1 << 1)void read_key_file (struct key2 *key2,const char *file,const unsigned int flags);/**
src/openvpn/crypto_mbedtls.c +8 -8
@@ -418,11 +418,11 @@ cipher_valid_reason(const char *ciphername, const char **reason)return false; } -if (cipher->key_bitlen/8 >MAX_CIPHER_KEY_LENGTH ) +if (cipher->key_bitlen /8 >MAX_CIPHER_KEY_LENGTH ) {msg (D_LOW ,"Cipher algorithm '%s' uses a default key size (%d bytes) " "which is larger than " PACKAGE_NAME "'s current maximum key size " -"(%d bytes)" , ciphername, cipher->key_bitlen/8 ,MAX_CIPHER_KEY_LENGTH ); +"(%d bytes)" , ciphername, cipher->key_bitlen /8 ,MAX_CIPHER_KEY_LENGTH ); *reason ="disabled due to key size too large" ;return false; }
@@ -453,7 +453,7 @@ cipher_kt_key_size(const char *ciphername)return 0 ; } -return cipher_kt->key_bitlen/8 ; +return cipher_kt->key_bitlen /8 ; }int
@@ -568,7 +568,7 @@ cipher_ctx_init(mbedtls_cipher_context_t *ctx, const uint8_t *key,CLEAR (*ctx);const mbedtls_cipher_info_t *kt =cipher_get (ciphername); -int key_len = kt->key_bitlen/8 ; +int key_len = kt->key_bitlen /8 ;ASSERT (kt);
@@ -577,13 +577,13 @@ cipher_ctx_init(mbedtls_cipher_context_t *ctx, const uint8_t *key,msg (M_FATAL ,"mbed TLS cipher context init #1" ); } -if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, key_len*8 , operation))) +if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, key_len *8 , operation))) {msg (M_FATAL ,"mbed TLS cipher set key" ); }/* make sure we used a big enough key */ -ASSERT (ctx->key_bitlen <= key_len*8 ); +ASSERT (ctx->key_bitlen <= key_len *8 ); }int
@@ -1097,10 +1097,10 @@ ssl_tls1_PRF(const uint8_t *label, int label_len, const uint8_t *sec,uint8_t *out2 = (uint8_t *)gc_malloc (olen, false, &gc); -int len = slen/2 ; +int len = slen /2 ;const uint8_t *S1 = sec;const uint8_t *S2 = &(sec[len]); - len += (slen&1 );/* add for odd, make longer */ + len += (slen &1 );/* add for odd, make longer */ tls1_P_hash (md5,S1 , len, label, label_len, out1, olen);tls1_P_hash (sha1,S2 , len, label, label_len, out2, olen);
src/openvpn/crypto_openssl.c +3 -3
@@ -986,7 +986,7 @@ cipher_des_encrypt_ecb(const unsigned char key[DES_KEY_LENGTH],crypto_msg (M_FATAL ,"%s: EVP_CIPHER_CTX_new() failed" , __func__); } -unsigned char key3[DES_KEY_LENGTH *3 ]; +unsigned char key3[DES_KEY_LENGTH *3 ];for (int i =0 ; i <3 ; i++) {memcpy (key3 + (i *DES_KEY_LENGTH ), key,DES_KEY_LENGTH );
@@ -1615,10 +1615,10 @@ ssl_tls1_PRF(const uint8_t *label, int label_len, const uint8_t *sec,uint8_t *out2 = (uint8_t *)gc_malloc (olen, false, &gc); -int len = slen/2 ; +int len = slen /2 ;const uint8_t *S1 = sec;const uint8_t *S2 = &(sec[len]); - len += (slen&1 );/* add for odd, make longer */ + len += (slen &1 );/* add for odd, make longer */ if (!tls1_P_hash (md5,S1 , len, label, label_len, out1, olen)) {
src/openvpn/cryptoapi.c +17 -17
@@ -113,7 +113,7 @@ cng_hash_algo(int md_type)break ;default : -msg (M_WARN |M_INFO ,"cryptoapicert: Unknown hash type NID=0x%x" , md_type); +msg (M_WARN |M_INFO ,"cryptoapicert: Unknown hash type NID=0x%x" , md_type);break ; }return alg;
@@ -170,7 +170,7 @@ cng_padding_type(int padding)break ;default : -msg (M_WARN |M_INFO ,"cryptoapicert: unknown OpenSSL padding type %d." , +msg (M_WARN |M_INFO ,"cryptoapicert: unknown OpenSSL padding type %d." , padding); }
@@ -222,7 +222,7 @@ priv_enc_CNG(const CAPI_DATA *cd, const wchar_t *hash_algo, const unsigned charif (status !=ERROR_SUCCESS ) {SetLastError (status); -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: NCryptSignHash failed" ); +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: NCryptSignHash failed" ); len =0 ; }
@@ -277,7 +277,7 @@ static ECDSA_SIG * ecdsa_bin2sig(unsigned char *buf, int len) {ECDSA_SIG *ecsig =NULL ; -DWORD rlen = len/2 ; +DWORD rlen = len /2 ;BIGNUM *r =BN_bin2bn (buf, rlen,NULL );BIGNUM *s =BN_bin2bn (buf + rlen, rlen,NULL );if (!r || !s)
@@ -323,7 +323,7 @@ ecdsa_sign_sig(const unsigned char *dgst, int dgstlen,if (status !=ERROR_SUCCESS ) {SetLastError (status); -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapticert: NCryptSignHash failed" ); +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapticert: NCryptSignHash failed" ); }else {
@@ -484,7 +484,7 @@ find_certificate_in_store(const char *cert_prop, HCERTSTORE cert_store) }if (!*++p)/* unexpected end of string */ { -msg (M_WARN |M_INFO ,"WARNING: cryptoapicert: error parsing <THUMB:%s>." , cert_prop); +msg (M_WARN |M_INFO ,"WARNING: cryptoapicert: error parsing <THUMB:%s>." , cert_prop); goto out; }if (*p >='0' && *p <='9' )
@@ -527,7 +527,7 @@ find_certificate_in_store(const char *cert_prop, HCERTSTORE cert_store) {break ; } -msg (M_WARN |M_INFO ,"WARNING: cryptoapicert: ignoring certificate in store %s." , +msg (M_WARN |M_INFO ,"WARNING: cryptoapicert: ignoring certificate in store %s." , validity <0 ?"not yet valid" :"that has expired" ); }
@@ -667,7 +667,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,if (!EVP_PKEY_CTX_get_rsa_pss_saltlen (ctx, &saltlen)) { -msg (M_WARN |M_INFO ,"cryptoapicert: unable to get the salt length from context." +msg (M_WARN |M_INFO ,"cryptoapicert: unable to get the salt length from context." " Using the default value." ); saltlen =-1 ; }
@@ -685,7 +685,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, {const RSA *rsa =EVP_PKEY_get0_RSA (pkey); saltlen =RSA_size (rsa) - hashlen -2 ;/* max salt length for RSASSA-PSS */ -if (RSA_bits (rsa) &0x7 )/* number of bits in the key not a multiple of 8 */ +if (RSA_bits (rsa) &0x7 )/* number of bits in the key not a multiple of 8 */ { saltlen--; }
@@ -799,7 +799,7 @@ xkey_cng_ec_sign(CAPI_DATA *cd, unsigned char *sig, size_t *siglen, const unsignif (status !=ERROR_SUCCESS ) {SetLastError (status); -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: ECDSA signature using CNG failed." ); +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: ECDSA signature using CNG failed." );return 0 ; }
@@ -884,7 +884,7 @@ xkey_cng_rsa_sign(CAPI_DATA *cd, unsigned char *sig, size_t *siglen, const unsigif (status !=ERROR_SUCCESS ) {SetLastError (status); -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: RSA signature using CNG failed." ); +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: RSA signature using CNG failed." );return 0 ; }
@@ -948,10 +948,10 @@ SSL_CTX_use_CryptoAPI_certificate(SSL_CTX *ssl_ctx, const char *cert_prop) }/* search CURRENT_USER first, then LOCAL_MACHINE */ cs =CertOpenStore ((LPCSTR )CERT_STORE_PROV_SYSTEM ,0 ,0 ,CERT_SYSTEM_STORE_CURRENT_USER - |CERT_STORE_OPEN_EXISTING_FLAG |CERT_STORE_READONLY_FLAG ,L"MY" ); + |CERT_STORE_OPEN_EXISTING_FLAG |CERT_STORE_READONLY_FLAG ,L"MY" );if (cs ==NULL ) { -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: failed to open user certficate store" ); +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: failed to open user certficate store" ); goto err; } cd->cert_context =find_certificate_in_store (cert_prop, cs);
@@ -959,10 +959,10 @@ SSL_CTX_use_CryptoAPI_certificate(SSL_CTX *ssl_ctx, const char *cert_prop)if (!cd->cert_context) { cs =CertOpenStore ((LPCSTR )CERT_STORE_PROV_SYSTEM ,0 ,0 ,CERT_SYSTEM_STORE_LOCAL_MACHINE - |CERT_STORE_OPEN_EXISTING_FLAG |CERT_STORE_READONLY_FLAG ,L"MY" ); + |CERT_STORE_OPEN_EXISTING_FLAG |CERT_STORE_READONLY_FLAG ,L"MY" );if (cs ==NULL ) { -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: failed to open machine certficate store" ); +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: failed to open machine certficate store" ); goto err; } cd->cert_context =find_certificate_in_store (cert_prop, cs);
@@ -991,7 +991,7 @@ SSL_CTX_use_CryptoAPI_certificate(SSL_CTX *ssl_ctx, const char *cert_prop) &cd->crypt_prov, &cd->key_spec, &cd->free_crypt_prov)) {/* private key may be in a token not available, or incompatible with CNG */ -msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: failed to acquire key. Key not present or " +msg (M_NONFATAL |M_ERRNO ,"Error in cryptoapicert: failed to acquire key. Key not present or " "is in a legacy token not supported by Windows CNG API" ); goto err; }
@@ -1037,7 +1037,7 @@ SSL_CTX_use_CryptoAPI_certificate(SSL_CTX *ssl_ctx, const char *cert_prop) }else { -msg (M_WARN |M_INFO ,"WARNING: cryptoapicert: key type <%d> not supported" , +msg (M_WARN |M_INFO ,"WARNING: cryptoapicert: key type <%d> not supported" ,EVP_PKEY_id (pkey)); goto err; }
src/openvpn/dco.c +1 -1
@@ -570,7 +570,7 @@ dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)multi_tcp_dereference_instance (m->mtcp, mi);if (close (sd)) { -msg (D_DCO |M_ERRNO ,"error closing TCP socket after DCO handover" ); +msg (D_DCO |M_ERRNO ,"error closing TCP socket after DCO handover" ); } c->c2.link_socket->info.dco_installed = true; c->c2.link_socket->sd =SOCKET_UNDEFINED ;
src/openvpn/dco_freebsd.c +2 -2
@@ -179,7 +179,7 @@ create_interface(struct tuntap *tt, const char *dev)if (ret) { ret = -errno; -msg (M_WARN |M_ERRNO ,"Failed to create interface %s (SIOCIFCREATE2)" , ifr.ifr_name); +msg (M_WARN |M_ERRNO ,"Failed to create interface %s (SIOCIFCREATE2)" , ifr.ifr_name);return ret; }
@@ -198,7 +198,7 @@ create_interface(struct tuntap *tt, const char *dev) ret = -errno;/* Delete the created interface again. */ (void )ioctl (tt->dco.fd,SIOCIFDESTROY , &ifr); -msg (M_WARN |M_ERRNO ,"Failed to create interface %s (SIOCSIFNAME)" , ifr.ifr_data); +msg (M_WARN |M_ERRNO ,"Failed to create interface %s (SIOCSIFNAME)" , ifr.ifr_data);return ret; }
src/openvpn/dco_linux.c +1 -1
@@ -153,7 +153,7 @@ ovpn_nl_recvmsgs(dco_context_t *dco, const char *prefix)default :if (ret) { -msg (M_NONFATAL |M_ERRNO ,"%s: netlink reports error (%d): %s" , prefix, ret,nl_geterror (-ret)); +msg (M_NONFATAL |M_ERRNO ,"%s: netlink reports error (%d): %s" , prefix, ret,nl_geterror (-ret)); }break ; }
src/openvpn/error.c +6 -6
@@ -198,7 +198,7 @@ msg_fp(const unsigned int flags)FILE *fp = msgfp;if (!fp) { - fp = (flags & (M_FATAL |M_USAGE_SMALL )) ? default_err : default_out; + fp = (flags & (M_FATAL |M_USAGE_SMALL )) ? default_err : default_out; }if (!fp) {
@@ -288,7 +288,7 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) }#if SYSLOG_CAPABILITY -if (flags & (M_FATAL |M_NONFATAL |M_USAGE_SMALL )) +if (flags & (M_FATAL |M_NONFATAL |M_USAGE_SMALL )) { level =LOG_ERR ; }
@@ -368,7 +368,7 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) prefix, prefix_sep, m1, - (flags&M_NOLF) ? "" : "\n"); + (flags & M_NOLF) ? "" : "\n"); }else {
@@ -377,7 +377,7 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) prefix, prefix_sep, m1, - (flags&M_NOLF) ? "" : "\n"); + (flags & M_NOLF) ? "" : "\n"); }fflush (fp); ++x_msg_line_num;
@@ -540,7 +540,7 @@ redirect_stdout_stderr(const char *file, bool append)if (log_handle ==INVALID_HANDLE_VALUE ) { -msg (M_WARN |M_ERRNO ,"Warning: cannot open --log file: %s" , file); +msg (M_WARN |M_ERRNO ,"Warning: cannot open --log file: %s" , file);return ; }
@@ -593,7 +593,7 @@ redirect_stdout_stderr(const char *file, bool append)if (out <0 ) { -msg (M_WARN |M_ERRNO ,"Warning: Error redirecting stdout/stderr to --log file: %s" , file); +msg (M_WARN |M_ERRNO ,"Warning: Error redirecting stdout/stderr to --log file: %s" , file);return ; }
src/openvpn/error.h +13 -13
@@ -92,20 +92,20 @@ extern int x_msg_line_num;#define M_DEBUG_LEVEL (0x0F)/* debug level mask */ -#define M_FATAL (1<<4)/* exit program */ -#define M_NONFATAL (1<<5)/* non-fatal error */ -#define M_WARN (1<<6)/* call syslog with LOG_WARNING */ -#define M_DEBUG (1<<7) +#define M_FATAL (1 << 4)/* exit program */ +#define M_NONFATAL (1 << 5)/* non-fatal error */ +#define M_WARN (1 << 6)/* call syslog with LOG_WARNING */ +#define M_DEBUG (1 << 7) -#define M_ERRNO (1<<8)/* show errno description */ +#define M_ERRNO (1 << 8)/* show errno description */ -#define M_NOMUTE (1<<11)/* don't do mute processing */ -#define M_NOPREFIX (1<<12)/* don't show date/time prefix */ -#define M_USAGE_SMALL (1<<13)/* fatal options error, call usage_small */ -#define M_MSG_VIRT_OUT (1<<14)/* output message through msg_status_output callback */ -#define M_OPTERR (1<<15)/* print "Options error:" prefix */ -#define M_NOLF (1<<16)/* don't print new line */ -#define M_NOIPREFIX (1<<17)/* don't print instance prefix */ +#define M_NOMUTE (1 << 11)/* don't do mute processing */ +#define M_NOPREFIX (1 << 12)/* don't show date/time prefix */ +#define M_USAGE_SMALL (1 << 13)/* fatal options error, call usage_small */ +#define M_MSG_VIRT_OUT (1 << 14)/* output message through msg_status_output callback */ +#define M_OPTERR (1 << 15)/* print "Options error:" prefix */ +#define M_NOLF (1 << 16)/* don't print new line */ +#define M_NOIPREFIX (1 << 17)/* don't print instance prefix */ /* flag combinations which are frequently used */ #define M_ERR (M_FATAL | M_ERRNO)
@@ -180,7 +180,7 @@ void set_suppress_timestamps(bool suppressed);void set_machine_readable_output (bool parsable); -#define SDL_CONSTRAIN (1<<0) +#define SDL_CONSTRAIN (1 << 0)bool set_debug_level (const int level,const unsigned int flags);bool set_mute_cutoff (const int cutoff);
src/openvpn/event.c +7 -7
@@ -333,11 +333,11 @@ we_ctl(struct event_set *es, event_t event, unsigned int rwflags, void *arg) }break ; -case EVENT_READ |EVENT_WRITE : +case EVENT_READ |EVENT_WRITE :switch (n) {case 0 : -if (!we_append_event (wes, event,EVENT_READ |EVENT_WRITE , arg)) +if (!we_append_event (wes, event,EVENT_READ |EVENT_WRITE , arg)) { goto err; }
@@ -561,7 +561,7 @@ ep_del(struct event_set *es, event_t event)CLEAR (ev);if (epoll_ctl (eps->epfd,EPOLL_CTL_DEL , event, &ev) <0 ) { -msg (M_WARN |M_ERRNO ,"EVENT: epoll_ctl EPOLL_CTL_DEL failed, sd=%d" , (int )event); +msg (M_WARN |M_ERRNO ,"EVENT: epoll_ctl EPOLL_CTL_DEL failed, sd=%d" , (int )event); } }
@@ -627,7 +627,7 @@ ep_wait(struct event_set *es, const struct timeval *tv, struct event_set_returnfor (i =0 ; i < stat; ++i) { esr->rwflags =0 ; -if (ev->events & (EPOLLIN |EPOLLPRI |EPOLLERR |EPOLLHUP )) +if (ev->events & (EPOLLIN |EPOLLPRI |EPOLLERR |EPOLLHUP )) { esr->rwflags |=EVENT_READ ; }
@@ -753,7 +753,7 @@ po_set_pollfd_events(struct pollfd *pfdp, unsigned int rwflags) }if (rwflags &EVENT_READ ) { - pfdp->events |= (POLLIN |POLLPRI ); + pfdp->events |= (POLLIN |POLLPRI ); } }
@@ -832,10 +832,10 @@ po_wait(struct event_set *es, const struct timeval *tv, struct event_set_returnconst struct pollfd *pfdp = pos->events;for (i =0 ; i < pos->n_events && j < outlen; ++i) { -if (pfdp->revents & (POLLIN |POLLPRI |POLLERR |POLLHUP |POLLOUT )) +if (pfdp->revents & (POLLIN |POLLPRI |POLLERR |POLLHUP |POLLOUT )) { out->rwflags =0 ; -if (pfdp->revents & (POLLIN |POLLPRI |POLLERR |POLLHUP )) +if (pfdp->revents & (POLLIN |POLLPRI |POLLERR |POLLHUP )) { out->rwflags |=EVENT_READ ; }
src/openvpn/event.h +2 -2
@@ -79,8 +79,8 @@/* * Initialization flags passed to event_set_init */ -#define EVENT_METHOD_US_TIMEOUT (1<<0) -#define EVENT_METHOD_FAST (1<<1) +#define EVENT_METHOD_US_TIMEOUT (1 << 0) +#define EVENT_METHOD_FAST (1 << 1)#ifdef _WIN32
src/openvpn/forward.c +4 -4
@@ -410,8 +410,8 @@ check_add_routes(struct context *c)register_signal (c,SIGHUP ,"ip-fail" ); c->persist.restart_sleep_seconds =10 ;#ifdef _WIN32 -show_routes (M_INFO |M_NOPREFIX ); -show_adapters (M_INFO |M_NOPREFIX ); +show_routes (M_INFO |M_NOPREFIX ); +show_adapters (M_INFO |M_NOPREFIX );#endif } }
@@ -1588,7 +1588,7 @@ process_ip_header(struct context *c, unsigned int flags, struct buffer *buf)mss_fixup_ipv6 (&ipbuf, c->c2.frame.mss_fix); }if (!(flags &PIP_OUTGOING ) && (flags - &(PIPV6_IMCP_NOHOST_CLIENT |PIPV6_IMCP_NOHOST_SERVER ))) + & (PIPV6_IMCP_NOHOST_CLIENT |PIPV6_IMCP_NOHOST_SERVER ))) {ipv6_send_icmp_unreachable (c, buf, (bool )(flags &PIPV6_IMCP_NOHOST_CLIENT ));
@@ -2177,7 +2177,7 @@ process_io(struct context *c)const unsigned int status = c->c2.event_set_status;#ifdef ENABLE_MANAGEMENT -if (status & (MANAGEMENT_READ |MANAGEMENT_WRITE )) +if (status & (MANAGEMENT_READ |MANAGEMENT_WRITE )) {ASSERT (management);management_io (management);
src/openvpn/forward.h +22 -22
74 lines not on this page · raw message
src/openvpn/gremlin.h +5 -5
@@ -49,11 +49,11 @@/* extract gremlin parms */ -#define GREMLIN_CONNECTION_FLOOD_LEVEL (x) (((x)>>GREMLIN_CONNECTION_FLOOD_SHIFT) & GREMLIN_CONNECTION_FLOOD_MASK) -#define GREMLIN_PACKET_FLOOD_LEVEL (x) (((x)>>GREMLIN_PACKET_FLOOD_SHIFT) & GREMLIN_PACKET_FLOOD_MASK) -#define GREMLIN_CORRUPT_LEVEL (x) (((x)>>GREMLIN_CORRUPT_SHIFT) & GREMLIN_CORRUPT_MASK) -#define GREMLIN_UP_DOWN_LEVEL (x) (((x)>>GREMLIN_UP_DOWN_SHIFT) & GREMLIN_UP_DOWN_MASK) -#define GREMLIN_DROP_LEVEL (x) (((x)>>GREMLIN_DROP_SHIFT) & GREMLIN_DROP_MASK) +#define GREMLIN_CONNECTION_FLOOD_LEVEL (x) (((x) >> GREMLIN_CONNECTION_FLOOD_SHIFT) & GREMLIN_CONNECTION_FLOOD_MASK) +#define GREMLIN_PACKET_FLOOD_LEVEL (x) (((x) >> GREMLIN_PACKET_FLOOD_SHIFT) & GREMLIN_PACKET_FLOOD_MASK) +#define GREMLIN_CORRUPT_LEVEL (x) (((x) >> GREMLIN_CORRUPT_SHIFT) & GREMLIN_CORRUPT_MASK) +#define GREMLIN_UP_DOWN_LEVEL (x) (((x) >> GREMLIN_UP_DOWN_SHIFT) & GREMLIN_UP_DOWN_MASK) +#define GREMLIN_DROP_LEVEL (x) (((x) >> GREMLIN_DROP_SHIFT) & GREMLIN_DROP_MASK)#include "buffer.h"
src/openvpn/httpdigest.c +4 -4
@@ -48,20 +48,20 @@ CvtHex( j = (Bin[i] >>4 ) &0xf ;if (j <=9 ) { - Hex[i*2 ] = (j +'0' ); + Hex[i *2 ] = (j +'0' ); }else { - Hex[i*2 ] = (j +'a' -10 ); + Hex[i *2 ] = (j +'a' -10 ); } j = Bin[i] &0xf ;if (j <=9 ) { - Hex[i*2 +1 ] = (j +'0' ); + Hex[i *2 +1 ] = (j +'0' ); }else { - Hex[i*2 +1 ] = (j +'a' -10 ); + Hex[i *2 +1 ] = (j +'a' -10 ); } } Hex[HASHHEXLEN ] ='\0' ;
src/openvpn/init.c +19 -19
@@ -66,9 +66,9 @@ static const char *saved_pid_file_name; /* GLOBAL *//* * Crypto initialization flags */ -#define CF_LOAD_PERSISTED_PACKET_ID (1<<0) -#define CF_INIT_TLS_MULTI (1<<1) -#define CF_INIT_TLS_AUTH_STANDALONE (1<<2) +#define CF_LOAD_PERSISTED_PACKET_ID (1 << 0) +#define CF_INIT_TLS_MULTI (1 << 1) +#define CF_INIT_TLS_AUTH_STANDALONE (1 << 2)static void do_init_first_time (struct context *c);static bool do_deferred_p2p_ncp (struct context *c);
@@ -334,7 +334,7 @@ management_callback_remote_cmd(void *arg, const char **p)struct context *c = (struct context *) arg;struct connection_entry *ce = &c->options.ce;int ret = false; -if (p[1 ] && ((ce->flags>>CE_MAN_QUERY_REMOTE_SHIFT )&CE_MAN_QUERY_REMOTE_MASK ) ==CE_MAN_QUERY_REMOTE_QUERY ) +if (p[1 ] && ((ce->flags >>CE_MAN_QUERY_REMOTE_SHIFT ) &CE_MAN_QUERY_REMOTE_MASK ) ==CE_MAN_QUERY_REMOTE_QUERY ) {int flags =0 ;if (!strcmp (p[1 ],"ACCEPT" ))
@@ -368,8 +368,8 @@ management_callback_remote_cmd(void *arg, const char **p) }if (ret) { - ce->flags &= ~(CE_MAN_QUERY_REMOTE_MASK <<CE_MAN_QUERY_REMOTE_SHIFT ); - ce->flags |= ((flags&CE_MAN_QUERY_REMOTE_MASK )<<CE_MAN_QUERY_REMOTE_SHIFT ); + ce->flags &= ~(CE_MAN_QUERY_REMOTE_MASK <<CE_MAN_QUERY_REMOTE_SHIFT ); + ce->flags |= ((flags &CE_MAN_QUERY_REMOTE_MASK ) <<CE_MAN_QUERY_REMOTE_SHIFT ); } }return ret;
@@ -693,7 +693,7 @@ context_init_1(struct context *c)struct user_pass up;CLEAR (up);strcpy (up.username,"Please insert your cryptographic token" );/* put the high-level message in up.username */ -get_user_pass (&up,NULL ,"token-insertion-request" ,GET_USER_PASS_MANAGEMENT |GET_USER_PASS_NEED_OK ); +get_user_pass (&up,NULL ,"token-insertion-request" ,GET_USER_PASS_MANAGEMENT |GET_USER_PASS_NEED_OK );msg (M_INFO ,"RET:%s" , up.password);/* will return the third argument to management interface * 'needok' command, usually 'ok' or 'cancel'. */ }
@@ -1067,7 +1067,7 @@ do_persist_tuntap(struct options *options, openvpn_net_ctx_t *ctx) || options->tls_server || options->tls_client ) { -msg (M_FATAL |M_OPTERR , +msg (M_FATAL |M_OPTERR ,"options --mktun or --rmtun should only be used together with --dev" ); }
@@ -1101,7 +1101,7 @@ do_persist_tuntap(struct options *options, openvpn_net_ctx_t *ctx) }return true;#else /* ifdef ENABLE_FEATURE_TUN_PERSIST */ -msg (M_FATAL |M_OPTERR , +msg (M_FATAL |M_OPTERR ,"options --mktun and --rmtun are not available on your operating " "system. Please check 'man tun' (or 'tap'), whether your system " "supports using 'ifconfig %s create' / 'destroy' to create/remove "
@@ -1537,8 +1537,8 @@ initialization_sequence_completed(struct context *c, const unsigned int flags)if (flags &ISC_ERRORS ) {#ifdef _WIN32 -show_routes (M_INFO |M_NOPREFIX ); -show_adapters (M_INFO |M_NOPREFIX ); +show_routes (M_INFO |M_NOPREFIX ); +show_adapters (M_INFO |M_NOPREFIX );msg (M_INFO ,"%s With Errors ( see http://openvpn.net/faq.html#dhcpclientserv )" , message);#else #ifdef ENABLE_SYSTEMD
@@ -1556,7 +1556,7 @@ initialization_sequence_completed(struct context *c, const unsigned int flags) }/* Flag that we initialized */ -if ((flags & (ISC_ERRORS |ISC_SERVER )) ==0 ) +if ((flags & (ISC_ERRORS |ISC_SERVER )) ==0 ) { c->options.no_advance = true; }
@@ -1670,13 +1670,13 @@ do_route(const struct options *options,#ifdef _WIN32if (options->show_net_up) { -show_routes (M_INFO |M_NOPREFIX ); -show_adapters (M_INFO |M_NOPREFIX ); +show_routes (M_INFO |M_NOPREFIX ); +show_adapters (M_INFO |M_NOPREFIX ); }else if (check_debug_level (D_SHOW_NET )) { -show_routes (D_SHOW_NET |M_NOPREFIX ); -show_adapters (D_SHOW_NET |M_NOPREFIX ); +show_routes (D_SHOW_NET |M_NOPREFIX ); +show_adapters (D_SHOW_NET |M_NOPREFIX ); }#endif }
@@ -2345,7 +2345,7 @@ do_deferred_options(struct context *c, const unsigned int found) {if (found &OPT_P_MESSAGES ) { -init_verb_mute (c,IVM_LEVEL_1 |IVM_LEVEL_2 ); +init_verb_mute (c,IVM_LEVEL_1 |IVM_LEVEL_2 );msg (D_PUSH ,"OPTIONS IMPORT: --verb and/or --mute level changed" ); }if (found &OPT_P_TIMER )
@@ -3505,7 +3505,7 @@ do_init_first_time(struct context *c)/* get user and/or group that we want to setuid/setgid to */ c0->uid_gid_specified =platform_group_get (c->options.groupname, &c0->platform_state_group) - |platform_user_get (c->options.username, &c0->platform_state_user); + |platform_user_get (c->options.username, &c0->platform_state_user);/* perform postponed chdir if --daemon */ if (c->did_we_daemonize && c->options.cd_dir ==NULL )
@@ -3860,7 +3860,7 @@ open_plugins(struct context *c, const bool import_options, int init_point) {options_string_import (&c->options, config.list[i]->value, -D_IMPORT_ERRORS |M_OPTERR , +D_IMPORT_ERRORS |M_OPTERR ,OPT_P_DEFAULT & ~OPT_P_PLUGIN , &option_types_found, c->es);
src/openvpn/init.h +8 -8
@@ -46,8 +46,8 @@ bool init_static(void);void uninit_static (void ); -#define IVM_LEVEL_1 (1<<0) -#define IVM_LEVEL_2 (1<<1) +#define IVM_LEVEL_1 (1 << 0) +#define IVM_LEVEL_2 (1 << 1)void init_verb_mute (struct context *c,unsigned int flags);void init_options_dev (struct options *options);
@@ -103,10 +103,10 @@ void inherit_context_child(struct context *dest,void inherit_context_top (struct context *dest,const struct context *src); -#define CC_GC_FREE (1<<0) -#define CC_USR1_TO_HUP (1<<1) -#define CC_HARD_USR1_TO_HUP (1<<2) -#define CC_NO_CLOSE (1<<3) +#define CC_GC_FREE (1 << 0) +#define CC_USR1_TO_HUP (1 << 1) +#define CC_HARD_USR1_TO_HUP (1 << 2) +#define CC_NO_CLOSE (1 << 3)void close_context (struct context *c,int sig,unsigned int flags);
@@ -114,8 +114,8 @@ struct context_buffers *init_context_buffers(const struct frame *frame);void free_context_buffers (struct context_buffers *b); -#define ISC_ERRORS (1<<0) -#define ISC_SERVER (1<<1) +#define ISC_ERRORS (1 << 0) +#define ISC_SERVER (1 << 1)void initialization_sequence_completed (struct context *c,const unsigned int flags);#ifdef ENABLE_MANAGEMENT
src/openvpn/list.c +9 -9
@@ -574,15 +574,15 @@ list_test(void)#define mix (a, b, c) \ { \ - a -= b; a -= c; a ^= (c>>13); \ - b -= c; b -= a; b ^= (a<<8); \ - c -= a; c -= b; c ^= (b>>13); \ - a -= b; a -= c; a ^= (c>>12); \ - b -= c; b -= a; b ^= (a<<16); \ - c -= a; c -= b; c ^= (b>>5); \ - a -= b; a -= c; a ^= (c>>3); \ - b -= c; b -= a; b ^= (a<<10); \ - c -= a; c -= b; c ^= (b>>15); \ + a -= b; a -= c; a ^= (c >> 13); \ + b -= c; b -= a; b ^= (a << 8); \ + c -= a; c -= b; c ^= (b >> 13); \ + a -= b; a -= c; a ^= (c >> 12); \ + b -= c; b -= a; b ^= (a << 16); \ + c -= a; c -= b; c ^= (b >> 5); \ + a -= b; a -= c; a ^= (c >> 3); \ + b -= c; b -= a; b ^= (a << 10); \ + c -= a; c -= b; c ^= (b >> 15); \ }uint32_t
src/openvpn/list.h +1 -1
@@ -39,7 +39,7 @@#include "basic.h" #include "buffer.h" -#define hashsize (n) ((uint32_t)1<<(n)) +#define hashsize (n) ((uint32_t)1 << (n))#define hashmask (n) (hashsize(n) - 1)struct hash_element
src/openvpn/manage.c +22 -22
144 lines not on this page · raw message
src/openvpn/manage.h +37 -37
116 lines not on this page · raw message
src/openvpn/mbuf.h +1 -1
@@ -43,7 +43,7 @@ struct mbuf_bufferstruct buffer buf;int refcount; -#define MF_UNICAST (1<<0) +#define MF_UNICAST (1 << 0)unsigned int flags; };
src/openvpn/misc.c +2 -2
@@ -87,7 +87,7 @@ hostname_randomize(const char *hostname, struct gc_arena *gc)uint8_t rnd_bytes[n_rnd_bytes];const char *rnd_str; -struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes)*2 +4 , gc); +struct buffer hname =alloc_buf_gc (strlen (hostname) +sizeof (rnd_bytes) *2 +4 , gc);prng_bytes (rnd_bytes,sizeof (rnd_bytes)); rnd_str =format_hex_ex (rnd_bytes,sizeof (rnd_bytes),40 ,0 ,NULL , gc);
@@ -294,7 +294,7 @@ get_user_pass_cr(struct user_pass *up,buf_set_write (&packed_resp, (uint8_t *)up->password,USER_PASS_LEN );if (!query_user_SINGLE (BSTR (&challenge),BLEN (&challenge), - response,USER_PASS_LEN ,BOOL_CAST (ac->flags&CR_ECHO ))) + response,USER_PASS_LEN ,BOOL_CAST (ac->flags &CR_ECHO ))) {msg (M_FATAL ,"ERROR: could not read challenge response from stdin" ); }
src/openvpn/misc.h +14 -14
@@ -76,8 +76,8 @@ struct user_pass* Challenge response info on client as pushed by server. */ struct auth_challenge_info { -#define CR_ECHO (1<<0)/* echo response when typed by user */ -#define CR_RESPONSE (1<<1)/* response needed */ +#define CR_ECHO (1 << 0)/* echo response when typed by user */ +#define CR_RESPONSE (1 << 1)/* response needed */ unsigned int flags;const char *user;
@@ -91,7 +91,7 @@ struct auth_challenge_info *get_auth_challenge(const char *auth_challenge, struc* Challenge response info on client as pushed by server. */ struct static_challenge_info { -#define SC_ECHO (1<<0)/* echo response when typed by user */ +#define SC_ECHO (1 << 0)/* echo response when typed by user */ unsigned int flags;const char *challenge_text;
@@ -105,19 +105,19 @@ struct static_challenge_info {};/* * Flags for get_user_pass and management_query_user_pass */ -#define GET_USER_PASS_MANAGEMENT (1<<0) +#define GET_USER_PASS_MANAGEMENT (1 << 0)/* GET_USER_PASS_SENSITIVE (1<<1) not used anymore */ -#define GET_USER_PASS_PASSWORD_ONLY (1<<2) -#define GET_USER_PASS_NEED_OK (1<<3) -#define GET_USER_PASS_NOFATAL (1<<4) -#define GET_USER_PASS_NEED_STR (1<<5) -#define GET_USER_PASS_PREVIOUS_CREDS_FAILED (1<<6) +#define GET_USER_PASS_PASSWORD_ONLY (1 << 2) +#define GET_USER_PASS_NEED_OK (1 << 3) +#define GET_USER_PASS_NOFATAL (1 << 4) +#define GET_USER_PASS_NEED_STR (1 << 5) +#define GET_USER_PASS_PREVIOUS_CREDS_FAILED (1 << 6) -#define GET_USER_PASS_DYNAMIC_CHALLENGE (1<<7)/* CRV1 protocol -- dynamic challenge */ -#define GET_USER_PASS_STATIC_CHALLENGE (1<<8)/* SCRV1 protocol -- static challenge */ -#define GET_USER_PASS_STATIC_CHALLENGE_ECHO (1<<9)/* SCRV1 protocol -- echo response */ +#define GET_USER_PASS_DYNAMIC_CHALLENGE (1 << 7)/* CRV1 protocol -- dynamic challenge */ +#define GET_USER_PASS_STATIC_CHALLENGE (1 << 8)/* SCRV1 protocol -- static challenge */ +#define GET_USER_PASS_STATIC_CHALLENGE_ECHO (1 << 9)/* SCRV1 protocol -- echo response */ -#define GET_USER_PASS_INLINE_CREDS (1<<10)/* indicates that auth_file is actually inline creds */ +#define GET_USER_PASS_INLINE_CREDS (1 << 10)/* indicates that auth_file is actually inline creds */ bool get_user_pass_cr(struct user_pass *up, const char *auth_file,
@@ -217,7 +217,7 @@ prepend_dir(const char *dir, const char *path, struct gc_arena *gc);/* *INDENT-ON* */ #define MAC_PRINT_ARG (_mac) _mac[0], _mac[1], _mac[2], \ _mac[3], _mac[4], _mac[5] -#define MAC_SCAN_ARG (_mac) &_mac[0], &_mac[1], &_mac[2], \ +#define MAC_SCAN_ARG (_mac) & _mac[0], &_mac[1], &_mac[2], \ &_mac[3], &_mac[4], &_mac[5]#endif /* ifndef MISC_H */
src/openvpn/mroute.h +13 -13
@@ -30,20 +30,20 @@#include <stddef.h> -#define IP_MCAST_SUBNET_MASK ((in_addr_t)240<<24) -#define IP_MCAST_NETWORK ((in_addr_t)224<<24) +#define IP_MCAST_SUBNET_MASK ((in_addr_t)240 << 24) +#define IP_MCAST_NETWORK ((in_addr_t)224 << 24)/* Return status values for mroute_extract_addr_from_packet */ -#define MROUTE_EXTRACT_SUCCEEDED (1<<0) -#define MROUTE_EXTRACT_BCAST (1<<1) -#define MROUTE_EXTRACT_MCAST (1<<2) -#define MROUTE_EXTRACT_IGMP (1<<3) +#define MROUTE_EXTRACT_SUCCEEDED (1 << 0) +#define MROUTE_EXTRACT_BCAST (1 << 1) +#define MROUTE_EXTRACT_MCAST (1 << 2) +#define MROUTE_EXTRACT_IGMP (1 << 3) -#define MROUTE_SEC_EXTRACT_SUCCEEDED (1<<(0 + MROUTE_SEC_SHIFT)) -#define MROUTE_SEC_EXTRACT_BCAST (1<<(1 + MROUTE_SEC_SHIFT)) -#define MROUTE_SEC_EXTRACT_MCAST (1<<(2 + MROUTE_SEC_SHIFT)) -#define MROUTE_SEC_EXTRACT_IGMP (1<<(3 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_SUCCEEDED (1 << (0 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_BCAST (1 << (1 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_MCAST (1 << (2 + MROUTE_SEC_SHIFT)) +#define MROUTE_SEC_EXTRACT_IGMP (1 << (3 + MROUTE_SEC_SHIFT))#define MROUTE_SEC_SHIFT 4
@@ -154,9 +154,9 @@ void mroute_addr_init(struct mroute_addr *addr);const char *mroute_addr_print (const struct mroute_addr *ma,struct gc_arena *gc); -#define MAPF_SUBNET (1<<0) -#define MAPF_IA_EMPTY_IF_UNDEF (1<<1) -#define MAPF_SHOW_ARP (1<<2) +#define MAPF_SUBNET (1 << 0) +#define MAPF_IA_EMPTY_IF_UNDEF (1 << 1) +#define MAPF_SHOW_ARP (1 << 2)const char *mroute_addr_print_ex (const struct mroute_addr *ma,const unsigned int flags,struct gc_arena *gc);
src/openvpn/mss.c +3 -3
@@ -193,13 +193,13 @@ mss_fixup_dowork(struct buffer *buf, uint16_t maxmss) {continue ; } - mssval = (opt[2 ]<<8 ) + opt[3 ]; + mssval = (opt[2 ] <<8 ) + opt[3 ];if (mssval > maxmss) {dmsg (D_MSS ,"MSS: %d -> %d" , (int ) mssval, (int ) maxmss); accumulate =htons (mssval); - opt[2 ] = (maxmss>>8 )&0xff ; - opt[3 ] = maxmss&0xff ; + opt[2 ] = (maxmss >>8 ) &0xff ; + opt[3 ] = maxmss &0xff ; accumulate -=htons (maxmss);ADJUST_CHECKSUM (accumulate, tc->check); }
src/openvpn/mstats.c +1 -1
@@ -86,7 +86,7 @@ mstats_open(const char *fn) }/* mmap the file */ - data =mmap (NULL ,sizeof (struct mmap_stats ),PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 ); + data =mmap (NULL ,sizeof (struct mmap_stats ),PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 );if (data ==MAP_FAILED ) {msg (M_ERR ,"mstats_open: write error: %s" , fn);
src/openvpn/mtcp.c +5 -5
@@ -439,7 +439,7 @@ multi_tcp_wait_lite(struct multi_context *m, struct multi_instance *mi, const incase TA_SOCKET_WRITE : looking_for =SOCKET_WRITE ; -io_wait (c,IOW_TO_LINK |IOW_READ_TUN_FORCE ); +io_wait (c,IOW_TO_LINK |IOW_READ_TUN_FORCE );break ;default :
@@ -475,7 +475,7 @@ multi_tcp_wait_lite(struct multi_context *m, struct multi_instance *mi, const instatic struct multi_instance *multi_tcp_dispatch (struct multi_context *m,struct multi_instance *mi,const int action) { -const unsigned int mpp_flags =MPP_PRE_SELECT |MPP_RECORD_TOUCH ; +const unsigned int mpp_flags =MPP_PRE_SELECT |MPP_RECORD_TOUCH ;struct multi_instance *touched = mi; m->mpp_touched = &touched;
@@ -559,8 +559,8 @@ multi_tcp_post(struct multi_context *m, struct multi_instance *mi, const int actint newaction =TA_UNDEF ;#define MTP_NONE 0 -#define MTP_TUN_OUT (1<<0) -#define MTP_LINK_OUT (1<<1) +#define MTP_TUN_OUT (1 << 0) +#define MTP_LINK_OUT (1 << 1)unsigned int flags =MTP_NONE ;if (TUN_OUT (c))
@@ -574,7 +574,7 @@ multi_tcp_post(struct multi_context *m, struct multi_instance *mi, const int actswitch (flags) { -case MTP_TUN_OUT |MTP_LINK_OUT : +case MTP_TUN_OUT |MTP_LINK_OUT :case MTP_TUN_OUT : newaction =TA_TUN_WRITE ;break ;
src/openvpn/mtu.c +1 -1
@@ -189,7 +189,7 @@ calc_options_string_link_mtu(const struct options *o, const struct frame *frame)* overhead */ /* overhead of BF-CBC: 64 bit block size, 64 bit IV size */ - overhead +=64 /8 +64 /8 ; + overhead +=64 /8 +64 /8 ;/* set ciphername to none, so its size does get added in the * fake_kt and the cipher is not tried to be resolved */ ciphername ="none" ;
src/openvpn/mudp.c +2 -2
@@ -339,7 +339,7 @@ multi_process_io_udp(struct multi_context *m)#endif /* ifdef MULTI_DEBUG_EVENT_LOOP */ #ifdef ENABLE_MANAGEMENT -if (status & (MANAGEMENT_READ |MANAGEMENT_WRITE )) +if (status & (MANAGEMENT_READ |MANAGEMENT_WRITE )) {ASSERT (management);management_io (management);
@@ -488,7 +488,7 @@ tunnel_server_udp(struct context *top)/* timeout? */ if (multi.top.c2.event_set_status ==ES_TIMEOUT ) { -multi_process_timeout (&multi,MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +multi_process_timeout (&multi,MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); }else {
src/openvpn/multi.c +7 -7
@@ -1173,7 +1173,7 @@ multi_get_instance_by_virtual_addr(struct multi_context *m, {/* found an applicable route, cache host route */ struct multi_instance *mi = route->instance; -multi_learn_addr (m, mi, addr,MULTI_ROUTE_CACHE |MULTI_ROUTE_AGEABLE ); +multi_learn_addr (m, mi, addr,MULTI_ROUTE_CACHE |MULTI_ROUTE_AGEABLE ); ret = mi;break ; }
@@ -1635,7 +1635,7 @@ multi_client_connect_post(struct multi_context *m, {options_server_import (&mi->context.options, dc_file, -D_IMPORT_ERRORS |M_OPTERR , +D_IMPORT_ERRORS |M_OPTERR ,CLIENT_CONNECT_OPT_MASK , option_types_found, mi->context.c2.es);
@@ -1676,7 +1676,7 @@ multi_client_connect_post_plugin(struct multi_context *m, {options_string_import (&mi->context.options, config.list[i]->value, -D_IMPORT_ERRORS |M_OPTERR , +D_IMPORT_ERRORS |M_OPTERR ,CLIENT_CONNECT_OPT_MASK , option_types_found, mi->context.c2.es);
@@ -1718,7 +1718,7 @@ multi_client_connect_mda(struct multi_context *m,const char *opt =BSTR (&be->buf);options_string_import (&mi->context.options, opt, -D_IMPORT_ERRORS |M_OPTERR , +D_IMPORT_ERRORS |M_OPTERR ,CLIENT_CONNECT_OPT_MASK , option_types_found, mi->context.c2.es);
@@ -2581,7 +2581,7 @@ multi_client_connect_source_ccd(struct multi_context *m, {options_server_import (&mi->context.options, ccd_file, -D_IMPORT_ERRORS |M_OPTERR , +D_IMPORT_ERRORS |M_OPTERR ,CLIENT_CONNECT_OPT_MASK , option_types_found, mi->context.c2.es);
@@ -3422,7 +3422,7 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst/* check for broadcast */ if (m->enable_c2c) { -if (mroute_flags & (MROUTE_EXTRACT_BCAST |MROUTE_EXTRACT_MCAST )) +if (mroute_flags & (MROUTE_EXTRACT_BCAST |MROUTE_EXTRACT_MCAST )) {multi_bcast (m, &c->c2.to_tun, m->pending,NULL , vid);
@@ -3517,7 +3517,7 @@ multi_process_incoming_tun(struct multi_context *m, const unsigned int mpp_flagsstruct context *c;/* broadcast or multicast dest addr? */ -if (mroute_flags & (MROUTE_EXTRACT_BCAST |MROUTE_EXTRACT_MCAST )) +if (mroute_flags & (MROUTE_EXTRACT_BCAST |MROUTE_EXTRACT_MCAST )) {/* for now, treat multicast as broadcast */ multi_bcast (m, &m->top.c2.buf,NULL ,NULL , vid);
src/openvpn/multi.h +8 -8
@@ -228,8 +228,8 @@ struct multi_routestruct mroute_addr addr;struct multi_instance *instance; -#define MULTI_ROUTE_CACHE (1<<0) -#define MULTI_ROUTE_AGEABLE (1<<1) +#define MULTI_ROUTE_CACHE (1 << 0) +#define MULTI_ROUTE_AGEABLE (1 << 1)unsigned int flags;unsigned int cache_generation;
@@ -282,10 +282,10 @@ bool multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags*/ void multi_process_float (struct multi_context *m,struct multi_instance *mi); -#define MPP_PRE_SELECT (1<<0) -#define MPP_CONDITIONAL_PRE_SELECT (1<<1) -#define MPP_CLOSE_ON_SIGNAL (1<<2) -#define MPP_RECORD_TOUCH (1<<3) +#define MPP_PRE_SELECT (1 << 0) +#define MPP_CONDITIONAL_PRE_SELECT (1 << 1) +#define MPP_CLOSE_ON_SIGNAL (1 << 2) +#define MPP_RECORD_TOUCH (1 << 3)/**************************************************************************/
@@ -667,8 +667,8 @@ multi_process_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags }#define CLIENT_CONNECT_OPT_MASK (OPT_P_INSTANCE | OPT_P_INHERIT \ - |OPT_P_PUSH | OPT_P_TIMER | OPT_P_CONFIG \ - |OPT_P_ECHO | OPT_P_COMP | OPT_P_SOCKFLAGS) + | OPT_P_PUSH | OPT_P_TIMER | OPT_P_CONFIG \ + | OPT_P_ECHO | OPT_P_COMP | OPT_P_SOCKFLAGS)static inline bool multi_process_outgoing_link_dowork (struct multi_context *m,struct multi_instance *mi,const unsigned int mpp_flags)
src/openvpn/ntlm.c +1 -1
@@ -312,7 +312,7 @@ ntlm_phase_3(const struct http_proxy_info *p, const char *phase_2,*/ const size_t hoff =0x14 ;unsigned long flags = buf2[hoff] | (buf2[hoff +1 ] <<8 ) - |(buf2[hoff +2 ] <<16 ) | (buf2[hoff +3 ] <<24 ); + | (buf2[hoff +2 ] <<16 ) | (buf2[hoff +3 ] <<24 );if ((flags &0x00800000 ) ==0x00800000 ) { tib_len = buf2[0x28 ];/* Get Target Information block size */
src/openvpn/openssl_compat.h +1 -1
@@ -211,7 +211,7 @@ X509_get0_pubkey(const X509 *x)* @return the X509 object stack */ static inline STACK_OF (X509_OBJECT) -*X509_STORE_get0_objects (X509_STORE *store) +*X509_STORE_get0_objects (X509_STORE * store) {return store ? store->objs :NULL ; }
src/openvpn/openvpn.h +3 -3
@@ -528,11 +528,11 @@ struct context*/ #define TLS_MODE (c) ((c)->c2.tls_multi != NULL) -#define PROTO_DUMP_FLAGS (check_debug_level(D_LINK_RW_VERBOSE) ? (PD_SHOW_DATA|PD_VERBOSE) : 0) +#define PROTO_DUMP_FLAGS (check_debug_level(D_LINK_RW_VERBOSE) ? (PD_SHOW_DATA | PD_VERBOSE) : 0)#define PROTO_DUMP (buf, gc) protocol_dump((buf), \ PROTO_DUMP_FLAGS \ - |(c->c2.tls_multi ? PD_TLS : 0) \ - |(c->options.tls_auth_file ? md_kt_size(c->c1.ks.key_type.digest) : 0), \ + | (c->c2.tls_multi ? PD_TLS : 0) \ + | (c->options.tls_auth_file ? md_kt_size(c->c1.ks.key_type.digest) : 0), \ gc)/* this represents "disabled peer-id" */
src/openvpn/options.c +99 -99
644 lines not on this page · raw message
src/openvpn/options.h +37 -37
92 lines not on this page · raw message
src/openvpn/perf.c +1 -1
@@ -290,7 +290,7 @@ perf_output_results(void)if (p->count >0.0 ) {const double mean = p->sum / p->count; -msg (M_INFO ,"%s n=%.0f mean=%.3f max=%.3f" , metric_names[i], p->count, mean*1000.0 , p->max*1000.0 ); +msg (M_INFO ,"%s n=%.0f mean=%.3f max=%.3f" , metric_names[i], p->count, mean *1000.0 , p->max *1000.0 ); } } }
src/openvpn/pkcs11.c +7 -7
@@ -63,7 +63,7 @@ void __mysleep(const unsigned long usec) {#if defined(_WIN32) -Sleep (usec/1000 ); +Sleep (usec /1000 );#else usleep (usec);#endif
@@ -173,7 +173,7 @@ _pkcs11_openvpn_log(va_list args ) { -char Buffer[10 *1024 ]; +char Buffer[10 *1024 ]; (void )global_data;
@@ -215,7 +215,7 @@ _pkcs11_openvpn_token_prompt( &token_resp,NULL ,"token-insertion-request" , -GET_USER_PASS_MANAGEMENT |GET_USER_PASS_NEED_OK |GET_USER_PASS_NOFATAL +GET_USER_PASS_MANAGEMENT |GET_USER_PASS_NEED_OK |GET_USER_PASS_NOFATAL ) ) {
@@ -257,7 +257,7 @@ _pkcs11_openvpn_pin_prompt( &token_pass,NULL , prompt, -GET_USER_PASS_MANAGEMENT |GET_USER_PASS_PASSWORD_ONLY |GET_USER_PASS_NOFATAL +GET_USER_PASS_MANAGEMENT |GET_USER_PASS_PASSWORD_ONLY |GET_USER_PASS_NOFATAL ) ) {
@@ -692,7 +692,7 @@ tls_ctx_use_pkcs11( &id_resp,NULL ,"pkcs11-id-request" , -GET_USER_PASS_MANAGEMENT |GET_USER_PASS_NEED_STR |GET_USER_PASS_NOFATAL +GET_USER_PASS_MANAGEMENT |GET_USER_PASS_NEED_STR |GET_USER_PASS_NOFATAL ) ) {
@@ -884,7 +884,7 @@ show_pkcs11_ids( } msg( - M_INFO|M_NOPREFIX|M_NOLF, + M_INFO | M_NOPREFIX | M_NOLF, ( "\n" "The following objects are available for use.\n"
@@ -969,7 +969,7 @@ show_pkcs11_ids( } msg( - M_INFO|M_NOPREFIX|M_NOLF, + M_INFO | M_NOPREFIX | M_NOLF, ( "\n" "Certificate\n"
src/openvpn/pkcs11_openssl.c +1 -1
@@ -45,7 +45,7 @@#ifdef HAVE_XKEY_PROVIDER static XKEY_EXTERNAL_SIGN_fn xkey_pkcs11h_sign; -#if PKCS11H_VERSION > ((1 <<16 ) | (27 <<8 ))/* version > 1.27 */ +#if PKCS11H_VERSION > ((1 <<16 ) | (27 <<8 ))/* version > 1.27 */ /* Table linking OpenSSL digest NID with CKM and CKG constants in PKCS#11 */ #define MD_TYPE (n) {NID_sha ## n, CKM_SHA ## n, CKG_MGF1_SHA ## n}
src/openvpn/platform.c +4 -4
@@ -348,11 +348,11 @@ platform_mlockall(bool print_msg) {msg (M_INFO ,"mlock: MEMLOCK limit: soft=%ld KB, hard=%ld KB" , ((long int ) rl.rlim_cur) /1024 , ((long int ) rl.rlim_max) /1024 ); -if (rl.rlim_cur <MIN_LOCKED_MEM_MB *1024 *1024 ) +if (rl.rlim_cur <MIN_LOCKED_MEM_MB *1024 *1024 ) {msg (M_INFO ,"mlock: RLIMIT_MEMLOCK < %d MB, increase limit" ,MIN_LOCKED_MEM_MB ); - rl.rlim_cur =MIN_LOCKED_MEM_MB *1024 *1024 ; + rl.rlim_cur =MIN_LOCKED_MEM_MB *1024 *1024 ;if (rl.rlim_max < rl.rlim_cur) { rl.rlim_max = rl.rlim_cur;
@@ -600,8 +600,8 @@ platform_gen_path(const char *directory, const char *filename, struct gc_arena *gc) {#ifdef _WIN32 -const int CC_PATH_RESERVED =CC_LESS_THAN |CC_GREATER_THAN |CC_COLON - |CC_DOUBLE_QUOTE |CC_SLASH |CC_BACKSLASH |CC_PIPE |CC_QUESTION_MARK |CC_ASTERISK ; +const int CC_PATH_RESERVED =CC_LESS_THAN |CC_GREATER_THAN |CC_COLON + |CC_DOUBLE_QUOTE |CC_SLASH |CC_BACKSLASH |CC_PIPE |CC_QUESTION_MARK |CC_ASTERISK ;#else const int CC_PATH_RESERVED =CC_SLASH ;#endif
src/openvpn/plugin.c +2 -2
@@ -47,7 +47,7 @@#include "win32.h" #include "memdbg.h" -#define PLUGIN_SYMBOL_REQUIRED (1<<0) +#define PLUGIN_SYMBOL_REQUIRED (1 << 0)/* used only for program aborts */ static struct plugin_common *static_plugin_common =NULL ;/* GLOBAL */
@@ -152,7 +152,7 @@ plugin_mask_string(const unsigned int type_mask, struct gc_arena *gc)static inline unsigned int plugin_supported_types (void ) { -return ((1 <<OPENVPN_PLUGIN_N ) -1 ); +return ((1 <<OPENVPN_PLUGIN_N ) -1 ); } struct plugin_option_list *
src/openvpn/pool.c +1 -1
@@ -560,7 +560,7 @@ ifconfig_pool_persist_init(const char *filename, int refresh_freq)if (refresh_freq >0 ) { ret->fixed = false; - ret->file =status_open (filename, refresh_freq,-1 ,NULL ,STATUS_OUTPUT_READ |STATUS_OUTPUT_WRITE ); + ret->file =status_open (filename, refresh_freq,-1 ,NULL ,STATUS_OUTPUT_READ |STATUS_OUTPUT_WRITE ); }else {
src/openvpn/proto.h +8 -8
@@ -184,14 +184,14 @@ struct openvpn_tcphdr {#define OPENVPN_TCPH_GET_DOFF (d) (((d) & 0xF0) >> 2)uint8_t doff_res; -#define OPENVPN_TCPH_FIN_MASK (1<<0) -#define OPENVPN_TCPH_SYN_MASK (1<<1) -#define OPENVPN_TCPH_RST_MASK (1<<2) -#define OPENVPN_TCPH_PSH_MASK (1<<3) -#define OPENVPN_TCPH_ACK_MASK (1<<4) -#define OPENVPN_TCPH_URG_MASK (1<<5) -#define OPENVPN_TCPH_ECE_MASK (1<<6) -#define OPENVPN_TCPH_CWR_MASK (1<<7) +#define OPENVPN_TCPH_FIN_MASK (1 << 0) +#define OPENVPN_TCPH_SYN_MASK (1 << 1) +#define OPENVPN_TCPH_RST_MASK (1 << 2) +#define OPENVPN_TCPH_PSH_MASK (1 << 3) +#define OPENVPN_TCPH_ACK_MASK (1 << 4) +#define OPENVPN_TCPH_URG_MASK (1 << 5) +#define OPENVPN_TCPH_ECE_MASK (1 << 6) +#define OPENVPN_TCPH_CWR_MASK (1 << 7)uint8_t flags;uint16_t window;
src/openvpn/ps.c +5 -5
@@ -243,7 +243,7 @@ port_share_sendmsg(const socket_descriptor_t sd, status =sendmsg (sd, &mesg,MSG_NOSIGNAL );if (status ==-1 ) { -msg (M_WARN |M_ERRNO ,"PORT SHARE: sendmsg failed -- unable to communicate with background process (%d,%d,%d,%d)" , +msg (M_WARN |M_ERRNO ,"PORT SHARE: sendmsg failed -- unable to communicate with background process (%d,%d,%d,%d)" , sd, sd_send, sd_null[0 ], sd_null[1 ] ); }
@@ -370,7 +370,7 @@ journal_add(const char *journal_dir, struct proxy_connection *pc, struct proxy_c }else { -msg (M_WARN |M_ERRNO ,"PORT SHARE: unable to write journal file in %s" , jfn); +msg (M_WARN |M_ERRNO ,"PORT SHARE: unable to write journal file in %s" , jfn);free (jfn); } }
@@ -429,7 +429,7 @@ proxy_entry_new(struct proxy_connection **list,/* connect to port share server */ if ((sd_server =socket (PF_INET ,SOCK_STREAM ,IPPROTO_TCP )) <0 ) { -msg (M_WARN |M_ERRNO ,"PORT SHARE PROXY: cannot create socket" ); +msg (M_WARN |M_ERRNO ,"PORT SHARE PROXY: cannot create socket" );return false; } status =openvpn_connect (sd_server, (const struct sockaddr *) &server_addr,5 ,NULL );
@@ -479,7 +479,7 @@ proxy_entry_new(struct proxy_connection **list,/* set initial i/o states */ proxy_connection_io_requeue (pc,EVENT_READ , es); -proxy_connection_io_requeue (cp,EVENT_READ |EVENT_WRITE , es); +proxy_connection_io_requeue (cp,EVENT_READ |EVENT_WRITE , es);return true; }
@@ -837,7 +837,7 @@ port_share_open(const char *host,* Get host's IP address */ - status =openvpn_getaddrinfo (GETADDR_RESOLVE |GETADDR_FATAL , + status =openvpn_getaddrinfo (GETADDR_RESOLVE |GETADDR_FATAL , host, port,0 ,NULL ,AF_INET , &ai);ASSERT (status ==0 ); hostaddr = *((struct sockaddr_in *) ai->ai_addr);
src/openvpn/push.c +2 -2
@@ -292,7 +292,7 @@ receive_auth_pending(struct context *c, const struct buffer *buffer)/* Cap the increase at the maximum time we are willing stay in the * pending authentication state */ -unsigned int max_timeout =max_uint (c->options.renegotiate_seconds/2 , +unsigned int max_timeout =max_uint (c->options.renegotiate_seconds /2 , c->options.handshake_window);/* try to parse parameter keywords, default to hand-winow timeout if the
@@ -386,7 +386,7 @@ send_auth_pending_messages(struct tls_multi *tls_multi, const char *extra,/* Calculate the maximum timeout and subtract the time we already waited */ -unsigned int max_timeout =max_uint (tls_multi->opt.renegotiate_seconds/2 , +unsigned int max_timeout =max_uint (tls_multi->opt.renegotiate_seconds /2 , tls_multi->opt.handshake_window); max_timeout = max_timeout - (now - ks->initial); timeout =min_uint (max_timeout, timeout);
src/openvpn/reliable.c +1 -1
@@ -128,7 +128,7 @@ reliable_ack_read_packet_id(struct buffer *buf, packet_id_type *pid) { *pid =ntohpid (net_pid);dmsg (D_REL_DEBUG ,"ACK read ID " packet_id_format" (buf->len=%d)" , - (packet_id_print_type)*pid, buf->len); + (packet_id_print_type) * pid, buf->len);return true; }
src/openvpn/route.c +11 -11
@@ -552,7 +552,7 @@ add_block_local_item(struct route_list *rl,const struct route_gateway_address *gateway, in_addr_t target) { - const int rgi_needed = (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED); + const int rgi_needed = (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED);if ((rl->rgi.flags & rgi_needed) == rgi_needed && rl->rgi.gateway.netmask <0xFFFFFFFF ) {
@@ -563,7 +563,7 @@ add_block_local_item(struct route_list *rl, ALLOC_OBJ_GC(r2, struct route_ipv4, &rl->gc);/* split a route into two smaller blocking routes, and direct them to target */ - l2 = ((~gateway->netmask) +1 )>>1 ; + l2 = ((~gateway->netmask) +1 ) >>1 ; r1->flags =RT_DEFINED ; r1->gateway = target; r1->network = gateway->addr & gateway->netmask;
@@ -581,7 +581,7 @@ add_block_local_item(struct route_list *rl,static void add_block_local (struct route_list *rl) { -const int rgi_needed = (RGI_ADDR_DEFINED |RGI_NETMASK_DEFINED ); +const int rgi_needed = (RGI_ADDR_DEFINED |RGI_NETMASK_DEFINED );if ((rl->flags &RG_BLOCK_LOCAL ) && (rl->rgi.flags & rgi_needed) == rgi_needed && (rl->spec.flags & RTSA_REMOTE_ENDPOINT)
@@ -867,8 +867,8 @@ init_route_ipv6_list(struct route_ipv6_list *rl6,/* add VPN server host route if needed */ if (need_remote_ipv6_route) { -if ( (rl6->rgi6.flags & (RGI_ADDR_DEFINED |RGI_IFACE_DEFINED ) ) == - (RGI_ADDR_DEFINED |RGI_IFACE_DEFINED ) ) +if ( (rl6->rgi6.flags & (RGI_ADDR_DEFINED |RGI_IFACE_DEFINED ) ) == + (RGI_ADDR_DEFINED |RGI_IFACE_DEFINED ) ) {struct route_ipv6 *r6; ALLOC_OBJ_CLEAR_GC(r6, struct route_ipv6, &rl6->gc);
@@ -931,7 +931,7 @@ del_route3(in_addr_t network, {struct route_ipv4 r;CLEAR (r); - r.flags =RT_DEFINED |RT_ADDED ; + r.flags =RT_DEFINED |RT_ADDED ; r.network = network; r.netmask = netmask; r.gateway = gateway;
@@ -1527,7 +1527,7 @@ local_route(in_addr_t network, const struct route_gateway_info *rgi) {/* set LR_MATCH on local host routes */ -const int rgi_needed = (RGI_ADDR_DEFINED |RGI_NETMASK_DEFINED |RGI_IFACE_DEFINED ); +const int rgi_needed = (RGI_ADDR_DEFINED |RGI_NETMASK_DEFINED |RGI_IFACE_DEFINED );if (rgi && (rgi->flags & rgi_needed) == rgi_needed && gateway == rgi->gateway.addr
@@ -2160,7 +2160,7 @@ delete_route(struct route_ipv4 *r,#endif int is_local_route; -if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED )) +if ((r->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED )) {return ; }
@@ -2346,7 +2346,7 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,#endif bool gateway_needed = false; -if ((r6->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED )) +if ((r6->flags & (RT_DEFINED |RT_ADDED )) != (RT_DEFINED |RT_ADDED )) {return ; }
@@ -2742,7 +2742,7 @@ get_default_gateway(struct route_gateway_info *rgi, openvpn_net_ctx_t *ctx)if (a_index !=TUN_ADAPTER_INDEX_INVALID ) { rgi->adapter_index = a_index; - rgi->flags |= (RGI_IFACE_DEFINED |RGI_NETMASK_DEFINED ); + rgi->flags |= (RGI_IFACE_DEFINED |RGI_NETMASK_DEFINED ); ai =get_adapter (adapters, a_index);if (ai) {
@@ -3727,7 +3727,7 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6, }if (write (sockfd, (char *)&m_rtmsg, l) <0 ) { -msg (M_WARN |M_ERRNO ,"GDG6: problem writing to routing socket" ); +msg (M_WARN |M_ERRNO ,"GDG6: problem writing to routing socket" ); goto done; }
src/openvpn/route.h +25 -25
86 lines not on this page · raw message
src/openvpn/run_command.h +3 -3
@@ -42,11 +42,11 @@ int script_security(void);void script_security_set (int level);/* openvpn_execve flags */ -#define S_SCRIPT (1<<0) -#define S_FATAL (1<<1) +#define S_SCRIPT (1 << 0) +#define S_FATAL (1 << 1)/** Instead of returning 1/0 for success/fail, * return exit code when between 0 and 255 and -1 otherwise */ -#define S_EXITCODE (1<<2) +#define S_EXITCODE (1 << 2)/* wrapper around the execve() call */ int openvpn_popen (const struct argv *a,const struct env_set *es);
src/openvpn/shaper.h +2 -2
@@ -132,10 +132,10 @@ shaper_wrote_bytes(struct shaper *s, int nbytes)/* compute delay in microseconds */ tv.tv_sec =0 ;#ifdef SHAPER_USE_FP - tv.tv_usec =min_int ((int )((double )max_int (nbytes,100 ) * s->factor), (SHAPER_MAX_TIMEOUT *1000000 )); + tv.tv_usec =min_int ((int )((double )max_int (nbytes,100 ) * s->factor), (SHAPER_MAX_TIMEOUT *1000000 ));#else tv.tv_usec = s->bytes_per_second - ?min_int (max_int (nbytes,100 ) * s->factor, (SHAPER_MAX_TIMEOUT *1000000 )) + ?min_int (max_int (nbytes,100 ) * s->factor, (SHAPER_MAX_TIMEOUT *1000000 )) :0 ;#endif
src/openvpn/socket.c +14 -14
@@ -332,9 +332,9 @@ do_preresolve(struct context *c)int i;struct connection_list *l = c->options.connection_list;const unsigned int preresolve_flags =GETADDR_RESOLVE - |GETADDR_UPDATE_MANAGEMENT_STATE - |GETADDR_MENTION_RESOLVE_RETRY - |GETADDR_FATAL ; + |GETADDR_UPDATE_MANAGEMENT_STATE + |GETADDR_MENTION_RESOLVE_RETRY + |GETADDR_FATAL ;for (i =0 ; i < l->len; ++i)
@@ -463,7 +463,7 @@ openvpn_getaddrinfo(unsigned int flags, msglevel |=M_MSG_VIRT_OUT ; } -if ((flags & (GETADDR_FATAL_ON_SIGNAL |GETADDR_WARN_ON_SIGNAL )) +if ((flags & (GETADDR_FATAL_ON_SIGNAL |GETADDR_WARN_ON_SIGNAL )) && !signal_received) { signal_received = &sigrec;
@@ -495,7 +495,7 @@ openvpn_getaddrinfo(unsigned int flags,const int fail_wait_interval =5 ;/* seconds */ /* Add +4 to cause integer division rounding up (1 + 4) = 5, (0+4)/5=0 */ int resolve_retries = (flags &GETADDR_TRY_ONCE ) ?1 : - ((resolve_retry_seconds +4 )/ fail_wait_interval); + ((resolve_retry_seconds +4 ) / fail_wait_interval);const char *fmt;int level =0 ;
@@ -670,11 +670,11 @@ openvpn_inet_aton(const char *dotted_quad, struct in_addr *addr) {if (a <256 && b <256 && c <256 && d <256 ) { - addr->s_addr =htonl (a<<24 | b<<16 | c<<8 | d); + addr->s_addr =htonl (a <<24 | b <<16 | c <<8 | d);return OIA_IP ;/* good dotted quad */ } } -if (string_class (dotted_quad,CC_DIGIT |CC_DOT ,0 )) +if (string_class (dotted_quad,CC_DIGIT |CC_DOT ,0 )) {return OIA_ERROR ;/* probably a badly formatted dotted quad */ }
@@ -762,7 +762,7 @@ dns_addr_safe(const char *addr)if (addr) {const size_t len =strlen (addr); -return len >0 && len <=255 &&string_class (addr,CC_ALNUM |CC_DASH |CC_DOT ,0 ); +return len >0 && len <=255 &&string_class (addr,CC_ALNUM |CC_DASH |CC_DOT ,0 ); }else {
@@ -1147,7 +1147,7 @@ create_socket(struct link_socket *sock, struct addrinfo *addr)msg (M_INFO ,"Using bind-dev %s" , sock->bind_dev);if (setsockopt (sock->sd,SOL_SOCKET ,SO_BINDTODEVICE , sock->bind_dev,strlen (sock->bind_dev) +1 ) !=0 ) { -msg (M_WARN |M_ERRNO ,"WARN: setsockopt SO_BINDTODEVICE=%s failed" , sock->bind_dev); +msg (M_WARN |M_ERRNO ,"WARN: setsockopt SO_BINDTODEVICE=%s failed" , sock->bind_dev); } }
@@ -1413,7 +1413,7 @@ socket_bind(socket_descriptor_t sd,msg (M_INFO ,"setsockopt(IPV6_V6ONLY=%d)" , v6only);if (setsockopt (sd,IPPROTO_IPV6 ,IPV6_V6ONLY , (void *) &v6only,sizeof (v6only))) { -msg (M_NONFATAL |M_ERRNO ,"Setting IPV6_V6ONLY=%d failed" , v6only); +msg (M_NONFATAL |M_ERRNO ,"Setting IPV6_V6ONLY=%d failed" , v6only); } }if (bind (sd, cur->ai_addr, cur->ai_addrlen))
@@ -1657,7 +1657,7 @@ resolve_bind_local(struct link_socket *sock, const sa_family_t af)if (!sock->info.lsa->bind_local) {int flags =GETADDR_RESOLVE |GETADDR_WARN_ON_SIGNAL - |GETADDR_FATAL |GETADDR_PASSIVE ; + |GETADDR_FATAL |GETADDR_PASSIVE ;int status;if (proto_is_dgram (sock->info.proto))
@@ -1703,7 +1703,7 @@ resolve_remote(struct link_socket *sock, {if (sock->remote_host) { -unsigned int flags =sf2gaf (GETADDR_RESOLVE |GETADDR_UPDATE_MANAGEMENT_STATE , sock->sockflags); +unsigned int flags =sf2gaf (GETADDR_RESOLVE |GETADDR_UPDATE_MANAGEMENT_STATE , sock->sockflags);int retry =0 ;int status =-1 ;struct addrinfo *ai;
@@ -2814,7 +2814,7 @@ print_sockaddr_ex(const struct sockaddr *sa,const char *print_link_socket_actual (const struct link_socket_actual *act,struct gc_arena *gc) { -return print_link_socket_actual_ex (act,":" ,PS_SHOW_PORT |PS_SHOW_PKTINFO , gc); +return print_link_socket_actual_ex (act,":" ,PS_SHOW_PORT |PS_SHOW_PKTINFO , gc); }#ifndef IF_NAMESIZE
@@ -2962,7 +2962,7 @@ add_in6_addr( struct in6_addr base, uint32_t add )* 8-bit and(!) 32-bit overruns nicely */ carry = ((h &0xff ) + (add &0xff )) >>8 ; - add = (add>>8 ) + carry; + add = (add >>8 ) + carry; }return base; }
src/openvpn/socket.h +28 -28
33 lines not on this page · raw message
tests/unit_tests/openvpn/test_auth_token.c +13 -13
Lines of this file are not shown. View the raw message.
tests/unit_tests/openvpn/test_provider.c +2 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.34.1
Part of the diff is not shown here. View the raw message.
Re: [Openvpn-devel] [PATCH 6/6] reformat for sp_arith=add
Quoted 1 line · Frank Lichtenheld
Signed-off-by Frank Lichtenheld <[email protected]...>
Looking a bit closer at the changes this one seems slightly broken.
Examples:
Quoted 4 lines
src/openvpn/misc.h +0
-0
[...]
Quoted 9 lines
src/openvpn/misc.h +1
-1@@ -217,7 +217,7 @@ prepend_dir(const char *dir, const char *path, struct gc_arena *gc);/* *INDENT-ON* */ #define MAC_PRINT_ARG (_mac) _mac[0], _mac[1], _mac[2], \ _mac[3], _mac[4], _mac[5] -#define MAC_SCAN_ARG (_mac) &_mac[0], &_mac[1], &_mac[2], \ +#define MAC_SCAN_ARG (_mac) & _mac[0], &_mac[1], &_mac[2], \ &_mac[3], &_mac[4], &_mac[5]#endif /* ifndef MISC_H */
[...]
src/openvpn/openssl_compat.h X509_get0_pubkey(const X509 *x) · line 217
Quoted 13 lines
src/openvpn/openssl_compat.h +1
-1@@ -211,7 +211,7 @@ X509_get0_pubkey(const X509 *x)* @return the X509 object stack */ static inline STACK_OF (X509_OBJECT) -*X509_STORE_get0_objects (X509_STORE *store) +*X509_STORE_get0_objects (X509_STORE * store) {return store ? store->objs :NULL ; }
So this seems to misinterpret '*' and '&' after ')'. This doesn't break compilation but is really ugly and confusing.
So NAKing my own patch ;)
Regards,
Frank
Re: [Openvpn-devel] [PATCH 6/6] reformat for sp_arith=add
Quoted 4 lines · Frank Lichtenheld
So this seems to misinterpret '*' and '&' after ')'. This doesn't break compilation but is really ugly and confusing.
So NAKing my own patch ;)
This seems to be a bug in uncrustify :-(
Basically it thinks that & and * are arithmetic operators in some contexts and so it adds spaces around them. darn.
What version are you using?
Cheers,
Signature · 1 line
Antonio Quartulli
Re: [Openvpn-devel] [PATCH 6/6] reformat for sp_arith=add
Quoted 4 lines · Antonio Quartulli
Quoted 3 lines · Frank Lichtenheld
So this seems to misinterpret '*' and '&' after ')'. This doesn't break compilation but is really ugly and confusing.
Quoted 8 lines
Quoted 1 line
So NAKing my own patch ;)
This seems to be a bug in uncrustify :-(
Basically it thinks that & and * are arithmetic operators in some contexts and so it adds spaces around them. darn.
What version are you using?
Uncrustify-0.72.0_f from Ubuntu 22.04
Signature · 1 line
Frank Lichtenheld