strongswan: Update to 5.9.9
[feed/packages.git] / net / transmission / patches / 001-apply-dscp-to-udp-sockets.patch
1 From 98da2afa58b7bdf5350de16fd99905ddb04e1b0d Mon Sep 17 00:00:00 2001
2 From: Dan Walters <dan@walters.io>
3 Date: Sun, 13 Oct 2019 10:08:36 -0500
4 Subject: [PATCH] Apply the configured peer socket TOS to UDP sockets, not just
5 TCP.
6
7 ---
8 libtransmission/session.c | 2 ++
9 libtransmission/tr-udp.c | 20 ++++++++++++++++++++
10 libtransmission/tr-udp.h | 1 +
11 3 files changed, 23 insertions(+)
12
13 --- a/libtransmission/session.c
14 +++ b/libtransmission/session.c
15 @@ -2274,6 +2274,8 @@ static void toggle_utp(void* data)
16
17 tr_udpSetSocketBuffers(session);
18
19 + tr_udpSetSocketTOS(session);
20 +
21 /* But don't call tr_utpClose -- see reset_timer in tr-utp.c for an
22 explanation. */
23 }
24 --- a/libtransmission/tr-udp.c
25 +++ b/libtransmission/tr-udp.c
26 @@ -125,6 +125,24 @@ void tr_udpSetSocketBuffers(tr_session*
27 }
28 }
29
30 +void tr_udpSetSocketTOS(tr_session* session)
31 +{
32 + if (session->peerSocketTOS == 0)
33 + {
34 + return;
35 + }
36 +
37 + if (session->udp_socket != TR_BAD_SOCKET)
38 + {
39 + tr_netSetTOS(session->udp_socket, session->peerSocketTOS, TR_AF_INET);
40 + }
41 +
42 + if (session->udp6_socket != TR_BAD_SOCKET)
43 + {
44 + tr_netSetTOS(session->udp6_socket, session->peerSocketTOS, TR_AF_INET6);
45 + }
46 +}
47 +
48 /* BEP-32 has a rather nice explanation of why we need to bind to one
49 IPv6 address, if I may say so myself. */
50
51 @@ -363,6 +381,8 @@ ipv6:
52
53 tr_udpSetSocketBuffers(ss);
54
55 + tr_udpSetSocketTOS(ss);
56 +
57 if (ss->isDHTEnabled)
58 {
59 tr_dhtInit(ss);
60 --- a/libtransmission/tr-udp.h
61 +++ b/libtransmission/tr-udp.h
62 @@ -30,5 +30,6 @@ THE SOFTWARE.
63 void tr_udpInit(tr_session*);
64 void tr_udpUninit(tr_session*);
65 void tr_udpSetSocketBuffers(tr_session*);
66 +void tr_udpSetSocketTOS(tr_session*);
67
68 bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen);