Skip to contentSkip to conversation

Change in openvpn[master]: dco-win: simplify control packets prepend code

Openvpn-devel In review stipa (Code Review) 2 participants 6 messages Feb 20, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1740037224000.Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937@...2715...

#1 lore raw

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/+/900?usp=email

to review the following change.

Change subject: dco-win: simplify control packets prepend code
......................................................................

dco-win: simplify control packets prepend code

Eliminate unneeded temporary struct sockaddr_in buffer.

Change-Id Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937

---
M src/openvpn/socket.h

1 file changed, 2 insertions(+), 6 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/00/900/1

src/openvpn/socket.h +2 -6
index c370f2c..ee04a96 100644
@@ -1125,15 +1125,11 @@
     {
         if (to->dest.addr.sa.sa_family == AF_INET)
         {
-            struct sockaddr_in sa;
-            memcpy(&sa, &to->dest.addr.in4, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf,  &to->dest.addr.in4, sizeof(struct sockaddr_in));
         }
         else
         {
-            struct sockaddr_in6 sa;
-            memcpy(&sa, &to->dest.addr.in6, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf, &to->dest.addr.in6, sizeof(struct sockaddr_in6));
         }
     }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/900?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: Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937
Gerrit-Change-Number: 900
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/900?usp=email )

Change subject: dco-win: simplify control packets prepend code
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/900?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: Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937
Gerrit-Change-Number: 900
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 20 Feb 2025 07:42:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 dco-win: simplify control packets prepend code

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

Eliminate unneeded temporary struct sockaddr_in buffer.

Change-Id Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937

---

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/+/900
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/socket.h +2 -6
index c370f2c..ee04a96 100644
@@ -1125,15 +1125,11 @@
     {
         if (to->dest.addr.sa.sa_family == AF_INET)
         {
-            struct sockaddr_in sa;
-            memcpy(&sa, &to->dest.addr.in4, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf,  &to->dest.addr.in4, sizeof(struct sockaddr_in));
         }
         else
         {
-            struct sockaddr_in6 sa;
-            memcpy(&sa, &to->dest.addr.in6, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf, &to->dest.addr.in6, sizeof(struct sockaddr_in6));
         }
     }
 
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: dco-win: simplify control packets prepend code

Straightforward, so I have not actually tested the resulting openvpn.exe
- but stared very hard at the change & asked MinGW for an opinion (no errors or warnings).

Fixed one whitespace gotcha on the fly.

Your patch has been applied to the master branch.

commit a8e67c7d0642f6b7e12ffc98af8495e66664d895

Author: Lev Stipakov
Date:   Thu Feb 20 08:43:27 2025 +0100
     dco-win: simplify control packets prepend code

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30942.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/900?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: dco-win: simplify control packets prepend code
......................................................................

dco-win: simplify control packets prepend code

Eliminate unneeded temporary struct sockaddr_in buffer.

Change-Id Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30942.html

---
M src/openvpn/socket.h

1 file changed, 2 insertions(+), 6 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/00/900/2

src/openvpn/socket.h +2 -6
index c370f2c..2c33319 100644
@@ -1125,15 +1125,11 @@
     {
         if (to->dest.addr.sa.sa_family == AF_INET)
         {
-            struct sockaddr_in sa;
-            memcpy(&sa, &to->dest.addr.in4, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf, &to->dest.addr.in4, sizeof(struct sockaddr_in));
         }
         else
         {
-            struct sockaddr_in6 sa;
-            memcpy(&sa, &to->dest.addr.in6, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf, &to->dest.addr.in6, sizeof(struct sockaddr_in6));
         }
     }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/900?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: Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937
Gerrit-Change-Number: 900
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/900?usp=email )

Change subject: dco-win: simplify control packets prepend code
......................................................................

dco-win: simplify control packets prepend code

Eliminate unneeded temporary struct sockaddr_in buffer.

Change-Id Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30942.html

---
M src/openvpn/socket.h

1 file changed, 2 insertions(+), 6 deletions(-)
src/openvpn/socket.h +2 -6
index c370f2c..2c33319 100644
@@ -1125,15 +1125,11 @@
     {
         if (to->dest.addr.sa.sa_family == AF_INET)
         {
-            struct sockaddr_in sa;
-            memcpy(&sa, &to->dest.addr.in4, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf, &to->dest.addr.in4, sizeof(struct sockaddr_in));
         }
         else
         {
-            struct sockaddr_in6 sa;
-            memcpy(&sa, &to->dest.addr.in6, sizeof(sa));
-            buf_write_prepend(buf, &sa, sizeof(sa));
+            buf_write_prepend(buf, &to->dest.addr.in6, sizeof(struct sockaddr_in6));
         }
     }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/900?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: Ie57f7b11157ab5ca8ff01e1c4f03a308117ff937
Gerrit-Change-Number: 900
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged