[Openvpn-devel,XS] Change in openvpn[master]: dco: pass remoteaddr only for UDP peers

Message ID ef088f4d459f0badb62893055dacc51d12013a28-HTML@gerrit.openvpn.net
State New
Headers show
Series [Openvpn-devel,XS] Change in openvpn[master]: dco: pass remoteaddr only for UDP peers | expand

Commit Message

ralf_lici (Code Review) Dec. 13, 2024, 5:09 p.m. UTC
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/+/842?usp=email

to review the following change.


Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

dco: pass remoteaddr only for UDP peers

TCP connected sockets do not need any remote addr
because the destination is fixed.
For this reason we can avoid sending the remote addr
along the peer-new dco call.

This change is important on Linux because the new 'ovpn'
kernel module is stricter when it comes to accepting
netlink messages and will reject calls with TCP sockets
if a remote address is specified.

Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
M src/openvpn/dco.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/842/1

Patch

diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index dcc80d3..b1a3715 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -494,7 +494,9 @@ 
     }
 #endif
     int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
-                           c->c2.link_socket->sd, NULL, remoteaddr, NULL, NULL);
+                           c->c2.link_socket->sd, NULL,
+                           proto_is_dgram(ls->info.proto) ? remoteaddr : NULL,
+                           NULL, NULL);
     if (ret < 0)
     {
         return ret;