Change in openvpn[master]: Fix socketpair return status not being checked in port share code
A message that is not in the archive (sent off-list or not yet received): gerrit.1727273213000.Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/770?usp=email
to review the following change.
Change subject: Fix socketpair return status not being checked in port share code
......................................................................
Fix socketpair return status not being checked in port share code
found by Coverity after tun_afunix introduced another call to socketpair, so it started to complain that we only check the return code in 4 of 5 cases.
Change-Id: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
---
M src/openvpn/ps.c
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/770/1
src/openvpn/ps.c +7 -1
@@ -234,7 +234,12 @@ }else { -socketpair (PF_UNIX ,SOCK_DGRAM ,0 , sd_null); +if (!socketpair (AF_UNIX ,SOCK_DGRAM ,0 , sd_null)) + { +msg (M_WARN |M_ERRNO ,"PORT SHARE: socketpair failed -- unable to communicate with background process " +"(%d, %d)" , sd, sd_send); + goto done; + }memcpy (CMSG_DATA (h), &sd_null[0 ],sizeof (sd_null[0 ])); }
@@ -246,6 +251,7 @@ ); } +done:close_socket_if_defined (sd_null[0 ]);close_socket_if_defined (sd_null[1 ]);free (mesg.msg_control);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?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: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/770?usp=email )
Change subject: Fix socketpair return status not being checked in port share code
......................................................................
Patch Set 1: Code-Review-2
(2 comments)
Patchset:
PS1:
Logic backwards, I think.
File src/openvpn/ps.c:
http://gerrit.openvpn.net/c/openvpn/+/770/comment/a89388f2_ba42e06c :
PS1, Line 237: if (!socketpair(AF_UNIX, SOCK_DGRAM, 0, sd_null))
Shouldn't that test for -1?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?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: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 14:21:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/770?usp=email
to look at the new patch set (#2).
Change subject: Fix socketpair return status not being checked in port share code
......................................................................
Fix socketpair return status not being checked in port share code
found by Coverity after tun_afunix introduced another call to socketpair, so it started to complain that we only check the return code in 4 of 5 cases.
---
M src/openvpn/ps.c
1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/770/2
src/openvpn/ps.c +8 -2
@@ -234,7 +234,12 @@ }else { -socketpair (PF_UNIX ,SOCK_DGRAM ,0 , sd_null); +if (!(socketpair (AF_UNIX ,SOCK_DGRAM ,0 , sd_null) ==0 )) + { +msg (M_WARN |M_ERRNO ,"PORT SHARE: socketpair failed -- unable to communicate with background process " +"(%d, %d)" , sd, sd_send); + goto done; + }memcpy (CMSG_DATA (h), &sd_null[0 ],sizeof (sd_null[0 ])); }
@@ -246,6 +251,7 @@ ); } +done:close_socket_if_defined (sd_null[0 ]);close_socket_if_defined (sd_null[1 ]);free (mesg.msg_control);
@@ -845,7 +851,7 @@* Make a socket for foreground and background processes * to communicate. */ -if (socketpair (PF_UNIX ,SOCK_DGRAM ,0 , fd) ==-1 ) +if (!(socketpair (PF_UNIX ,SOCK_DGRAM ,0 , fd) ==0 )) {msg (M_WARN ,"PORT SHARE: socketpair call failed" ); goto error;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?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: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/770?usp=email )
Change subject: Fix socketpair return status not being checked in port share code
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File src/openvpn/ps.c:
http://gerrit.openvpn.net/c/openvpn/+/770/comment/ba250b0d_b7b0eda3 :
PS2, Line 856: SHARE
Should we add M_ERRNO here while at it?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?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: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 26 Sep 2024 12:53:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/770?usp=email )
Change subject: Fix socketpair return status not being checked in port share code
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File src/openvpn/ps.c:
http://gerrit.openvpn.net/c/openvpn/+/770/comment/299616be_4ad3018f :
PS2, Line 854: if (!(socketpair(PF_UNIX, SOCK_DGRAM, 0, fd) == 0))
can we please not do double-negate-conditions for standard syscall return value checking?? == -1 or <0 is perfectly fine, according to the manpage. My brain hurts.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?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: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 26 Sep 2024 12:58:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/770?usp=email )
Change subject: Fix socketpair return status not being checked in port share code
......................................................................
Patch Set 2:
(1 comment)
File src/openvpn/ps.c:
http://gerrit.openvpn.net/c/openvpn/+/770/comment/b573480e_0d81a26d :
PS1, Line 237: if (!socketpair(AF_UNIX, SOCK_DGRAM, 0, sd_null))
Quoted 1 line
Shouldn't that test for -1?
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?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: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 22 Jul 2025 14:42:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment