From: "cron2 (Code Review)" Date: Sun, 29 Dec 2024 22:40:09 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., gianmarco@...2726..., openvpn-devel@lists.sourceforge.net, frank@...2641..., a@...2181... Message-ID: <0c421d9c23b5e07327c3c2b90e8c80a6d3e4e12e-EmailReviewComments-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="GPmQfcZRiU0="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: Adapt socket handling to support listening on multiple sockets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: its_Giaan Cc: flichtenheld , plaisthos , openvpn-devel --GPmQfcZRiU0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: its_Giaan, ordex, plaisthos. cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/ope= nvpn/+/434?usp=3Demail ) Change subject: Adapt socket handling to support listening on multiple sock= ets ...................................................................... Patch Set 10: Code-Review-2 (18 comments) Patchset: PS10: Getting there, and except for the `bind_dev` these are minor nitpicks in th= e source (but worth fixing if we do another round anyway). In the review, I seem to have overlooked something, though - applying this = on top of current master breaks `--fragment` servers - on the first connect= ing client, *boom* ``` 2024-12-29 23:34:56 us=3D142019 Initialization Sequence Completed 2024-12-29 23:35:05 us=3D857683 Connection Attempt MULTI: multi_create_inst= ance called 2024-12-29 23:35:05 us=3D857852 2001:608:0:814::f000:21 Re-using SSL/TLS co= ntext 2024-12-29 23:35:05 us=3D857903 2001:608:0:814::f000:21 WARNING: if you use= --mssfix and --fragment, you should use the "mtu" flag for both or none of= of them. 2024-12-29 23:35:05 us=3D858101 2001:608:0:814::f000:21 Control Channel MTU= parms [ mss_fix:0 max_frag:0 tun_mtu:1250 tun_max_mtu:0 headroom:126 paylo= ad:1600 tailroom:126 ET:0 ] Program received signal SIGSEGV, Segmentation fault. 0x000055555558121e in get_link_socket_info (c=3D0x5555556c6450) at /home/gert/t_server.git/src/openvpn/forward.h:324 324 return &c->c2.link_sockets[0]->info; (gdb) where #0 0x000055555558121e in get_link_socket_info (c=3D0x5555556c6450) at /home/gert/t_server.git/src/openvpn/forward.h:324 #1 do_init_fragment (c=3D0x5555556c6450) at init.c:3801 #2 init_instance (c=3Dc@...1851...=3D0x5555556c6450, env=3D, flags=3Dflags@...1851...=3D10) at init.c:4736 #3 0x0000555555581e91 in inherit_context_child ( dest=3Ddest@...1851...=3D0x5555556c6450, src=3Dsrc@...1851...=3D0x7ffff= fffc848, ls=3Dls@...1851...=3D0x55555569fb00) at init.c:4977 #4 0x00005555555999e0 in multi_create_instance (m=3Dm@...1851...=3D0x7ffff= fffc780, real=3Dreal@...1851...=3D0x7fffffffc3c0, ls=3Dls@...1851...=3D0x5555556= 9fb00) at multi.c:777 #5 0x00005555555928b2 in multi_get_create_instance_udp (m=3D0x7fffffffc780, floated=3Dfloated@...1851...=3D0x7fffffffc6cf, ls=3Dls@...1851...=3D0x5= 5555569fb00) at mudp.c:260 #6 0x000055555559a4dd in multi_process_incoming_link ( m=3Dm@...1851...=3D0x7fffffffc780, instance=3Dinstance@...1851...=3D0x0, mpp_flags=3Dmpp_flags@...1851...=3D5, ls=3Dls@...1851...=3D0x55555569fb= 00) at multi.c:3356 #7 0x00005555555935f2 in multi_process_io_udp (m=3D0x7fffffffc780, sock=3D0x55555569fb00) at mudp.c:387 #8 tunnel_server_udp (top=3Dtop@...1851...=3D0x7fffffffda10) at mudp.c:523 #9 0x000055555559b2c4 in tunnel_server (top=3Dtop@...1851...=3D0x7fffffffd= a10) at multi.c:4168 (gdb) print &c->c2.link_sockets[0]->info Cannot access memory at address 0x0 (gdb) print &c->c2.link_sockets[0] $1 =3D (struct link_socket **) 0x0 ``` so it definitely looks like "socket not initialized", though I have no idea= why. File src/openvpn/init.c: http://gerrit.openvpn.net/c/openvpn/+/434/comment/721e4eca_fe894283 : PS9, Line 4054: { The `if()` should be outside and the `for()` inside - the condition does no= t depend on `i`. http://gerrit.openvpn.net/c/openvpn/+/434/comment/1a384971_29102103 : PS9, Line 4062: { same thing. http://gerrit.openvpn.net/c/openvpn/+/434/comment/89309b77_8f3abbb8 : PS9, Line 4786: get_link_socket_info(c)); Should this be a per-socket thing? IPv4 vs. IPv6 will change overhead so t= he `frame` calculation will be wrong for all sockets !=3D 0. Maybe a comment to that extent ("for multiple listening sockets, this will = not be correct for these cases, but everything but TLS should no longer be = used anyway")? http://gerrit.openvpn.net/c/openvpn/+/434/comment/a405a93a_e360204a : PS9, Line 4991: &dest->gc); if line length permits, can this be unwrapped? File src/openvpn/mtcp.c: http://gerrit.openvpn.net/c/openvpn/+/434/comment/040f4e94_88362f91 : PS9, Line 271: &c->c2.link_sockets[i]-= >ev_arg); the diff looks as if there are tabs at the beginning of this line? File src/openvpn/mudp.c: http://gerrit.openvpn.net/c/openvpn/+/434/comment/0490e7ea_822b07fb : PS9, Line 388: sock); please unwrap File src/openvpn/multi.c: http://gerrit.openvpn.net/c/openvpn/+/434/comment/7963d5d0_1f026e7c : PS9, Line 3336: { I think this could be wrapped before `const unsigned int mpp_flags` File src/openvpn/socket.c: http://gerrit.openvpn.net/c/openvpn/+/434/comment/c450a732_4bec3d43 : PS9, Line 1037: another blank line http://gerrit.openvpn.net/c/openvpn/+/434/comment/a223f45e_43302346 : PS9, Line 1875: sock->bind_dev =3D o->bind_dev; where did that go to? another rebase accident? *red flag* http://gerrit.openvpn.net/c/openvpn/+/434/comment/03786af0_25ca4cba : PS9, Line 1019: socket_descriptor_t sd; we shouldn't delete blank lines unrelated to actual changes (minor nit) http://gerrit.openvpn.net/c/openvpn/+/434/comment/9c9ce7e2_01384c14 : PS9, Line 1854: int mode) please unwrap http://gerrit.openvpn.net/c/openvpn/+/434/comment/b9a7826e_aead3ffe : PS9, Line 1863: sock->remote_port =3D o->ce.remote_port; not sure this change (remove the local variables `remote_host` and `remote_= port`) is a good thing as part of this patchset. It's cleanup/refactoring,= and unrelated, but makes this diff larger than it should be. So I'd prefer to not do this set of changes. http://gerrit.openvpn.net/c/openvpn/+/434/comment/bff14e2e_61aafce1 : PS9, Line 1919: sock->proxy_dest_port =3D o->ce.remote_port; this http://gerrit.openvpn.net/c/openvpn/+/434/comment/ac638e3f_3c683fd8 : PS9, Line 1924: spurious blank line http://gerrit.openvpn.net/c/openvpn/+/434/comment/8bdd62db_a3c5abdd : PS9, Line 1931: sock->proxy_dest_port =3D o->ce.remote_port; this http://gerrit.openvpn.net/c/openvpn/+/434/comment/c27c8614_67874b24 : PS9, Line 1936: sock->remote_port =3D o->ce.remote_port; and this http://gerrit.openvpn.net/c/openvpn/+/434/comment/731d7cd9_eba0b68a : PS9, Line 2301: /* Always restore the saved signal --register/throw= _signal will handle priority */ you lost a ` ` here after `--` (this is not a command line option `--regist= er`) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/434?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: Ia0a889e800f0b36aed770ee36e31afeec5df6084 Gerrit-Change-Number: 434 Gerrit-PatchSet: 10 Gerrit-Owner: ordex Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: its_Giaan Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: its_Giaan Gerrit-Attention: ordex Gerrit-Comment-Date: Sun, 29 Dec 2024 22:40:09 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment --GPmQfcZRiU0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: its_Giaan, ordex, plaisthos.

Patch set 10:Code-Review -2

V= iew Change

18 comments:

  • Patchset:

    • <= p style=3D"margin-bottom: 4px;">Patch Set #10:

      Getting there, and except for the `bind_de= v` these are minor nitpicks in the source (but worth fixing if we do anothe= r round anyway).

      In the review, I seem to have overlooked something, though - applying t= his on top of current master breaks `--fragment` servers - on the first con= necting client, *boom*

      ```
      2024-12-29 23:34:56 us=3D142019 Initialization Sequence Co= mpleted
      2024-12-29 23:35:05 us=3D857683 Connection Attempt MULTI: multi_= create_instance called
      2024-12-29 23:35:05 us=3D857852 2001:608:0:814::f= 000:21 Re-using SSL/TLS context
      2024-12-29 23:35:05 us=3D857903 2001:608= :0:814::f000:21 WARNING: if you use --mssfix and --fragment, you should use= the "mtu" flag for both or none of of them.
      2024-12-29 23:35:= 05 us=3D858101 2001:608:0:814::f000:21 Control Channel MTU parms [ mss_fix:= 0 max_frag:0 tun_mtu:1250 tun_max_mtu:0 headroom:126 payload:1600 tailroom:= 126 ET:0 ]

      Program received signal SIGSEGV, Segmentation fault.
      0x000055= 555558121e in get_link_socket_info (c=3D0x5555556c6450)
      at /home/ger= t/t_server.git/src/openvpn/forward.h:324
      324 return &c-&= gt;c2.link_sockets[0]->info;
      (gdb) where
      #0 0x000055555558121e in= get_link_socket_info (c=3D0x5555556c6450)
      at /home/gert/t_server.gi= t/src/openvpn/forward.h:324
      #1 do_init_fragment (c=3D0x5555556c6450) at= init.c:3801
      #2 init_instance (c=3Dc@...1851...=3D0x5555556c6450, env= =3D<optimized out>,
      flags=3Dflags@...1851...=3D10) at init.c:= 4736
      #3 0x0000555555581e91 in inherit_context_child (
      dest=3Ddes= t@...1851...=3D0x5555556c6450, src=3Dsrc@...1851...=3D0x7fffffffc848,
      = ls=3Dls@...1851...=3D0x55555569fb00) at init.c:4977
      #4 0x00005555555= 999e0 in multi_create_instance (m=3Dm@...1851...=3D0x7fffffffc780,
      = real=3Dreal@...1851...=3D0x7fffffffc3c0, ls=3Dls@...1851...=3D0x55555569fb0= 0) at multi.c:777
      #5 0x00005555555928b2 in multi_get_create_instance_ud= p (m=3D0x7fffffffc780,
      floated=3Dfloated@...1851...=3D0x7fffffffc6c= f, ls=3Dls@...1851...=3D0x55555569fb00)
      at mudp.c:260
      #6 0x00005= 5555559a4dd in multi_process_incoming_link (
      m=3Dm@...1851...=3D0x7f= ffffffc780, instance=3Dinstance@...1851...=3D0x0,
      mpp_flags=3Dmpp_f= lags@...1851...=3D5, ls=3Dls@...1851...=3D0x55555569fb00) at multi.c:3356#7 0x00005555555935f2 in multi_process_io_udp (m=3D0x7fffffffc780,
      = sock=3D0x55555569fb00) at mudp.c:387
      #8 tunnel_server_udp (top=3Dtop= @...1851...=3D0x7fffffffda10) at mudp.c:523
      #9 0x000055555559b2c4 in tu= nnel_server (top=3Dtop@...1851...=3D0x7fffffffda10)
      at multi.c:4168<= br>(gdb) print &c->c2.link_sockets[0]->info
      Cannot access memo= ry at address 0x0
      (gdb) print &c->c2.link_sockets[0]
      $1 =3D (s= truct link_socket **) 0x0
      ```

      so it definitely looks like "socket not initiali= zed", though I have no idea why.

  • File src/openvpn/init.c:

    • Patch Set #9, Line 4054: {

      The `if()` should be outside and the `for(= )` inside - the condition does not depend on `i`.

    • Patch Se= t #9, Line 4062: = {

      sa= me thing.

    • Patch Set #9, Line 4786: get_link_socke= t_info(c));

      Should this be a per-socket thing? IPv4 vs. IPv6 will change overhea= d so the `frame` calculation will be wrong for all sockets !=3D 0.

      Maybe a comment to th= at extent ("for multiple listening sockets, this will not be correct f= or these cases, but everything but TLS should no longer be used anyway"= ;)?

    • Patch Set #9, Line 4991: &dest->gc);

      if line length per= mits, can this be unwrapped?

  • File src/openvpn/mtcp.c:

    • Patch Set #9, Line 271: &c->c2.link_= sockets[i]->ev_arg);

      the diff looks as if there are tabs at the beginning of t= his line?

  • File sr= c/openvpn/mudp.c:

  • <= li style=3D"margin: 0; padding: 0;">

    File src/openvpn/multi.c:

  • File src/openvpn/socket.c:

  • =

To view, visit change 434. To unsubscribe, or for help writing mail filt= ers, visit settings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia0a889e800f0b36aed770ee36e3= 1afeec5df6084
Gerrit-Change-Number: 434
Gerrit-PatchSet: 10
Gerrit-Owner: ordex <a@...2181...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: its_Giaan <gianmarco@...1664...= 26...>
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: its_Giaan <gianmarco@...1665...= 726...>
Gerrit-Attention: ordex <a@...2181...> <= /div>
Gerrit-Comment-Date: Sun, 29 Dec 2024 22:40:09= +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
--GPmQfcZRiU0=--