From: "cron2 (Code Review)" Date: Thu, 15 Jan 2026 10:10:15 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="tDB5zLQVG2w="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: forward: Avoid conversion warning in ipv6_send_icmp_unreachable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --tDB5zLQVG2w= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1472?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: forward: Avoid conversion warning in ipv6_send_icmp_unreach= able ...................................................................... forward: Avoid conversion warning in ipv6_send_icmp_unreachable Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t. While here remove a unused gc arena in neighbouring code. Change-Id: I701f9e0a96a7b43f278f8e6089e9156feab772c8 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472 Message-Id: <20260115091124.23360-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59283657/ Signed-off-by: Gert Doering --- M src/openvpn/forward.c 1 file changed, 5 insertions(+), 16 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1472/2 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 39ac3b3..5004e35 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1352,11 +1352,6 @@ check_status(c->c2.buf.len, "read from TUN/TAP", NULL, c->c1.tuntap); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /** * Drops UDP packets which OS decided to route via tun. * @@ -1483,8 +1478,6 @@ void process_incoming_tun(struct context *c, struct link_socket *out_sock) { - struct gc_arena gc =3D gc_new(); - if (c->c2.buf.len > 0) { c->c2.tun_read_bytes +=3D c->c2.buf.len; @@ -1528,7 +1521,6 @@ { buf_reset(&c->c2.to_link); } - gc_free(&gc); } /** @@ -1593,7 +1585,7 @@ icmp6out.icmp6_type =3D OPENVPN_ICMP6_DESTINATION_UNREACHABLE; icmp6out.icmp6_code =3D OPENVPN_ICMP6_DU_NOROUTE; - int icmpheader_len =3D sizeof(struct openvpn_ipv6hdr) + sizeof(struct = openvpn_icmp6hdr); + const int icmpheader_len =3D sizeof(struct openvpn_ipv6hdr) + sizeof(s= truct openvpn_icmp6hdr); int totalheader_len =3D icmpheader_len; if (TUNNEL_TYPE(c->c1.tuntap) =3D=3D DEV_TYPE_TAP) @@ -1606,10 +1598,11 @@ * frame should be <=3D 1280 and have as much as possible of the origi= nal * packet */ - int max_payload_size =3D min_int(MAX_ICMPV6LEN, c->c2.frame.tun_mtu - = icmpheader_len); - int payload_len =3D min_int(max_payload_size, BLEN(&inputipbuf)); + const int max_payload_size =3D min_int(MAX_ICMPV6LEN, c->c2.frame.tun_= mtu - icmpheader_len); + const int payload_len =3D min_int(max_payload_size, BLEN(&inputipbuf)); + const uint16_t icmp_len =3D (uint16_t)(sizeof(struct openvpn_icmp6hdr)= + payload_len); - pip6out.payload_len =3D htons(sizeof(struct openvpn_icmp6hdr) + payloa= d_len); + pip6out.payload_len =3D htons(icmp_len); /* Construct the packet as outgoing packet back to the client */ struct buffer *outbuf; @@ -1665,10 +1658,6 @@ #undef MAX_ICMPV6LEN } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void process_ip_header(struct context *c, unsigned int flags, struct buffer *bu= f, struct link_socket *sock) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1472?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: I701f9e0a96a7b43f278f8e6089e9156feab772c8 Gerrit-Change-Number: 1472 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --tDB5zLQVG2w= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

forward: Avoid conversion warning i=
n ipv6_send_icmp_unreachable

Since all values are limited by MAX_ICM= PV6LEN we can
just cast to uint16_t.

While here remove a unused g= c arena in neighbouring
code.

Change-Id: I701f9e0a96a7b43f278f8e6= 089e9156feab772c8
Signed-off-by: Frank Lichtenheld <frank@...2641...&= gt;
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: https:= //gerrit.openvpn.net/c/openvpn/+/1472
Message-Id: <20260115091124.233= 60-1-gert@...1296...>
URL: https://sourceforge.net/p/openvpn/mailman/= message/59283657/
Signed-off-by: Gert Doering <gert@...1296...>---
M src/openvpn/forward.c
1 file changed, 5 insertions(+), 16 dele= tions(-)

git pull ssh://gerrit.openvpn.net:29418=
/openvpn refs/changes/72/1472/2
diff --git a/src/openvpn/forward.c =
b/src/openvpn/forward.c
index 39ac3b3..5004e35 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/fo= rward.c
@@ -1352,11 +1352,6 @@
check_s= tatus(c->c2.buf.len, "read from TUN/TAP", NULL, c->c1.tunta= p);
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
=
-#pragma GCC diagnostic ignor= ed "-Wconversion"
-#endif
- /**
* Drops UDP packets which OS decided to rout= e via tun.
*
@@ -1483,8 +1478,6 @@=
void
process_incoming_tun(struct context *c, st= ruct link_socket *out_sock)
{
- struct gc_arena gc =3D gc_new();
-
if (c->c2.= buf.len > 0)
{
c->c2.tu= n_read_bytes +=3D c->c2.buf.len;
@@ -1528,7 +1521,6 @@
{
buf_reset(&c->c2.to_l= ink);
}
- gc_free(&gc);
}
/**
@@ -1593,7 +1585,7 @@
icmp= 6out.icmp6_type =3D OPENVPN_ICMP6_DESTINATION_UNREACHABLE;
= icmp6out.icmp6_code =3D OPENVPN_ICMP6_DU_NOROUTE;

- int icmpheader_len = =3D sizeof(struct openvpn_ipv6hdr) + sizeof(struct openvpn_icmp6hdr);
+ const int icmpheader_= len =3D sizeof(struct openvpn_ipv6hdr) + sizeof(struct openvpn_icmp6hdr);
int totalheader_len =3D icmpheader_len;

if (TUNNEL_TYPE(c->c1.tuntap) =3D=3D DEV_TYPE_TA= P)
@@ -1606,10 +1598,11 @@
* frame sh= ould be <=3D 1280 and have as much as possible of the original * packet
*/
- int max_payload_size =3D min_int(MAX_ICMPV6LEN= , c->c2.frame.tun_mtu - icmpheader_len);
- int payload_len =3D min_int(max_payload_size, BLE= N(&inputipbuf));
= + const int max_payload_size =3D min_int(MAX_ICMPV6LEN, c->c2.frame.t= un_mtu - icmpheader_len);
+ const int payload_len =3D min_int(max_payload_size, BLEN(&inp= utipbuf));
+ const= uint16_t icmp_len =3D (uint16_t)(sizeof(struct openvpn_icmp6hdr) + payload= _len);

+ pip6ou= t.payload_len =3D htons(icmp_len);

/= * Construct the packet as outgoing packet back to the client */
<= span> struct buffer *outbuf;

@@ -1665,10 +1658,6 @@

#undef MAX_ICMPV6LEN
}

-#if defined(__GNUC__) || = defined(__clang__)
-#pr= agma GCC diagnostic pop
-#endif
-
void

process_ip_header(struct context *c, unsigned in= t flags, struct buffer *buf,
struct link= _socket *sock)

To view, visit change 1472= . To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I701f9e0a96a7b43f278f8e6089e= 9156feab772c8
Gerrit-Change-Number: 1472
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --tDB5zLQVG2w=--