From: "flichtenheld (Code Review)" Date: Fri, 8 May 2026 11:26:56 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="eNyCIsd9vXA="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: Remove instances of constParameterPointer cppcheck warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --eNyCIsd9vXA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1663?usp=3Demail to look at the new patch set (#3). Change subject: Remove instances of constParameterPointer cppcheck warnings ...................................................................... Remove instances of constParameterPointer cppcheck warnings This requires a few suppressions since cppcheck doesn't quite understand the different code-paths implemented by preprocessor defines. Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58 Signed-off-by: Frank Lichtenheld --- M dev-tools/cppcheck-suppression M sample/sample-plugins/client-connect/sample-client-connect.c M sample/sample-plugins/defer/multi-auth.c M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporte= r.c M src/openvpn/buffer.c M src/openvpn/buffer.h M src/openvpn/clinat.c M src/openvpn/clinat.h M src/openvpn/comp.c M src/openvpn/comp.h M src/openvpn/crypto.c M src/openvpn/crypto.h M src/openvpn/dco.c M src/openvpn/dco.h M src/openvpn/dco_freebsd.c M src/openvpn/dco_internal.h M src/openvpn/dco_linux.c M src/openvpn/dco_win.c M src/openvpn/dhcp.c M src/openvpn/dhcp.h M src/openvpn/event.h M src/openvpn/forward.c M src/openvpn/forward.h M src/openvpn/init.c M src/openvpn/init.h M src/openvpn/interval.h M src/openvpn/list.c M src/openvpn/list.h M src/openvpn/manage.c M src/openvpn/manage.h M src/openvpn/mbuf.c M src/openvpn/mbuf.h M src/openvpn/mss.c M src/openvpn/mss.h M src/openvpn/mtcp.c M src/openvpn/mtcp.h M src/openvpn/mudp.c M src/openvpn/multi.c M src/openvpn/multi.h M src/openvpn/networking.h M src/openvpn/networking_iproute2.c M src/openvpn/networking_sitnl.c M src/openvpn/occ.h M src/openvpn/openssl_compat.h M src/openvpn/options.c M src/openvpn/options_parse.c M src/openvpn/otime.c M src/openvpn/otime.h M src/openvpn/proto.h M src/openvpn/proxy.c M src/openvpn/proxy.h M src/openvpn/ps.c M src/openvpn/ps.h M src/openvpn/push.c M src/openvpn/push.h M src/openvpn/push_util.c M src/openvpn/reliable.c M src/openvpn/reliable.h M src/openvpn/route.c M src/openvpn/schedule.c M src/openvpn/socket.c M src/openvpn/socket.h M src/openvpn/socket_util.h M src/openvpn/socks.c M src/openvpn/socks.h M src/openvpn/ssl.c M src/openvpn/ssl.h M src/openvpn/ssl_backend.h M src/openvpn/ssl_mbedtls.c M src/openvpn/ssl_openssl.c M src/openvpn/ssl_pkt.c M src/openvpn/ssl_pkt.h M src/openvpn/ssl_verify.c M src/openvpn/ssl_verify.h M src/openvpn/status.c M src/openvpn/status.h M src/openvpn/tun.c M src/openvpn/tun.h M src/openvpn/tun_afunix.c M src/openvpn/tun_afunix.h M src/openvpn/vlan.c M src/openvpn/vlan.h M src/openvpn/win32.h M src/openvpnmsica/openvpnmsica.c M src/openvpnserv/interactive.c M tests/unit_tests/openvpn/mock_management.c M tests/unit_tests/openvpn/test_misc.c M tests/unit_tests/openvpn/test_user_pass.c 88 files changed, 322 insertions(+), 281 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1663/3 diff --git a/dev-tools/cppcheck-suppression b/dev-tools/cppcheck-suppression index 900e03c..e392f8f 100644 --- a/dev-tools/cppcheck-suppression +++ b/dev-tools/cppcheck-suppression @@ -2,7 +2,6 @@ # occurences right now. They still should be fixed at some point constParameter constParameterCallback -constParameterPointer invalidPrintfArgType_sint invalidPrintfArgType_uint usleepCalled @@ -33,6 +32,38 @@ badBitmaskCheck:tests/unit_tests/openvpn/test_pkt.c # IGN: we store integers in pointers CastAddressToIntegerAtReturn:src/openvpn/multi.c +constParameterPointer:/usr/include/* +# IGN: test files provide mocks/stubs that match prototypes from headers e= xactly +constParameterPointer:tests/unit_tests/openvpn/mock_* +constParameterPointer:tests/unit_tests/openvpn/test_* +constParameterPointer:tests/unit_tests/openvpnserv/test_* +# FP: different crypto implementations but same API +constParameterPointer:src/openvpn/crypto_mbedtls_legacy.c:85 +constParameterPointer:src/openvpn/crypto_openssl.c:172 +constParameterPointer:src/openvpn/crypto_openssl.c:1456 +constParameterPointer:src/openvpn/cryptoapi.c:58 +constParameterPointer:src/openvpn/ssl_mbedtls.c +constParameterPointer:src/openvpn/ssl_openssl.c +constParameterPointer:src/openvpn/ssl_verify_mbedtls.c +# IGN: too many different implementations, not worth it +constParameterPointer:src/openvpn/dco* +# FP: parameters are modified on some platform only +constParameterPointer:src/openvpn/dns.c:859 +constParameterPointer:src/openvpn/error.c:223 +constParameterPointer:src/openvpn/manage.c:344 +constParameterPointer:src/openvpn/manage.c:3332 +constParameterPointer:src/openvpn/misc.c:792 +constParameterPointer:src/openvpn/misc.c:812 +constParameterPointer:src/openvpn/options.c:3205 +constParameterPointer:src/openvpn/route.c:3947 +constParameterPointer:src/openvpn/socket.c:2244 +constParameterPointer:src/openvpn/socket.h:726 +constParameterPointer:src/openvpn/socket.h:825 +constParameterPointer:src/openvpn/tun.c:560 +constParameterPointer:src/openvpn/tun.c:2188 +constParameterPointer:src/openvpn/tun_afunix.c +# FP: local is modified via cast inside function +constParameterPointer:src/openvpn/dco.c:560 # IGN: event code uses a pointer to store integers intToPointerCast:src/openvpn/forward.c intToPointerCast:src/openvpn/multi_io.c diff --git a/sample/sample-plugins/client-connect/sample-client-connect.c b= /sample/sample-plugins/client-connect/sample-client-connect.c index 420de61..cbd98e8 100644 --- a/sample/sample-plugins/client-connect/sample-client-connect.c +++ b/sample/sample-plugins/client-connect/sample-client-connect.c @@ -344,7 +344,7 @@ } int -openvpn_plugin_client_connect(struct plugin_context *context, const char *= *argv, const char **envp) +openvpn_plugin_client_connect(const struct plugin_context *context, const = char **argv, const char **envp) { /* log environment variables handed to us by OpenVPN, but * only if "setenv verb" is 3 or higher (arbitrary number) @@ -465,7 +465,7 @@ int openvpn_plugin_client_connect_defer_v2(struct plugin_context *context, - struct plugin_per_client_context *p= cc, + const struct plugin_per_client_cont= ext *pcc, struct openvpn_plugin_string_list *= *return_list) { time_t time_left =3D pcc->sleep_until - time(NULL); diff --git a/sample/sample-plugins/defer/multi-auth.c b/sample/sample-plugi= ns/defer/multi-auth.c index bacf557..cdd616f 100644 --- a/sample/sample-plugins/defer/multi-auth.c +++ b/sample/sample-plugins/defer/multi-auth.c @@ -255,7 +255,7 @@ } static bool -do_auth_user_pass(struct plugin_context *context, const char *username, co= nst char *password) +do_auth_user_pass(const struct plugin_context *context, const char *userna= me, const char *password) { plog(context, PLOG_NOTE, "expect_user=3D%s, received_user=3D%s, expect= _passw=3D%s, received_passw=3D%s", np(context->test_valid_user), np(username), np(context->test_vali= d_pass), np(password)); @@ -279,7 +279,7 @@ static int -auth_user_pass_verify(struct plugin_context *context, struct plugin_per_cl= ient_context *pcc, +auth_user_pass_verify(const struct plugin_context *context, struct plugin_= per_client_context *pcc, const char *argv[], const char *envp[]) { /* get username/password from envp string array */ diff --git a/sample/sample-plugins/keying-material-exporter-demo/keyingmate= rialexporter.c b/sample/sample-plugins/keying-material-exporter-demo/keying= materialexporter.c index 25c9ff5..512861a 100644 --- a/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexp= orter.c +++ b/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexp= orter.c @@ -186,7 +186,7 @@ } static void -file_store(char *file, char *content) +file_store(const char *file, const char *content) { FILE *f; if (!(f =3D fopen(file, "w+"))) @@ -202,7 +202,7 @@ server_store(struct openvpn_plugin_args_func_in const *args) { struct plugin *plugin =3D (struct plugin *)args->handle; - struct session *sess =3D (struct session *)args->per_client_context; + const struct session *sess =3D (struct session *)args->per_client_cont= ext; char file[MAXPATH]; snprintf(file, sizeof(file) - 1, "/tmp/openvpn_sso_%s", sess->key); @@ -214,7 +214,7 @@ client_store(struct openvpn_plugin_args_func_in const *args) { struct plugin *plugin =3D (struct plugin *)args->handle; - struct session *sess =3D (struct session *)args->per_client_context; + const struct session *sess =3D (struct session *)args->per_client_cont= ext; char *file =3D "/tmp/openvpn_sso_user"; ovpn_note("app session file: %s", file); diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 131e1d6..f9990d6 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -290,7 +290,7 @@ * truncated by buf_printf */ void -buf_catrunc(struct buffer *buf, const char *str) +buf_catrunc(const struct buffer *buf, const char *str) { if (buf_forward_capacity(buf) <=3D 1) { @@ -1091,7 +1091,7 @@ } bool -string_check_buf(struct buffer *buf, const unsigned int inclusive, const u= nsigned int exclusive) +string_check_buf(const struct buffer *buf, const unsigned int inclusive, c= onst unsigned int exclusive) { ASSERT(buf); diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index 6a751ad..0d3b202 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -487,7 +487,7 @@ * write a string to the end of a buffer that was * truncated by buf_printf */ -void buf_catrunc(struct buffer *buf, const char *str); +void buf_catrunc(const struct buffer *buf, const char *str); /* * Parse a string based on a given delimiter char @@ -774,7 +774,7 @@ } static inline int -buf_peek_u8(struct buffer *buf) +buf_peek_u8(const struct buffer *buf) { int ret; if (BLEN(buf) < 1) @@ -923,7 +923,7 @@ * @param exclusive Character classes that are not allowed even if they ar= e also in inclusive. * @return True if the string consists only of allowed characters, false o= therwise. */ -bool string_check_buf(struct buffer *buf, const unsigned int inclusive, +bool string_check_buf(const struct buffer *buf, const unsigned int inclusi= ve, const unsigned int exclusive); /** @@ -1102,7 +1102,7 @@ } static inline void -check_malloc_return(void *p) +check_malloc_return(const void *p) { if (!p) { diff --git a/src/openvpn/clinat.c b/src/openvpn/clinat.c index 32c1325..b465950 100644 --- a/src/openvpn/clinat.c +++ b/src/openvpn/clinat.c @@ -159,7 +159,7 @@ #endif static void -print_pkt(struct openvpn_iphdr *iph, const char *prefix, const int directi= on, const msglvl_t msglevel) +print_pkt(const struct openvpn_iphdr *iph, const char *prefix, const int d= irection, const msglvl_t msglevel) { struct gc_arena gc =3D gc_new(); @@ -181,7 +181,7 @@ } void -client_nat_transform(const struct client_nat_option_list *list, struct buf= fer *ipbuf, +client_nat_transform(const struct client_nat_option_list *list, const stru= ct buffer *ipbuf, const int direction) { struct ip_tcp_udp_hdr *h =3D (struct ip_tcp_udp_hdr *)BPTR(ipbuf); diff --git a/src/openvpn/clinat.h b/src/openvpn/clinat.h index 1e8ceb3..bc56037 100644 --- a/src/openvpn/clinat.h +++ b/src/openvpn/clinat.h @@ -60,7 +60,7 @@ const char *network, const char *netmas= k, const char *foreign_network, msglvl_t m= sglevel); -void client_nat_transform(const struct client_nat_option_list *list, struc= t buffer *ipbuf, +void client_nat_transform(const struct client_nat_option_list *list, const= struct buffer *ipbuf, const int direction); #endif /* if !defined(CLINAT_H) */ diff --git a/src/openvpn/comp.c b/src/openvpn/comp.c index b88b79f..387a7c4 100644 --- a/src/openvpn/comp.c +++ b/src/openvpn/comp.c @@ -159,7 +159,7 @@ #endif /* USE_COMP */ bool -check_compression_settings_valid(struct compress_options *info, msglvl_t m= sglevel) +check_compression_settings_valid(const struct compress_options *info, msgl= vl_t msglevel) { /* * We also allow comp-stub-v2 here as it technically allows escaping of diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index 29a90a2..ad80243 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -91,7 +91,7 @@ * flags of allow-compression and also the whether algorithms are compiled * in */ -bool check_compression_settings_valid(struct compress_options *info, msglv= l_t msglevel); +bool check_compression_settings_valid(const struct compress_options *info,= msglvl_t msglevel); #ifdef USE_COMP #include "buffer.h" diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index a9a33c0..e04eedf 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -1105,7 +1105,7 @@ } static bool -key_is_zero(struct key *key, const struct key_type *kt) +key_is_zero(const struct key *key, const struct key_type *kt) { size_t cipher_length =3D cipher_kt_key_size(kt->cipher); for (size_t i =3D 0; i < cipher_length; ++i) @@ -1123,7 +1123,7 @@ * Make sure that cipher key is a valid key for current key_type. */ bool -check_key(struct key *key, const struct key_type *kt) +check_key(const struct key *key, const struct key_type *kt) { if (cipher_defined(kt->cipher)) { @@ -1196,7 +1196,7 @@ } void -test_crypto(struct crypto_options *co, struct frame *frame) +test_crypto(struct crypto_options *co, const struct frame *frame) { int i, j; struct gc_arena gc =3D gc_new(); diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index fbca2a0..044f2d2 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -414,7 +414,7 @@ */ int write_key_file(const int nkeys, const char *filename); -bool check_key(struct key *key, const struct key_type *kt); +bool check_key(const struct key *key, const struct key_type *kt); /** * Initialize a key_type structure with. @@ -609,7 +609,7 @@ /** Print a cipher list entry */ void print_cipher(const char *cipher); -void test_crypto(struct crypto_options *co, struct frame *f); +void test_crypto(struct crypto_options *co, const struct frame *f); /* key direction functions */ diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 69ce1d7..f509a29 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -556,7 +556,7 @@ } static bool -dco_multi_get_localaddr(struct multi_context *m, struct multi_instance *mi, +dco_multi_get_localaddr(const struct multi_context *m, const struct multi_= instance *mi, struct sockaddr_storage *local) { #if ENABLE_IP_PKTINFO @@ -568,7 +568,7 @@ return false; } - struct link_socket_actual *actual =3D &c->c2.link_socket_infos[0]->lsa= ->actual; + const struct link_socket_actual *actual =3D &c->c2.link_socket_infos[0= ]->lsa->actual; switch (actual->dest.addr.sa.sa_family) { @@ -606,7 +606,7 @@ } int -dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi) +dco_multi_add_new_peer(const struct multi_context *m, struct multi_instanc= e *mi) { const struct context *c =3D &mi->context; @@ -660,7 +660,7 @@ } void -dco_install_iroute(struct multi_context *m, struct multi_instance *mi, str= uct mroute_addr *addr) +dco_install_iroute(struct multi_context *m, struct multi_instance *mi, con= st struct mroute_addr *addr) { #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(_WIN32) if (!dco_enabled(&m->top.options)) @@ -779,7 +779,7 @@ /* Checked if we added a host route as the assigned client IP addr= ess was * outside the --ifconfig-ipv6 tun interface config */ #if !defined(_WIN32) - struct in6_addr *dest =3D &mi->context.c2.push_ifconfig_ipv6_local; + const struct in6_addr *dest =3D &mi->context.c2.push_ifconfig_ipv6= _local; if (multi_check_push_ifconfig_ipv6_extra_route(mi, dest)) { /* On windows we do not install these routes, so we also do no= t need to delete them */ diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h index 4e5aad5..694875c 100644 --- a/src/openvpn/dco.h +++ b/src/openvpn/dco.h @@ -204,7 +204,7 @@ * @param mi the client instance * @return 0 on success or a negative error code otherwise */ -int dco_multi_add_new_peer(struct multi_context *m, struct multi_instance = *mi); +int dco_multi_add_new_peer(const struct multi_context *m, struct multi_ins= tance *mi); /** * Install an iroute in DCO, which means adding a route to the system rout= ing @@ -215,7 +215,7 @@ * @param addr the route to add */ void dco_install_iroute(struct multi_context *m, struct multi_instance *mi, - struct mroute_addr *addr); + const struct mroute_addr *addr); /** * Remove all routes added through the specified client @@ -253,7 +253,7 @@ * a 64 bit packet counter and AEAD tag at the end. */ bool -dco_supports_epoch_data(struct context *c); +dco_supports_epoch_data(const struct context *c); #else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t; @@ -350,7 +350,7 @@ } static inline int -dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi) +dco_multi_add_new_peer(const struct multi_context *m, struct multi_instanc= e *mi) { return 0; } @@ -384,7 +384,7 @@ } static inline bool -dco_supports_epoch_data(struct context *c) +dco_supports_epoch_data(const struct context *c) { return false; } diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index d933aaf..7346903 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -930,7 +930,7 @@ } bool -dco_supports_epoch_data(struct context *c) +dco_supports_epoch_data(const struct context *c) { return false; } diff --git a/src/openvpn/dco_internal.h b/src/openvpn/dco_internal.h index fcf8aca..1022e66 100644 --- a/src/openvpn/dco_internal.h +++ b/src/openvpn/dco_internal.h @@ -59,8 +59,9 @@ * They are implemented by dco_linux.c */ -int dco_new_peer(dco_context_t *dco, unsigned int peerid, socket_descripto= r_t sd, struct sockaddr *localaddr, - struct sockaddr *remoteaddr, const struct in_addr *vpn_ip= v4, const struct in6_addr *vpn_ipv6); +int dco_new_peer(dco_context_t *dco, unsigned int peerid, socket_descripto= r_t sd, + struct sockaddr *localaddr, struct sockaddr *remoteaddr, + const struct in_addr *vpn_ipv4, const struct in6_addr *vp= n_ipv6); int dco_del_peer(dco_context_t *dco, unsigned int peerid); diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 56f6259..31bbe87 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -114,7 +114,7 @@ } static struct nl_msg * -ovpn_dco_nlmsg_create(dco_context_t *dco, uint8_t cmd) +ovpn_dco_nlmsg_create(const dco_context_t *dco, uint8_t cmd) { struct nl_msg *nl_msg =3D nlmsg_alloc(); if (!nl_msg) @@ -804,7 +804,7 @@ /* libnl < 3.11.0 does not implement nla_get_uint() */ static uint64_t -ovpn_nla_get_uint(struct nlattr *attr) +ovpn_nla_get_uint(const struct nlattr *attr) { if (nla_len(attr) =3D=3D sizeof(uint32_t)) { @@ -916,7 +916,7 @@ } static bool -ovpn_iface_check(dco_context_t *dco, struct nlattr *attrs[]) +ovpn_iface_check(const dco_context_t *dco, struct nlattr *attrs[]) { /* we must know which interface this message is referring to in order = to * avoid mixing messages for other instances @@ -1340,7 +1340,7 @@ } bool -dco_supports_epoch_data(struct context *c) +dco_supports_epoch_data(const struct context *c) { return false; } diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c index b3268bc..8deb9d8 100644 --- a/src/openvpn/dco_win.c +++ b/src/openvpn/dco_win.c @@ -1100,7 +1100,7 @@ } bool -dco_supports_epoch_data(struct context *c) +dco_supports_epoch_data(const struct context *c) { OVPN_VERSION ver =3D { 0 }; return dco_get_version(&ver) && ((ver.Major =3D=3D 2 && ver.Minor >=3D= 8) || (ver.Major > 2)); diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.c index a54ab3f..68173e6 100644 --- a/src/openvpn/dhcp.c +++ b/src/openvpn/dhcp.c @@ -145,7 +145,7 @@ } in_addr_t -dhcp_extract_router_msg(struct buffer *ipbuf) +dhcp_extract_router_msg(const struct buffer *ipbuf) { struct dhcp_full *df =3D (struct dhcp_full *)BPTR(ipbuf); const int optlen =3D diff --git a/src/openvpn/dhcp.h b/src/openvpn/dhcp.h index 38ebf8d..ed8a0c9 100644 --- a/src/openvpn/dhcp.h +++ b/src/openvpn/dhcp.h @@ -91,7 +91,7 @@ #pragma pack() -in_addr_t dhcp_extract_router_msg(struct buffer *ipbuf); +in_addr_t dhcp_extract_router_msg(const struct buffer *ipbuf); #if defined(_WIN32) || defined(DHCP_UNIT_TEST) #include "tun.h" diff --git a/src/openvpn/event.h b/src/openvpn/event.h index b784dfe..0940a1d 100644 --- a/src/openvpn/event.h +++ b/src/openvpn/event.h @@ -204,7 +204,7 @@ #else /* ifdef _WIN32 */ static inline void -wait_signal(struct event_set *es, void *arg) +wait_signal(const struct event_set *es, const void *arg) { } diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 887d7d7..1d76859 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -231,7 +231,7 @@ } static void -parse_incoming_control_channel_command(struct context *c, struct buffer *b= uf) +parse_incoming_control_channel_command(struct context *c, const struct buf= fer *buf) { if (buf_string_match_head_str(buf, "AUTH_FAILED")) { @@ -501,7 +501,7 @@ } int -get_server_poll_remaining_time(struct event_timeout *server_poll_timeout) +get_server_poll_remaining_time(const struct event_timeout *server_poll_tim= eout) { update_time(); int remaining =3D event_timeout_remaining(server_poll_timeout); @@ -598,7 +598,7 @@ * Buffer reallocation, for use with null encryption. */ static inline void -buffer_turnover(const uint8_t *orig_buf, struct buffer *dest_stub, struct = buffer *src_stub, +buffer_turnover(const uint8_t *orig_buf, struct buffer *dest_stub, const s= truct buffer *src_stub, struct buffer *storage) { if (orig_buf =3D=3D src_stub->data && src_stub->data !=3D storage->dat= a) @@ -885,7 +885,7 @@ */ static inline void -socks_postprocess_incoming_link(struct context *c, struct link_socket *soc= k) +socks_postprocess_incoming_link(struct context *c, const struct link_socke= t *sock) { if (sock->socks_proxy && sock->info.proto =3D=3D PROTO_UDP) { @@ -984,7 +984,7 @@ } bool -process_incoming_link_part1(struct context *c, struct link_socket_info *ls= i, bool floated) +process_incoming_link_part1(struct context *c, const struct link_socket_in= fo *lsi, bool floated) { struct gc_arena gc =3D gc_new(); bool decrypt_status =3D false; @@ -1534,7 +1534,7 @@ * @param client Determines whether to the send packet back via tun or = link */ void -ipv6_send_icmp_unreachable(struct context *c, struct buffer *buf, bool cli= ent) +ipv6_send_icmp_unreachable(struct context *c, const struct buffer *buf, bo= ol client) { #define MAX_ICMPV6LEN 1280 struct openvpn_icmp6hdr icmp6out; diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index 0d3e492..d8e07fa 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -112,7 +112,7 @@ */ void encrypt_sign(struct context *c, bool comp_frag); -int get_server_poll_remaining_time(struct event_timeout *server_poll_timeo= ut); +int get_server_poll_remaining_time(const struct event_timeout *server_poll= _timeout); /**********************************************************************/ /** @@ -163,7 +163,7 @@ * * @return true if packet is authenticated, false otherwise. */ -bool process_incoming_link_part1(struct context *c, struct link_socket_inf= o *lsi, bool floated); +bool process_incoming_link_part1(struct context *c, const struct link_sock= et_info *lsi, bool floated); /** * Continues processing a packet read from the external network interface. diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 0861cb5..41fa557 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -817,7 +817,7 @@ } static void -init_port_share(struct context *c) +init_port_share(const struct context *c) { if (!port_share && (c->options.port_share_host && c->options.port_shar= e_port)) { @@ -1269,7 +1269,7 @@ * prepending to msg() output. */ const char * -format_common_name(struct context *c, struct gc_arena *gc) +format_common_name(const struct context *c, struct gc_arena *gc) { struct buffer out =3D alloc_buf_gc(256, gc); if (c->c2.tls_multi) @@ -1755,7 +1755,7 @@ static bool -can_preserve_tun(struct tuntap *tt) +can_preserve_tun(const struct tuntap *tt) { if (tt && tt->backend_driver =3D=3D DRIVER_AFUNIX) { @@ -1777,7 +1777,7 @@ * @param c pointer to the connection context */ static void -add_wfp_block(struct context *c) +add_wfp_block(const struct context *c) { #if defined(_WIN32) /* Fortify 'redirect-gateway block-local' with firewall rules? */ @@ -1803,7 +1803,7 @@ * @param adapter_index the VPN adapter index */ static void -del_wfp_block(struct context *c, unsigned long adapter_index) +del_wfp_block(const struct context *c, unsigned long adapter_index) { #if defined(_WIN32) if (c->options.block_outside_dns || block_local_needed(c->c1.route_lis= t)) diff --git a/src/openvpn/init.h b/src/openvpn/init.h index 9d5050d..af4393c 100644 --- a/src/openvpn/init.h +++ b/src/openvpn/init.h @@ -91,7 +91,7 @@ unsigned int pull_permission_mask(const struct context *c); -const char *format_common_name(struct context *c, struct gc_arena *gc); +const char *format_common_name(const struct context *c, struct gc_arena *g= c); void reset_coarse_timers(struct context *c); diff --git a/src/openvpn/interval.h b/src/openvpn/interval.h index 59051bd..0cfe202 100644 --- a/src/openvpn/interval.h +++ b/src/openvpn/interval.h @@ -89,7 +89,7 @@ } static inline void -interval_schedule_wakeup(struct interval *top, interval_t *wakeup) +interval_schedule_wakeup(const struct interval *top, interval_t *wakeup) { const time_t local_now =3D now; interval_earliest_wakeup(wakeup, top->last_test_true + top->refresh, l= ocal_now); @@ -214,7 +214,7 @@ * This function does not check if the timeout is actually valid. */ static inline interval_t -event_timeout_remaining(struct event_timeout *et) +event_timeout_remaining(const struct event_timeout *et) { return (interval_t)((et->last + et->n) - now); } diff --git a/src/openvpn/list.c b/src/openvpn/list.c index 2e1cf05..c04ee4f 100644 --- a/src/openvpn/list.c +++ b/src/openvpn/list.c @@ -162,7 +162,7 @@ } void -hash_remove_by_value(struct hash *hash, void *value) +hash_remove_by_value(struct hash *hash, const void *value) { struct hash_iterator hi; const struct hash_element *he; diff --git a/src/openvpn/list.h b/src/openvpn/list.h index 04cc3ab..089637d 100644 --- a/src/openvpn/list.h +++ b/src/openvpn/list.h @@ -73,7 +73,7 @@ bool hash_remove_fast(struct hash *hash, struct hash_bucket *bucket, const= void *key, uint32_t hv); -void hash_remove_by_value(struct hash *hash, void *value); +void hash_remove_by_value(struct hash *hash, const void *value); struct hash_iterator { diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 604bbcd..17abfd8 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -330,7 +330,7 @@ } static void -man_delete_unix_socket(struct management *man) +man_delete_unix_socket(const struct management *man) { #if UNIX_SOCK_SUPPORT if ((man->settings.flags & (MF_UNIX_SOCK | MF_CONNECT_AS_CLIENT)) =3D= =3D MF_UNIX_SOCK) @@ -675,7 +675,7 @@ * for the log and echo commands. */ static void -man_history(struct management *man, const char *parm, const char *type, st= ruct log_history *log, +man_history(struct management *man, const char *parm, const char *type, co= nst struct log_history *log, bool *realtime, const unsigned int lep_flags) { struct gc_arena gc =3D gc_new(); @@ -843,7 +843,7 @@ } static void -man_forget_passwords(struct management *man) +man_forget_passwords(const struct management *man) { ssl_purge_auth(false); (void)ssl_clean_auth_token(); @@ -851,7 +851,7 @@ } static void -man_net(struct management *man) +man_net(const struct management *man) { if (man->persist.callback.show_net) { @@ -887,7 +887,7 @@ #ifdef ENABLE_PKCS11 static void -man_pkcs11_id_count(struct management *man) +man_pkcs11_id_count(const struct management *man) { msg(M_CLIENT, ">PKCS11ID-COUNT:%d", pkcs11_management_id_count()); } @@ -1350,7 +1350,7 @@ * @return Return whether p has n (or at least n) parameters */ static bool -man_need(struct management *man, const char **p, const int n, unsigned int= flags) +man_need(const struct management *man, const char **p, const int n, unsign= ed int flags) { int i; ASSERT(p[0]); @@ -2365,7 +2365,7 @@ * the route/ifconfig/open tun command. See doc/android.txt for details. */ bool -management_android_control(struct management *man, const char *command, co= nst char *msg) +management_android_control(const struct management *man, const char *comma= nd, const char *msg) { if (!man) { @@ -3013,7 +3013,7 @@ } void -management_up_down(struct management *man, const char *updown, const struc= t env_set *es) +management_up_down(const struct management *man, const char *updown, const= struct env_set *es) { if (man->settings.flags & MF_UP_DOWN) { @@ -3023,13 +3023,13 @@ } void -management_notify(struct management *man, const char *severity, const char= *type, const char *text) +management_notify(const struct management *man, const char *severity, cons= t char *type, const char *text) { msg(M_CLIENT, ">NOTIFY:%s,%s,%s", severity, type, text); } =20 void -management_notify_generic(struct management *man, const char *str) +management_notify_generic(const struct management *man, const char *str) { msg(M_CLIENT, "%s", str); } @@ -3115,7 +3115,8 @@ } void -management_notify_client_close(struct management *management, struct man_d= ef_auth_context *mdac, +management_notify_client_close(const struct management *management, + struct man_def_auth_context *mdac, const struct env_set *es) { if ((mdac->flags & DAF_INITIAL_AUTH) && !(mdac->flags & DAF_CONNECTION= _CLOSED)) @@ -3206,7 +3207,7 @@ } void -management_auth_failure(struct management *man, const char *type, const ch= ar *reason) +management_auth_failure(const struct management *man, const char *type, co= nst char *reason) { if (reason) { @@ -3219,7 +3220,7 @@ } void -management_auth_token(struct management *man, const char *token) +management_auth_token(const struct management *man, const char *token) { msg(M_CLIENT, ">PASSWORD:Auth-Token:%s", token); } diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index 1be3549..ab68968 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -376,12 +376,12 @@ void management_event_loop_n_seconds(struct management *man, int sec); -void management_up_down(struct management *man, const char *updown, const = struct env_set *es); +void management_up_down(const struct management *man, const char *updown, = const struct env_set *es); -void management_notify(struct management *man, const char *severity, const= char *type, +void management_notify(const struct management *man, const char *severity,= const char *type, const char *text); -void management_notify_generic(struct management *man, const char *str); +void management_notify_generic(const struct management *man, const char *s= tr); void management_notify_client_needing_auth(struct management *management, const unsigned int auth_id, @@ -391,7 +391,7 @@ void management_connection_established(struct management *management, struct man_def_auth_context *mdac, = const struct env_set *es); -void management_notify_client_close(struct management *management, +void management_notify_client_close(const struct management *management, struct man_def_auth_context *mdac, con= st struct env_set *es); void management_learn_addr(struct management *management, struct man_def_a= uth_context *mdac, @@ -476,12 +476,12 @@ * OpenVPN calls here to indicate a password failure */ -void management_auth_failure(struct management *man, const char *type, con= st char *reason); +void management_auth_failure(const struct management *man, const char *typ= e, const char *reason); /* * Echo an authentication token to management interface */ -void management_auth_token(struct management *man, const char *token); +void management_auth_token(const struct management *man, const char *token= ); /* * These functions drive the bytecount in/out counters. diff --git a/src/openvpn/mbuf.c b/src/openvpn/mbuf.c index 5e1b585..39f85ba 100644 --- a/src/openvpn/mbuf.c +++ b/src/openvpn/mbuf.c @@ -160,7 +160,7 @@ } void -mbuf_dereference_instance(struct mbuf_set *ms, struct multi_instance *mi) +mbuf_dereference_instance(struct mbuf_set *ms, const struct multi_instance= *mi) { if (ms) { diff --git a/src/openvpn/mbuf.h b/src/openvpn/mbuf.h index cfe698c..e368054 100644 --- a/src/openvpn/mbuf.h +++ b/src/openvpn/mbuf.h @@ -75,7 +75,7 @@ bool mbuf_extract_item(struct mbuf_set *ms, struct mbuf_item *item); -void mbuf_dereference_instance(struct mbuf_set *ms, struct multi_instance = *mi); +void mbuf_dereference_instance(struct mbuf_set *ms, const struct multi_ins= tance *mi); static inline bool mbuf_defined(const struct mbuf_set *ms) diff --git a/src/openvpn/mss.c b/src/openvpn/mss.c index 36bbb43..a7242a8 100644 --- a/src/openvpn/mss.c +++ b/src/openvpn/mss.c @@ -43,7 +43,7 @@ * if yes, hand to mss_fixup_dowork() */ void -mss_fixup_ipv4(struct buffer *buf, uint16_t maxmss) +mss_fixup_ipv4(const struct buffer *buf, uint16_t maxmss) { const struct openvpn_iphdr *pip; int hlen; @@ -80,7 +80,7 @@ * (IPv6 header structure is sufficiently different from IPv4= ...) */ void -mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss) +mss_fixup_ipv6(const struct buffer *buf, uint16_t maxmss) { const struct openvpn_ipv6hdr *pip6; struct buffer newbuf; @@ -136,7 +136,7 @@ */ void -mss_fixup_dowork(struct buffer *buf, uint16_t maxmss) +mss_fixup_dowork(const struct buffer *buf, uint16_t maxmss) { int olen, optlen; uint8_t *opt; @@ -239,8 +239,8 @@ } static void -frame_calculate_fragment(struct frame *frame, struct key_type *kt, const s= truct options *options, - struct link_socket_info *lsi) +frame_calculate_fragment(struct frame *frame, const struct key_type *kt, c= onst struct options *options, + const struct link_socket_info *lsi) { #if defined(ENABLE_FRAGMENT) size_t overhead; @@ -269,8 +269,8 @@ } static void -frame_calculate_mssfix(struct frame *frame, struct key_type *kt, const str= uct options *options, - struct link_socket_info *lsi) +frame_calculate_mssfix(struct frame *frame, const struct key_type *kt, con= st struct options *options, + const struct link_socket_info *lsi) { if (options->ce.mssfix_fixed) { @@ -314,8 +314,8 @@ } void -frame_calculate_dynamic(struct frame *frame, struct key_type *kt, const st= ruct options *options, - struct link_socket_info *lsi) +frame_calculate_dynamic(struct frame *frame, const struct key_type *kt, co= nst struct options *options, + const struct link_socket_info *lsi) { if (options->ce.fragment > 0) { diff --git a/src/openvpn/mss.h b/src/openvpn/mss.h index 1d092bb..6b832a2 100644 --- a/src/openvpn/mss.h +++ b/src/openvpn/mss.h @@ -29,15 +29,15 @@ #include "socket.h" #include "ssl_common.h" -void mss_fixup_ipv4(struct buffer *buf, uint16_t maxmss); +void mss_fixup_ipv4(const struct buffer *buf, uint16_t maxmss); -void mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss); +void mss_fixup_ipv6(const struct buffer *buf, uint16_t maxmss); -void mss_fixup_dowork(struct buffer *buf, uint16_t maxmss); +void mss_fixup_dowork(const struct buffer *buf, uint16_t maxmss); /** Set the --mssfix option. */ -void frame_calculate_dynamic(struct frame *frame, struct key_type *kt, - const struct options *options, struct link_so= cket_info *lsi); +void frame_calculate_dynamic(struct frame *frame, const struct key_type *k= t, + const struct options *options, const struct l= ink_socket_info *lsi); /** * Checks and adjusts the fragment and mssfix value according to the diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index df94a70..d9f14b3 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -91,7 +91,7 @@ } bool -multi_tcp_instance_specific_init(struct multi_context *m, struct multi_ins= tance *mi) +multi_tcp_instance_specific_init(const struct multi_context *m, struct mul= ti_instance *mi) { /* buffer for queued TCP socket output packets */ mi->tcp_link_out_deferred =3D mbuf_init(m->top.options.n_bcast_buf); diff --git a/src/openvpn/mtcp.h b/src/openvpn/mtcp.h index 9b7d1d2..bb117fa 100644 --- a/src/openvpn/mtcp.h +++ b/src/openvpn/mtcp.h @@ -35,7 +35,7 @@ void multi_tcp_dereference_instance(struct multi_io *multi_io, struct mult= i_instance *mi); -bool multi_tcp_instance_specific_init(struct multi_context *m, struct mult= i_instance *mi); +bool multi_tcp_instance_specific_init(const struct multi_context *m, struc= t multi_instance *mi); void multi_tcp_instance_specific_free(struct multi_instance *mi); diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 50d72d5..4828a17 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -39,7 +39,7 @@ static void send_hmac_reset_packet(struct multi_context *m, struct tls_pre_decrypt_sta= te *state, - struct tls_auth_standalone *tas, struct session_id = *sid, + const struct tls_auth_standalone *tas, const struct= session_id *sid, bool request_resend_wkc) { reset_packet_id_send(&state->tls_wrap_tmp.opt.packet_id.send); @@ -69,7 +69,7 @@ enum first_packet_verdict verdict; - struct tls_auth_standalone *tas =3D m->top.c2.tls_auth_standalone; + const struct tls_auth_standalone *tas =3D m->top.c2.tls_auth_standalon= e; verdict =3D tls_pre_decrypt_lite(tas, state, &m->top.c2.from, &m->top.= c2.buf); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index c72c4b2..dd4d61d 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -57,7 +57,7 @@ #ifdef MULTI_DEBUG_EVENT_LOOP static const char * -id(struct multi_instance *mi) +id(const struct multi_instance *mi) { if (mi) { @@ -1315,7 +1315,7 @@ * same common name. */ static void -multi_delete_dup(struct multi_context *m, struct multi_instance *new_mi) +multi_delete_dup(struct multi_context *m, const struct multi_instance *new= _mi) { if (new_mi) { @@ -2260,7 +2260,7 @@ } static bool -multi_client_setup_dco_initial(struct multi_context *m, struct multi_insta= nce *mi, +multi_client_setup_dco_initial(const struct multi_context *m, struct multi= _instance *mi, struct gc_arena *gc) { if (!dco_enabled(&mi->context.options)) @@ -3195,7 +3195,7 @@ #if defined(ENABLE_DCO) static void -process_incoming_del_peer(struct multi_context *m, struct multi_instance *= mi, dco_context_t *dco) +process_incoming_del_peer(struct multi_context *m, struct multi_instance *= mi, const dco_context_t *dco) { const char *reason =3D "ovpn-dco: unknown reason"; switch (dco->dco_del_peer_reason) @@ -4226,7 +4226,7 @@ /* Searches for the address and deletes it if it is owned by the multi_ins= tance */ static void -multi_unlearn_addr(struct multi_context *m, struct multi_instance *mi, con= st struct mroute_addr *addr) +multi_unlearn_addr(struct multi_context *m, const struct multi_instance *m= i, const struct mroute_addr *addr) { struct hash_element *he; const uint32_t hv =3D hash_value(m->vhash, addr); @@ -4261,7 +4261,7 @@ * @param a The new IPv4 address in network byte order */ static void -multi_unlearn_in_addr_t(struct multi_context *m, struct multi_instance *mi= , in_addr_t a) +multi_unlearn_in_addr_t(struct multi_context *m, const struct multi_instan= ce *mi, in_addr_t a) { struct mroute_addr addr; CLEAR(addr); @@ -4279,7 +4279,7 @@ * @param a6 The new IPv6 address */ static void -multi_unlearn_in6_addr(struct multi_context *m, struct multi_instance *mi,= struct in6_addr a6) +multi_unlearn_in6_addr(struct multi_context *m, const struct multi_instanc= e *mi, struct in6_addr a6) { struct mroute_addr addr; CLEAR(addr); @@ -4395,7 +4395,7 @@ bool multi_check_push_ifconfig_ipv6_extra_route(struct multi_instance *mi, - struct in6_addr *dest) + const struct in6_addr *dest) { const struct options *o =3D &mi->context.options; diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 3ed08d4..cd7aa3e 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -520,7 +520,7 @@ */ static inline void -set_prefix(struct multi_instance *mi) +set_prefix(const struct multi_instance *mi) { #ifdef MULTI_DEBUG_EVENT_LOOP if (mi->msg_prefix[0]) @@ -694,7 +694,7 @@ */ bool multi_check_push_ifconfig_ipv6_extra_route(struct multi_instance *mi, - struct in6_addr *dest); + const struct in6_addr *dest); /* * Check for signals. diff --git a/src/openvpn/networking.h b/src/openvpn/networking.h index bce0c19..25233c8 100644 --- a/src/openvpn/networking.h +++ b/src/openvpn/networking.h @@ -44,7 +44,7 @@ */ #if !defined(ENABLE_IPROUTE) static inline int -net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx) +net_ctx_init(const struct context *c, openvpn_net_ctx_t *ctx) { (void)c; (void)ctx; @@ -75,7 +75,7 @@ * * @return 0 on success, a negative error code otherwise */ -int net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx); +int net_ctx_init(const struct context *c, openvpn_net_ctx_t *ctx); /** * Release resources allocated by the internal garbage collector @@ -102,7 +102,7 @@ * @return 0 on success, negative error code on error */ int net_iface_new(openvpn_net_ctx_t *ctx, const openvpn_net_iface_t *iface= , const char *type, - void *arg); + const void *arg); /** * Retrieve the interface type diff --git a/src/openvpn/networking_iproute2.c b/src/openvpn/networking_ipr= oute2.c index a1f3525..f091fb3 100644 --- a/src/openvpn/networking_iproute2.c +++ b/src/openvpn/networking_iproute2.c @@ -36,7 +36,7 @@ #include int -net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx) +net_ctx_init(const struct context *c, openvpn_net_ctx_t *ctx) { ctx->es =3D NULL; if (c) @@ -61,7 +61,7 @@ } int -net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,= void *arg) +net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,= const void *arg) { struct argv argv =3D argv_new(); diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index e6e72d0..a1d220f 100644 --- a/src/openvpn/networking_sitnl.c +++ b/src/openvpn/networking_sitnl.c @@ -987,7 +987,7 @@ } static int -sitnl_addr_del(sa_family_t af_family, const char *iface, inet_address_t *a= ddr, int prefixlen) +sitnl_addr_del(sa_family_t af_family, const char *iface, const inet_addres= s_t *addr, int prefixlen) { int ifindex; @@ -1230,8 +1230,8 @@ } static int -sitnl_route_del(const char *iface, sa_family_t af_family, inet_address_t *= dst, int prefixlen, - inet_address_t *gw, uint32_t table, int metric) +sitnl_route_del(const char *iface, sa_family_t af_family, const inet_addre= ss_t *dst, int prefixlen, + const inet_address_t *gw, uint32_t table, int metric) { int ifindex =3D 0; @@ -1308,7 +1308,7 @@ int -net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,= void *arg) +net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,= const void *arg) { struct sitnl_link_req req =3D {}; int ret =3D -1; diff --git a/src/openvpn/occ.h b/src/openvpn/occ.h index bda4f18..49def4d 100644 --- a/src/openvpn/occ.h +++ b/src/openvpn/occ.h @@ -156,7 +156,7 @@ * via control channel. * @return control channel exit message should be used */ static inline bool -cc_exit_notify_enabled(struct context *c) +cc_exit_notify_enabled(const struct context *c) { /* Check if we have TLS active at all */ if (!c->c2.tls_multi) diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index 3494ce6..32e0b6f 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -124,7 +124,7 @@ /* Mimics the functions but only when the default context without * options is chosen */ static inline const EVP_CIPHER * -EVP_CIPHER_fetch(void *ctx, const char *algorithm, const char *properties) +EVP_CIPHER_fetch(const void *ctx, const char *algorithm, const char *prope= rties) { ASSERT(!ctx); ASSERT(!properties); @@ -132,7 +132,7 @@ } static inline const EVP_MD * -EVP_MD_fetch(void *ctx, const char *algorithm, const char *properties) +EVP_MD_fetch(const void *ctx, const char *algorithm, const char *propertie= s) { ASSERT(!ctx); ASSERT(!properties); diff --git a/src/openvpn/options.c b/src/openvpn/options.c index fd0d3fc..6d85a23 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3050,7 +3050,7 @@ } static void -options_postprocess_mutate_le(struct connection_entry *ce, struct local_en= try *le, int mode) +options_postprocess_mutate_le(const struct connection_entry *ce, struct lo= cal_entry *le, int mode) { /* use the global port if none is specified */ if (!le->port) @@ -4980,7 +4980,7 @@ static bool verify_permission(const char *name, const char *file, int line, const uint= 64_t type, const uint64_t allowed, uint64_t *found, const msglvl_t = msglevel, - struct options *options, bool is_inline) + const struct options *options, bool is_inline) { if (!(type & allowed)) { @@ -5547,7 +5547,7 @@ } static void -show_compression_warning(struct compress_options *info) +show_compression_warning(const struct compress_options *info) { if (comp_non_stub_enabled(info)) { diff --git a/src/openvpn/options_parse.c b/src/openvpn/options_parse.c index 88ab4d2..0e94522 100644 --- a/src/openvpn/options_parse.c +++ b/src/openvpn/options_parse.c @@ -258,7 +258,7 @@ } static char * -read_inline_file(struct in_src *is, const char *close_tag, int *num_lines,= struct gc_arena *gc) +read_inline_file(const struct in_src *is, const char *close_tag, int *num_= lines, struct gc_arena *gc) { char line[OPTION_LINE_SIZE]; struct buffer buf =3D alloc_buf(8 * OPTION_LINE_SIZE); @@ -302,7 +302,7 @@ } static int -check_inline_file(struct in_src *is, char *p[], struct gc_arena *gc) +check_inline_file(const struct in_src *is, char *p[], struct gc_arena *gc) { int num_inline_lines =3D 0; diff --git a/src/openvpn/otime.c b/src/openvpn/otime.c index 1608458..5d3633c 100644 --- a/src/openvpn/otime.c +++ b/src/openvpn/otime.c @@ -66,7 +66,7 @@ } void -update_now_usec(struct timeval *tv) +update_now_usec(const struct timeval *tv) { const time_t last =3D now; update_now(tv->tv_sec); diff --git a/src/openvpn/otime.h b/src/openvpn/otime.h index 84e315b..b5a9f7c 100644 --- a/src/openvpn/otime.h +++ b/src/openvpn/otime.h @@ -65,7 +65,7 @@ void update_now(const time_t system_time); extern time_t now_usec; -void update_now_usec(struct timeval *tv); +void update_now_usec(const struct timeval *tv); static inline int openvpn_gettimeofday(struct timeval *tv, void *tz) diff --git a/src/openvpn/proto.h b/src/openvpn/proto.h index 3570582..33bf4ea 100644 --- a/src/openvpn/proto.h +++ b/src/openvpn/proto.h @@ -248,7 +248,7 @@ * and offset of IP header (via parameter). */ static inline int -get_tun_ip_ver(int tunnel_type, struct buffer *buf, int *ip_hdr_offset) +get_tun_ip_ver(int tunnel_type, const struct buffer *buf, int *ip_hdr_offs= et) { int ip_ver =3D -1; diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c index 4de7615..d4e0a8b 100644 --- a/src/openvpn/proxy.c +++ b/src/openvpn/proxy.c @@ -527,8 +527,9 @@ } static bool -add_proxy_headers(struct http_proxy_info *p, socket_descriptor_t sd, /* al= ready open to proxy */ - const char *host /* op= envpn server remote */ +add_proxy_headers(const struct http_proxy_info *p, + socket_descriptor_t sd, /* already open to proxy */ + const char *host /* openvpn server remote */ ) { char buf[512]; @@ -597,8 +598,8 @@ socket_descriptor_t sd, /* already open to p= roxy */ const char *host, /* openvpn server re= mote */ const char *port, /* openvpn server po= rt */ - struct event_timeout *server_poll_timeout, s= truct buffer *lookahead, - struct signal_info *sig_info) + const struct event_timeout *server_poll_time= out, + struct buffer *lookahead, struct signal_info= *sig_info) { struct gc_arena gc =3D gc_new(); char buf[512]; diff --git a/src/openvpn/proxy.h b/src/openvpn/proxy.h index e662e7d..a2f4e47 100644 --- a/src/openvpn/proxy.h +++ b/src/openvpn/proxy.h @@ -89,7 +89,7 @@ socket_descriptor_t sd, /* already open= to proxy */ const char *host, /* openvpn serv= er remote */ const char *port, /* openvpn serv= er port */ - struct event_timeout *server_poll_timeo= ut, + const struct event_timeout *server_poll= _timeout, struct buffer *lookahead, struct signal= _info *sig_info); uint8_t *make_base64_string2(const uint8_t *str, int str_len, struct gc_ar= ena *gc); diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index 57afacd..0e581e5 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -332,7 +332,7 @@ * the proxy can determine true client origin. */ static void -journal_add(const char *journal_dir, struct proxy_connection *pc, struct p= roxy_connection *cp) +journal_add(const char *journal_dir, const struct proxy_connection *pc, st= ruct proxy_connection *cp) { struct openvpn_sockaddr from, to; @@ -410,7 +410,7 @@ static bool proxy_entry_new(struct proxy_connection **list, struct event_set *es, const struct openvpn_sockaddr server_addr, const socket_de= scriptor_t sd_client, - struct buffer *initial_data, const char *journal_dir) + const struct buffer *initial_data, const char *journal_dir) { socket_descriptor_t sd_server; int status; @@ -1013,7 +1013,7 @@ * call. */ void -port_share_redirect(struct port_share *ps, const struct buffer *head, sock= et_descriptor_t sd) +port_share_redirect(const struct port_share *ps, const struct buffer *head= , socket_descriptor_t sd) { if (ps) { diff --git a/src/openvpn/ps.h b/src/openvpn/ps.h index 557ecf5..918ceb6 100644 --- a/src/openvpn/ps.h +++ b/src/openvpn/ps.h @@ -49,7 +49,7 @@ bool is_openvpn_protocol(const struct buffer *buf); -void port_share_redirect(struct port_share *ps, const struct buffer *head,= socket_descriptor_t sd); +void port_share_redirect(const struct port_share *ps, const struct buffer = *head, socket_descriptor_t sd); #endif /* if PORT_SHARE */ #endif /* ifndef PS_H */ diff --git a/src/openvpn/push.c b/src/openvpn/push.c index a030acd..373272f 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -435,7 +435,7 @@ #endif bool -send_auth_pending_messages(struct tls_multi *tls_multi, struct tls_session= *session, +send_auth_pending_messages(const struct tls_multi *tls_multi, struct tls_s= ession *session, const char *extra, unsigned int timeout) { struct key_state *ks =3D &session->key[KS_PRIMARY]; diff --git a/src/openvpn/push.h b/src/openvpn/push.h index dff945f..39302f6 100644 --- a/src/openvpn/push.h +++ b/src/openvpn/push.h @@ -117,7 +117,7 @@ * doc/management-notes.txt under client-pending-auth for * more details on message format */ -bool send_auth_pending_messages(struct tls_multi *tls_multi, struct tls_se= ssion *session, +bool send_auth_pending_messages(const struct tls_multi *tls_multi, struct = tls_session *session, const char *extra, unsigned int timeout); void send_restart(struct context *c, const char *kill_msg); diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c index af22af5..008d45f 100644 --- a/src/openvpn/push_util.c +++ b/src/openvpn/push_util.c @@ -222,7 +222,7 @@ /* Return true if the client supports push-update */ static bool -support_push_update(struct multi_instance *mi) +support_push_update(const struct multi_instance *mi) { ASSERT(mi->context.c2.tls_multi); const unsigned int iv_proto_peer =3D extract_iv_proto(mi->context.c2.t= ls_multi->peer_info); diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c index 52adacf..3588483 100644 --- a/src/openvpn/reliable.c +++ b/src/openvpn/reliable.c @@ -92,7 +92,7 @@ /* check if a particular packet_id is present in ack */ static inline bool -reliable_ack_packet_id_present(struct reliable_ack *ack, packet_id_type pi= d) +reliable_ack_packet_id_present(const struct reliable_ack *ack, packet_id_t= ype pid) { for (int i =3D 0; i < ack->len; ++i) { @@ -733,7 +733,7 @@ */ void -reliable_mark_active_incoming(struct reliable *rel, struct buffer *buf, pa= cket_id_type pid, +reliable_mark_active_incoming(struct reliable *rel, const struct buffer *b= uf, packet_id_type pid, int opcode) { for (int i =3D 0; i < rel->size; ++i) @@ -793,7 +793,7 @@ /* delete a buffer previously activated by reliable_mark_active() */ void -reliable_mark_deleted(struct reliable *rel, struct buffer *buf) +reliable_mark_deleted(struct reliable *rel, const struct buffer *buf) { for (int i =3D 0; i < rel->size; ++i) { diff --git a/src/openvpn/reliable.h b/src/openvpn/reliable.h index a5ed75c..8d9e2e3 100644 --- a/src/openvpn/reliable.h +++ b/src/openvpn/reliable.h @@ -173,7 +173,7 @@ * @li False, if there are packet IDs to be acknowledged. */ static inline bool -reliable_ack_empty(struct reliable_ack *ack) +reliable_ack_empty(const struct reliable_ack *ack) { return !ack->len; } @@ -186,7 +186,7 @@ * @returns the number of outstanding acks */ static inline int -reliable_ack_outstanding(struct reliable_ack *ack) +reliable_ack_outstanding(const struct reliable_ack *ack) { return ack->len; } @@ -336,7 +336,7 @@ * @param pid The packet's packet ID. * @param opcode The packet's opcode. */ -void reliable_mark_active_incoming(struct reliable *rel, struct buffer *bu= f, packet_id_type pid, +void reliable_mark_active_incoming(struct reliable *rel, const struct buff= er *buf, packet_id_type pid, int opcode); /** @@ -389,7 +389,7 @@ * @param rel The reliable structure associated with the given buffer. * @param buf The buffer of the reliable entry which is to be removed. */ -void reliable_mark_deleted(struct reliable *rel, struct buffer *buf); +void reliable_mark_deleted(struct reliable *rel, const struct buffer *buf); /** @} name Functions for extracting incoming packets */ diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 45793a4..85c246b 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -898,8 +898,9 @@ } static bool -add_bypass_routes(struct route_bypass *rb, in_addr_t gateway, const struct= tuntap *tt, - unsigned int flags, const struct route_gateway_info *rgi, +add_bypass_routes(const struct route_bypass *rb, in_addr_t gateway, + const struct tuntap *tt, unsigned int flags, + const struct route_gateway_info *rgi, const struct env_set *es, openvpn_net_ctx_t *ctx) { int ret =3D true; @@ -916,8 +917,9 @@ } static void -del_bypass_routes(struct route_bypass *rb, in_addr_t gateway, const struct= tuntap *tt, - unsigned int flags, const struct route_gateway_info *rgi, +del_bypass_routes(const struct route_bypass *rb, in_addr_t gateway, + const struct tuntap *tt, unsigned int flags, + const struct route_gateway_info *rgi, const struct env_set *es, openvpn_net_ctx_t *ctx) { int i; @@ -3942,7 +3944,7 @@ #else /* if defined(_WIN32) */ static void -get_bypass_addresses(struct route_bypass *rb, const unsigned int flags) /*= PLATFORM-SPECIFIC */ +get_bypass_addresses(struct route_bypass *rb, const unsigned int flags) { } diff --git a/src/openvpn/schedule.c b/src/openvpn/schedule.c index 6d9bb62..c29009e 100644 --- a/src/openvpn/schedule.c +++ b/src/openvpn/schedule.c @@ -501,7 +501,7 @@ } int -schedule_debug(struct schedule *s, int *count, struct timeval *least) +schedule_debug(const struct schedule *s, int *count, struct timeval *least) { struct timeval min; struct timeval max; diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 0382aea..5474e94 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -647,7 +647,7 @@ } static void -bind_local(struct link_socket *sock, const sa_family_t ai_family) +bind_local(const struct link_socket *sock, const sa_family_t ai_family) { /* bind to local address/port */ if (sock->bind_local) @@ -914,8 +914,8 @@ } void -socket_bind(socket_descriptor_t sd, struct addrinfo *local, int ai_family,= const char *prefix, - bool ipv6only) +socket_bind(socket_descriptor_t sd, const struct addrinfo *local, int ai_f= amily, + const char *prefix, bool ipv6only) { struct gc_arena gc =3D gc_new(); @@ -1123,8 +1123,8 @@ * such as TCP. */ -static void stream_buf_init(struct stream_buf *sb, struct buffer *buf, con= st unsigned int sockflags, - const int proto); +static void stream_buf_init(struct stream_buf *sb, const struct buffer *bu= f, + const unsigned int sockflags, const int proto); static void stream_buf_close(struct stream_buf *sb); @@ -1481,7 +1481,7 @@ } static void -phase2_set_socket_flags(struct link_socket *sock) +phase2_set_socket_flags(const struct link_socket *sock) { /* set misc socket parameters */ socket_set_flags(sock->sd, sock->sockflags); @@ -2073,7 +2073,7 @@ } static void -stream_buf_init(struct stream_buf *sb, struct buffer *buf, const unsigned = int sockflags, +stream_buf_init(struct stream_buf *sb, const struct buffer *buf, const uns= igned int sockflags, const int proto) { sb->buf_init =3D *buf; @@ -2337,7 +2337,7 @@ #endif static socklen_t -link_socket_read_udp_posix_recvmsg(struct link_socket *sock, struct buffer= *buf, +link_socket_read_udp_posix_recvmsg(const struct link_socket *sock, struct = buffer *buf, struct link_socket_actual *from) { struct iovec iov; @@ -2405,7 +2405,7 @@ #endif /* if ENABLE_IP_PKTINFO */ int -link_socket_read_udp_posix(struct link_socket *sock, struct buffer *buf, +link_socket_read_udp_posix(const struct link_socket *sock, struct buffer *= buf, struct link_socket_actual *from) { socklen_t fromlen =3D sizeof(from->dest.addr); @@ -2462,7 +2462,7 @@ #if ENABLE_IP_PKTINFO ssize_t -link_socket_write_udp_posix_sendmsg(struct link_socket *sock, struct buffe= r *buf, +link_socket_write_udp_posix_sendmsg(const struct link_socket *sock, const = struct buffer *buf, struct link_socket_actual *to) { struct iovec iov; @@ -2656,7 +2656,7 @@ } int -socket_send_queue(struct link_socket *sock, struct buffer *buf, const stru= ct link_socket_actual *to) +socket_send_queue(struct link_socket *sock, const struct buffer *buf, cons= t struct link_socket_actual *to) { if (sock->writes.iostate =3D=3D IOSTATE_INITIAL) { @@ -2756,8 +2756,8 @@ return sock->writes.iostate; } -void -read_sockaddr_from_overlapped(struct overlapped_io *io, struct sockaddr *d= st, int overlapped_ret) +static void +read_sockaddr_from_overlapped(const struct overlapped_io *io, struct socka= ddr *dst, int overlapped_ret) { if (overlapped_ret >=3D 0 && io->addr_defined) { diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 71a3595..6771ec5 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -267,7 +267,7 @@ int socket_recv_queue(struct link_socket *sock, int maxsize); -int socket_send_queue(struct link_socket *sock, struct buffer *buf, +int socket_send_queue(struct link_socket *sock, const struct buffer *buf, const struct link_socket_actual *to); typedef struct @@ -347,8 +347,8 @@ struct link_socket *link_socket_new(void); -void socket_bind(socket_descriptor_t sd, struct addrinfo *local, int af_fa= mily, const char *prefix, - bool ipv6only); +void socket_bind(socket_descriptor_t sd, const struct addrinfo *local, int= af_family, + const char *prefix, bool ipv6only); int openvpn_connect(socket_descriptor_t sd, const struct sockaddr *remote,= int connect_timeout, volatile int *signal_received); @@ -484,7 +484,7 @@ } static inline bool -link_socket_verify_incoming_addr(struct buffer *buf, const struct link_soc= ket_info *info, +link_socket_verify_incoming_addr(const struct buffer *buf, const struct li= nk_socket_info *info, const struct link_socket_actual *from_add= r) { if (buf->len > 0) @@ -608,7 +608,7 @@ #else /* ifdef _WIN32 */ -int link_socket_read_udp_posix(struct link_socket *sock, struct buffer *bu= f, +int link_socket_read_udp_posix(const struct link_socket *sock, struct buff= er *buf, struct link_socket_actual *from); #endif /* ifdef _WIN32 */ @@ -694,12 +694,12 @@ #else /* ifdef _WIN32 */ -ssize_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, stru= ct buffer *buf, +ssize_t link_socket_write_udp_posix_sendmsg(const struct link_socket *sock= , const struct buffer *buf, struct link_socket_actual *to); static inline ssize_t -link_socket_write_udp_posix(struct link_socket *sock, struct buffer *buf, +link_socket_write_udp_posix(const struct link_socket *sock, const struct b= uffer *buf, struct link_socket_actual *to) { #if ENABLE_IP_PKTINFO @@ -715,7 +715,7 @@ } static inline ssize_t -link_socket_write_tcp_posix(struct link_socket *sock, struct buffer *buf) +link_socket_write_tcp_posix(const struct link_socket *sock, const struct b= uffer *buf) { return send(sock->sd, BPTR(buf), BLENZ(buf), MSG_NOSIGNAL); } @@ -773,7 +773,7 @@ * from tunnel packet. */ static inline void -link_socket_set_tos(struct link_socket *sock) +link_socket_set_tos(const struct link_socket *sock) { if (sock && sock->ptos_defined) { @@ -819,6 +819,8 @@ } } +/* cppcheck-suppress constParameterPointer + * sock is modified on Windows via &sock->listen_handle */ static inline void socket_reset_listen_persistent(struct link_socket *sock) { diff --git a/src/openvpn/socket_util.h b/src/openvpn/socket_util.h index 13f5962..add08ba 100644 --- a/src/openvpn/socket_util.h +++ b/src/openvpn/socket_util.h @@ -439,7 +439,7 @@ static inline bool -addrlist_match_proto(const struct openvpn_sockaddr *a1, struct addrinfo *a= ddr_list, const int proto) +addrlist_match_proto(const struct openvpn_sockaddr *a1, const struct addri= nfo *addr_list, const int proto) { return link_socket_proto_connection_oriented(proto) ? addrlist_match(a= 1, addr_list) : addrlist_port_ma= tch(a1, addr_list); diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c index 19f3d54..77ca863 100644 --- a/src/openvpn/socks.c +++ b/src/openvpn/socks.c @@ -82,7 +82,7 @@ static bool socks_proxy_recv_char(uint8_t *c, const char *name, socket_descriptor_t sd, - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_timeout, volatile int *signal_received) { fd_set reads; @@ -97,8 +97,8 @@ } static bool -socks_username_password_auth(struct socks_proxy_info *p, socket_descriptor= _t sd, - struct event_timeout *server_poll_timeout, +socks_username_password_auth(const struct socks_proxy_info *p, socket_desc= riptor_t sd, + const struct event_timeout *server_poll_timeo= ut, volatile int *signal_received) { char to_send[516]; @@ -156,8 +156,8 @@ } static bool -socks_handshake(struct socks_proxy_info *p, socket_descriptor_t sd, - struct event_timeout *server_poll_timeout, volatile int *s= ignal_received) +socks_handshake(const struct socks_proxy_info *p, socket_descriptor_t sd, + const struct event_timeout *server_poll_timeout, volatile = int *signal_received) { uint8_t buf[2]; int len =3D 0; @@ -231,7 +231,7 @@ static bool recv_socks_reply(socket_descriptor_t sd, struct openvpn_sockaddr *addr, - struct event_timeout *server_poll_timeout, volatile int *= signal_received) + const struct event_timeout *server_poll_timeout, volatile= int *signal_received) { uint8_t atyp =3D 0; int alen =3D 0; @@ -334,11 +334,11 @@ } void -establish_socks_proxy_passthru(struct socks_proxy_info *p, +establish_socks_proxy_passthru(const struct socks_proxy_info *p, socket_descriptor_t sd, /* already open to = proxy */ const char *host, /* openvpn server r= emote */ const char *servname, /* openvpn server p= ort */ - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_tim= eout, struct signal_info *sig_info) { char buf[270]; @@ -392,10 +392,10 @@ } void -establish_socks_proxy_udpassoc(struct socks_proxy_info *p, +establish_socks_proxy_udpassoc(const struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* already ope= n to proxy */ struct openvpn_sockaddr *relay_addr, - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_tim= eout, struct signal_info *sig_info) { if (!socks_handshake(p, ctrl_sd, server_poll_timeout, &sig_info->signa= l_received)) diff --git a/src/openvpn/socks.h b/src/openvpn/socks.h index 846113d..f7c93b6 100644 --- a/src/openvpn/socks.h +++ b/src/openvpn/socks.h @@ -47,17 +47,17 @@ =20 void socks_proxy_close(struct socks_proxy_info *sp); -void establish_socks_proxy_passthru(struct socks_proxy_info *p, +void establish_socks_proxy_passthru(const struct socks_proxy_info *p, socket_descriptor_t sd, /* already ope= n to proxy */ const char *host, /* openvpn ser= ver remote */ const char *servname, /* openvpn ser= ver port */ - struct event_timeout *server_poll_time= out, + const struct event_timeout *server_pol= l_timeout, struct signal_info *sig_info); -void establish_socks_proxy_udpassoc(struct socks_proxy_info *p, +void establish_socks_proxy_udpassoc(const struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* alread= y open to proxy */ struct openvpn_sockaddr *relay_addr, - struct event_timeout *server_poll_time= out, + const struct event_timeout *server_pol= l_timeout, struct signal_info *sig_info); void socks_process_incoming_udp(struct buffer *buf, struct link_socket_act= ual *from); diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 7f3b4dc..262522b 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1159,7 +1159,7 @@ } struct tls_multi * -tls_multi_init(struct tls_options *tls_options) +tls_multi_init(const struct tls_options *tls_options) { struct tls_multi *ret; @@ -1188,7 +1188,7 @@ */ struct tls_auth_standalone * -tls_auth_standalone_init(struct tls_options *tls_options, struct gc_arena = *gc) +tls_auth_standalone_init(const struct tls_options *tls_options, struct gc_= arena *gc) { struct tls_auth_standalone *tas; @@ -1336,7 +1336,7 @@ static void init_epoch_keys(struct key_state *ks, struct tls_multi *multi, const struc= t key_type *key_type, - bool server, struct key2 *key2) + bool server, const struct key2 *key2) { /* For now we hardcode this to be 16 for the software based data chann= el * DCO based implementations/HW implementation might adjust this number @@ -1375,7 +1375,7 @@ static void init_key_contexts(struct key_state *ks, struct tls_multi *multi, const str= uct key_type *key_type, - bool server, struct key2 *key2, bool dco_enabled) + bool server, const struct key2 *key2, bool dco_enabled) { struct key_ctx_bi *key =3D &ks->crypto_options.key_ctx_bi; @@ -1573,8 +1573,9 @@ bool tls_session_update_crypto_params_do_work(struct tls_multi *multi, struct t= ls_session *session, - struct options *options, struct f= rame *frame, - struct frame *frame_fragment, str= uct link_socket_info *lsi, + const struct options *options, st= ruct frame *frame, + struct frame *frame_fragment, + const struct link_socket_info *ls= i, dco_context_t *dco) { if (session->key[KS_PRIMARY].crypto_options.key_ctx_bi.initialized) @@ -1643,7 +1644,7 @@ bool tls_session_update_crypto_params(struct tls_multi *multi, struct tls_sessi= on *session, struct options *options, struct frame *fr= ame, - struct frame *frame_fragment, struct link= _socket_info *lsi, + struct frame *frame_fragment, const struc= t link_socket_info *lsi, dco_context_t *dco) { if (!check_session_cipher(session, options)) @@ -2495,8 +2496,8 @@ } bool -session_skip_to_pre_start(struct tls_session *session, struct tls_pre_decr= ypt_state *state, - struct link_socket_actual *from) +session_skip_to_pre_start(struct tls_session *session, const struct tls_pr= e_decrypt_state *state, + const struct link_socket_actual *from) { struct key_state *ks =3D &session->key[KS_PRIMARY]; ks->session_id_remote =3D state->peer_session_id; @@ -4011,7 +4012,7 @@ } void -tls_post_encrypt(struct tls_multi *multi, struct buffer *buf) +tls_post_encrypt(struct tls_multi *multi, const struct buffer *buf) { struct key_state *ks =3D multi->save_ks; multi->save_ks =3D NULL; @@ -4142,7 +4143,7 @@ * into a garbage collectable string which is returned. */ const char * -protocol_dump(struct buffer *buffer, unsigned int flags, struct gc_arena *= gc) +protocol_dump(const struct buffer *buffer, unsigned int flags, struct gc_a= rena *gc) { struct buffer out =3D alloc_buf_gc(256, gc); struct buffer buf =3D *buffer; diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index 5822336..3370321 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -166,7 +166,7 @@ * * @return A newly allocated and initialized \c tls_multi structure. */ -struct tls_multi *tls_multi_init(struct tls_options *tls_options); +struct tls_multi *tls_multi_init(const struct tls_options *tls_options); /** * Finalize initialization of a \c tls_multi structure. @@ -187,7 +187,7 @@ /* * Initialize a standalone tls-auth verification object. */ -struct tls_auth_standalone *tls_auth_standalone_init(struct tls_options *t= ls_options, +struct tls_auth_standalone *tls_auth_standalone_init(const struct tls_opti= ons *tls_options, struct gc_arena *gc); /** @@ -371,7 +371,7 @@ * @param multi - The TLS state for this packet's destination VPN tunnel. * @param buf - The buffer containing the outgoing packet. */ -void tls_post_encrypt(struct tls_multi *multi, struct buffer *buf); +void tls_post_encrypt(struct tls_multi *multi, const struct buffer *buf); /** @} name Functions for managing security parameter state for data chann= el packets */ @@ -461,7 +461,8 @@ */ bool tls_session_update_crypto_params(struct tls_multi *multi, struct tls_= session *session, struct options *options, struct fram= e *frame, - struct frame *frame_fragment, struct= link_socket_info *lsi, + struct frame *frame_fragment, + const struct link_socket_info *lsi, dco_context_t *dco); /* @@ -525,7 +526,7 @@ #define PD_VERBOSE (1 << 10) #define PD_TLS_CRYPT (1 << 11) -const char *protocol_dump(struct buffer *buffer, unsigned int flags, struc= t gc_arena *gc); +const char *protocol_dump(const struct buffer *buffer, unsigned int flags,= struct gc_arena *gc); /* * debugging code @@ -573,7 +574,7 @@ /* Special method to skip the three way handshake RESET stages. This is * used by the HMAC code when seeing a packet that matches the previous * HMAC based stateless server state */ -bool session_skip_to_pre_start(struct tls_session *session, struct tls_pre= _decrypt_state *state, - struct link_socket_actual *from); +bool session_skip_to_pre_start(struct tls_session *session, const struct t= ls_pre_decrypt_state *state, + const struct link_socket_actual *from); #endif /* ifndef OPENVPN_SSL_H */ diff --git a/src/openvpn/ssl_backend.h b/src/openvpn/ssl_backend.h index 816fb9c..ed395e7 100644 --- a/src/openvpn/ssl_backend.h +++ b/src/openvpn/ssl_backend.h @@ -144,7 +144,7 @@ * * @return true if the context is initialised, false if not. */ -bool tls_ctx_initialised(struct tls_root_ctx *ctx); +bool tls_ctx_initialised(const struct tls_root_ctx *ctx); /** * Set any library specific options. @@ -177,7 +177,7 @@ * @param ciphers String containing : delimited cipher names, or NUL= L to use * sane defaults. */ -void tls_ctx_restrict_ciphers_tls13(struct tls_root_ctx *ctx, const char *= ciphers); +void tls_ctx_restrict_ciphers_tls13(const struct tls_root_ctx *ctx, const = char *ciphers); /** * Set the TLS certificate profile. The profile defines which crypto diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 9d408c0..7893be0 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -161,7 +161,7 @@ } bool -tls_ctx_initialised(struct tls_root_ctx *ctx) +tls_ctx_initialised(const struct tls_root_ctx *ctx) { /* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */ @@ -284,7 +284,7 @@ } void -tls_ctx_restrict_ciphers_tls13(struct tls_root_ctx *ctx, const char *ciphe= rs) +tls_ctx_restrict_ciphers_tls13(const struct tls_root_ctx *ctx, const char = *ciphers) { if (ciphers =3D=3D NULL) { diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index 306f85cd..706d78d 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -147,7 +147,7 @@ } bool -tls_ctx_initialised(struct tls_root_ctx *ctx) +tls_ctx_initialised(const struct tls_root_ctx *ctx) { /* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */ @@ -509,7 +509,7 @@ #endif void -tls_ctx_restrict_ciphers_tls13(struct tls_root_ctx *ctx, const char *ciphe= rs) +tls_ctx_restrict_ciphers_tls13(const struct tls_root_ctx *ctx, const char = *ciphers) { if (ciphers =3D=3D NULL) { @@ -1165,7 +1165,7 @@ } static void -tls_ctx_load_cert_uri(struct tls_root_ctx *tls_ctx, const char *uri) +tls_ctx_load_cert_uri(const struct tls_root_ctx *tls_ctx, const char *uri) { #if defined(HAVE_OPENSSL_STORE_API) X509 *x =3D NULL; @@ -2078,7 +2078,7 @@ } static void -bio_debug_data(const char *mode, BIO *bio, const uint8_t *buf, int len, co= nst char *desc) +bio_debug_data(const char *mode, const BIO *bio, const uint8_t *buf, int l= en, const char *desc) { struct gc_arena gc =3D gc_new(); if (len > 0) @@ -2092,7 +2092,7 @@ } static void -bio_debug_oc(const char *mode, BIO *bio) +bio_debug_oc(const char *mode, const BIO *bio) { open_biofp(); fprintf(biofp, "BIO %s time=3D%" PRIi64 " bio=3D" ptr_format "\n", mod= e, (int64_t)time(NULL), diff --git a/src/openvpn/ssl_pkt.c b/src/openvpn/ssl_pkt.c index 1805995..6b53e7e 100644 --- a/src/openvpn/ssl_pkt.c +++ b/src/openvpn/ssl_pkt.c @@ -57,7 +57,7 @@ * @return if the swap was successful (buf was large enough) */ static bool -swap_hmac(struct buffer *buf, const struct crypto_options *co, bool incomi= ng) +swap_hmac(const struct buffer *buf, const struct crypto_options *co, bool = incoming) { ASSERT(co); @@ -117,7 +117,7 @@ */ static void tls_wrap_control(struct tls_wrap_ctx *ctx, uint8_t header, struct buffer *= buf, - struct session_id *session_id) + const struct session_id *session_id) { if (ctx->mode =3D=3D TLS_WRAP_AUTH || ctx->mode =3D=3D TLS_WRAP_NONE) { @@ -403,9 +403,9 @@ struct buffer -tls_reset_standalone(struct tls_wrap_ctx *ctx, struct tls_auth_standalone = *tas, - struct session_id *own_sid, struct session_id *remote= _sid, uint8_t header, - bool request_resend_wkc) +tls_reset_standalone(struct tls_wrap_ctx *ctx, const struct tls_auth_stand= alone *tas, + const struct session_id *own_sid, const struct sessio= n_id *remote_sid, + uint8_t header, bool request_resend_wkc) { /* Copy buffer here to point at the same data but allow tls_wrap_contr= ol * to potentially change buf to point to another buffer without diff --git a/src/openvpn/ssl_pkt.h b/src/openvpn/ssl_pkt.h index ac9d4be..ffd34f4 100644 --- a/src/openvpn/ssl_pkt.h +++ b/src/openvpn/ssl_pkt.h @@ -220,8 +220,9 @@ * from the tls pre decrypt state. * */ -struct buffer tls_reset_standalone(struct tls_wrap_ctx *ctx, struct tls_au= th_standalone *tas, - struct session_id *own_sid, struct sess= ion_id *remote_sid, +struct buffer tls_reset_standalone(struct tls_wrap_ctx *ctx, const struct = tls_auth_standalone *tas, + const struct session_id *own_sid, + const struct session_id *remote_sid, uint8_t header, bool request_resend_wkc= ); diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index e5b55a1..0298106 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -1137,7 +1137,7 @@ * cache. */ static bool -tls_authentication_status_use_cache(struct tls_multi *multi) +tls_authentication_status_use_cache(const struct tls_multi *multi) { unsigned int idx =3D min_uint(multi->tas_cache_num_updates, SIZE(cache= _intervals) - 1); time_t latency =3D cache_intervals[idx]; @@ -1281,7 +1281,7 @@ * Check if the script/plugin left a message in the auth failed message * file and relay it to the user */ static void -check_for_client_reason(struct tls_multi *multi, struct auth_deferred_stat= us *status) +check_for_client_reason(struct tls_multi *multi, const struct auth_deferre= d_status *status) { struct gc_arena gc =3D gc_new(); const char *msg =3D key_state_check_auth_failed_message_file(status, &= gc); @@ -1550,7 +1550,7 @@ #endif /* ifdef ENABLE_MANAGEMENT */ static bool -set_verify_user_pass_env(struct user_pass *up, struct tls_multi *multi, st= ruct tls_session *session) +set_verify_user_pass_env(const struct user_pass *up, struct tls_multi *mul= ti, struct tls_session *session) { /* Is username defined? */ if ((session->opt->ssl_flags & SSLF_AUTH_USER_PASS_OPTIONAL) || strlen= (up->username)) @@ -1578,7 +1578,7 @@ } bool -ssl_verify_username_length(struct tls_session *session, const char *userna= me) +ssl_verify_username_length(const struct tls_session *session, const char *= username) { if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME) && strlen(username) > TLS_USERNAME_LEN) diff --git a/src/openvpn/ssl_verify.h b/src/openvpn/ssl_verify.h index 3176d76..e77bc4a 100644 --- a/src/openvpn/ssl_verify.h +++ b/src/openvpn/ssl_verify.h @@ -202,7 +202,7 @@ * @return true if name is under limit or username-as-common-= name * is not active */ -bool ssl_verify_username_length(struct tls_session *session, const char *u= sername); +bool ssl_verify_username_length(const struct tls_session *session, const c= har *username); /** * Runs the --client-crresponse script if one is defined. @@ -275,7 +275,7 @@ void auth_set_client_reason(struct tls_multi *multi, const char *client_re= ason); static inline const char * -tls_client_reason(struct tls_multi *multi) +tls_client_reason(const struct tls_multi *multi) { return multi->client_reason; } diff --git a/src/openvpn/status.c b/src/openvpn/status.c index c7d375b..cfbc38d 100644 --- a/src/openvpn/status.c +++ b/src/openvpn/status.c @@ -135,7 +135,7 @@ } void -status_reset(struct status_output *so) +status_reset(const struct status_output *so) { if (so && so->fd >=3D 0) { diff --git a/src/openvpn/status.h b/src/openvpn/status.h index 7953a4e..4c01d75 100644 --- a/src/openvpn/status.h +++ b/src/openvpn/status.h @@ -69,7 +69,7 @@ bool status_trigger(struct status_output *so); -void status_reset(struct status_output *so); +void status_reset(const struct status_output *so); void status_flush(struct status_output *so); diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index bc262cd..a662b94 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -835,7 +835,7 @@ const char *ifconfig_ipv6_local_parm, /* --ifconfig parm 1 IP= v6 */ int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 IP= v6 */ - struct addrinfo *local_public, struct addrinfo *remote_public, co= nst bool strict_warn, + const struct addrinfo *local_public, const struct addrinfo *remot= e_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt) { if (!tt) @@ -978,7 +978,7 @@ * -> helper function to simplify code below */ static void -add_route_connected_v6_net(struct tuntap *tt, const struct env_set *es) +add_route_connected_v6_net(const struct tuntap *tt, const struct env_set *= es) { struct route_ipv6 r6; @@ -1020,7 +1020,7 @@ */ in_addr_t -create_arbitrary_remote(struct tuntap *tt) +create_arbitrary_remote(const struct tuntap *tt) { in_addr_t remote; @@ -1592,7 +1592,7 @@ } static void -undo_ifconfig_ipv4(struct tuntap *tt, openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv4(const struct tuntap *tt, openvpn_net_ctx_t *ctx) { #if defined(TARGET_LINUX) int netbits =3D netmask_to_netbits2(tt->remote_netmask); @@ -1627,7 +1627,7 @@ } static void -undo_ifconfig_ipv6(struct tuntap *tt, openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv6(const struct tuntap *tt, openvpn_net_ctx_t *ctx) { #if defined(TARGET_LINUX) if (net_addr_v6_del(ctx, tt->actual_name, &tt->local_ipv6, tt->netbits= _ipv6) < 0) @@ -1652,7 +1652,7 @@ } void -undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx) +undo_ifconfig(const struct tuntap *tt, openvpn_net_ctx_t *ctx) { if (tt->backend_driver !=3D DRIVER_NULL && tt->backend_driver !=3D DRI= VER_AFUNIX) { @@ -1808,7 +1808,7 @@ #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) static bool -tun_dco_enabled(struct tuntap *tt) +tun_dco_enabled(const struct tuntap *tt) { return tt->backend_driver =3D=3D DRIVER_DCO; } @@ -2055,13 +2055,13 @@ } ssize_t -write_tun(struct tuntap *tt, uint8_t *buf, int len) +write_tun(const struct tuntap *tt, const uint8_t *buf, int len) { return write(tt->fd, buf, len); } ssize_t -read_tun(struct tuntap *tt, uint8_t *buf, int len) +read_tun(const struct tuntap *tt, const uint8_t *buf, int len) { return read(tt->fd, buf, len); } @@ -2260,13 +2260,13 @@ } ssize_t -write_tun(struct tuntap *tt, uint8_t *buf, int len) +write_tun(const struct tuntap *tt, const uint8_t *buf, int len) { return write(tt->fd, buf, len); } ssize_t -read_tun(struct tuntap *tt, uint8_t *buf, int len) +read_tun(const struct tuntap *tt, uint8_t *buf, int len) { return read(tt->fd, buf, len); } @@ -2596,7 +2596,7 @@ } ssize_t -write_tun(struct tuntap *tt, uint8_t *buf, int len) +write_tun(const struct tuntap *tt, const uint8_t *buf, int len) { struct strbuf sbuf; sbuf.len =3D len; @@ -2605,7 +2605,7 @@ } ssize_t -read_tun(struct tuntap *tt, uint8_t *buf, int len) +read_tun(const struct tuntap *tt, uint8_t *buf, int len) { struct strbuf sbuf; int f =3D 0; @@ -3320,7 +3320,7 @@ } int -tun_write_queue(struct tuntap *tt, struct buffer *buf) +tun_write_queue(struct tuntap *tt, const struct buffer *buf) { if (tt->writes.iostate =3D=3D IOSTATE_INITIAL) { @@ -3375,7 +3375,7 @@ } int -tun_write_win32(struct tuntap *tt, struct buffer *buf) +tun_write_win32(struct tuntap *tt, const struct buffer *buf) { int err =3D 0; int status =3D 0; @@ -5383,7 +5383,7 @@ } void -fork_register_dns_action(struct tuntap *tt) +fork_register_dns_action(const struct tuntap *tt) { if (tt && tt->options.register_dns && tt->options.msg_channel) { @@ -5473,7 +5473,7 @@ } static void -tuntap_get_mtu(struct tuntap *tt) +tuntap_get_mtu(const struct tuntap *tt) { ULONG mtu =3D 0; DWORD len; @@ -6048,7 +6048,7 @@ } void -tun_show_debug(struct tuntap *tt) +tun_show_debug(const struct tuntap *tt) { if (tt->backend_driver =3D=3D WINDOWS_DRIVER_TAP_WINDOWS6) { diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 6a7af85..be0baa9 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -272,9 +272,9 @@ void close_tun_handle(struct tuntap *tt); -ssize_t write_tun(struct tuntap *tt, uint8_t *buf, int len); +ssize_t write_tun(const struct tuntap *tt, const uint8_t *buf, int len); -ssize_t read_tun(struct tuntap *tt, uint8_t *buf, int len); +ssize_t read_tun(const struct tuntap *tt, uint8_t *buf, int len); #ifdef ENABLE_FEATURE_TUN_PERSIST void tuncfg(const char *dev, const char *dev_type, const char *dev_node, i= nt persist_mode, @@ -293,7 +293,7 @@ const char *ifconfig_ipv6_local_parm, /* --ifc= onfig parm 1 / IPv6 */ int ifconfig_ipv6_netbits_parm, /* --ifc= onfig parm 1 / bits */ const char *ifconfig_ipv6_remote_parm, /* --ifc= onfig parm 2 / IPv6 */ - struct addrinfo *local_public, struct addrinfo *re= mote_public, + const struct addrinfo *local_public, const struct = addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvp= n_net_ctx_t *ctx, struct tuntap *tt); @@ -320,7 +320,7 @@ * @param tt the tuntap interface context * @param ctx the networking API opaque context */ -void undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx); +void undo_ifconfig(const struct tuntap *tt, openvpn_net_ctx_t *ctx); bool is_dev_type(const char *dev, const char *dev_type, const char *match_= type); @@ -351,7 +351,7 @@ #define IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPEN static inline int -ifconfig_order(struct tuntap *tt) +ifconfig_order(const struct tuntap *tt) { if (tt->backend_driver =3D=3D DRIVER_AFUNIX) { @@ -381,7 +381,7 @@ #define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUN static inline int -route_order(struct tuntap *tt) +route_order(const struct tuntap *tt) { if (tt->backend_driver =3D=3D DRIVER_AFUNIX) { @@ -454,13 +454,13 @@ const char *tap_win_getinfo(const struct tuntap *tt, struct gc_arena *gc); -void tun_show_debug(struct tuntap *tt); +void tun_show_debug(const struct tuntap *tt); bool dhcp_release_by_adapter_index(const DWORD adapter_index); bool dhcp_renew_by_adapter_index(const DWORD adapter_index); -void fork_register_dns_action(struct tuntap *tt); +void fork_register_dns_action(const struct tuntap *tt); void ipconfig_register_dns(const struct env_set *es); @@ -470,7 +470,7 @@ int tun_read_queue(struct tuntap *tt, int maxsize); -int tun_write_queue(struct tuntap *tt, struct buffer *buf); +int tun_write_queue(struct tuntap *tt, const struct buffer *buf); static inline bool tuntap_stop(int status) @@ -529,13 +529,13 @@ } static inline bool -tuntap_is_dco_win(struct tuntap *tt) +tuntap_is_dco_win(const struct tuntap *tt) { return tt && tt->backend_driver =3D=3D DRIVER_DCO; } static inline bool -tuntap_is_dco_win_timeout(struct tuntap *tt, int status) +tuntap_is_dco_win_timeout(const struct tuntap *tt, int status) { return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() =3D= =3D ERROR_NETNAME_DELETED); } @@ -555,25 +555,25 @@ } static inline void -tun_standby_init(struct tuntap *tt) +tun_standby_init(const struct tuntap *tt) { } =20 static inline bool -tun_standby(struct tuntap *tt) +tun_standby(const struct tuntap *tt) { return true; } static inline bool -tuntap_is_dco_win(struct tuntap *tt) +tuntap_is_dco_win(const struct tuntap *tt) { return false; } static inline bool -tuntap_is_dco_win_timeout(struct tuntap *tt, int status) +tuntap_is_dco_win_timeout(const struct tuntap *tt, int status) { return false; } diff --git a/src/openvpn/tun_afunix.c b/src/openvpn/tun_afunix.c index a67a472..e9223bc 100644 --- a/src/openvpn/tun_afunix.c +++ b/src/openvpn/tun_afunix.c @@ -48,7 +48,7 @@ static void -tun_afunix_exec_child(const char *dev_node, struct tuntap *tt, struct env_= set *env) +tun_afunix_exec_child(const char *dev_node, struct tuntap *tt, const struc= t env_set *env) { const char *msgprefix =3D "ERROR: failure executing process for tun:"; struct argv argv =3D argv_new(); @@ -73,7 +73,7 @@ } void -open_tun_afunix(struct options *o, int mtu, struct tuntap *tt, struct env_= set *orig_env) +open_tun_afunix(const struct options *o, int mtu, struct tuntap *tt, const= struct env_set *orig_env) { struct gc_arena gc =3D gc_new(); diff --git a/src/openvpn/tun_afunix.h b/src/openvpn/tun_afunix.h index 5b6a8e0..fb88eb2 100644 --- a/src/openvpn/tun_afunix.h +++ b/src/openvpn/tun_afunix.h @@ -31,7 +31,7 @@ * the user provided taking care of implementing the actual tun * device. */ -void open_tun_afunix(struct options *o, int mtu, struct tuntap *tt, struct= env_set *env); +void open_tun_afunix(const struct options *o, int mtu, struct tuntap *tt, = const struct env_set *env); /** diff --git a/src/openvpn/vlan.c b/src/openvpn/vlan.c index bffc60e..cd32a9b 100644 --- a/src/openvpn/vlan.c +++ b/src/openvpn/vlan.c @@ -288,7 +288,7 @@ } void -vlan_process_outgoing_tun(struct multi_context *m, struct multi_instance *= mi) +vlan_process_outgoing_tun(const struct multi_context *m, struct multi_inst= ance *mi) { if (!m->top.options.vlan_tagging) { diff --git a/src/openvpn/vlan.h b/src/openvpn/vlan.h index 9389f89..cd2f66f 100644 --- a/src/openvpn/vlan.h +++ b/src/openvpn/vlan.h @@ -35,6 +35,6 @@ bool vlan_is_tagged(const struct buffer *buf); -void vlan_process_outgoing_tun(struct multi_context *m, struct multi_insta= nce *mi); +void vlan_process_outgoing_tun(const struct multi_context *m, struct multi= _instance *mi); #endif /* VLAN_H */ diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h index ef32062..bcbfa67 100644 --- a/src/openvpn/win32.h +++ b/src/openvpn/win32.h @@ -226,7 +226,7 @@ void overlapped_io_close(struct overlapped_io *o); static inline bool -overlapped_io_active(struct overlapped_io *o) +overlapped_io_active(const struct overlapped_io *o) { return o->iostate =3D=3D IOSTATE_QUEUED || o->iostate =3D=3D IOSTATE_I= MMEDIATE_RETURN; } diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsic= a.c index a861e8a..25fa1e4 100644 --- a/src/openvpnmsica/openvpnmsica.c +++ b/src/openvpnmsica/openvpnmsica.c @@ -77,7 +77,7 @@ * @return ERROR_SUCCESS on success; An error code otherwise */ static UINT -setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ st= ruct msica_arg_seq *seq) +setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ co= nst struct msica_arg_seq *seq) { UINT uiResult; LPWSTR szSequence =3D msica_arg_seq_join(seq); diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 628ec85..1fff6af 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -521,7 +521,7 @@ static SOCKADDR_INET -sockaddr_inet(short family, inet_address_t *addr) +sockaddr_inet(short family, const inet_address_t *addr) { SOCKADDR_INET sa_inet; ZeroMemory(&sa_inet, sizeof(sa_inet)); @@ -3733,7 +3733,7 @@ static DWORD UpdateWaitHandles(LPHANDLE *handles_ptr, LPDWORD count, HANDLE io_event, H= ANDLE exit_event, - list_item_t *threads) + const list_item_t *threads) { static DWORD size =3D 10; static LPHANDLE handles =3D NULL; diff --git a/tests/unit_tests/openvpn/mock_management.c b/tests/unit_tests/= openvpn/mock_management.c index 77f6ce2..fff4c2b 100644 --- a/tests/unit_tests/openvpn/mock_management.c +++ b/tests/unit_tests/openvpn/mock_management.c @@ -36,7 +36,7 @@ struct management *management; /* GLOBAL */ void -management_auth_failure(struct management *man, const char *type, const ch= ar *reason) +management_auth_failure(const struct management *man, const char *type, co= nst char *reason) { ASSERT(false); } diff --git a/tests/unit_tests/openvpn/test_misc.c b/tests/unit_tests/openvp= n/test_misc.c index 4a055e7..af96764 100644 --- a/tests/unit_tests/openvpn/test_misc.c +++ b/tests/unit_tests/openvpn/test_misc.c @@ -146,7 +146,7 @@ } static struct hash_element * -hash_lookup_by_value(struct hash *hash, void *value) +hash_lookup_by_value(struct hash *hash, const void *value) { struct hash_iterator hi; struct hash_element *he; diff --git a/tests/unit_tests/openvpn/test_user_pass.c b/tests/unit_tests/o= penvpn/test_user_pass.c index c0a0866..7636a33 100644 --- a/tests/unit_tests/openvpn/test_user_pass.c +++ b/tests/unit_tests/openvpn/test_user_pass.c @@ -59,7 +59,7 @@ return mock(); } void -management_auth_failure(struct management *man, const char *type, const ch= ar *reason) +management_auth_failure(const struct management *man, const char *type, co= nst char *reason) { assert_true(0); } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1663?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58 Gerrit-Change-Number: 1663 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --eNyCIsd9vXA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld uploaded patch set #3 to this change.

<= p>View C= hange

Remove instances of constParameterPointer cppche=
ck warnings

This requires a few suppressions since cppcheck
doesn= 't quite understand the different code-paths
implemented by preproce= ssor defines.

Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58Signed-off-by: Frank Lichtenheld <frank@...2641...>
---
M dev= -tools/cppcheck-suppression
M sample/sample-plugins/client-connect/sampl= e-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sampl= e/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c
= M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/clinat.c<= br>M src/openvpn/clinat.h
M src/openvpn/comp.c
M src/openvpn/comp.hM src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/dco.cM src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_i= nternal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_win.c
M src/= openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/event.h
M src/op= envpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src= /openvpn/init.h
M src/openvpn/interval.h
M src/openvpn/list.c
M sr= c/openvpn/list.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M s= rc/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/mss.c
M src/o= penvpn/mss.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openv= pn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvp= n/networking.h
M src/openvpn/networking_iproute2.c
M src/openvpn/netw= orking_sitnl.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
= M src/openvpn/options.c
M src/openvpn/options_parse.c
M src/openvpn/o= time.c
M src/openvpn/otime.h
M src/openvpn/proto.h
M src/openvpn/p= roxy.c
M src/openvpn/proxy.h
M src/openvpn/ps.c
M src/openvpn/ps.h=
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util= .c
M src/openvpn/reliable.c
M src/openvpn/reliable.h
M src/openvpn= /route.c
M src/openvpn/schedule.c
M src/openvpn/socket.c
M src/ope= nvpn/socket.h
M src/openvpn/socket_util.h
M src/openvpn/socks.c
M = src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/= openvpn/ssl_backend.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_o= penssl.c
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/ope= nvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/status.cM src/openvpn/status.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M= src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vl= an.c
M src/openvpn/vlan.h
M src/openvpn/win32.h
M src/openvpnmsica= /openvpnmsica.c
M src/openvpnserv/interactive.c
M tests/unit_tests/op= envpn/mock_management.c
M tests/unit_tests/openvpn/test_misc.c
M test= s/unit_tests/openvpn/test_user_pass.c
88 files changed, 322 insertions(+= ), 281 deletions(-)

git pull ssh://gerrit.openvp=
n.net:29418/openvpn refs/changes/63/1663/3
diff --git a/dev-tools/c=
ppcheck-suppression b/dev-tools/cppcheck-suppression
index = 900e03c..e392f8f 100644
--- a/dev-tools/cppcheck-suppressio= n
+++ b/dev-tools/cppcheck-suppression
@@ -= 2,7 +2,6 @@
# occurences right now. They still should be f= ixed at some point
constParameter
constPa= rameterCallback
-constP= arameterPointer
invalidPrintfArgType_sint
= invalidPrintfArgType_uint
usleepCalled
@@= -33,6 +32,38 @@
badBitmaskCheck:tests/unit_tests/openvpn/= test_pkt.c
# IGN: we store integers in pointers
= CastAddressToIntegerAtReturn:src/openvpn/multi.c
+constParameterPointer:/usr/include/*
+# IGN: test files prov= ide mocks/stubs that match prototypes from headers exactly
+constParameterPointer:tests/unit_tes= ts/openvpn/mock_*
+co= nstParameterPointer:tests/unit_tests/openvpn/test_*
+constParameterPointer:tests/unit_tests/op= envpnserv/test_*
+# F= P: different crypto implementations but same API
+constParameterPointer:src/openvpn/crypto_mbedt= ls_legacy.c:85
+const= ParameterPointer:src/openvpn/crypto_openssl.c:172
+constParameterPointer:src/openvpn/crypto_open= ssl.c:1456
+constPara= meterPointer:src/openvpn/cryptoapi.c:58
+constParameterPointer:src/openvpn/ssl_mbedtls.c<= br>+constParameterPointer:src/o= penvpn/ssl_openssl.c
= +constParameterPointer:src/openvpn/ssl_verify_mbedtls.c
+# IGN: too many different implementatio= ns, not worth it
+con= stParameterPointer:src/openvpn/dco*
+# FP: parameters are modified on some platform only<= br>+constParameterPointer:src/o= penvpn/dns.c:859
+con= stParameterPointer:src/openvpn/error.c:223
+constParameterPointer:src/openvpn/manage.c:344
+constParameterPointer:src= /openvpn/manage.c:3332
+constParameterPointer:src/openvpn/misc.c:812
+constParameterPointer:= src/openvpn/options.c:3205
+constParameterPointer:src/openvpn/route.c:3947
+constParameterPointer:src/openvpn/socket.= c:2244
+constParamete= rPointer:src/openvpn/socket.h:726
+constParameterPointer:src/openvpn/socket.h:825
+constParameterPointer:src/openvpn/= tun.c:560

+constParam= eterPointer:src/openvpn/tun.c:2188
+constParameterPointer:src/openvpn/tun_afunix.c
+# FP: local is modified via cast = inside function

+cons= tParameterPointer:src/openvpn/dco.c:560
# IGN: event code = uses a pointer to store integers
intToPointerCast:src/open= vpn/forward.c
intToPointerCast:src/openvpn/multi_io.c
diff --git a/sample/sample-plugins/client-connect/sample-client= -connect.c b/sample/sample-plugins/client-connect/sample-client-connect.c
index 420de61..cbd98e8 100644
--- a/sample/s= ample-plugins/client-connect/sample-client-connect.c
+++ b/= sample/sample-plugins/client-connect/sample-client-connect.c
@@ -344,7 +344,7 @@

}

= int
-openvpn_plugin_cl= ient_connect(struct plugin_context *context, const char **argv, const char = **envp)
+openvpn_plug= in_client_connect(const struct plugin_context *context, const char **argv, = const char **envp)
{
/* log environme= nt variables handed to us by OpenVPN, but
* only if &= quot;setenv verb" is 3 or higher (arbitrary number)
@@= -465,7 +465,7 @@

int
o= penvpn_plugin_client_connect_defer_v2(struct plugin_context *context,
- = struct plugin_per_client_context *pcc,
+ const= struct plugin_per_client_context *pcc,
= struct openvpn_plugin_string_list **return_list)
{
time_t time_left =3D pcc->sleep_until= - time(NULL);
diff --git a/sample/sample-plugins/defer/mul= ti-auth.c b/sample/sample-plugins/defer/multi-auth.c
index = bacf557..cdd616f 100644
--- a/sample/sample-plugins/defer/m= ulti-auth.c
+++ b/sample/sample-plugins/defer/multi-auth.c<= /span>
@@ -255,7 +255,7 @@
}

static bool
-do_auth_user_pass(struct plugin_context *context, const char *username= , const char *password)
+do_auth_user_pass(const struct plugin_context *context, const char *use= rname, const char *password)
{
plog(c= ontext, PLOG_NOTE, "expect_user=3D%s, received_user=3D%s, expect_passw= =3D%s, received_passw=3D%s",
np(context->= test_valid_user), np(username), np(context->test_valid_pass), np(passwor= d));
@@ -279,7 +279,7 @@

=
static int
-auth_user_pass_verify(struct plugin_context *context, struct plugin= _per_client_context *pcc,
+auth_user_pass_verify(const struct plugin_context *context, struct pl= ugin_per_client_context *pcc,
const = char *argv[], const char *envp[])
{
/= * get username/password from envp string array */
diff --gi= t a/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexpor= ter.c b/sample/sample-plugins/keying-material-exporter-demo/keyingmateriale= xporter.c
index 25c9ff5..512861a 100644
---= a/sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexport= er.c
+++ b/sample/sample-plugins/keying-material-exporter-d= emo/keyingmaterialexporter.c
@@ -186,7 +186,7 @@
= }

static void
-file_store(char *file, char *content)
+file_store(const char *= file, const char *content)
{
FILE *f;=
if (!(f =3D fopen(file, "w+")))
<= span>@@ -202,7 +202,7 @@

server_store(struct openvpn_plugi= n_args_func_in const *args)
{
struct = plugin *plugin =3D (struct plugin *)args->handle;
- struct session *sess =3D (struct sessio= n *)args->per_client_context;
+ const struct session *sess =3D (struct session *)args->= per_client_context;

char file[MAXPAT= H];
snprintf(file, sizeof(file) - 1, "/tmp/openvp= n_sso_%s", sess->key);
@@ -214,7 +214,7 @@ client_store(struct openvpn_plugin_args_func_in const *args)
{
struct plugin *plugin =3D (struct plugin= *)args->handle;
- = struct session *sess =3D (struct session *)args->per_client_context;
+ const struct sess= ion *sess =3D (struct session *)args->per_client_context;

char *file =3D "/tmp/openvpn_sso_user";<= /span>
ovpn_note("app session file: %s", file);
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index 131e1d6..f9990d6 100644
--- a/src/openvpn/= buffer.c
+++ b/src/openvpn/buffer.c
@@ -290= ,7 +290,7 @@
* truncated by buf_printf
= */
void
+buf_catrunc(const struct buffer *buf, con= st char *str)
{
if (buf_forward_capac= ity(buf) <=3D 1)
{
@@ -1091,7 +1091= ,7 @@
}

bool
= -string_check_buf(struct buffer *= buf, const unsigned int inclusive, const unsigned int exclusive)
= +string_check_buf(const struct = buffer *buf, const unsigned int inclusive, const unsigned int exclusive)
{
ASSERT(buf);
=
diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.hindex 6a751ad..0d3b202 100644
--- a/src/openvpn/buf= fer.h
+++ b/src/openvpn/buffer.h
@@ -487,7 = +487,7 @@
* write a string to the end of a buffer that wa= s
* truncated by buf_printf
*/-void buf_catrunc(struct buffer= *buf, const char *str);
+void buf_catrunc(const struct buffer *buf, const char *str);
/*
* Parse a string based on a = given delimiter char
@@ -774,7 +774,7 @@
}=

static inline int
-buf_peek_u8(struct buffer *buf)
<= span style=3D"color: hsl(120, 100%, 40%);">+buf_peek_u8(const struct buffer= *buf)

{
int ret;
= if (BLEN(buf) < 1)
@@ -923,7 +923,7 @@
* @param exclusive Character classes that are not allowed even if they a= re also in inclusive.

* @return True if the string consis= ts only of allowed characters, false otherwise.
*/=
-bool string_check_buf(struct= buffer *buf, const unsigned int inclusive,
+bool string_check_buf(const struct buffer *buf, con= st unsigned int inclusive,
const uns= igned int exclusive);

/**
@@ -1102,7 +1102,7 @@

}

= static inline void
-check_malloc_return(void *p)
+check_malloc_return(const void *p)
{ if (!p)
{
diff --git a/sr= c/openvpn/clinat.c b/src/openvpn/clinat.c
index 32c1325..b4= 65950 100644
--- a/src/openvpn/clinat.c
+++= b/src/openvpn/clinat.c
@@ -159,7 +159,7 @@
#endif


static void
-print_pkt(struct openvpn_iphdr *iph, cons= t char *prefix, const int direction, const msglvl_t msglevel)
+print_pkt(const struct openvpn_ip= hdr *iph, const char *prefix, const int direction, const msglvl_t msglevel)=

{
struct gc_arena gc =3D gc_new();

@@ -181,7 +181,7 @@
}

void
-client_nat_transform(const struct client_nat_option_list *li= st, struct buffer *ipbuf,
+client_nat_transform(const struct client_nat_option_list *list, const= struct buffer *ipbuf,
const int dire= ction)
{
struct ip_tcp_udp_hdr *h =3D= (struct ip_tcp_udp_hdr *)BPTR(ipbuf);
diff --git a/src/ope= nvpn/clinat.h b/src/openvpn/clinat.h
index 1e8ceb3..bc56037= 100644
--- a/src/openvpn/clinat.h
+++ b/sr= c/openvpn/clinat.h
@@ -60,7 +60,7 @@
= const char *network, const char *netmask,
const char *foreign_networ= k, msglvl_t msglevel);

-void client_nat_transform(const struct client_nat_option= _list *list, struct buffer *ipbuf,
+void client_nat_transform(const struct client_nat_option_lis= t *list, const struct buffer *ipbuf,
= const int direction);

#endif /* if = !defined(CLINAT_H) */
diff --git a/src/openvpn/comp.c b/src= /openvpn/comp.c
index b88b79f..387a7c4 100644
--- a/src/openvpn/comp.c

+++ b/src/openvpn/comp.c=
@@ -159,7 +159,7 @@
#endif /* USE_COMP */=

bool
-check_compression_settings_valid(struct compress_options *info,= msglvl_t msglevel)
+= check_compression_settings_valid(const struct compress_options *info, msglv= l_t msglevel)
{
/*
= * We also allow comp-stub-v2 here as it technically allows escaping of<= /span>
diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h=
index 29a90a2..ad80243 100644
--- a/src/openvpn/c= omp.h
+++ b/src/openvpn/comp.h
@@ -91,7 +91= ,7 @@
* flags of allow-compression and also the whether a= lgorithms are compiled
* in
*/-bool check_compression_setting= s_valid(struct compress_options *info, msglvl_t msglevel);
+bool check_compression_settings_vali= d(const struct compress_options *info, msglvl_t msglevel);
=
#ifdef USE_COMP
#include "buffer.h= "
diff --git a/src/openvpn/crypto.c b/src/openvpn/cryp= to.c
index a9a33c0..e04eedf 100644
--- a/sr= c/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -1105,7 +1105,7 @@

}

static bool

-key_is= _zero(struct key *key, const struct key_type *kt)
+key_is_zero(const struct key *key, const stru= ct key_type *kt)
{
size_t cipher_leng= th =3D cipher_kt_key_size(kt->cipher);
for (size_t = i =3D 0; i < cipher_length; ++i)
@@ -1123,7 +1123,7 @@
* Make sure that cipher key is a valid key for current key= _type.
*/
bool
-check_key(struct key *key, const struct key_typ= e *kt)
+check_key(con= st struct key *key, const struct key_type *kt)
{ if (cipher_defined(kt->cipher))
{
@@ -1196,7 +1196,7 @@
}

void
-test_= crypto(struct crypto_options *co, struct frame *frame)
+test_crypto(struct crypto_options *co, c= onst struct frame *frame)
{
int i, j;=
struct gc_arena gc =3D gc_new();
diff= --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h
index = fbca2a0..044f2d2 100644
--- a/src/openvpn/crypto.h+++ b/src/openvpn/crypto.h
@@ -414,7 +414,7 @@
*/
int write_key_file(const int nkeys, const= char *filename);

-bool check_key(struct key *key, const struct key_type *kt);
+bool check_key(const = struct key *key, const struct key_type *kt);

/**

* Initialize a key_type structure with.@@ -609,7 +609,7 @@
/** Print a cipher list entry = */
void print_cipher(const char *cipher);
=
-void test_crypto(str= uct crypto_options *co, struct frame *f);
+void test_crypto(struct crypto_options *co, const str= uct frame *f);


/* key = direction functions */
diff --git a/src/openvpn/dco.c b/src= /openvpn/dco.c
index 69ce1d7..f509a29 100644
--- a/src/openvpn/dco.c

+++ b/src/openvpn/dco.c@@ -556,7 +556,7 @@
}

<= span> static bool

-dco_= multi_get_localaddr(struct multi_context *m, struct multi_instance *mi,
+dco_multi_get_localaddr= (const struct multi_context *m, const struct multi_instance *mi,
= struct sockaddr_storage *local)
{

#if ENABLE_IP_PKTINFO
@@ -568,7 +56= 8,7 @@
return false;
}=

- struct= link_socket_actual *actual =3D &c->c2.link_socket_infos[0]->lsa-= >actual;
+ cons= t struct link_socket_actual *actual =3D &c->c2.link_socket_infos[0]-= >lsa->actual;

switch (actual-&= gt;dest.addr.sa.sa_family)
{
@@ -606,7= +606,7 @@
}

int=
-dco_multi_add_new_peer(struc= t multi_context *m, struct multi_instance *mi)
+dco_multi_add_new_peer(const struct multi_contex= t *m, struct multi_instance *mi)
{
co= nst struct context *c =3D &mi->context;

= @@ -660,7 +660,7 @@
}

void

-dco_install_= iroute(struct multi_context *m, struct multi_instance *mi, struct mroute_ad= dr *addr)
+dco_instal= l_iroute(struct multi_context *m, struct multi_instance *mi, const struct m= route_addr *addr)
{
#if defined(TARGET_LI= NUX) || defined(TARGET_FREEBSD) || defined(_WIN32)
if = (!dco_enabled(&m->top.options))
@@ -779,7 +779,7 @@<= /span>
/* Checked if we added a host route as the assigne= d client IP address was
* outside the --ifconfig-= ipv6 tun interface config */
#if !defined(_WIN32)- struct in6_addr *dest = =3D &mi->context.c2.push_ifconfig_ipv6_local;
+ const struct in6_addr *dest =3D &= amp;mi->context.c2.push_ifconfig_ipv6_local;
if= (multi_check_push_ifconfig_ipv6_extra_route(mi, dest))
= {
/* On windows we do not install these = routes, so we also do not need to delete them */
diff --git= a/src/openvpn/dco.h b/src/openvpn/dco.h
index 4e5aad5..694= 875c 100644
--- a/src/openvpn/dco.h
+++ b/s= rc/openvpn/dco.h
@@ -204,7 +204,7 @@
* @p= aram mi the client instance
* @return 0 o= n success or a negative error code otherwise
*/-int dco_multi_add_new_peer(stru= ct multi_context *m, struct multi_instance *mi);
+int dco_multi_add_new_peer(const struct multi_= context *m, struct multi_instance *mi);

= /**
* Install an iroute in DCO, which means adding a rout= e to the system routing
@@ -215,7 +215,7 @@
* @param addr the route to add

*/
void dco_install_iroute(struct multi_context *m, struct multi_instance *m= i,

- = struct mroute_addr *addr);
+ const struct mroute_addr *addr);=

/**
* Remove all routes adde= d through the specified client
@@ -253,7 +253,7 @@ * a 64 bit packet counter and AEAD tag at the end.
*/

bool
-dco_supports_epoch_data(struct context *c);
+dco_supports_epoch_data(const struct context= *c);
#else /* if defined(ENABLE_DCO) */
=
typedef void *dco_context_t;
@@ -350,7 += 350,7 @@
}

static inlin= e int
-dco_multi_add_ne= w_peer(struct multi_context *m, struct multi_instance *mi)
+dco_multi_add_new_peer(const struct = multi_context *m, struct multi_instance *mi)
{
<= span> return 0;

}
@@ -384,7 +384,7 @@<= /span>
}

static inline bool
-dco_supports_epoch_data(= struct context *c)
+d= co_supports_epoch_data(const struct context *c)
{ return false;
}
diff --git a/= src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index= d933aaf..7346903 100644
--- a/src/openvpn/dco_freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@@ -930,7 +93= 0,7 @@
}

bool-dco_supports_epoch_data(struct = context *c)
+dco_supp= orts_epoch_data(const struct context *c)
{
return false;

}
diff --git a/src/ope= nvpn/dco_internal.h b/src/openvpn/dco_internal.h
index fcf8= aca..1022e66 100644
--- a/src/openvpn/dco_internal.h=
+++ b/src/openvpn/dco_internal.h
@@ -59,8 +59,9 @= @
* They are implemented by dco_linux.c
= */

-= int dco_new_peer(dco_context_t *dco, unsigned int peerid, socket_descriptor= _t sd, struct sockaddr *localaddr,
- struct sockaddr *remoteaddr, const struct in_= addr *vpn_ipv4, const struct in6_addr *vpn_ipv6);
+int dco_new_peer(dco_context_t *dco, unsigned= int peerid, socket_descriptor_t sd,
+ struct sockaddr *localaddr, struct sockad= dr *remoteaddr,
+ = const struct in_addr *vpn_ipv4, const struct in6_addr *vpn_ipv= 6);

int dco_del_peer(dco_context_t *dco,= unsigned int peerid);

diff --git a/src/o= penvpn/dco_linux.c b/src/openvpn/dco_linux.c
index 56f6259.= .31bbe87 100644
--- a/src/openvpn/dco_linux.c
+++ b/src/openvpn/dco_linux.c

@@ -114,7 +114,7 @@=
}

static struct nl_msg *
-ovpn_dco_nlmsg_create(dco_= context_t *dco, uint8_t cmd)
+ovpn_dco_nlmsg_create(const dco_context_t *dco, uint8_t cmd)
{
struct nl_msg *nl_msg =3D nlmsg_alloc();=
if (!nl_msg)
@@ -804,7 +804,7 @@

/* libnl < 3.11.0 does not implement nla_= get_uint() */
static uint64_t
-ovpn_nla_get_uint(struct nlattr *attr)
<= span style=3D"color: hsl(120, 100%, 40%);">+ovpn_nla_get_uint(const struct = nlattr *attr)

{
if (nla_len(attr) =3D= =3D sizeof(uint32_t))
{
@@ -916,7 +916= ,7 @@
}

static bool
-ovpn_iface_check(dco_cont= ext_t *dco, struct nlattr *attrs[])
+ovpn_iface_check(const dco_context_t *dco, struct nlattr *a= ttrs[])
{
/* we must know which inter= face this message is referring to in order to
* avoid= mixing messages for other instances
@@ -1340,7 +1340,7 @@<= /span>
}

bool
-dco_supports_epoch_data(struct context= *c)
+dco_supports_ep= och_data(const struct context *c)
{
r= eturn false;
}
diff --git a/src/openvpn/dc= o_win.c b/src/openvpn/dco_win.c
index b3268bc..8deb9d8 1006= 44
--- a/src/openvpn/dco_win.c
+++ b/src/op= envpn/dco_win.c
@@ -1100,7 +1100,7 @@
}

bool
-dco_supports_epoch_data(struct context *c)
+dco_supports_epoch_data(const struct= context *c)
{
OVPN_VERSION ver =3D {= 0 };
return dco_get_version(&ver) && ((ve= r.Major =3D=3D 2 && ver.Minor >=3D 8) || (ver.Major > 2));
diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.cindex a54ab3f..68173e6 100644
--- a/src/openvpn/dhc= p.c
+++ b/src/openvpn/dhcp.c
@@ -145,7 +145= ,7 @@
}

in_addr_t
-dhcp_extract_router_msg(str= uct buffer *ipbuf)
+d= hcp_extract_router_msg(const struct buffer *ipbuf)
{
struct dhcp_full *df =3D (struct dhcp_full *)BPTR(ipbuf);
const int optlen =3D
diff --git a/src/o= penvpn/dhcp.h b/src/openvpn/dhcp.h
index 38ebf8d..ed8a0c9 1= 00644
--- a/src/openvpn/dhcp.h
+++ b/src/op= envpn/dhcp.h
@@ -91,7 +91,7 @@

= #pragma pack()

-in_addr_t dhcp_extract_router_msg(struct buffer *ipbuf);<= /span>
+in_addr_t dhcp_extra= ct_router_msg(const struct buffer *ipbuf);

#if defined(_WIN32) || defined(DHCP_UNIT_TEST)

#include= "tun.h"
diff --git a/src/openvpn/event.h b/src/o= penvpn/event.h
index b784dfe..0940a1d 100644
--- a/src/openvpn/event.h

+++ b/src/openvpn/event.h
@@ -204,7 +204,7 @@
#else /* ifdef _WIN32 */

static inline void
-wait_signal(struct event_set *es, void *arg= )
+wait_signal(const = struct event_set *es, const void *arg)
{
= }

diff --git a/src/openvpn/forward.c b/sr= c/openvpn/forward.c
index 887d7d7..1d76859 100644--- a/src/openvpn/forward.c
+++ b/src/openvpn/forwar= d.c
@@ -231,7 +231,7 @@
}
=
static void
-parse_incoming_control_channel_command(struct context *c, struct b= uffer *buf)
+parse_in= coming_control_channel_command(struct context *c, const struct buffer *buf)=
{
if (buf_string_match_head_str(buf,= "AUTH_FAILED"))
{
@@ -501,7= +501,7 @@
}

int=
-get_server_poll_remaining_ti= me(struct event_timeout *server_poll_timeout)
+get_server_poll_remaining_time(const struct event= _timeout *server_poll_timeout)
{
upda= te_time();
int remaining =3D event_timeout_remaining(s= erver_poll_timeout);
@@ -598,7 +598,7 @@
= * Buffer reallocation, for use with null encryption.
*/
static inline void
-buffer_turnover(const uint8_t *orig_buf, struct buffer *dest_s= tub, struct buffer *src_stub,
+buffer_turnover(const uint8_t *orig_buf, struct buffer *dest_stub= , const struct buffer *src_stub,
struct bu= ffer *storage)
{
if (orig_buf =3D=3D = src_stub->data && src_stub->data !=3D storage->data)
@@ -885,7 +885,7 @@
*/

static inline void
-socks_postprocess_incoming_link(struct context *c, struct link_soc= ket *sock)
+socks_pos= tprocess_incoming_link(struct context *c, const struct link_socket *sock)
{
if (sock->socks_proxy && = sock->info.proto =3D=3D PROTO_UDP)
{
@@ -984,7 +984,7 @@

}

= bool
-process_incoming= _link_part1(struct context *c, struct link_socket_info *lsi, bool floated)<= /span>
+process_incoming_lin= k_part1(struct context *c, const struct link_socket_info *lsi, bool floated= )
{
struct gc_arena gc =3D gc_new();<= /span>
bool decrypt_status =3D false;
@@ -153= 4,7 +1534,7 @@
* @param client Determines whether to t= he send packet back via tun or link
*/
v= oid
-ipv6_send_icmp_unr= eachable(struct context *c, struct buffer *buf, bool client)
+ipv6_send_icmp_unreachable(struct = context *c, const struct buffer *buf, bool client)

{
#define MAX_ICMPV6LEN 1280
struct openvpn_= icmp6hdr icmp6out;
diff --git a/src/openvpn/forward.h b/src= /openvpn/forward.h
index 0d3e492..d8e07fa 100644
= --- a/src/openvpn/forward.h
+++ b/src/openvpn/forward= .h
@@ -112,7 +112,7 @@
*/
void encrypt_sign(struct context *c, bool comp_frag);


-int get_server_poll_rem= aining_time(struct event_timeout *server_poll_timeout);
+int get_server_poll_remaining_time(cons= t struct event_timeout *server_poll_timeout);

<= span> /********************************************************************= **/

/**
@@ -163,7 +163,7 @@
*

* @return true if packet is authenticated, false ot= herwise.
*/
-bool process_incoming_link_part1(struct context *c, struct link_soc= ket_info *lsi, bool floated);
+bool process_incoming_link_part1(struct context *c, const struct = link_socket_info *lsi, bool floated);

/*= *
* Continues processing a packet read from the external = network interface.
diff --git a/src/openvpn/init.c b/src/op= envpn/init.c
index 0861cb5..41fa557 100644
= --- a/src/openvpn/init.c
+++ b/src/openvpn/init.c@@ -817,7 +817,7 @@
}

<= span> static void

-init= _port_share(struct context *c)
+init_port_share(const struct context *c)
{
if (!port_share && (c->options.port_share_host = && c->options.port_share_port))
{@@ -1269,7 +1269,7 @@
* prepending to msg() output= .
*/
const char *
-format_common_name(struct context *c, struc= t gc_arena *gc)
+form= at_common_name(const struct context *c, struct gc_arena *gc)
{

struct buffer out =3D alloc_buf_gc(256, gc);
if (c->c2.tls_multi)
@@ -1755,7 +1755,7= @@


static bool=
-can_preserve_tun(struct tunt= ap *tt)
+can_preserve= _tun(const struct tuntap *tt)
{
if (t= t && tt->backend_driver =3D=3D DRIVER_AFUNIX)
= {
@@ -1777,7 +1777,7 @@
* @param c poi= nter to the connection context
*/
static= void
-add_wfp_block(st= ruct context *c)
+add= _wfp_block(const struct context *c)
{
#if= defined(_WIN32)
/* Fortify 'redirect-gateway bloc= k-local' with firewall rules? */
@@ -1803,7 +1803,7 @@<= /span>
* @param adapter_index the VPN adapter index
*/

static void
-del_wfp_block(struct context *c, unsigned long adapter_inde= x)
+del_wfp_block(con= st struct context *c, unsigned long adapter_index)
{
#if defined(_WIN32)
if (c->options.bloc= k_outside_dns || block_local_needed(c->c1.route_list))
d= iff --git a/src/openvpn/init.h b/src/openvpn/init.h
index 9= d5050d..af4393c 100644
--- a/src/openvpn/init.h
<= span>+++ b/src/openvpn/init.h

@@ -91,7 +91,7 @@
<= span>

unsigned int pull_permission_mask(const struct cont= ext *c);

-const char *format_common_name(struct context *c, struct gc_arena *gc)= ;
+const char *format= _common_name(const struct context *c, struct gc_arena *gc);

void reset_coarse_timers(struct context *c);
=
diff --git a/src/openvpn/interval.h b/src/openvpn/i= nterval.h
index 59051bd..0cfe202 100644
---= a/src/openvpn/interval.h
+++ b/src/openvpn/interval.h
@@ -89,7 +89,7 @@
}
static inline void
-interval_schedule_wakeup(struct interval *top, interval_t *wakeup)
+interval_schedule_wake= up(const struct interval *top, interval_t *wakeup)
{
const time_t local_now =3D now;
interv= al_earliest_wakeup(wakeup, top->last_test_true + top->refresh, local_= now);
@@ -214,7 +214,7 @@
* This function= does not check if the timeout is actually valid.
*/
static inline interval_t
-event_timeout_remaining(struct event_timeout *et)+event_timeout_remaining(const= struct event_timeout *et)
{
return (= interval_t)((et->last + et->n) - now);
}
<= span>diff --git a/src/openvpn/list.c b/src/openvpn/list.c

i= ndex 2e1cf05..c04ee4f 100644
--- a/src/openvpn/list.c
+++ b/src/openvpn/list.c
@@ -162,7 +162,7 @@
}

void
-hash_remove_by_value(struct hash *hash, v= oid *value)
+hash_rem= ove_by_value(struct hash *hash, const void *value)
{
struct hash_iterator hi;
const struct = hash_element *he;
diff --git a/src/openvpn/list.h b/src/ope= nvpn/list.h
index 04cc3ab..089637d 100644
-= -- a/src/openvpn/list.h
+++ b/src/openvpn/list.h
= @@ -73,7 +73,7 @@

bool hash_remove= _fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint3= 2_t hv);

-void hash_remove_by_value(struct hash *hash, void *value);
<= span style=3D"color: hsl(120, 100%, 40%);">+void hash_remove_by_value(struc= t hash *hash, const void *value);


struct= hash_iterator
{
diff --git a/src/openvpn/= manage.c b/src/openvpn/manage.c
index 604bbcd..17abfd8 1006= 44
--- a/src/openvpn/manage.c
+++ b/src/ope= nvpn/manage.c
@@ -330,7 +330,7 @@
}=

static void
-man_delete_unix_socket(struct management *man)+man_delete_unix_socket(const = struct management *man)
{
#if UNIX_SOCK_S= UPPORT
if ((man->settings.flags & (MF_UNIX_SOCK= | MF_CONNECT_AS_CLIENT)) =3D=3D MF_UNIX_SOCK)
@@ -675,7 +6= 75,7 @@
* for the log and echo commands.
= */
static void
-man_history(struct management *man, const char *parm, const cha= r *type, struct log_history *log,
+man_history(struct management *man, const char *parm, const c= har *type, const struct log_history *log,
bool= *realtime, const unsigned int lep_flags)
{
struct gc_arena gc =3D gc_new();

@@ -843,7 +843,7 @@=
}

static void-man_forget_passwords(struct ma= nagement *man)
+man_f= orget_passwords(const struct management *man)
{
= ssl_purge_auth(false);
(void)ssl_clean_auth= _token();
@@ -851,7 +851,7 @@
}
=
static void
-man_net(struct management *man)
+man_net(const struct management *man)
= {
if (man->persist.callback.show_net)=
{
@@ -887,7 +887,7 @@
#ifde= f ENABLE_PKCS11

static void
-man_pkcs11_id_count(struct managem= ent *man)

+man_pkcs11= _id_count(const struct management *man)
{
= msg(M_CLIENT, ">PKCS11ID-COUNT:%d", pkcs11_management_id_= count());
}
@@ -1350,7 +1350,7 @@ * @return Return whether p has n (or at least n) paramet= ers
*/
static bool
-man_need(struct management *man, const char= **p, const int n, unsigned int flags)
+man_need(const struct management *man, const char **p, c= onst int n, unsigned int flags)
{
int= i;
ASSERT(p[0]);
@@ -2365,7 +2365,7 @= @
* the route/ifconfig/open tun command. See doc/androi= d.txt for details.
*/
bool
-management_android_control(struct m= anagement *man, const char *command, const char *msg)

+management_android_control(const struct m= anagement *man, const char *command, const char *msg)
{
if (!man)
{
@@ -301= 3,7 +3013,7 @@
}

void
-management_up_down(stru= ct management *man, const char *updown, const struct env_set *es)+management_up_down(const stru= ct management *man, const char *updown, const struct env_set *es) {
if (man->settings.flags & MF_UP_DOWN)=
{
@@ -3023,13 +3023,13 @@
<= span> }


void
-management_notify(struct management *man, const c= har *severity, const char *type, const char *text)
+management_notify(const struct management *m= an, const char *severity, const char *type, const char *text)
{

msg(M_CLIENT, ">NOTIFY:%s,%s,%s", s= everity, type, text);
}

= void
-management_notif= y_generic(struct management *man, const char *str)
+management_notify_generic(const struct manag= ement *man, const char *str)
{
msg(M_= CLIENT, "%s", str);
}
@@ -3115,7= +3115,8 @@
}

void
-management_notify_client_c= lose(struct management *management, struct man_def_auth_context *mdac,
+management_notify_client= _close(const struct management *management,
+ struct man_def_auth_= context *mdac,
const struct= env_set *es)
{
if ((mdac->flags &= amp; DAF_INITIAL_AUTH) && !(mdac->flags & DAF_CONNECTION_CLO= SED))
@@ -3206,7 +3207,7 @@
}

void
-management_auth_failure(struct management *man, const char *type, con= st char *reason)
+man= agement_auth_failure(const struct management *man, const char *type, const = char *reason)
{
if (reason) {
@@ -3219,7 +3220,7 @@
}

void
-management_auth_token(struct management *man, const char *tok= en)
+management_auth_= token(const struct management *man, const char *token)
{
msg(M_CLIENT, ">PASSWORD:Auth-Token:%s", t= oken);
}
diff --git a/src/openvpn/manage.h= b/src/openvpn/manage.h
index 1be3549..ab68968 100644
--- a/src/openvpn/manage.h
+++ b/src/openvpn/man= age.h
@@ -376,12 +376,12 @@

void management_event_loop_n_seconds(struct management *man, int sec);<= /span>

-void= management_up_down(struct management *man, const char *updown, const struc= t env_set *es);
+void= management_up_down(const struct management *man, const char *updown, const= struct env_set *es);

-void management_notify(struct management *man, const char= *severity, const char *type,
+void management_notify(const struct management *man, const char *= severity, const char *type,
const c= har *text);

-void management_notify_generic(struct management *man, const char *= str);
+void managemen= t_notify_generic(const struct management *man, const char *str);
=
void management_notify_client_needing_auth(struct = management *management,
= const unsigned int auth_id,
@@ -391,7 +391,7 @@
void management_connection_established(struct management *ma= nagement,
struct ma= n_def_auth_context *mdac, const struct env_set *es);

-void management_notify_cli= ent_close(struct management *management,
+void management_notify_client_close(const struct manag= ement *management,
str= uct man_def_auth_context *mdac, const struct env_set *es);
=
void management_learn_addr(struct management *management= , struct man_def_auth_context *mdac,
@@ -476,12 +476,12 @@<= /span>
* OpenVPN calls here to indicate a password failure
*/

-void management_auth_failure(struct management *man, const char= *type, const char *reason);
+void management_auth_failure(const struct management *man, const c= har *type, const char *reason);

/*
* Echo an authentication token to management interface<= br> */
-void man= agement_auth_token(struct management *man, const char *token);
+void management_auth_token(const= struct management *man, const char *token);


/*

* These functions drive the bytecount in/out coun= ters.
diff --git a/src/openvpn/mbuf.c b/src/openvpn/mbuf.c<= /span>
index 5e1b585..39f85ba 100644
--- a/src/ope= nvpn/mbuf.c
+++ b/src/openvpn/mbuf.c
@@ -16= 0,7 +160,7 @@
}

void
-mbuf_dereference_instanc= e(struct mbuf_set *ms, struct multi_instance *mi)
+mbuf_dereference_instance(struct mbuf_set *ms= , const struct multi_instance *mi)
{
= if (ms)
{
diff --git a/src/openvpn/mbu= f.h b/src/openvpn/mbuf.h
index cfe698c..e368054 100644
--- a/src/openvpn/mbuf.h
+++ b/src/openvpn/mbuf= .h
@@ -75,7 +75,7 @@

boo= l mbuf_extract_item(struct mbuf_set *ms, struct mbuf_item *item);
-void mbuf_der= eference_instance(struct mbuf_set *ms, struct multi_instance *mi);+void mbuf_dereference_instan= ce(struct mbuf_set *ms, const struct multi_instance *mi);
=
static inline bool
mbuf_defined(const st= ruct mbuf_set *ms)
diff --git a/src/openvpn/mss.c b/src/ope= nvpn/mss.c
index 36bbb43..a7242a8 100644
--= - a/src/openvpn/mss.c
+++ b/src/openvpn/mss.c
@@ -43,7 +43,7 @@

* if yes, hand to mss_f= ixup_dowork()
*/
void
-mss_fixup_ipv4(struct buffer *buf, uint1= 6_t maxmss)
+mss_fixu= p_ipv4(const struct buffer *buf, uint16_t maxmss)
{=
const struct openvpn_iphdr *pip;
int hl= en;
@@ -80,7 +80,7 @@
* (IPv= 6 header structure is sufficiently different from IPv4...)
= */
void
-mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss)
+mss_fixup_ipv6(const struct buffer *bu= f, uint16_t maxmss)
{
const struct op= envpn_ipv6hdr *pip6;
struct buffer newbuf;
<= span>@@ -136,7 +136,7 @@

*/

<= span> void

-mss_fixup_d= owork(struct buffer *buf, uint16_t maxmss)
+mss_fixup_dowork(const struct buffer *buf, uint16_t = maxmss)
{
int olen, optlen; uint8_t *opt;
@@ -239,8 +239,8 @@
}


static void
-frame_calculate_fragment(struct frame *fram= e, struct key_type *kt, const struct options *options,
- struct link_socke= t_info *lsi)
+frame_c= alculate_fragment(struct frame *frame, const struct key_type *kt, const str= uct options *options,
+ const struct link_socket_info *lsi)
{

#if defined(ENABLE_FRAGMENT)
s= ize_t overhead;
@@ -269,8 +269,8 @@
}

static void
-frame_calculate_mssfix(struct frame *frame, struct key= _type *kt, const struct options *options,
- struct link_socket_info *lsi)
+frame_calculate_mssfix= (struct frame *frame, const struct key_type *kt, const struct options *opti= ons,
+ = const struct link_socket_info *lsi)
{
if (options->ce.mssfix_fixed)

{
= @@ -314,8 +314,8 @@
}

void

-frame_calcul= ate_dynamic(struct frame *frame, struct key_type *kt, const struct options = *options,
- = struct link_socket_info *lsi)
+frame_calculate_dynamic(struct frame *frame, const st= ruct key_type *kt, const struct options *options,
+ const struct link_soc= ket_info *lsi)
{
if (options->ce.f= ragment > 0)
{
diff --git a/src/ope= nvpn/mss.h b/src/openvpn/mss.h
index 1d092bb..6b832a2 10064= 4
--- a/src/openvpn/mss.h
+++ b/src/openvpn= /mss.h
@@ -29,15 +29,15 @@
#include "= socket.h"
#include "ssl_common.h"
-void mss_fixu= p_ipv4(struct buffer *buf, uint16_t maxmss);
+void mss_fixup_ipv4(const struct buffer *buf, uint= 16_t maxmss);

-void mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss);<= br>+void mss_fixup_ipv6(const s= truct buffer *buf, uint16_t maxmss);

-void mss_fixup_dowork(struct buffer *buf, = uint16_t maxmss);
+vo= id mss_fixup_dowork(const struct buffer *buf, uint16_t maxmss);
<= span>

/** Set the --mssfix option. */
-void frame_calculate_dynamic(struct frame= *frame, struct key_type *kt,
- const struct options *options, struct = link_socket_info *lsi);
+void frame_calculate_dynamic(struct frame *frame, const struct key_type= *kt,
+ = const struct options *options, const struct link_socket_info= *lsi);

/**
* Checks a= nd adjusts the fragment and mssfix value according to the
d= iff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c
index d= f94a70..d9f14b3 100644
--- a/src/openvpn/mtcp.c
<= span>+++ b/src/openvpn/mtcp.c

@@ -91,7 +91,7 @@
<= span> }


bool
-multi_tcp_instance_specific_init(struct multi_con= text *m, struct multi_instance *mi)
+multi_tcp_instance_specific_init(const struct multi_context= *m, struct multi_instance *mi)
{
/* = buffer for queued TCP socket output packets */
mi->= tcp_link_out_deferred =3D mbuf_init(m->top.options.n_bcast_buf);<= br>diff --git a/src/openvpn/mtcp.h b/src/openvpn/mtcp.h
index 9b7d1d2..bb117fa 100644

--- a/src/openvpn/mtcp.h
+++ b/src/openvpn/mtcp.h
@@ -35,7 +35,7 @@

void multi_tcp_dereference_instance(struc= t multi_io *multi_io, struct multi_instance *mi);
<= br>-bool multi_tcp_instance_speci= fic_init(struct multi_context *m, struct multi_instance *mi);
+bool multi_tcp_instance_specific_= init(const struct multi_context *m, struct multi_instance *mi);

<= span>

void multi_tcp_instance_specific_free(struct multi_= instance *mi);

diff --git a/src/openvpn/m= udp.c b/src/openvpn/mudp.c
index 50d72d5..4828a17 100644
--- a/src/openvpn/mudp.c
+++ b/src/openvpn/mu= dp.c
@@ -39,7 +39,7 @@

s= tatic void
send_hmac_reset_packet(struct multi_context *m,= struct tls_pre_decrypt_state *state,
- struct tls_auth_standalone *tas, str= uct session_id *sid,
= + const struct tls_auth_standalone *tas, const struct= session_id *sid,
bool request_rese= nd_wkc)
{
reset_packet_id_send(&s= tate->tls_wrap_tmp.opt.packet_id.send);
@@ -69,7 +69,7 @= @

enum first_packet_verdict verdict;=

- = struct tls_auth_standalone *tas =3D m->top.c2.tls_auth_standalone;
+ const struct tls_aut= h_standalone *tas =3D m->top.c2.tls_auth_standalone;

verdict =3D tls_pre_decrypt_lite(tas, state, &m->= ;top.c2.from, &m->top.c2.buf);

dif= f --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index c= 72c4b2..dd4d61d 100644
--- a/src/openvpn/multi.c
= +++ b/src/openvpn/multi.c
@@ -57,7 +57,7 @@
#ifdef MULTI_DEBUG_EVENT_LOOP
st= atic const char *
-id(s= truct multi_instance *mi)
+id(const struct multi_instance *mi)
{
if (mi)

{
@@ -1315,7 +1315,7 @@=
* same common name.
*/
static void

-multi_de= lete_dup(struct multi_context *m, struct multi_instance *new_mi)
= +multi_delete_dup(struct multi_= context *m, const struct multi_instance *new_mi)
{<= br> if (new_mi)
{
@@ -2260,7= +2260,7 @@
}

static bo= ol
-multi_client_setup_= dco_initial(struct multi_context *m, struct multi_instance *mi,
<= span style=3D"color: hsl(120, 100%, 40%);">+multi_client_setup_dco_initial(= const struct multi_context *m, struct multi_instance *mi,

= struct gc_arena *gc)
{
if (!dco_enabled(&mi->context.options))
<= span>@@ -3195,7 +3195,7 @@


#if defined(E= NABLE_DCO)
static void
-process_incoming_del_peer(struct multi_context *m, struct= multi_instance *mi, dco_context_t *dco)
+process_incoming_del_peer(struct multi_context *m, str= uct multi_instance *mi, const dco_context_t *dco)
{=
const char *reason =3D "ovpn-dco: unknown reason";=
switch (dco->dco_del_peer_reason)
= @@ -4226,7 +4226,7 @@

/* Searches for th= e address and deletes it if it is owned by the multi_instance */
= static void
-mul= ti_unlearn_addr(struct multi_context *m, struct multi_instance *mi, const s= truct mroute_addr *addr)
+multi_unlearn_addr(struct multi_context *m, const struct multi_instanc= e *mi, const struct mroute_addr *addr)
{
= struct hash_element *he;
const uint32_t hv =3D has= h_value(m->vhash, addr);
@@ -4261,7 +4261,7 @@ * @param a The new IPv4 address in network byte order */
static void
-multi_unlearn_in_addr_t(struct multi_context *m, struct= multi_instance *mi, in_addr_t a)
+multi_unlearn_in_addr_t(struct multi_context *m, const struct= multi_instance *mi, in_addr_t a)
{
s= truct mroute_addr addr;
CLEAR(addr);
@= @ -4279,7 +4279,7 @@
* @param a6 The new IPv6 address<= /span>
*/
static void
-multi_unlearn_in6_addr(struct multi_context *m,= struct multi_instance *mi, struct in6_addr a6)
+multi_unlearn_in6_addr(struct multi_context *m,= const struct multi_instance *mi, struct in6_addr a6)
{
struct mroute_addr addr;
CLEAR(addr= );
@@ -4395,7 +4395,7 @@

= bool
multi_check_push_ifconfig_ipv6_extra_route(struct mu= lti_instance *mi,
- = struct in6_addr *dest)
+ = const struct in6_addr *dest)

{
= const struct options *o =3D &mi->context.options;

diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h<= /span>
index 3ed08d4..cd7aa3e 100644
--- a/src/ope= nvpn/multi.h
+++ b/src/openvpn/multi.h
@@ -= 520,7 +520,7 @@
*/

sta= tic inline void
-set_pr= efix(struct multi_instance *mi)
+set_prefix(const struct multi_instance *mi)
{<= /span>
#ifdef MULTI_DEBUG_EVENT_LOOP
if (mi-= >msg_prefix[0])
@@ -694,7 +694,7 @@
*/=
bool
multi_check_push_ifconfig_ipv6_extr= a_route(struct multi_instance *mi,
- struct in6_addr *de= st);
+ = const struct in6_addr *dest);
=
/*
* Check for signals.
diff --git a/src/openvpn/networking.h b/src/openvpn/networking.h
index bce0c19..25233c8 100644
--- a/src/openvpn/netw= orking.h
+++ b/src/openvpn/networking.h
@@ = -44,7 +44,7 @@
*/
#if !defined(ENABLE_IP= ROUTE)
static inline int
-net_ctx_init(struct context *c, openvpn_net_ctx_t *ctx)=
+net_ctx_init(const = struct context *c, openvpn_net_ctx_t *ctx)
{
(void)c;

(void)ctx;
@@ -75,7 += 75,7 @@
*
* @return 0 on succe= ss, a negative error code otherwise
*/
-int net_ctx_init(struct context *c, open= vpn_net_ctx_t *ctx);
= +int net_ctx_init(const struct context *c, openvpn_net_ctx_t *ctx);<= br>
/**
* Release resources alloc= ated by the internal garbage collector
@@ -102,7 +102,7 @@<= /span>
* @return 0 on success, negative error code on e= rror
*/
int net_iface_new(openvpn_net_ct= x_t *ctx, const openvpn_net_iface_t *iface, const char *type,
- void *arg);
+ const v= oid *arg);

/**
* Retri= eve the interface type
diff --git a/src/openvpn/networking_= iproute2.c b/src/openvpn/networking_iproute2.c
index a1f352= 5..f091fb3 100644
--- a/src/openvpn/networking_iproute2.c
+++ b/src/openvpn/networking_iproute2.c
@@ -= 36,7 +36,7 @@
#include <netinet/in.h>

int
+net_ctx_init(const struct context *c= , openvpn_net_ctx_t *ctx)
{
ctx->e= s =3D NULL;
if (c)
@@ -61,7 +61,7 @@
}

int
-net_iface_new(openvpn_net_ctx_t *ctx, co= nst char *iface, const char *type, void *arg)
+net_iface_new(openvpn_net_ctx_t *ctx, const char = *iface, const char *type, const void *arg)
{
struct argv argv =3D argv_new();


= diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.= c
index e6e72d0..a1d220f 100644
--- a/src/o= penvpn/networking_sitnl.c
+++ b/src/openvpn/networking_sitn= l.c
@@ -987,7 +987,7 @@
}
=
static int
-sitnl_addr_del(sa_family_t af_family, const char *iface, inet_addre= ss_t *addr, int prefixlen)
+sitnl_addr_del(sa_family_t af_family, const char *iface, const inet_= address_t *addr, int prefixlen)
{
int= ifindex;

@@ -1230,8 +1230,8 @@ }

static int
-sitnl_route_del(const char *iface, sa_fam= ily_t af_family, inet_address_t *dst, int prefixlen,
- inet_address_t *gw, uint32_= t table, int metric)
= +sitnl_route_del(const char *iface, sa_family_t af_family, const inet_addre= ss_t *dst, int prefixlen,
+ const inet_address_t *gw, uint32_t table, int metric)=
{
int ifindex =3D 0;

@@ -1308,7 +1308,7 @@

=
int
= -net_iface_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type,= void *arg)
+net_ifac= e_new(openvpn_net_ctx_t *ctx, const char *iface, const char *type, const vo= id *arg)
{
struct sitnl_link_req req = =3D {};
int ret =3D -1;
diff --git a/s= rc/openvpn/occ.h b/src/openvpn/occ.h
index bda4f18..49def4d= 100644
--- a/src/openvpn/occ.h
+++ b/src/o= penvpn/occ.h
@@ -156,7 +156,7 @@
* via co= ntrol channel.
* @return control channel exit message sho= uld be used */
static inline bool
-cc_exit_notify_enabled(struct context *c)
+cc_exit_notify_enabled(c= onst struct context *c)
{
/* Check if= we have TLS active at all */
if (!c->c2.tls_multi)=
diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/op= enssl_compat.h
index 3494ce6..32e0b6f 100644
--- a/src/openvpn/openssl_compat.h

+++ b/src/openvpn/open= ssl_compat.h
@@ -124,7 +124,7 @@
/* Mimics= the functions but only when the default context without
= * options is chosen */
static inline const EVP_CIPHER *
-EVP_CIPHER_fetch(void *c= tx, const char *algorithm, const char *properties)
+EVP_CIPHER_fetch(const void *ctx, const char= *algorithm, const char *properties)
{
= ASSERT(!ctx);
ASSERT(!properties);
@= @ -132,7 +132,7 @@
}

st= atic inline const EVP_MD *
-EVP_MD_fetch(void *ctx, const char *algorithm, const char *properties)=
+EVP_MD_fetch(const = void *ctx, const char *algorithm, const char *properties)
= {
ASSERT(!ctx);
ASSERT(!propertie= s);
diff --git a/src/openvpn/options.c b/src/openvpn/option= s.c
index fd0d3fc..6d85a23 100644
--- a/src= /openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3050,7 +3050,7 @@

}

static void

-optio= ns_postprocess_mutate_le(struct connection_entry *ce, struct local_entry *l= e, int mode)
+options= _postprocess_mutate_le(const struct connection_entry *ce, struct local_entr= y *le, int mode)
{
/* use the global = port if none is specified */
if (!le->port)<= br>@@ -4980,7 +4980,7 @@
static bool
verify_permission(const char *name, const char *file, int line, const uin= t64_t type,

const uint64_t allowed, uint= 64_t *found, const msglvl_t msglevel,
- struct options *options, bool is_inline)<= /span>
+ co= nst struct options *options, bool is_inline)
{
<= span> if (!(type & allowed))

{
@@ -5547,7 +5547,7 @@

}

static void

-show_com= pression_warning(struct compress_options *info)
+show_compression_warning(const struct compress_= options *info)
{
if (comp_non_stub_en= abled(info))
{
diff --git a/src/openvp= n/options_parse.c b/src/openvpn/options_parse.c
index 88ab4= d2..0e94522 100644
--- a/src/openvpn/options_parse.c=
+++ b/src/openvpn/options_parse.c
@@ -258,7 +258,= 7 @@
}

static char *
-read_inline_file(struct = in_src *is, const char *close_tag, int *num_lines, struct gc_arena *gc)
+read_inline_file(const = struct in_src *is, const char *close_tag, int *num_lines, struct gc_arena *= gc)
{
char line[OPTION_LINE_SIZE];
struct buffer buf =3D alloc_buf(8 * OPTION_LINE_SIZE);
@@ -302,7 +302,7 @@
}

static int
+check_inline_file(const= struct in_src *is, char *p[], struct gc_arena *gc)
{
int num_inline_lines =3D 0;

diff --git a/src/openvpn/otime.c b/src/openvpn/otime.c

= index 1608458..5d3633c 100644
--- a/src/openvpn/otime.c
+++ b/src/openvpn/otime.c
@@ -66,7 +66,7 @@
}

void
-update_now_usec(struct timeval *tv)
+update_now_usec(const st= ruct timeval *tv)
{
const time_t last= =3D now;
update_now(tv->tv_sec);
d= iff --git a/src/openvpn/otime.h b/src/openvpn/otime.h
index= 84e315b..b5a9f7c 100644
--- a/src/openvpn/otime.h+++ b/src/openvpn/otime.h
@@ -65,7 +65,7 @@<= br> void update_now(const time_t system_time);

extern time_t now_usec;
-void update_now_usec(struct timeval *tv);
+void update_now_usec(const struct time= val *tv);

static inline int
openvpn_gettimeofday(struct timeval *tv, void *tz)

dif= f --git a/src/openvpn/proto.h b/src/openvpn/proto.h
index 3= 570582..33bf4ea 100644
--- a/src/openvpn/proto.h
= +++ b/src/openvpn/proto.h
@@ -248,7 +248,7 @@<= br> * and offset of IP header (via parameter).
*/<= /span>
static inline int
-get_tun_ip_ver(int tunnel_type, struct buffer *buf, int *ip_hd= r_offset)
+get_tun_ip= _ver(int tunnel_type, const struct buffer *buf, int *ip_hdr_offset)<= br> {
int ip_ver =3D -1;

diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.cindex 4de7615..d4e0a8b 100644
--- a/src/openvpn/prox= y.c
+++ b/src/openvpn/proxy.c
@@ -527,8 +52= 7,9 @@
}

static bool
-add_proxy_headers(struct= http_proxy_info *p, socket_descriptor_t sd, /* already open to proxy */
- const = char *host /* openvpn server remote */
+add_proxy_headers(cons= t struct http_proxy_info *p,
+ socket_descriptor_t sd, /* already open to proxy= */
+ = const char *host /* openvpn server remote */
)
{
char buf[512];
@@ -59= 7,8 +598,8 @@
socket_descrip= tor_t sd, /* already open to proxy */
= const char *host, /* openvpn server remote */
const char *port, /* openvpn server= port */

- = struct event_timeout *server_poll_timeout, struct buffer *= lookahead,
- = struct signal_info *sig_info)
+ const struct eve= nt_timeout *server_poll_timeout,
+ struct buffer *lookahead, struct= signal_info *sig_info)
{
struct gc_a= rena gc =3D gc_new();
char buf[512];
d= iff --git a/src/openvpn/proxy.h b/src/openvpn/proxy.h
index= e662e7d..a2f4e47 100644
--- a/src/openvpn/proxy.h+++ b/src/openvpn/proxy.h
@@ -89,7 +89,7 @@<= br> socket_descriptor_t sd, /* alr= eady open to proxy */
c= onst char *host, /* openvpn server remote */
= const char *port, /* openvpn server port = */
- = struct event_timeout *server_poll_timeout,
+ c= onst struct event_timeout *server_poll_timeout,
= struct buffer *lookahead, struct signal_info *sig_= info);

uint8_t *make_base64_string2(cons= t uint8_t *str, int str_len, struct gc_arena *gc);
diff --g= it a/src/openvpn/ps.c b/src/openvpn/ps.c
index 57afacd..0e5= 81e5 100644
--- a/src/openvpn/ps.c
+++ b/sr= c/openvpn/ps.c
@@ -332,7 +332,7 @@
* the = proxy can determine true client origin.
*/
static void

-journal= _add(const char *journal_dir, struct proxy_connection *pc, struct proxy_con= nection *cp)
+journal= _add(const char *journal_dir, const struct proxy_connection *pc, struct pro= xy_connection *cp)
{
struct openvpn_s= ockaddr from, to;

@@ -410,7 +410,7 @@
static bool
proxy_entry_new(struct proxy_con= nection **list, struct event_set *es,
cons= t struct openvpn_sockaddr server_addr, const socket_descriptor_t sd_client,=
- struc= t buffer *initial_data, const char *journal_dir)
+ const struct buffer *initial_d= ata, const char *journal_dir)
{
socke= t_descriptor_t sd_server;
int status;
= @@ -1013,7 +1013,7 @@
* call.
*/=
void
-port_s= hare_redirect(struct port_share *ps, const struct buffer *head, socket_desc= riptor_t sd)
+port_sh= are_redirect(const struct port_share *ps, const struct buffer *head, socket= _descriptor_t sd)
{
if (ps) {
diff --git a/src/openvpn/ps.h b/src/openvpn/p= s.h
index 557ecf5..918ceb6 100644
--- a/src= /openvpn/ps.h
+++ b/src/openvpn/ps.h
@@ -49= ,7 +49,7 @@

bool is_openvpn_protocol(con= st struct buffer *buf);

-void port_share_redirect(struct port_share *ps, const s= truct buffer *head, socket_descriptor_t sd);
+void port_share_redirect(const struct port_share *= ps, const struct buffer *head, socket_descriptor_t sd);

#endif /* if PORT_SHARE */
#endif /* ifnde= f PS_H */
diff --git a/src/openvpn/push.c b/src/openvpn/pus= h.c
index a030acd..373272f 100644
--- a/src= /openvpn/push.c
+++ b/src/openvpn/push.c
@@= -435,7 +435,7 @@
#endif

bool

-send_auth_pendi= ng_messages(struct tls_multi *tls_multi, struct tls_session *session,
+send_auth_pending_message= s(const struct tls_multi *tls_multi, struct tls_session *session, const char *extra, unsigned int timeout)=
{
struct key_state *ks =3D &sess= ion->key[KS_PRIMARY];
diff --git a/src/openvpn/push.h b/= src/openvpn/push.h
index dff945f..39302f6 100644
= --- a/src/openvpn/push.h
+++ b/src/openvpn/push.h
@@ -117,7 +117,7 @@
* doc/management-notes.t= xt under client-pending-auth for
* more details on messag= e format
*/
-bool send_auth_pending_messages(struct tls_multi *tls_multi, struct= tls_session *session,
-support_push_update(struct multi_instance = *mi)
+support_push_up= date(const struct multi_instance *mi)
{
= ASSERT(mi->context.c2.tls_multi);
const unsigned= int iv_proto_peer =3D extract_iv_proto(mi->context.c2.tls_multi->pee= r_info);
diff --git a/src/openvpn/reliable.c b/src/openvpn/= reliable.c
index 52adacf..3588483 100644
--= - a/src/openvpn/reliable.c
+++ b/src/openvpn/reliable.c
@@ -92,7 +92,7 @@

/* check = if a particular packet_id is present in ack */
static inli= ne bool
-reliable_ack_p= acket_id_present(struct reliable_ack *ack, packet_id_type pid)
+reliable_ack_packet_id_present(c= onst struct reliable_ack *ack, packet_id_type pid)

{
for (int i =3D 0; i < ack->len; ++i)
= {
@@ -733,7 +733,7 @@
*/
<= span>

void
-reliable_mark_active_incoming(struct reliable *rel, struct buffer *b= uf, packet_id_type pid,
+reliable_mark_active_incoming(struct reliable *rel, const struct buffer= *buf, packet_id_type pid,
i= nt opcode)
{
for (int i =3D 0; i <= rel->size; ++i)
@@ -793,7 +793,7 @@

/* delete a buffer previously activated by reliable_mark_ac= tive() */
void
-reliable_mark_deleted(struct reliable *rel, struct buffer *buf)
+reliable_mark_deleted= (struct reliable *rel, const struct buffer *buf)
{<= br> for (int i =3D 0; i < rel->size; ++i)
= {
diff --git a/src/openvpn/reliable.h b/src/openvpn/rel= iable.h
index a5ed75c..8d9e2e3 100644
--- a= /src/openvpn/reliable.h
+++ b/src/openvpn/reliable.h=
@@ -173,7 +173,7 @@
* @li False, if there are p= acket IDs to be acknowledged.
*/
static = inline bool
-reliable_a= ck_empty(struct reliable_ack *ack)
+reliable_ack_empty(const struct reliable_ack *ack) {
return !ack->len;
}
@@ -186,7 +186,7 @@
* @returns the number of = outstanding acks
*/
static inline int
-reliable_ack_outstanding= (struct reliable_ack *ack)
+reliable_ack_outstanding(const struct reliable_ack *ack)
<= span> {

return ack->len;
}<= br>@@ -336,7 +336,7 @@
* @param pid The packet'= s packet ID.
* @param opcode The packet's opcode.
*/
-void= reliable_mark_active_incoming(struct reliable *rel, struct buffer *buf, pa= cket_id_type pid,
+vo= id reliable_mark_active_incoming(struct reliable *rel, const struct buffer = *buf, packet_id_type pid,
= int opcode);

/**
@@ -= 389,7 +389,7 @@
* @param rel The reliable structure assoc= iated with the given buffer.
* @param buf The buffer of t= he reliable entry which is to be removed.
*/
-void reliable_mark_deleted(struct = reliable *rel, struct buffer *buf);

+void reliable_mark_deleted(struct reliable *rel, const stru= ct buffer *buf);

/** @} name Functions f= or extracting incoming packets */

diff --= git a/src/openvpn/route.c b/src/openvpn/route.c
index 45793= a4..85c246b 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c

@@ -898,8 +898,9 @@
<= span> }


static bool
-add_bypass_routes(struct route_bypass *rb,= in_addr_t gateway, const struct tuntap *tt,
- unsigned int flags, const struct r= oute_gateway_info *rgi,
+add_bypass_routes(const struct route_bypass *rb, in_addr_t gateway,
+ const= struct tuntap *tt, unsigned int flags,
+ const struct route_gateway_info *rgi,=
const struct env_set *es, openvpn_net_c= tx_t *ctx)
{
int ret =3D true;=
@@ -916,8 +917,9 @@
}
static void
-d= el_bypass_routes(struct route_bypass *rb, in_addr_t gateway, const struct t= untap *tt,
- = unsigned int flags, const struct route_gateway_info *rgi,
= +del_bypass_routes(const struct= route_bypass *rb, in_addr_t gateway,
+ const struct tuntap *tt, unsigned int f= lags,
+ = const struct route_gateway_info *rgi,
= const struct env_set *es, openvpn_net_ctx_t *ctx)
{
int i;
@@ -3942,7 +3944,7 @@
#else /* if defined(_WIN32) */


stat= ic void
-get_bypass_add= resses(struct route_bypass *rb, const unsigned int flags) /* PLATFORM-SPECI= FIC */
+get_bypass_ad= dresses(struct route_bypass *rb, const unsigned int flags)
= {
}

diff --git a/src/op= envpn/schedule.c b/src/openvpn/schedule.c
index 6d9bb62..c2= 9009e 100644
--- a/src/openvpn/schedule.c
+= ++ b/src/openvpn/schedule.c
@@ -501,7 +501,7 @@
<= span> }


int
-schedule_debug(struct schedule *s, int *count, str= uct timeval *least)
+= schedule_debug(const struct schedule *s, int *count, struct timeval *least)=
{
struct timeval min;
struct timeval max;

diff --git a/src/openvpn/socket.= c b/src/openvpn/socket.c
index 0382aea..5474e94 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/so= cket.c
@@ -647,7 +647,7 @@
}

static void
-bind_local(struct link_socket *sock, const sa_family_t ai_famil= y)
+bind_local(const = struct link_socket *sock, const sa_family_t ai_family)
{
/* bind to local address/port */
i= f (sock->bind_local)
@@ -914,8 +914,8 @@
}


void
-socket_bind(socket_descriptor_t sd, struct addrinfo *= local, int ai_family, const char *prefix,
- bool ipv6only)
+socket_bind(socket_descriptor_t sd, const struct= addrinfo *local, int ai_family,
+ const char *prefix, bool ipv6only)
{

struct gc_arena gc =3D gc_new();
=
@@ -1123,8 +1123,8 @@
* such as TCP.
*/

-static void stream_buf_init(struct stream_buf *sb, struct buf= fer *buf, const unsigned int sockflags,
- const int proto);
<= span style=3D"color: hsl(120, 100%, 40%);">+static void stream_buf_init(str= uct stream_buf *sb, const struct buffer *buf,

+ const unsigned int so= ckflags, const int proto);

static void s= tream_buf_close(struct stream_buf *sb);

@= @ -1481,7 +1481,7 @@
}

= static void
-phase2_set= _socket_flags(struct link_socket *sock)
+phase2_set_socket_flags(const struct link_socket *sock)=
{
/* set misc socket parameters */
socket_set_flags(sock->sd, sock->sockflags);
@@ -2073,7 +2073,7 @@
}

static void
+str= eam_buf_init(struct stream_buf *sb, const struct buffer *buf, const unsigne= d int sockflags,
const int proto) {
sb->buf_init =3D *buf;
@= @ -2337,7 +2337,7 @@
#endif

static socklen_t

-= link_socket_read_udp_posix_recvmsg(struct link_socket *sock, struct buffer = *buf,
+link_socket_re= ad_udp_posix_recvmsg(const struct link_socket *sock, struct buffer *buf,
struct link_socket_actual= *from)
{
struct iovec iov;@@ -2405,7 +2405,7 @@
#endif /* if ENABLE_IP_PKTINF= O */

int
-link_socket_read_udp_posix(struct link_socket *sock, = struct buffer *buf,
+= link_socket_read_udp_posix(const struct link_socket *sock, struct buffer *b= uf,
struct link_socket_actual *= from)
{
socklen_t fromlen =3D sizeof(= from->dest.addr);
@@ -2462,7 +2462,7 @@
= #if ENABLE_IP_PKTINFO

ssize_t-link_socket_write_udp_posix_sen= dmsg(struct link_socket *sock, struct buffer *buf,
+link_socket_write_udp_posix_sendmsg(const st= ruct link_socket *sock, const struct buffer *buf,
= struct link_socket_actual *to)
= {
struct iovec iov;
@@ -2656,7 +2656,= 7 @@
}

int
-socket_send_queue(struct link_sock= et *sock, struct buffer *buf, const struct link_socket_actual *to)
+socket_send_queue(struct lin= k_socket *sock, const struct buffer *buf, const struct link_socket_actual *= to)
{
if (sock->writes.iostate =3D= =3D IOSTATE_INITIAL)
{
@@ -2756,8 +275= 6,8 @@
return sock->writes.iostate;
}


-= void
-read_sockaddr_fro= m_overlapped(struct overlapped_io *io, struct sockaddr *dst, int overlapped= _ret)
+static void
+read_sockaddr_from_ove= rlapped(const struct overlapped_io *io, struct sockaddr *dst, int overlappe= d_ret)
{
if (overlapped_ret >=3D 0= && io->addr_defined)
{
dif= f --git a/src/openvpn/socket.h b/src/openvpn/socket.h
index= 71a3595..6771ec5 100644
--- a/src/openvpn/socket.h<= br>+++ b/src/openvpn/socket.h
@@ -267,7 +267,7 @@

int socket_recv_queue(struct link_socket *s= ock, int maxsize);

-int socket_send_queue(struct link_socket *sock, struct buffe= r *buf,
+int socket_s= end_queue(struct link_socket *sock, const struct buffer *buf,
const struct link_socket_actual *to);

<= span>

typedef struct
@@ -347,8 +347,8 @@<= /span>

struct link_socket *link_socket_new(void= );

-v= oid socket_bind(socket_descriptor_t sd, struct addrinfo *local, int af_fami= ly, const char *prefix,
- bool ipv6only);
+void socket_bind(socket_descriptor_t sd, const struct addrin= fo *local, int af_family,
+ const char *prefix, bool ipv6only);
=
int openvpn_connect(socket_descriptor_t sd, const struct= sockaddr *remote, int connect_timeout,
= volatile int *signal_received);
@@ -484,7 +484,7 @@
}

static inline bool<= br>-link_socket_verify_incoming_a= ddr(struct buffer *buf, const struct link_socket_info *info,
+link_socket_verify_incoming_addr(c= onst struct buffer *buf, const struct link_socket_info *info,

const struct link_socket_actual *from_= addr)

{
if (buf->len > 0)
@@ -608,7 +608,7 @@

#else /*= ifdef _WIN32 */

-int link_socket_read_udp_posix(struct link_socket *sock, struc= t buffer *buf,
+int l= ink_socket_read_udp_posix(const struct link_socket *sock, struct buffer *bu= f,
struct link_socket_actua= l *from);

#endif /* ifdef _WIN32 */
@@ -694,12 +694,12 @@

#else = /* ifdef _WIN32 */

-ssize_t link_socket_write_udp_posix_sendmsg(struct link_sock= et *sock, struct buffer *buf,
+ssize_t link_socket_write_udp_posix_sendmsg(const struct link_soc= ket *sock, const struct buffer *buf,
= struct link_socket_actual *to);


static inline ssize_t
-link_socket_write_udp_posix(struct link_so= cket *sock, struct buffer *buf,
+link_socket_write_udp_posix(const struct link_socket *sock, con= st struct buffer *buf,
struct = link_socket_actual *to)
{
#if ENABLE_IP_P= KTINFO
@@ -715,7 +715,7 @@
}

static inline ssize_t
-link_socket_write_tcp_posix(struct link_socket *sock,= struct buffer *buf)
= +link_socket_write_tcp_posix(const struct link_socket *sock, const struct b= uffer *buf)
{
return send(sock->sd= , BPTR(buf), BLENZ(buf), MSG_NOSIGNAL);
}
= @@ -773,7 +773,7 @@
* from tunnel packet.
*/

static inline void
-link_socket_set_tos(struct link_socket *sock)+link_socket_set_tos(const str= uct link_socket *sock)
{
if (sock &am= p;& sock->ptos_defined)
{
@@ -8= 19,6 +819,8 @@
}
}
<= /span>
+/* cppcheck-suppress= constParameterPointer
-addrlist_match_p= roto(const struct openvpn_sockaddr *a1, struct addrinfo *addr_list, const i= nt proto)
+addrlist_m= atch_proto(const struct openvpn_sockaddr *a1, const struct addrinfo *addr_l= ist, const int proto)
{
return link_s= ocket_proto_connection_oriented(proto) ? addrlist_match(a1, addr_list)
: addr= list_port_match(a1, addr_list);
diff --git a/src/openvpn/so= cks.c b/src/openvpn/socks.c
index 19f3d54..77ca863 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/= socks.c
@@ -82,7 +82,7 @@

static bool

socks_proxy_recv_char(uint8_t *c, const char= *name, socket_descriptor_t sd,
- struct event_timeout *server_poll_timeout,<= /span>
+ = const struct event_timeout *server_poll_timeout,
= volatile int *signal_received)
{
= fd_set reads;
@@ -97,8 +97,8 @@
= }

static bool
-socks_username_password_auth(struct socks_proxy= _info *p, socket_descriptor_t sd,
- struct event_timeout *server_poll_= timeout,
+socks_usern= ame_password_auth(const struct socks_proxy_info *p, socket_descriptor_t sd,=
+ = const struct event_timeout *server_poll_timeout,
= volatile int *signal_received)
{

char to_send[516];
@@ -156,8 +156= ,8 @@
}

static bool
-socks_handshake(struct so= cks_proxy_info *p, socket_descriptor_t sd,
- struct event_timeout *server_poll_time= out, volatile int *signal_received)
+socks_handshake(const struct socks_proxy_info *p, socket_de= scriptor_t sd,
+ = const struct event_timeout *server_poll_timeout, volatile int *s= ignal_received)
{
uint8_t buf[2];
int len =3D 0;
@@ -231,7 +231,7 @@=

static bool
recv_socks_reply(= socket_descriptor_t sd, struct openvpn_sockaddr *addr,
- struct event_timeout *ser= ver_poll_timeout, volatile int *signal_received)
+ const struct event_timeout *s= erver_poll_timeout, volatile int *signal_received)
{
uint8_t atyp =3D 0;
int alen =3D 0;
@@ -334,11 +334,11 @@
}

void
-es= tablish_socks_proxy_passthru(struct socks_proxy_info *p,
+establish_socks_proxy_passthru(const s= truct socks_proxy_info *p,
= socket_descriptor_t sd, /* already open to proxy */
= const char *host, /* openvpn server remote *= /
const char *servname, /= * openvpn server port */
+ = const struct event_timeout *server_poll_timeout,
struct signal_info *sig_info)

= {
char buf[270];
@@ -392,10 +39= 2,10 @@
}

void-establish_socks_proxy_udpassoc= (struct socks_proxy_info *p,
+establish_socks_proxy_udpassoc(const struct socks_proxy_info *p,
socket_descriptor_t ctrl_sd,= /* already open to proxy */
= struct openvpn_sockaddr *relay_addr,
- struct event_timeout *serve= r_poll_timeout,
+ = const struct event_timeout *server_poll_timeout,=
struct signal_info *sig_in= fo)
{
if (!socks_handshake(p, ctrl_sd= , server_poll_timeout, &sig_info->signal_received))
= diff --git a/src/openvpn/socks.h b/src/openvpn/socks.h
inde= x 846113d..f7c93b6 100644
--- a/src/openvpn/socks.h<= br>+++ b/src/openvpn/socks.h
@@ -47,17 +47,17 @@

void socks_proxy_close(struct socks_proxy_in= fo *sp);

-void establish_socks_proxy_passthru(struct socks_proxy_info *p,=
+void establish_socks_proxy= _passthru(const struct socks_proxy_info *p,
= socket_descriptor_t sd, /* already open to proxy */
const char *host, = /* openvpn server remote */
= const char *servname, /* openvpn server port */
- stru= ct event_timeout *server_poll_timeout,
+ const struct event_t= imeout *server_poll_timeout,
= struct signal_info *sig_info);

-void establish_socks_proxy_udpassoc(struc= t socks_proxy_info *p,
- struct event_= timeout *server_poll_timeout,
+ const struct event_timeout *s= erver_poll_timeout,
st= ruct signal_info *sig_info);

void socks_= process_incoming_udp(struct buffer *buf, struct link_socket_actual *from);<= /span>
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.cindex 7f3b4dc..262522b 100644
--- a/src/openvpn/ssl= .c
+++ b/src/openvpn/ssl.c
@@ -1159,7 +1159= ,7 @@
}

struct tls_mult= i *
-tls_multi_init(str= uct tls_options *tls_options)
+tls_multi_init(const struct tls_options *tls_options)
<= span> {

struct tls_multi *ret;

@@ -1188,7 +1188,7 @@
*/

struct tls_auth_standalone *
-tls_auth_standalone_init(struct tls_options *tls_optio= ns, struct gc_arena *gc)
+tls_auth_standalone_init(const struct tls_options *tls_options, struct= gc_arena *gc)
{
struct tls_auth_stan= dalone *tas;

@@ -1336,7 +1336,7 @@=

static void
init_epoch_keys(s= truct key_state *ks, struct tls_multi *multi, const struct key_type *key_ty= pe,
- bo= ol server, struct key2 *key2)
+ bool server, const struct key2 *key2)
<= span> {

/* For now we hardcode this to be 16 for the s= oftware based data channel
* DCO based implementation= s/HW implementation might adjust this number
@@ -1375,7 +13= 75,7 @@

static void
ini= t_key_contexts(struct key_state *ks, struct tls_multi *multi, const struct = key_type *key_type,
- = bool server, struct key2 *key2, bool dco_enabled)+ bool server= , const struct key2 *key2, bool dco_enabled)
{
<= span> struct key_ctx_bi *key =3D &ks->crypto_options.key_ctx_bi;=


@@ -1573,8 +1573,9 @@
<= /span>
bool
tls_session_update_crypto_params_do_= work(struct tls_multi *multi, struct tls_session *session,
- = struct options *options, struct frame *frame,
- struct = frame *frame_fragment, struct link_socket_info *lsi,
+ = const struct options *options, struct frame *frame,
+ = struct frame *frame_fragment,
+ const struct link_socket= _info *lsi,
dco_c= ontext_t *dco)
{
if (session->key[= KS_PRIMARY].crypto_options.key_ctx_bi.initialized)
@@ -1643= ,7 +1644,7 @@
bool
tls_session_update_cry= pto_params(struct tls_multi *multi, struct tls_session *session,
= struct options *options, struct fra= me *frame,
- = struct frame *frame_fragment, struct link_socket_info= *lsi,
+ = struct frame *frame_fragment, const struct link_socket_= info *lsi,
dco_context_t = *dco)
{
if (!check_session_cipher(ses= sion, options))
@@ -2495,8 +2496,8 @@
}

bool
-session_skip_to_pre_start(struct tls_session *session, stru= ct tls_pre_decrypt_state *state,
- struct link_socket_actual *from)
+session_skip_to_pre_start= (struct tls_session *session, const struct tls_pre_decrypt_state *state,
+ = const struct link_socket_actual *from)
{
struct key_state *ks =3D &session->key[KS_PRIMARY];
ks->session_id_remote =3D state->peer_session_id;=
@@ -4011,7 +4012,7 @@
}
=
void
-tls_po= st_encrypt(struct tls_multi *multi, struct buffer *buf)
+tls_post_encrypt(struct tls_multi *mult= i, const struct buffer *buf)
{
struct= key_state *ks =3D multi->save_ks;
multi->save_k= s =3D NULL;
@@ -4142,7 +4143,7 @@
* into = a garbage collectable string which is returned.
*/=
const char *
-protocol_dump(struct buffer *buffer, unsigned int flags, struct gc_arena = *gc)
+protocol_dump(c= onst struct buffer *buffer, unsigned int flags, struct gc_arena *gc)=
{
struct buffer out =3D alloc_buf_gc(256, g= c);
struct buffer buf =3D *buffer;
dif= f --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h
index 58223= 36..3370321 100644
--- a/src/openvpn/ssl.h
= +++ b/src/openvpn/ssl.h
@@ -166,7 +166,7 @@
*

* @return A newly allocated and initialized \c tls_m= ulti structure.
*/
-struct tls_multi *tls_multi_init(struct tls_options *tls_opt= ions);
+struct tls_mu= lti *tls_multi_init(const struct tls_options *tls_options);

/**
* Finalize initialization of a \c= tls_multi structure.
@@ -187,7 +187,7 @@
= /*
* Initialize a standalone tls-auth verification object= .
*/
= -struct tls_auth_standalone *tls_auth_standalone_init(struct tls_options *t= ls_options,
+struct t= ls_auth_standalone *tls_auth_standalone_init(const struct tls_options *tls_= options,
= struct gc_arena *gc);

/**
= @@ -371,7 +371,7 @@
* @param multi - The TLS state = for this packet's destination VPN tunnel.
* @param bu= f - The buffer containing the outgoing packet.
*/<= br>-void tls_post_encrypt(struct = tls_multi *multi, struct buffer *buf);
+void tls_post_encrypt(struct tls_multi *multi, const str= uct buffer *buf);

/** @} name Functions = for managing security parameter state for data channel packets */
@@ -461,7 +461,8 @@
*/ bool tls_session_update_crypto_params(struct tls_multi *multi, stru= ct tls_session *session,
= struct options *options, struct frame *frame,
- struct f= rame *frame_fragment, struct link_socket_info *lsi,
+ str= uct frame *frame_fragment,
+ const struct link_socket_info = *lsi,
dco_context_t = *dco);

/*
@@ -525,7 +526= ,7 @@
#define PD_VERBOSE (1 << 10)
#define PD_TLS_CRYPT (1 << 11)
-const char *= protocol_dump(struct buffer *buffer, unsigned int flags, struct gc_arena *g= c);
+const char *prot= ocol_dump(const struct buffer *buffer, unsigned int flags, struct gc_arena = *gc);

/*
* debugging c= ode
@@ -573,7 +574,7 @@
/* Special method = to skip the three way handshake RESET stages. This is
* u= sed by the HMAC code when seeing a packet that matches the previous<= br> * HMAC based stateless server state */
-bool session_skip_to_pre_start(struct tls_sessi= on *session, struct tls_pre_decrypt_state *state,
- struct link_sock= et_actual *from);
+bo= ol session_skip_to_pre_start(struct tls_session *session, const struct tls_= pre_decrypt_state *state,
+ const struct link_socket_actual *from)= ;

#endif /* ifndef OPENVPN_SSL_H */
diff --git a/src/openvpn/ssl_backend.h b/src/openvpn/ssl_backen= d.h
index 816fb9c..ed395e7 100644
--- a/src= /openvpn/ssl_backend.h
+++ b/src/openvpn/ssl_backend.h
@@ -144,7 +144,7 @@
*
* @re= turn true if the context is initialised, false if not.
*/

-bool tls_ctx_ini= tialised(struct tls_root_ctx *ctx);
+bool tls_ctx_initialised(const struct tls_root_ctx *ctx);

/**
* Set any library s= pecific options.
@@ -177,7 +177,7 @@
* @p= aram ciphers String containing : delimited cipher names, or NULL to u= se
* sane defaults.<= /span>
*/
-v= oid tls_ctx_restrict_ciphers_tls13(struct tls_root_ctx *ctx, const char *ci= phers);
+void tls_ctx= _restrict_ciphers_tls13(const struct tls_root_ctx *ctx, const char *ciphers= );

/**
* Set the TLS c= ertificate profile. The profile defines which crypto
diff = --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c
index 9d408c0..7893be0 100644

--- a/src/openvpn/ssl_mbed= tls.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -1= 61,7 +161,7 @@
}

bool
-tls_ctx_initialised(str= uct tls_root_ctx *ctx)
-tls_ctx_= restrict_ciphers_tls13(struct tls_root_ctx *ctx, const char *ciphers)
+tls_ctx_restrict_ciphers_= tls13(const struct tls_root_ctx *ctx, const char *ciphers)
= {
if (ciphers =3D=3D NULL)
{
diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_opens= sl.c
index 306f85cd..706d78d 100644
--- a/s= rc/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -147,7 +147,7 @@
}

bool
-tls_= ctx_initialised(struct tls_root_ctx *ctx)
+tls_ctx_initialised(const struct tls_root_ctx *ctx)
{
/* either this should be NULL or sho= uld be non-null and then have a
* valid TLS ctx insid= e as well */
@@ -509,7 +509,7 @@
#endif

void
-tls_ctx_restrict_ciphers_tls13(struct tls_root_ctx *ctx, co= nst char *ciphers)
+t= ls_ctx_restrict_ciphers_tls13(const struct tls_root_ctx *ctx, const char *c= iphers)
{
if (ciphers =3D=3D NULL)
{
@@ -1165,7 +1165,7 @@
= }

static void
-tls_ctx_load_cert_uri(struct tls_root_ctx *tls_= ctx, const char *uri)
+tls_ctx_load_cert_uri(const struct tls_root_ctx *tls_ctx, const char *uri= )
{
#if defined(HAVE_OPENSSL_STORE_API)
X509 *x =3D NULL;
@@ -2078,7 +2078,7 @@=
}

static void-bio_debug_data(const char *mod= e, BIO *bio, const uint8_t *buf, int len, const char *desc)
+bio_debug_data(const char *mode, co= nst BIO *bio, const uint8_t *buf, int len, const char *desc)

{

struct gc_arena gc =3D gc_new();
= if (len > 0)
@@ -2092,7 +2092,7 @@
= }

static void
-bio_debug_oc(const char *mode, BIO *bio)=
+bio_debug_oc(const char *m= ode, const BIO *bio)
{
open_biofp();<= /span>
fprintf(biofp, "BIO %s time=3D%" PRIi64 &quo= t; bio=3D" ptr_format "\n", mode, (int64_t)time(NULL),
diff --git a/src/openvpn/ssl_pkt.c b/src/openvpn/ssl_pkt.c
index 1805995..6b53e7e 100644
--- a/src/openvpn/= ssl_pkt.c
+++ b/src/openvpn/ssl_pkt.c
@@ -5= 7,7 +57,7 @@
* @return if the swap was successfu= l (buf was large enough)
*/
static bool<= /span>
-swap_hmac(struct buffe= r *buf, const struct crypto_options *co, bool incoming)
+swap_hmac(const struct buffer *buf, con= st struct crypto_options *co, bool incoming)
{
<= span> ASSERT(co);


@@ -117,7 +117,7 @@=
*/
static void
tls_wra= p_control(struct tls_wrap_ctx *ctx, uint8_t header, struct buffer *buf,
- struct s= ession_id *session_id)
-tls_reset_standalone(st= ruct tls_wrap_ctx *ctx, struct tls_auth_standalone *tas,
- struct session_id *= own_sid, struct session_id *remote_sid, uint8_t header,
- bool request_resend_= wkc)
+tls_reset_stand= alone(struct tls_wrap_ctx *ctx, const struct tls_auth_standalone *tas,
+ con= st struct session_id *own_sid, const struct session_id *remote_sid,<= br>+ uint8_= t header, bool request_resend_wkc)
{
= /* Copy buffer here to point at the same data but allow tls_wrap_control
* to potentially change buf to point to another buffer = without
diff --git a/src/openvpn/ssl_pkt.h b/src/openvpn/ss= l_pkt.h
index ac9d4be..ffd34f4 100644
--- a= /src/openvpn/ssl_pkt.h
+++ b/src/openvpn/ssl_pkt.h@@ -220,8 +220,9 @@
* from the tls pre decrypt st= ate.
*
*/
-struct buffer tls_reset_standalone(struct tls_wrap_= ctx *ctx, struct tls_auth_standalone *tas,
- struct session_id *= own_sid, struct session_id *remote_sid,
+struct buffer tls_reset_standalone(struct tls_wrap_ctx = *ctx, const struct tls_auth_standalone *tas,
+ const struct se= ssion_id *own_sid,
+ = const struct session_id *remote_sid,
uint8_t header, bool reques= t_resend_wkc);


diff --g= it a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
in= dex e5b55a1..0298106 100644
--- a/src/openvpn/ssl_verify.c<= /span>
+++ b/src/openvpn/ssl_verify.c
@@ -1137,7 += 1137,7 @@
* cache.
*/
= static bool
-tls_authen= tication_status_use_cache(struct tls_multi *multi)
+tls_authentication_status_use_cache(const st= ruct tls_multi *multi)
{
unsigned int= idx =3D min_uint(multi->tas_cache_num_updates, SIZE(cache_intervals) - = 1);
time_t latency =3D cache_intervals[idx];@@ -1281,7 +1281,7 @@
* Check if the script/plugin= left a message in the auth failed message
* file and rel= ay it to the user */
static void
-check_for_client_reason(struct tls_multi *multi= , struct auth_deferred_status *status)
+check_for_client_reason(struct tls_multi *multi, const s= truct auth_deferred_status *status)
{
= struct gc_arena gc =3D gc_new();
const char *msg =3D = key_state_check_auth_failed_message_file(status, &gc);
= @@ -1550,7 +1550,7 @@
#endif /* ifdef ENABLE_MANAGEMENT */=

static bool
-set_verify_user_pass_env(struct user_pass *up, st= ruct tls_multi *multi, struct tls_session *session)
+set_verify_user_pass_env(const struct use= r_pass *up, struct tls_multi *multi, struct tls_session *session) {
/* Is username defined? */
= if ((session->opt->ssl_flags & SSLF_AUTH_USER_PASS_OPTIONAL) = || strlen(up->username))
@@ -1578,7 +1578,7 @@ }

bool
-ssl_verify_username_length(struct tls_session *= session, const char *username)
+ssl_verify_username_length(const struct tls_session *session, co= nst char *username)
{
if ((session-&g= t;opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME)
= && strlen(username) > TLS_USERNAME_LEN)
di= ff --git a/src/openvpn/ssl_verify.h b/src/openvpn/ssl_verify.h
index 3176d76..e77bc4a 100644

--- a/src/openvpn/ssl_ver= ify.h
+++ b/src/openvpn/ssl_verify.h
@@ -20= 2,7 +202,7 @@
* @return true if name is unde= r limit or username-as-common-name
* = is not active
*/
-bool ssl_verify_username_length(struct tls_session *session, = const char *username);
-tls_client_reason(struct tls_multi *multi)
+tls_client_reason(const struct tls_multi *mult= i)
{
return multi->client_reason;<= /span>
}
diff --git a/src/openvpn/status.c b/src/= openvpn/status.c
index c7d375b..cfbc38d 100644
--- a/src/openvpn/status.c

+++ b/src/openvpn/status.c
@@ -135,7 +135,7 @@
}

void
-sta= tus_reset(struct status_output *so)
+status_reset(const struct status_output *so)
{

if (so && so->fd >=3D 0)
= {
diff --git a/src/openvpn/status.h b/src/openvp= n/status.h
index 7953a4e..4c01d75 100644
--= - a/src/openvpn/status.h
+++ b/src/openvpn/status.h<= br>@@ -69,7 +69,7 @@

bool status_t= rigger(struct status_output *so);

-void status_reset(struct status_output *so)= ;
+void status_reset(= const struct status_output *so);

void st= atus_flush(struct status_output *so);

dif= f --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index bc262= cd..a662b94 100644
--- a/src/openvpn/tun.c
= +++ b/src/openvpn/tun.c
@@ -835,7 +835,7 @@
const char *ifconfig_ipv6_local_parm, /* --ifconfig parm 1 I= Pv6 */

int ifconfig_ipv6_netbits_parm,
= const char *ifconfig_ipv6_remote_parm, /* --ifconfig par= m 2 IPv6 */
- s= truct addrinfo *local_public, struct addrinfo *remote_public, const bool st= rict_warn,
+ = const struct addrinfo *local_public, const struct addrinfo *remote_public, = const bool strict_warn,
struct env_set *es, openv= pn_net_ctx_t *ctx, struct tuntap *tt)
{
= if (!tt)
@@ -978,7 +978,7 @@
* -> h= elper function to simplify code below
*/
= static void
-add_route= _connected_v6_net(struct tuntap *tt, const struct env_set *es)
+add_route_connected_v6_net(const= struct tuntap *tt, const struct env_set *es)

{
= struct route_ipv6 r6;

@@ -1020= ,7 +1020,7 @@
*/

in_ad= dr_t
-create_arbitrary_= remote(struct tuntap *tt)
+create_arbitrary_remote(const struct tuntap *tt)
{
in_addr_t remote;

@@ = -1592,7 +1592,7 @@
}

st= atic void
-undo_ifconfi= g_ipv4(struct tuntap *tt, openvpn_net_ctx_t *ctx)
+undo_ifconfig_ipv4(const struct tuntap *tt, o= penvpn_net_ctx_t *ctx)
{
#if defined(TARG= ET_LINUX)
int netbits =3D netmask_to_netbits2(tt->r= emote_netmask);
@@ -1627,7 +1627,7 @@
}

static void
-undo_ifconfig_ipv6(struct tuntap *tt, openvpn_net_ct= x_t *ctx)
+undo_ifcon= fig_ipv6(const struct tuntap *tt, openvpn_net_ctx_t *ctx)
= {
#if defined(TARGET_LINUX)
if (net_a= ddr_v6_del(ctx, tt->actual_name, &tt->local_ipv6, tt->netbits_= ipv6) < 0)
@@ -1652,7 +1652,7 @@
}

void
-undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx)
+undo_ifconfig(const stru= ct tuntap *tt, openvpn_net_ctx_t *ctx)
{
= if (tt->backend_driver !=3D DRIVER_NULL && tt->backend_dr= iver !=3D DRIVER_AFUNIX)
{
@@ -1808,7 = +1808,7 @@

#if defined(TARGET_LINUX) || = defined(TARGET_FREEBSD)
static bool
-tun_dco_enabled(struct tuntap *tt)+tun_dco_enabled(const struct= tuntap *tt)
{
return tt->backend_= driver =3D=3D DRIVER_DCO;
}
@@ -2055,13 +2= 055,13 @@
}

ssize_t
-write_tun(struct tuntap *= tt, uint8_t *buf, int len)
+write_tun(const struct tuntap *tt, const uint8_t *buf, int len)
{
return write(tt->fd, buf, len);
}

ssize_t
-read_tun(struct tuntap *tt, uint8_t *bu= f, int len)
+read_tun= (const struct tuntap *tt, const uint8_t *buf, int len)
{
return read(tt->fd, buf, len);
}
@@ -2260,13 +2260,13 @@
}
<= /span>
ssize_t
+write_tun(const struct tuntap *tt, const= uint8_t *buf, int len)
{
return writ= e(tt->fd, buf, len);
}

ssize_t

-read_tun(st= ruct tuntap *tt, uint8_t *buf, int len)
+read_tun(const struct tuntap *tt, uint8_t *buf, int len= )
{
return read(tt->fd, buf, len);=
}
@@ -2596,7 +2596,7 @@
= }

ssize_t
-write_tun(struct tuntap *tt, uint8_t *buf, int len)<= /span>
+write_tun(const stru= ct tuntap *tt, const uint8_t *buf, int len)
{
struct strbuf sbuf;

sbuf.len =3D len;<= br>@@ -2605,7 +2605,7 @@
}
<= br> ssize_t
-read= _tun(struct tuntap *tt, uint8_t *buf, int len)
+read_tun(const struct tuntap *tt, uint8_t *buf, = int len)
{
struct strbuf sbuf;=
int f =3D 0;
@@ -3320,7 +3320,7 @@ }

int
-tun_write_queue(struct tuntap *tt, struct buffer= *buf)
+tun_write_que= ue(struct tuntap *tt, const struct buffer *buf)
{ if (tt->writes.iostate =3D=3D IOSTATE_INITIAL)
{

@@ -3375,7 +3375,7 @@
}<= br>
int
-tun_write_win32(struct tuntap *tt, struct buffer *buf)
= +tun_write_win32(struct tuntap = *tt, const struct buffer *buf)
{
int = err =3D 0;
int status =3D 0;
@@ -5383,= 7 +5383,7 @@
}

void
-fork_register_dns_action(= struct tuntap *tt)
+f= ork_register_dns_action(const struct tuntap *tt)
{<= br> if (tt && tt->options.register_dns && tt-&= gt;options.msg_channel)
{
@@ -5473,7 += 5473,7 @@
}

static void=
-tuntap_get_mtu(struct= tuntap *tt)
+tuntap_= get_mtu(const struct tuntap *tt)
{
UL= ONG mtu =3D 0;
DWORD len;
@@ -6048,7 += 6048,7 @@
}

void=
-tun_show_debug(struct tuntap= *tt)
+tun_show_debug= (const struct tuntap *tt)
{
if (tt-&g= t;backend_driver =3D=3D WINDOWS_DRIVER_TAP_WINDOWS6)
{=
diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h<= br>index 6a7af85..be0baa9 100644
--- a/src/openvpn/tu= n.h
+++ b/src/openvpn/tun.h
@@ -272,9 +272,= 9 @@

void close_tun_handle(struct tuntap= *tt);

+ssize_t write_tun(const struct = tuntap *tt, const uint8_t *buf, int len);

-ssize_t read_tun(struct tuntap *tt, u= int8_t *buf, int len);

- struct addrinfo *local_public, struct addrinfo *r= emote_public,
+ = const struct addrinfo *local_public, const struct addrinf= o *remote_public,
const bool stric= t_warn, struct env_set *es, openvpn_net_ctx_t *ctx,
= struct tuntap *tt);

@@ = -320,7 +320,7 @@
* @param tt the tuntap interface cont= ext
* @param ctx the networking API opaque context
*/
-void = undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx);
+void undo_ifconfig(const struct tunta= p *tt, openvpn_net_ctx_t *ctx);

bool is_= dev_type(const char *dev, const char *dev_type, const char *match_type);

@@ -351,7 +351,7 @@
#defin= e IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPEN

static inline int

-i= fconfig_order(struct tuntap *tt)
+ifconfig_order(const struct tuntap *tt)
{
if (tt->backend_driver =3D=3D DRIVER_AFUNIX) {
@@ -381,7 +381,7 @@
#define = ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUN

stat= ic inline int
-route_or= der(struct tuntap *tt)
-void = tun_show_debug(struct tuntap *tt);
+void tun_show_debug(const struct tuntap *tt);

bool dhcp_release_by_adapter_index(const DWORD adapter= _index);

bool dhcp_renew_by_adapter_inde= x(const DWORD adapter_index);

-void fork_register_dns_action(struct tuntap *tt);=
+void fork_register_= dns_action(const struct tuntap *tt);

voi= d ipconfig_register_dns(const struct env_set *es);
=
@@ -470,7 +470,7 @@

int tun_re= ad_queue(struct tuntap *tt, int maxsize);

-int tun_write_queue(struct tuntap *tt= , struct buffer *buf);

-tuntap_is_dco_win(struct tuntap *tt)
= +tuntap_is_dco_win(const struct= tuntap *tt)
{
return tt && t= t->backend_driver =3D=3D DRIVER_DCO;
}
=
static inline bool
-tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
+tuntap_is_dco_win_time= out(const struct tuntap *tt, int status)
{
return tuntap_is_dco_win(tt) && (status < 0) && (o= penvpn_errno() =3D=3D ERROR_NETNAME_DELETED);

}
= @@ -555,25 +555,25 @@
}

= static inline void
-tun_standby_init(struct tuntap *tt)
+tun_standby_init(const struct tuntap *tt)
{

}

static inline b= ool
-tun_standby(struct= tuntap *tt)
+tun_sta= ndby(const struct tuntap *tt)
{
retur= n true;
}


static inline bool

-tuntap_is_dco_win(struct tuntap *tt)
+tuntap_is_dco_win(const struct tuntap *tt)
{

return false;
}

static inline bool
-tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
+tuntap_is_dco_win_tim= eout(const struct tuntap *tt, int status)
{
return false;

}
diff --git a/src/op= envpn/tun_afunix.c b/src/openvpn/tun_afunix.c
index a67a472= ..e9223bc 100644
--- a/src/openvpn/tun_afunix.c
<= span>+++ b/src/openvpn/tun_afunix.c

@@ -48,7 +48,7 @@


static void
-tun_afunix_exec_child(const char *dev= _node, struct tuntap *tt, struct env_set *env)

+tun_afunix_exec_child(const char *dev_node, stru= ct tuntap *tt, const struct env_set *env)
{
const char *msgprefix =3D "ERROR: failure executing process for= tun:";

struct argv argv =3D argv_new();@@ -73,7 +73,7 @@
}

void

-open_tun_afu= nix(struct options *o, int mtu, struct tuntap *tt, struct env_set *orig_env= )
+open_tun_afunix(co= nst struct options *o, int mtu, struct tuntap *tt, const struct env_set *or= ig_env)
{
struct gc_arena gc =3D gc_n= ew();

diff --git a/src/openvpn/tun_afunix= .h b/src/openvpn/tun_afunix.h
index 5b6a8e0..fb88eb2 100644=
--- a/src/openvpn/tun_afunix.h
+++ b/src/o= penvpn/tun_afunix.h
@@ -31,7 +31,7 @@
* t= he user provided taking care of implementing the actual tun
* device.

*/
-void open_tun_afunix(struct options *o, int mtu, struct tuntap = *tt, struct env_set *env);
+void open_tun_afunix(const struct options *o, int mtu, struct tuntap= *tt, const struct env_set *env);


/**
diff --git a/src/openvpn/vlan.c b/src/openv= pn/vlan.c
index bffc60e..cd32a9b 100644
---= a/src/openvpn/vlan.c
+++ b/src/openvpn/vlan.c
@@ -288,7 +288,7 @@

}

void

-vlan_process_o= utgoing_tun(struct multi_context *m, struct multi_instance *mi)
<= span style=3D"color: hsl(120, 100%, 40%);">+vlan_process_outgoing_tun(const= struct multi_context *m, struct multi_instance *mi)

{
if (!m->top.options.vlan_tagging)
= {
diff --git a/src/openvpn/vlan.h b/src/openvpn/vlan.h
index 9389f89..cd2f66f 100644
--- a/src/openvp= n/vlan.h
+++ b/src/openvpn/vlan.h
@@ -35,6 = +35,6 @@

bool vlan_is_tagged(const struc= t buffer *buf);

-void vlan_process_outgoing_tun(struct multi_context *m, struct = multi_instance *mi);
= +void vlan_process_outgoing_tun(const struct multi_context *m, struct multi= _instance *mi);

#endif /* VLAN_H */
diff --git a/src/openvpn/win32.h b/src/openvpn/win32.hindex ef32062..bcbfa67 100644
--- a/src/openvpn/win= 32.h
+++ b/src/openvpn/win32.h
@@ -226,7 +2= 26,7 @@
void overlapped_io_close(struct overlapped_io *o);=

static inline bool
-overlapped_io_active(struct overlapped_io = *o)
+overlapped_io_ac= tive(const struct overlapped_io *o)
{
= return o->iostate =3D=3D IOSTATE_QUEUED || o->iostate =3D=3D IOSTATE= _IMMEDIATE_RETURN;
}
diff --git a/src/open= vpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c
i= ndex a861e8a..25fa1e4 100644
--- a/src/openvpnmsica/openvpn= msica.c
+++ b/src/openvpnmsica/openvpnmsica.c
@@ -77,7 +77,7 @@

* @return ERROR_SUCCESS on success; = An error code otherwise
*/
static UINT
-setup_sequence(_In_ MSI= HANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ struct msica_arg_seq *seq)=
+setup_sequence(_In_= MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ const struct msica_arg= _seq *seq)
{
UINT uiResult; LPWSTR szSequence =3D msica_arg_seq_join(seq);
= diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c<= /span>
index 628ec85..1fff6af 100644
--- a/src/ope= nvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c<= /span>
@@ -521,7 +521,7 @@


static SOCKADDR_INET
-sockaddr_inet(short family, inet_address_t *addr)
+sockaddr_inet(short family, cons= t inet_address_t *addr)

{
SOCKADDR_IN= ET sa_inet;
ZeroMemory(&sa_inet, sizeof(sa_inet));=
@@ -3733,7 +3733,7 @@

s= tatic DWORD
UpdateWaitHandles(LPHANDLE *handles_ptr, LPDWO= RD count, HANDLE io_event, HANDLE exit_event,
- list_item_t *threads)
<= span style=3D"color: hsl(120, 100%, 40%);">+ const list_it= em_t *threads)

{
static DWORD size = =3D 10;
static LPHANDLE handles =3D NULL;
diff --git a/tests/unit_tests/openvpn/mock_management.c b/tests/unit_te= sts/openvpn/mock_management.c

index 77f6ce2..fff4c2b 100644=
--- a/tests/unit_tests/openvpn/mock_management.c+++ b/tests/unit_tests/openvpn/mock_management.c
@@ = -36,7 +36,7 @@
struct management *management; /* GLOBAL */=

void
-management_auth_failure(struct management *man, const ch= ar *type, const char *reason)
+management_auth_failure(const struct management *man, const char = *type, const char *reason)
{
ASSERT(f= alse);
}
diff --git a/tests/unit_tests/ope= nvpn/test_misc.c b/tests/unit_tests/openvpn/test_misc.c
ind= ex 4a055e7..af96764 100644
--- a/tests/unit_tests/openvpn/t= est_misc.c
+++ b/tests/unit_tests/openvpn/test_misc.c
@@ -146,7 +146,7 @@
}
<= br> static struct hash_element *
-hash_lookup_by_value(struct hash *hash, void *value)
+hash_lookup_by_value(stru= ct hash *hash, const void *value)
{
s= truct hash_iterator hi;
struct hash_element *he;
diff --git a/tests/unit_tests/openvpn/test_user_pass.c b/tests/u= nit_tests/openvpn/test_user_pass.c
index c0a0866..7636a33 1= 00644
--- a/tests/unit_tests/openvpn/test_user_pass.c
+++ b/tests/unit_tests/openvpn/test_user_pass.c
= @@ -59,7 +59,7 @@
return mock();
}
void
-ma= nagement_auth_failure(struct management *man, const char *type, const char = *reason)
+management_= auth_failure(const struct management *man, const char *type, const char *re= ason)
{
assert_true(0);
}


To view, visit change 1663. To unsubs= cribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I56248cf6d199c2da770774b8fd1= e5daf2b116f58
Gerrit-Change-Number: 1663
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --eNyCIsd9vXA=--