Change in openvpn[master]: proto: Clean up conversion warnings related to checksum macros
A message that is not in the archive (sent off-list or not yet received): gerrit.1756814708000.Ica721a51b00d5314125bcaf5a586e718c5982aef@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
to review the following change.
Change subject: proto: Clean up conversion warnings related to checksum macros
......................................................................
proto: Clean up conversion warnings related to checksum macros
These should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
---
M src/openvpn/clinat.c
M src/openvpn/mss.c
M src/openvpn/proto.h
3 files changed, 37 insertions(+), 42 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1164/1
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +23 -27
76 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Gerrit-Change-Number: 1164
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
to look at the new patch set (#3).
Change subject: proto: Clean up conversion warnings related to checksum macros
......................................................................
proto: Clean up conversion warnings related to checksum macros
These should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
---
M src/openvpn/clinat.c
M src/openvpn/mss.c
M src/openvpn/proto.h
3 files changed, 37 insertions(+), 51 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1164/3
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +23 -36
96 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Gerrit-Change-Number: 1164
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
to look at the new patch set (#4).
Change subject: proto: Clean up conversion warnings related to checksum macros
......................................................................
proto: Clean up conversion warnings related to checksum macros
These should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
---
M src/openvpn/clinat.c
M src/openvpn/mss.c
M src/openvpn/proto.h
3 files changed, 36 insertions(+), 51 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1164/4
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +22 -36
95 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Gerrit-Change-Number: 1164
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email )
Change subject: proto: Clean up conversion warnings related to checksum macros
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Gerrit-Change-Number: 1164
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 24 Sep 2025 16:18:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v4 1/1 proto: Clean up conversion warnings related to checksum macros
In reply to a message not in the archiveThese should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
MaxF <[email protected]...>
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +22 -36
95 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
[Openvpn-devel] [PATCH applied] Re: proto: Clean up conversion warnings related to checksum macros
Stared long and hard at the changes... looks reasonable... and I actually tested this (set different MSS values, see TCP SYN/ACKs go in/out and verify that the changes are what we want to see *and* the resulting checksum is correct).
Your patch has been applied to the master branch.
commit a06b9b2fcdea0ee36545019c6984baad2236e51d
Author: Frank Lichtenheld Date: Fri Sep 26 13:17:26 2025 +0200
proto: Clean up conversion warnings related to checksum macros
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: MaxF <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33218.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
PATCH v4 1/1 proto: Clean up conversion warnings related to checksum macros
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
These should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
MaxF <[email protected]...>
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +22 -36
95 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
cron2 has uploaded a new patch set (#5) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by MaxF
Change subject: proto: Clean up conversion warnings related to checksum macros
......................................................................
proto: Clean up conversion warnings related to checksum macros
These should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33218.html
---
M src/openvpn/clinat.c
M src/openvpn/mss.c
M src/openvpn/proto.h
3 files changed, 36 insertions(+), 51 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/64/1164/5
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +22 -36
95 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Gerrit-Change-Number: 1164
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email )
Change subject: proto: Clean up conversion warnings related to checksum macros
......................................................................
proto: Clean up conversion warnings related to checksum macros
These should not change any behavior, they mostly clarify the used types and silence warnings, since these casts are deliberate.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1164
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33218.html
---
M src/openvpn/clinat.c
M src/openvpn/mss.c
M src/openvpn/proto.h
3 files changed, 36 insertions(+), 51 deletions(-)
src/openvpn/clinat.c +5 -6
@@ -185,11 +185,7 @@ const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf); -int i; -uint32_t addr, *addr_ptr; -const uint32_t *from, *to; -int accumulate =0 ; -unsigned int amask; +int32_t accumulate =0 ;unsigned int alog =0 ;if (check_debug_level (D_CLIENT_NAT ))
@@ -197,8 +193,11 @@print_pkt (&h->ip,"BEFORE" , direction,D_CLIENT_NAT ); } -for (i =0 ; i < list->n; ++i) +for (int i =0 ; i < list->n; ++i) { +uint32_t addr, *addr_ptr; +const uint32_t *from, *to; +unsigned int amask;const struct client_nat_entry *e = &list->entries[i];/* current NAT rule */ if (e->type ^ direction) {
src/openvpn/mss.c +22 -36
95 lines not on this page · raw message
src/openvpn/proto.h +9 -9
@@ -214,7 +214,7 @@*/ #define ADJUST_CHECKSUM (acc, cksum) \ { \ - int _acc = acc; \ + int32_t _acc = acc; \ _acc += (cksum); \ if (_acc < 0) \ { \
@@ -231,16 +231,16 @@ } \ } -#define ADD_CHECKSUM_32 (acc, u32) \ - { \ - acc += (u32) & 0xffff; \ - acc += (u32) >> 16; \ +#define ADD_CHECKSUM_32 (acc, u32) \ + { \ + acc += (int32_t)((u32) & 0xffff); \ + acc += (int32_t)((u32) >> 16); \ } -#define SUB_CHECKSUM_32 (acc, u32) \ - { \ - acc -= (u32) & 0xffff; \ - acc -= (u32) >> 16; \ +#define SUB_CHECKSUM_32 (acc, u32) \ + { \ + acc -= (int32_t)((u32) & 0xffff); \ + acc -= (int32_t)((u32) >> 16); \ }/*
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1164?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ica721a51b00d5314125bcaf5a586e718c5982aef
Gerrit-Change-Number: 1164
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>