From: "its_Giaan (Code Review)" Date: Thu, 15 Feb 2024 15:59:02 +0000 References: Reply-To: gianmarco@...2726..., 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="HbhnCR7Mi6c="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Minor fix to process_ip_header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --HbhnCR7Mi6c= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/525?usp=3Demail to review the following change. Change subject: Minor fix to process_ip_header ...................................................................... Minor fix to process_ip_header Introduced a bitmask to replace the previous check for individual option bits with a check for all possible combinations of options. Fixes: Trac https://community.openvpn.net/openvpn/ticket/269 Change-Id: I4b5e8357d872c920efdb64632e9bce72cebee202 Signed-off-by: Gianmarco De Gregori --- M src/openvpn/forward.c M src/openvpn/forward.h 2 files changed, 4 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/525/1 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 0443ca0..04bf407 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1649,17 +1649,7 @@ if (buf->len > 0) { - /* - * The --passtos and --mssfix options require - * us to examine the IPv4 header. - */ - - if (flags & (PIP_MSSFIX -#if PASSTOS_CAPABILITY - | PIPV4_PASSTOS -#endif - | PIPV4_CLIENT_NAT - )) + if (flags & PIP_OPT_MASK) { struct buffer ipbuf =3D *buf; if (is_ipv4(TUNNEL_TYPE(c->c1.tuntap), &ipbuf)) diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index e19115e..8da1cc1 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -294,11 +294,13 @@ #define PIPV4_PASSTOS (1<<0) #define PIP_MSSFIX (1<<1) /* v4 and v6 */ -#define PIP_OUTGOING (1<<2) #define PIPV4_EXTRACT_DHCP_ROUTER (1<<3) #define PIPV4_CLIENT_NAT (1<<4) #define PIPV6_IMCP_NOHOST_CLIENT (1<<5) #define PIPV6_IMCP_NOHOST_SERVER (1<<6) +#define PIP_OPT_MASK 0xFFFF +#define PIP_OUTGOING (1<<16) + void process_ip_header(struct context *c, unsigned int flags, struct buffe= r *buf); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/525?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I4b5e8357d872c920efdb64632e9bce72cebee202 Gerrit-Change-Number: 525 Gerrit-PatchSet: 1 Gerrit-Owner: its_Giaan Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --HbhnCR7Mi6c= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

its_Giaan would like plaisthos and flichtenheld to review this change.

Vi= ew Change

Minor fix to process_ip_header

Introduced a bitmask to= replace the previous check
for individual option bits with a check for = all
possible combinations of options.

Fixes: Trac https://communi= ty.openvpn.net/openvpn/ticket/269
Change-Id: I4b5e8357d872c920efdb64632e= 9bce72cebee202
Signed-off-by: Gianmarco De Gregori <gianmarco@...2787...= ...>
---
M src/openvpn/forward.c
M src/openvpn/forward.h
2 f= iles changed, 4 insertions(+), 12 deletions(-)

git pull ssh://ger=
rit.openvpn.net:29418/openvpn refs/changes/25/525/1
diff --git a/sr=
c/openvpn/forward.c b/src/openvpn/forward.c
index 0443ca0..= 04bf407 100644
--- a/src/openvpn/forward.c
= +++ b/src/openvpn/forward.c
@@ -1649,17 +1649,7 @@
if (buf->len > 0)
= {
- /*- * The --passtos and -= -mssfix options require
- * us to examine the IPv4 header.
- */
-
- i= f (flags & (PIP_MSSFIX
-#if PASSTOS_CAPABILITY
- | PIPV4_PASSTOS
-#endif
- | PIPV4_CLIENT_NAT
- ))
+ if (flags & PIP_OPT_MASK) {
struct buffer ipbuf =3D *buf= ;
if (is_ipv4(TUNNEL_TYPE(c->c1.tuntap), &a= mp;ipbuf))
diff --git a/src/openvpn/forward.h b/src/openvpn= /forward.h
index e19115e..8da1cc1 100644
--= - a/src/openvpn/forward.h
+++ b/src/openvpn/forward.h
@@ -294,11 +294,13 @@

#define= PIPV4_PASSTOS (1<<0)
#define PIP_= MSSFIX (1<<1) /* v4 and v6 */
= -#define PIP_OUTGOING = (1<<2)
#define PIPV4_EXTRACT_DHCP_ROUTER = (1<<3)
#define PIPV4_CLIENT_NAT (1= <<4)
#define PIPV6_IMCP_NOHOST_CLIENT (1<&= lt;5)
#define PIPV6_IMCP_NOHOST_SERVER (1<<6)=
+#define PIP_OPT_MAS= K 0xFFFF
+#define PIP_OUTGOING (1<<16)
+


void process_ip_header(struct context *c, unsigned int flags, struct buf= fer *buf);


To view, v= isit chan= ge 525. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4b5e8357d872c920efdb64632e9= bce72cebee202
Gerrit-Change-Number: 525
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--HbhnCR7Mi6c=--