Development discussion of WireGuard
 help / color / mirror / Atom feed
* passtos patch
@ 2018-01-18 11:30 Vadim Zotov
  2018-01-18 11:56 ` Kalin KOZHUHAROV
  2018-01-18 16:11 ` Jason A. Donenfeld
  0 siblings, 2 replies; 7+ messages in thread
From: Vadim Zotov @ 2018-01-18 11:30 UTC (permalink / raw)
  To: WireGuard mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1274 bytes --]

Hello,

in some circumstances it is important to set the TOS field in tunnel
packet equivalent to payload packet TOS.

for example, our provider supports three different SLAs, depending on
packet TOS field, with different jitter,

packet loss and service availability. In current release wireguard
always set tos to 0.

This patch solves that problem.


--- send.c.orig 2017-10-17 20:26:29.000000000 +0300
+++ send.c      2018-01-08 15:10:25.364428109 +0300
@@ -302,7 +302,7 @@
         * all of the packets in the queue. If we can't assign nonces
for all of them,
         * we just consider it a failure and wait for the next handshake. */
        skb_queue_walk (&packets, skb) {
-               PACKET_CB(skb)->ds = ip_tunnel_ecn_encap(0 /* No outer
TOS: no leak. TODO: should we use flowi->tos as outer? */, ip_hdr(skb),
skb);
+               PACKET_CB(skb)->ds =
ip_tunnel_ecn_encap(ipv4_get_dsfield(ip_hdr(skb)) & ~INET_ECN_MASK,
ip_hdr(skb), skb);
                PACKET_CB(skb)->nonce =
atomic64_inc_return(&key->counter.counter) - 1;
                if (unlikely(PACKET_CB(skb)->nonce >=
REJECT_AFTER_MESSAGES))
                        goto out_invalid;


[-- Attachment #1.2: Type: text/html, Size: 1846 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: passtos.patch --]
[-- Type: text/x-patch; name="passtos.patch", Size: 726 bytes --]

--- send.c.orig	2017-10-17 20:26:29.000000000 +0300
+++ send.c	2018-01-08 15:10:25.364428109 +0300
@@ -302,7 +302,7 @@
 	 * all of the packets in the queue. If we can't assign nonces for all of them,
 	 * we just consider it a failure and wait for the next handshake. */
 	skb_queue_walk (&packets, skb) {
-		PACKET_CB(skb)->ds = ip_tunnel_ecn_encap(0 /* No outer TOS: no leak. TODO: should we use flowi->tos as outer? */, ip_hdr(skb), skb);
+		PACKET_CB(skb)->ds = ip_tunnel_ecn_encap(ipv4_get_dsfield(ip_hdr(skb)) & ~INET_ECN_MASK, ip_hdr(skb), skb);
 		PACKET_CB(skb)->nonce = atomic64_inc_return(&key->counter.counter) - 1;
 		if (unlikely(PACKET_CB(skb)->nonce >= REJECT_AFTER_MESSAGES))
 			goto out_invalid;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-19  4:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 11:30 passtos patch Vadim Zotov
2018-01-18 11:56 ` Kalin KOZHUHAROV
2018-01-18 13:03   ` Matthias Urlichs
2018-01-18 20:57   ` Ivan Labáth
2018-01-18 16:11 ` Jason A. Donenfeld
2018-01-18 21:10   ` Eric Light
2018-01-19  4:04   ` Daniel Kahn Gillmor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).