Skip to contentSkip to conversation

wireguard column reformatting for end of cycle

PATCH In review Jason A. Donenfeld 4 participants 13 messages Jun 1, 2020

Subsystems (3)
lore
Share & tools
lore

Jason A. Donenfeld

author maintainer
#0 lore raw

cover wireguard column reformatting for end of cycle

Hey Dave,

This is a series of 1, and the sole patch inside of it has justification regarding that patch itself. But I thought I'd mention in the cover letter that this is being sent right at the tail end of the net-next cycle, before you close it tomorrow afternoon, so that when net-next subsequently opens up, this patch has already made it to net, and we don't have any hassles with merges. I realize that in general this isn't the type of patch anyone really likes because of the merge hassle, but I think the timing is right for it, and WireGuard is still young enough that this should be still pretty easily possible.

Thanks,
Jason

Jason A. Donenfeld (1):
wireguard: reformat to 100 column lines

 drivers/net/wireguard/allowedips.c           |  98 +++---
 drivers/net/wireguard/allowedips.h           |  22 +-
 drivers/net/wireguard/cookie.c               |  90 ++----
 drivers/net/wireguard/cookie.h               |  15 +-
 drivers/net/wireguard/device.c               |  69 ++--
 drivers/net/wireguard/messages.h             |  10 +-
 drivers/net/wireguard/netlink.c              | 143 +++------
 drivers/net/wireguard/noise.c                | 321 ++++++++-----------
 drivers/net/wireguard/noise.h                |  20 +-
 drivers/net/wireguard/peer.c                 |  92 +++---
 drivers/net/wireguard/peer.h                 |   3 +-
 drivers/net/wireguard/peerlookup.c           |  96 +++---
 drivers/net/wireguard/peerlookup.h           |  27 +-
 drivers/net/wireguard/queueing.c             |  14 +-
 drivers/net/wireguard/queueing.h             |  66 ++--
 drivers/net/wireguard/ratelimiter.c          |  39 +--
 drivers/net/wireguard/receive.c              | 162 ++++------
 drivers/net/wireguard/selftest/allowedips.c  | 164 ++++------
 drivers/net/wireguard/selftest/counter.c     |  13 +-
 drivers/net/wireguard/selftest/ratelimiter.c |  35 +-
 drivers/net/wireguard/send.c                 | 163 ++++------
 drivers/net/wireguard/socket.c               |  75 ++---
 drivers/net/wireguard/socket.h               |  30 +-
 drivers/net/wireguard/timers.c               | 110 +++----
 drivers/net/wireguard/timers.h               |   3 +-
 include/uapi/linux/wireguard.h               |  89 +++--
 26 files changed, 753 insertions(+), 1216 deletions(-)
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH 1/1 wireguard: reformat to 100 column lines

While this sort of change is typically viewed as "trivial", "cosmetic", or even "bikesheddy", I think there's a very serious argument to be made about the readability and comprehensibility of the code as a result.

One of the principle motivations for WireGuard is that the code is readable and, generally, enjoyable to read, so that people do actually spend time understanding it and helping to find bugs. Changing the original codebase to 80 columns was a painful exercise, and resulted in something much less satisfactory than desired. It wasn't really worth debating -- conventions are conventions, after all -- but with the recent Linux style guideline being changed from 80 to 100, we can finally revisit this. The end result makes a considerable difference. Even when developing on this code base prior, I tended to work in ~100 line columns, sometimes reformatting a function for the purposes of development, before packaging it back up for the mailing list. With this change, development and maintenance also becomes a more enjoyable task.

Generally speaking, I did not write WireGuard with butchered variable names, preferring things that would be immediately memorable and recognizable for readers. For example, I prefer to name the ephemeral private key "ephemeral_private" instead of "ep" or "eph_priv", so that there's no guess work or additional cognitive strain when auditing. It seems like many other parts of the kernel have made similar choices. For example, "hlist_for_each_entry_rcu_bh" is a very clearly named function, that tells me exactly what it's going to do, without needing to guess or look things up in documentation. But it's also 27 characters. Previously this would cause all sorts of gnarly wrapping; now it reads naturally.

To be clear, this isn't at all a reversion to the original v1 submission of WireGuard, which had wild and out of control column widths. Rather, this is a thorough reworking based on the readability afforded to us now by the 100 column guideline. This also isn't some kind of machine-made automated conversion. All of this has been reworked by hand, hours of work, with real attention to detail, given 100 column constraints.

My hope in paying attention to readability like this is that it will produce a more maintainable codebase, as well as being more attractive to audit and understand fully. Logistically, it also happens to be a good time in the development cycle for making these kinds of changes.

Since, as mentioned earlier, I did do this by hand, I've made sure that the actual resulting algorithms haven't changed at all by accident. The only actual change is that device.o winds up slightly different, due to the call to ASSERT_RTNL in wg_netdevice_notification. That macro expands to something with __LINE__ in it, which then changes the input argument to the printk. Beyond this, the object files are byte-for-byte identical.

---
 drivers/net/wireguard/allowedips.c           |  98 +++---
 drivers/net/wireguard/allowedips.h           |  22 +-
 drivers/net/wireguard/cookie.c               |  90 ++----
 drivers/net/wireguard/cookie.h               |  15 +-
 drivers/net/wireguard/device.c               |  69 ++--
 drivers/net/wireguard/messages.h             |  10 +-
 drivers/net/wireguard/netlink.c              | 143 +++------
 drivers/net/wireguard/noise.c                | 321 ++++++++-----------
 drivers/net/wireguard/noise.h                |  20 +-
 drivers/net/wireguard/peer.c                 |  92 +++---
 drivers/net/wireguard/peer.h                 |   3 +-
 drivers/net/wireguard/peerlookup.c           |  96 +++---
 drivers/net/wireguard/peerlookup.h           |  27 +-
 drivers/net/wireguard/queueing.c             |  14 +-
 drivers/net/wireguard/queueing.h             |  66 ++--
 drivers/net/wireguard/ratelimiter.c          |  39 +--
 drivers/net/wireguard/receive.c              | 162 ++++------
 drivers/net/wireguard/selftest/allowedips.c  | 164 ++++------
 drivers/net/wireguard/selftest/counter.c     |  13 +-
 drivers/net/wireguard/selftest/ratelimiter.c |  35 +-
 drivers/net/wireguard/send.c                 | 163 ++++------
 drivers/net/wireguard/socket.c               |  75 ++---
 drivers/net/wireguard/socket.h               |  30 +-
 drivers/net/wireguard/timers.c               | 110 +++----
 drivers/net/wireguard/timers.h               |   3 +-
 include/uapi/linux/wireguard.h               |  89 +++--
 26 files changed, 753 insertions(+), 1216 deletions(-)
drivers/net/wireguard/allowedips.c +37 -61
index 3725e9cd85f4..ef059c83f7f7 100644
@@ -16,8 +16,7 @@ static void swap_endian(u8 *dst, const u8 *src, u8 bits)
 	}
 }
 
-static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src,
-				 u8 cidr, u8 bits)
+static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src, u8 cidr, u8 bits)
 {
 	node->cidr = cidr;
 	node->bit_at_a = cidr / 8U;
@@ -28,11 +27,9 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src,
 	node->bitlen = bits;
 	memcpy(node->bits, src, bits / 8U);
 }
-#define CHOOSE_NODE(parent, key) \
-	parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1]
+#define CHOOSE_NODE(parent, key) parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1]
 
-static void push_rcu(struct allowedips_node **stack,
-		     struct allowedips_node __rcu *p, unsigned int *len)
+static void push_rcu(struct allowedips_node **stack, struct allowedips_node __rcu *p, unsigned int *len)
 {
 	if (rcu_access_pointer(p)) {
 		WARN_ON(IS_ENABLED(DEBUG) && *len >= 128);
@@ -42,8 +39,7 @@ static void push_rcu(struct allowedips_node **stack,
 
 static void root_free_rcu(struct rcu_head *rcu)
 {
-	struct allowedips_node *node, *stack[128] = {
-		container_of(rcu, struct allowedips_node, rcu) };
+	struct allowedips_node *node, *stack[128] = { container_of(rcu, struct allowedips_node, rcu) };
 	unsigned int len = 1;
 
 	while (len > 0 && (node = stack[--len])) {
@@ -66,8 +62,8 @@ static void root_remove_peer_lists(struct allowedips_node *root)
 	}
 }
 
-static void walk_remove_by_peer(struct allowedips_node __rcu **top,
-				struct wg_peer *peer, struct mutex *lock)
+static void walk_remove_by_peer(struct allowedips_node __rcu **top, struct wg_peer *peer,
+				struct mutex *lock)
 {
 #define REF(p) rcu_access_pointer(p)
 #define DEREF(p) rcu_dereference_protected(*(p), lockdep_is_held(lock))
@@ -90,8 +86,7 @@ static void walk_remove_by_peer(struct allowedips_node __rcu **top,
 			--len;
 			continue;
 		}
-		if (!prev || REF(prev->bit[0]) == node ||
-		    REF(prev->bit[1]) == node) {
+		if (!prev || REF(prev->bit[0]) == node || REF(prev->bit[1]) == node) {
 			if (REF(node->bit[0]))
 				PUSH(&node->bit[0]);
 			else if (REF(node->bit[1]))
@@ -100,13 +95,11 @@ static void walk_remove_by_peer(struct allowedips_node __rcu **top,
 			if (REF(node->bit[1]))
 				PUSH(&node->bit[1]);
 		} else {
-			if (rcu_dereference_protected(node->peer,
-				lockdep_is_held(lock)) == peer) {
+			if (rcu_dereference_protected(node->peer, lockdep_is_held(lock)) == peer) {
 				RCU_INIT_POINTER(node->peer, NULL);
 				list_del_init(&node->peer_list);
 				if (!node->bit[0] || !node->bit[1]) {
-					rcu_assign_pointer(*nptr, DEREF(
-					       &node->bit[!REF(node->bit[0])]));
+					rcu_assign_pointer(*nptr, DEREF(&node->bit[!REF(node->bit[0])]));
 					kfree_rcu(node, rcu);
 					node = DEREF(nptr);
 				}
@@ -125,32 +118,27 @@ static unsigned int fls128(u64 a, u64 b)
 	return a ? fls64(a) + 64U : fls64(b);
 }
 
-static u8 common_bits(const struct allowedips_node *node, const u8 *key,
-		      u8 bits)
+static u8 common_bits(const struct allowedips_node *node, const u8 *key, u8 bits)
 {
 	if (bits == 32)
 		return 32U - fls(*(const u32 *)node->bits ^ *(const u32 *)key);
 	else if (bits == 128)
-		return 128U - fls128(
-			*(const u64 *)&node->bits[0] ^ *(const u64 *)&key[0],
-			*(const u64 *)&node->bits[8] ^ *(const u64 *)&key[8]);
+		return 128U - fls128(*(const u64 *)&node->bits[0] ^ *(const u64 *)&key[0],
+				     *(const u64 *)&node->bits[8] ^ *(const u64 *)&key[8]);
 	return 0;
 }
 
-static bool prefix_matches(const struct allowedips_node *node, const u8 *key,
-			   u8 bits)
+static bool prefix_matches(const struct allowedips_node *node, const u8 *key, u8 bits)
 {
-	/* This could be much faster if it actually just compared the common
-	 * bits properly, by precomputing a mask bswap(~0 << (32 - cidr)), and
-	 * the rest, but it turns out that common_bits is already super fast on
-	 * modern processors, even taking into account the unfortunate bswap.
-	 * So, we just inline it like this instead.
+	/* This could be much faster if it actually just compared the common bits properly, by
+	 * precomputing a mask bswap(~0 << (32 - cidr)), and the rest, but it turns out that
+	 * common_bits is already super fast on modern processors, even taking into account the
+	 * unfortunate bswap.  So, we just inline it like this instead.
 	 */
 	return common_bits(node, key, bits) >= node->cidr;
 }
 
-static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits,
-					 const u8 *key)
+static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits, const u8 *key)
 {
 	struct allowedips_node *node = trie, *found = NULL;
 
@@ -165,8 +153,7 @@ static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits,
 }
 
 /* Returns a strong reference to a peer */
-static struct wg_peer *lookup(struct allowedips_node __rcu *root, u8 bits,
-			      const void *be_ip)
+static struct wg_peer *lookup(struct allowedips_node __rcu *root, u8 bits, const void *be_ip)
 {
 	/* Aligned so it can be passed to fls/fls64 */
 	u8 ip[16] __aligned(__alignof(u64));
@@ -187,12 +174,10 @@ static struct wg_peer *lookup(struct allowedips_node __rcu *root, u8 bits,
 	return peer;
 }
 
-static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key,
-			   u8 cidr, u8 bits, struct allowedips_node **rnode,
-			   struct mutex *lock)
+static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, u8 cidr, u8 bits,
+			   struct allowedips_node **rnode, struct mutex *lock)
 {
-	struct allowedips_node *node = rcu_dereference_protected(trie,
-						lockdep_is_held(lock));
+	struct allowedips_node *node = rcu_dereference_protected(trie, lockdep_is_held(lock));
 	struct allowedips_node *parent = NULL;
 	bool exact = false;
 
@@ -202,15 +187,14 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key,
 			exact = true;
 			break;
 		}
-		node = rcu_dereference_protected(CHOOSE_NODE(parent, key),
-						 lockdep_is_held(lock));
+		node = rcu_dereference_protected(CHOOSE_NODE(parent, key), lockdep_is_held(lock));
 	}
 	*rnode = parent;
 	return exact;
 }
 
-static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
-	       u8 cidr, struct wg_peer *peer, struct mutex *lock)
+static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, u8 cidr,
+	       struct wg_peer *peer, struct mutex *lock)
 {
 	struct allowedips_node *node, *parent, *down, *newnode;
 
@@ -243,8 +227,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
 	if (!node) {
 		down = rcu_dereference_protected(*trie, lockdep_is_held(lock));
 	} else {
-		down = rcu_dereference_protected(CHOOSE_NODE(node, key),
-						 lockdep_is_held(lock));
+		down = rcu_dereference_protected(CHOOSE_NODE(node, key), lockdep_is_held(lock));
 		if (!down) {
 			rcu_assign_pointer(CHOOSE_NODE(node, key), newnode);
 			return 0;
@@ -258,8 +241,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
 		if (!parent)
 			rcu_assign_pointer(*trie, newnode);
 		else
-			rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits),
-					   newnode);
+			rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits), newnode);
 	} else {
 		node = kzalloc(sizeof(*node), GFP_KERNEL);
 		if (unlikely(!node)) {
@@ -275,8 +257,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
 		if (!parent)
 			rcu_assign_pointer(*trie, node);
 		else
-			rcu_assign_pointer(CHOOSE_NODE(parent, node->bits),
-					   node);
+			rcu_assign_pointer(CHOOSE_NODE(parent, node->bits), node);
 	}
 	return 0;
 }
@@ -295,23 +276,21 @@ void wg_allowedips_free(struct allowedips *table, struct mutex *lock)
 	RCU_INIT_POINTER(table->root4, NULL);
 	RCU_INIT_POINTER(table->root6, NULL);
 	if (rcu_access_pointer(old4)) {
-		struct allowedips_node *node = rcu_dereference_protected(old4,
-							lockdep_is_held(lock));
+		struct allowedips_node *node = rcu_dereference_protected(old4, lockdep_is_held(lock));
 
 		root_remove_peer_lists(node);
 		call_rcu(&node->rcu, root_free_rcu);
 	}
 	if (rcu_access_pointer(old6)) {
-		struct allowedips_node *node = rcu_dereference_protected(old6,
-							lockdep_is_held(lock));
+		struct allowedips_node *node = rcu_dereference_protected(old6, lockdep_is_held(lock));
 
 		root_remove_peer_lists(node);
 		call_rcu(&node->rcu, root_free_rcu);
 	}
 }
 
-int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
-			    u8 cidr, struct wg_peer *peer, struct mutex *lock)
+int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip, u8 cidr,
+			    struct wg_peer *peer, struct mutex *lock)
 {
 	/* Aligned so it can be passed to fls */
 	u8 key[4] __aligned(__alignof(u32));
@@ -321,8 +300,8 @@ int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
 	return add(&table->root4, 32, key, cidr, peer, lock);
 }
 
-int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
-			    u8 cidr, struct wg_peer *peer, struct mutex *lock)
+int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip, u8 cidr,
+			    struct wg_peer *peer, struct mutex *lock)
 {
 	/* Aligned so it can be passed to fls64 */
 	u8 key[16] __aligned(__alignof(u64));
@@ -332,8 +311,7 @@ int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
 	return add(&table->root6, 128, key, cidr, peer, lock);
 }
 
-void wg_allowedips_remove_by_peer(struct allowedips *table,
-				  struct wg_peer *peer, struct mutex *lock)
+void wg_allowedips_remove_by_peer(struct allowedips *table, struct wg_peer *peer, struct mutex *lock)
 {
 	++table->seq;
 	walk_remove_by_peer(&table->root4, peer, lock);
@@ -353,8 +331,7 @@ int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr)
 }
 
 /* Returns a strong reference to a peer */
-struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
-					 struct sk_buff *skb)
+struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table, struct sk_buff *skb)
 {
 	if (skb->protocol == htons(ETH_P_IP))
 		return lookup(table->root4, 32, &ip_hdr(skb)->daddr);
@@ -364,8 +341,7 @@ struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
 }
 
 /* Returns a strong reference to a peer */
-struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,
-					 struct sk_buff *skb)
+struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, struct sk_buff *skb)
 {
 	if (skb->protocol == htons(ETH_P_IP))
 		return lookup(table->root4, 32, &ip_hdr(skb)->saddr);
drivers/net/wireguard/allowedips.h +9 -13
index e5c83cafcef4..288f9981261f 100644
@@ -15,9 +15,8 @@ struct wg_peer;
 struct allowedips_node {
 	struct wg_peer __rcu *peer;
 	struct allowedips_node __rcu *bit[2];
-	/* While it may seem scandalous that we waste space for v4,
-	 * we're alloc'ing to the nearest power of 2 anyway, so this
-	 * doesn't actually make a difference.
+	/* While it may seem scandalous that we waste space for v4, we're alloc'ing to the nearest
+	 * power of 2 anyway, so this doesn't actually make a difference.
 	 */
 	u8 bits[16] __aligned(__alignof(u64));
 	u8 cidr, bit_at_a, bit_at_b, bitlen;
@@ -37,20 +36,17 @@ struct allowedips {
 
 void wg_allowedips_init(struct allowedips *table);
 void wg_allowedips_free(struct allowedips *table, struct mutex *mutex);
-int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
-			    u8 cidr, struct wg_peer *peer, struct mutex *lock);
-int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
-			    u8 cidr, struct wg_peer *peer, struct mutex *lock);
-void wg_allowedips_remove_by_peer(struct allowedips *table,
-				  struct wg_peer *peer, struct mutex *lock);
+int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip, u8 cidr,
+			    struct wg_peer *peer, struct mutex *lock);
+int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip, u8 cidr,
+			    struct wg_peer *peer, struct mutex *lock);
+void wg_allowedips_remove_by_peer(struct allowedips *table, struct wg_peer *peer, struct mutex *lock);
 /* The ip input pointer should be __aligned(__alignof(u64))) */
 int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr);
 
 /* These return a strong reference to a peer: */
-struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
-					 struct sk_buff *skb);
-struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,
-					 struct sk_buff *skb);
+struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table, struct sk_buff *skb);
+struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, struct sk_buff *skb);
 
 #ifdef DEBUG
 bool wg_allowedips_selftest(void);
drivers/net/wireguard/cookie.c +33 -57

195 lines not on this page · raw message

drivers/net/wireguard/cookie.h +5 -10
index c4bd61ca03f2..722ca8c50dc8 100644
@@ -38,22 +38,17 @@ enum cookie_mac_state {
 	VALID_MAC_WITH_COOKIE
 };
 
-void wg_cookie_checker_init(struct cookie_checker *checker,
-			    struct wg_device *wg);
+void wg_cookie_checker_init(struct cookie_checker *checker, struct wg_device *wg);
 void wg_cookie_checker_precompute_device_keys(struct cookie_checker *checker);
 void wg_cookie_checker_precompute_peer_keys(struct wg_peer *peer);
 void wg_cookie_init(struct cookie *cookie);
 
-enum cookie_mac_state wg_cookie_validate_packet(struct cookie_checker *checker,
-						struct sk_buff *skb,
+enum cookie_mac_state wg_cookie_validate_packet(struct cookie_checker *checker, struct sk_buff *skb,
 						bool check_cookie);
-void wg_cookie_add_mac_to_packet(void *message, size_t len,
-				 struct wg_peer *peer);
+void wg_cookie_add_mac_to_packet(void *message, size_t len, struct wg_peer *peer);
 
-void wg_cookie_message_create(struct message_handshake_cookie *src,
-			      struct sk_buff *skb, __le32 index,
+void wg_cookie_message_create(struct message_handshake_cookie *src, struct sk_buff *skb, __le32 index,
 			      struct cookie_checker *checker);
-void wg_cookie_message_consume(struct message_handshake_cookie *src,
-			       struct wg_device *wg);
+void wg_cookie_message_consume(struct message_handshake_cookie *src, struct wg_device *wg);
 
 #endif /* _WG_COOKIE_H */
drivers/net/wireguard/device.c +29 -40

154 lines not on this page · raw message

drivers/net/wireguard/messages.h +4 -6
index 208da72673fc..660635cae81d 100644
@@ -66,8 +66,8 @@ struct message_header {
 	 * u8 type
 	 * u8 reserved_zero[3]
 	 *
-	 * But it turns out that by encoding this as little endian,
-	 * we achieve the same thing, and it makes checking faster.
+	 * But it turns out that by encoding this as little endian, we achieve the same thing, and
+	 * it makes checking faster.
 	 */
 	__le32 type;
 };
@@ -109,8 +109,7 @@ struct message_data {
 	u8 encrypted_data[];
 };
 
-#define message_data_len(plain_len) \
-	(noise_encrypted_len(plain_len) + sizeof(struct message_data))
+#define message_data_len(plain_len) (noise_encrypted_len(plain_len) + sizeof(struct message_data))
 
 enum message_alignments {
 	MESSAGE_PADDING_MULTIPLE = 16,
@@ -120,8 +119,7 @@ enum message_alignments {
 #define SKB_HEADER_LEN                                       \
 	(max(sizeof(struct iphdr), sizeof(struct ipv6hdr)) + \
 	 sizeof(struct udphdr) + NET_SKB_PAD)
-#define DATA_PACKET_HEAD_ROOM \
-	ALIGN(sizeof(struct message_data) + SKB_HEADER_LEN, 4)
+#define DATA_PACKET_HEAD_ROOM ALIGN(sizeof(struct message_data) + SKB_HEADER_LEN, 4)
 
 enum { HANDSHAKE_DSCP = 0x88 /* AF41, plus 00 ECN */ };
 
drivers/net/wireguard/netlink.c +53 -90

313 lines not on this page · raw message

drivers/net/wireguard/noise.c +126 -195

639 lines not on this page · raw message

drivers/net/wireguard/noise.h +8 -12
index c527253dba80..25ade2cc4db6 100644
@@ -111,23 +111,19 @@ bool wg_noise_received_with_keypair(struct noise_keypairs *keypairs,
 				    struct noise_keypair *received_keypair);
 void wg_noise_expire_current_peer_keypairs(struct wg_peer *peer);
 
-void wg_noise_set_static_identity_private_key(
-	struct noise_static_identity *static_identity,
-	const u8 private_key[NOISE_PUBLIC_KEY_LEN]);
+void wg_noise_set_static_identity_private_key(struct noise_static_identity *static_identity,
+					      const u8 private_key[NOISE_PUBLIC_KEY_LEN]);
 void wg_noise_precompute_static_static(struct wg_peer *peer);
 
-bool
-wg_noise_handshake_create_initiation(struct message_handshake_initiation *dst,
-				     struct noise_handshake *handshake);
-struct wg_peer *
-wg_noise_handshake_consume_initiation(struct message_handshake_initiation *src,
-				      struct wg_device *wg);
+bool wg_noise_handshake_create_initiation(struct message_handshake_initiation *dst,
+					  struct noise_handshake *handshake);
+struct wg_peer *wg_noise_handshake_consume_initiation(struct message_handshake_initiation *src,
+						      struct wg_device *wg);
 
 bool wg_noise_handshake_create_response(struct message_handshake_response *dst,
 					struct noise_handshake *handshake);
-struct wg_peer *
-wg_noise_handshake_consume_response(struct message_handshake_response *src,
-				    struct wg_device *wg);
+struct wg_peer *wg_noise_handshake_consume_response(struct message_handshake_response *src,
+						    struct wg_device *wg);
 
 bool wg_noise_handshake_begin_session(struct noise_handshake *handshake,
 				      struct noise_keypairs *keypairs);
drivers/net/wireguard/peer.c +36 -56

161 lines not on this page · raw message

drivers/net/wireguard/peer.h +1 -2
index 23af40922997..6d771fd9499d 100644
@@ -66,8 +66,7 @@ struct wg_peer {
 	bool is_dead;
 };
 
-struct wg_peer *wg_peer_create(struct wg_device *wg,
-			       const u8 public_key[NOISE_PUBLIC_KEY_LEN],
+struct wg_peer *wg_peer_create(struct wg_device *wg, const u8 public_key[NOISE_PUBLIC_KEY_LEN],
 			       const u8 preshared_key[NOISE_SYMMETRIC_KEY_LEN]);
 
 struct wg_peer *__must_check wg_peer_get_maybe_zero(struct wg_peer *peer);
drivers/net/wireguard/peerlookup.c +36 -60

192 lines not on this page · raw message

drivers/net/wireguard/peerlookup.h +10 -17
index ced811797680..e17969c487d7 100644
@@ -22,13 +22,10 @@ struct pubkey_hashtable {
 };
 
 struct pubkey_hashtable *wg_pubkey_hashtable_alloc(void);
-void wg_pubkey_hashtable_add(struct pubkey_hashtable *table,
-			     struct wg_peer *peer);
-void wg_pubkey_hashtable_remove(struct pubkey_hashtable *table,
-				struct wg_peer *peer);
-struct wg_peer *
-wg_pubkey_hashtable_lookup(struct pubkey_hashtable *table,
-			   const u8 pubkey[NOISE_PUBLIC_KEY_LEN]);
+void wg_pubkey_hashtable_add(struct pubkey_hashtable *table, struct wg_peer *peer);
+void wg_pubkey_hashtable_remove(struct pubkey_hashtable *table, struct wg_peer *peer);
+struct wg_peer *wg_pubkey_hashtable_lookup(struct pubkey_hashtable *table,
+					   const u8 pubkey[NOISE_PUBLIC_KEY_LEN]);
 
 struct index_hashtable {
 	/* TODO: move to rhashtable */
@@ -49,16 +46,12 @@ struct index_hashtable_entry {
 };
 
 struct index_hashtable *wg_index_hashtable_alloc(void);
-__le32 wg_index_hashtable_insert(struct index_hashtable *table,
-				 struct index_hashtable_entry *entry);
-bool wg_index_hashtable_replace(struct index_hashtable *table,
-				struct index_hashtable_entry *old,
+__le32 wg_index_hashtable_insert(struct index_hashtable *table, struct index_hashtable_entry *entry);
+bool wg_index_hashtable_replace(struct index_hashtable *table, struct index_hashtable_entry *old,
 				struct index_hashtable_entry *new);
-void wg_index_hashtable_remove(struct index_hashtable *table,
-			       struct index_hashtable_entry *entry);
-struct index_hashtable_entry *
-wg_index_hashtable_lookup(struct index_hashtable *table,
-			  const enum index_hashtable_type type_mask,
-			  const __le32 index, struct wg_peer **peer);
+void wg_index_hashtable_remove(struct index_hashtable *table, struct index_hashtable_entry *entry);
+struct index_hashtable_entry *wg_index_hashtable_lookup(struct index_hashtable *table,
+							const enum index_hashtable_type type_mask,
+							const __le32 index, struct wg_peer **peer);
 
 #endif /* _WG_PEERLOOKUP_H */
drivers/net/wireguard/queueing.c +6 -8
index 71b8e80b58e1..42ffc4d6f501 100644
@@ -5,12 +5,11 @@
 
 #include "queueing.h"
 
-struct multicore_worker __percpu *
-wg_packet_percpu_multicore_worker_alloc(work_func_t function, void *ptr)
+struct multicore_worker __percpu *wg_packet_percpu_multicore_worker_alloc(work_func_t function,
+									  void *ptr)
 {
 	int cpu;
-	struct multicore_worker __percpu *worker =
-		alloc_percpu(struct multicore_worker);
+	struct multicore_worker __percpu *worker = alloc_percpu(struct multicore_worker);
 
 	if (!worker)
 		return NULL;
@@ -22,8 +21,8 @@ wg_packet_percpu_multicore_worker_alloc(work_func_t function, void *ptr)
 	return worker;
 }
 
-int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function,
-			 bool multicore, unsigned int len)
+int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, bool multicore,
+			 unsigned int len)
 {
 	int ret;
 
@@ -33,8 +32,7 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function,
 		return ret;
 	if (function) {
 		if (multicore) {
-			queue->worker = wg_packet_percpu_multicore_worker_alloc(
-				function, queue);
+			queue->worker = wg_packet_percpu_multicore_worker_alloc(function, queue);
 			if (!queue->worker) {
 				ptr_ring_cleanup(&queue->ring, NULL);
 				return -ENOMEM;
drivers/net/wireguard/queueing.h +27 -39

137 lines not on this page · raw message

drivers/net/wireguard/ratelimiter.c +15 -24
index 3fedd1d21f5e..9398cd5ef5c9 100644
@@ -40,8 +40,7 @@ enum {
 
 static void entry_free(struct rcu_head *rcu)
 {
-	kmem_cache_free(entry_cache,
-			container_of(rcu, struct ratelimiter_entry, rcu));
+	kmem_cache_free(entry_cache, container_of(rcu, struct ratelimiter_entry, rcu));
 	atomic_dec(&total_entries);
 }
 
@@ -62,14 +61,12 @@ static void wg_ratelimiter_gc_entries(struct work_struct *work)
 	for (i = 0; i < table_size; ++i) {
 		spin_lock(&table_lock);
 		hlist_for_each_entry_safe(entry, temp, &table_v4[i], hash) {
-			if (unlikely(!work) ||
-			    now - entry->last_time_ns > NSEC_PER_SEC)
+			if (unlikely(!work) || now - entry->last_time_ns > NSEC_PER_SEC)
 				entry_uninit(entry);
 		}
 #if IS_ENABLED(CONFIG_IPV6)
 		hlist_for_each_entry_safe(entry, temp, &table_v6[i], hash) {
-			if (unlikely(!work) ||
-			    now - entry->last_time_ns > NSEC_PER_SEC)
+			if (unlikely(!work) || now - entry->last_time_ns > NSEC_PER_SEC)
 				entry_uninit(entry);
 		}
 #endif
@@ -83,9 +80,8 @@ static void wg_ratelimiter_gc_entries(struct work_struct *work)
 
 bool wg_ratelimiter_allow(struct sk_buff *skb, struct net *net)
 {
-	/* We only take the bottom half of the net pointer, so that we can hash
-	 * 3 words in the end. This way, siphash's len param fits into the final
-	 * u32, and we don't incur an extra round.
+	/* We only take the bottom half of the net pointer, so that we can hash 3 words in the end.
+	 * This way, siphash's len param fits into the final u32, and we don't incur an extra round.
 	 */
 	const u32 net_word = (unsigned long)net;
 	struct ratelimiter_entry *entry;
@@ -94,15 +90,13 @@ bool wg_ratelimiter_allow(struct sk_buff *skb, struct net *net)
 
 	if (skb->protocol == htons(ETH_P_IP)) {
 		ip = (u64 __force)ip_hdr(skb)->saddr;
-		bucket = &table_v4[hsiphash_2u32(net_word, ip, &key) &
-				   (table_size - 1)];
+		bucket = &table_v4[hsiphash_2u32(net_word, ip, &key) & (table_size - 1)];
 	}
 #if IS_ENABLED(CONFIG_IPV6)
 	else if (skb->protocol == htons(ETH_P_IPV6)) {
 		/* Only use 64 bits, so as to ratelimit the whole /64. */
 		memcpy(&ip, &ipv6_hdr(skb)->saddr, sizeof(ip));
-		bucket = &table_v6[hsiphash_3u32(net_word, ip >> 32, ip, &key) &
-				   (table_size - 1)];
+		bucket = &table_v6[hsiphash_3u32(net_word, ip >> 32, ip, &key) & (table_size - 1)];
 	}
 #endif
 	else
@@ -112,16 +106,13 @@ bool wg_ratelimiter_allow(struct sk_buff *skb, struct net *net)
 		if (entry->net == net && entry->ip == ip) {
 			u64 now, tokens;
 			bool ret;
-			/* Quasi-inspired by nft_limit.c, but this is actually a
-			 * slightly different algorithm. Namely, we incorporate
-			 * the burst as part of the maximum tokens, rather than
-			 * as part of the rate.
+			/* Quasi-inspired by nft_limit.c, but this is actually a slightly different
+			 * algorithm. Namely, we incorporate the burst as part of the maximum
+			 * tokens, rather than as part of the rate.
 			 */
 			spin_lock(&entry->lock);
 			now = ktime_get_coarse_boottime_ns();
-			tokens = min_t(u64, TOKEN_MAX,
-				       entry->tokens + now -
-					       entry->last_time_ns);
+			tokens = min_t(u64, TOKEN_MAX, entry->tokens + now - entry->last_time_ns);
 			entry->last_time_ns = now;
 			ret = tokens >= PACKET_COST;
 			entry->tokens = ret ? tokens - PACKET_COST : tokens;
@@ -165,10 +156,10 @@ int wg_ratelimiter_init(void)
 	if (!entry_cache)
 		goto err;
 
-	/* xt_hashlimit.c uses a slightly different algorithm for ratelimiting,
-	 * but what it shares in common is that it uses a massive hashtable. So,
-	 * we borrow their wisdom about good table sizes on different systems
-	 * dependent on RAM. This calculation here comes from there.
+	/* xt_hashlimit.c uses a slightly different algorithm for ratelimiting, but what it shares
+	 * in common is that it uses a massive hashtable. So, we borrow their wisdom about good
+	 * table sizes on different systems dependent on RAM. This calculation here comes from
+	 * there.
 	 */
 	table_size = (totalram_pages() > (1U << 30) / PAGE_SIZE) ? 8192 :
 		max_t(unsigned long, 16, roundup_pow_of_two(
drivers/net/wireguard/receive.c +59 -103

370 lines not on this page · raw message

drivers/net/wireguard/selftest/allowedips.c +62 -102

307 lines not on this page · raw message

drivers/net/wireguard/selftest/counter.c +6 -7
index ec3c156bf91b..39214e43b4df 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireguard/selftest/ratelimiter.c +12 -23
index 007cd4457c5f..7a97e4e651bc 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireguard/send.c +58 -105

163 lines not on this page · raw message

drivers/net/wireguard/socket.c +28 -47

75 lines not on this page · raw message

drivers/net/wireguard/socket.h +11 -19
index bab5848efbcd..e1e3f98800f0 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireguard/timers.c +43 -67

110 lines not on this page · raw message

drivers/net/wireguard/timers.h +1 -2
index f0653dcb1326..72fa1606c6f9 100644

Lines of this file are not shown. View the raw message.

include/uapi/linux/wireguard.h +38 -51

89 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.26.2

Part of the diff is not shown here. View the raw message.

#2 lore raw

Re: [PATCH net-next 1/1] wireguard: reformat to 100 column lines

Quoted 3 lines · Jason A. Donenfeld

While this sort of change is typically viewed as "trivial", "cosmetic", or even "bikesheddy", I think there's a very serious argument to be made about the readability and comprehensibility of the code as a result.

Hey Jason.

I think a lot of these changes make a good deal of sense.

I certainly prefer:

drivers/net/wireguard/allowedips.c static unsigned int fls128(u64 a, u64 b) · line 129

Quoted 12 lines
drivers/net/wireguard/allowedips.c +3 -3
+static u8 common_bits(const struct allowedips_node *node, const u8 *key, u8 bits)
 {
 	if (bits == 32)
 		return 32U - fls(*(const u32 *)node->bits ^ *(const u32 *)key);
 	else if (bits == 128)
-		return 128U - fls128(
-			*(const u64 *)&node->bits[0] ^ *(const u64 *)&key[0],
-			*(const u64 *)&node->bits[8] ^ *(const u64 *)&key[8]);
+		return 128U - fls128(*(const u64 *)&node->bits[0] ^ *(const u64 *)&key[0],
+				     *(const u64 *)&node->bits[8] ^ *(const u64 *)&key[8]);
 	return 0;
 }

(though the different uses of nodes->bits vs &nodes->bits[0]
and node->key vs &node->key[0] in the two blocks is just odd.

whereas:

drivers/net/wireguard/allowedips.c static unsigned int fls128(u64 a, u64 b) · line 136

Quoted 13 lines
drivers/net/wireguard/allowedips.c +5 -7
-static bool prefix_matches(const struct allowedips_node *node, const u8 *key,
-			   u8 bits)
+static bool prefix_matches(const struct allowedips_node *node, const u8 *key, u8 bits)
 {
-	/* This could be much faster if it actually just compared the common
-	 * bits properly, by precomputing a mask bswap(~0 << (32 - cidr)), and
-	 * the rest, but it turns out that common_bits is already super fast on
-	 * modern processors, even taking into account the unfortunate bswap.
-	 * So, we just inline it like this instead.
+	/* This could be much faster if it actually just compared the common bits properly, by
+	 * precomputing a mask bswap(~0 << (32 - cidr)), and the rest, but it turns out that
+	 * common_bits is already super fast on modern processors, even taking into account the
+	 * unfortunate bswap.  So, we just inline it like this instead.

Reformatting comments just because you get more columns in the code makes reading the comments a bit harder.

Newspaper columns are pretty narrow for a reason.

Please remember that left to right scanning of text, especially for comments, is not particularly improved by longer lines.

cheers, Joe

author maintainer
#3 lore raw

Re: [PATCH net-next 1/1] wireguard: reformat to 100 column lines

Quoted 4 lines · Joe Perches

Newspaper columns are pretty narrow for a reason.

Please remember that left to right scanning of text, especially for comments, is not particularly improved by longer lines.

I agree that extra long lines make reading text impossible -- 500 is madness, for example -- but 100 columns is a marked improvement over 80 in reading quickly for me, where I can take in more text on one glance. I regularly will reformat long emails in vim with gq, and I'm not the only one who does that; it was a nice suggestion made to me years ago.

Either way, I would prefer not to bikeshed these minutia. If you want to impose a different column limit for comments than for the rest of the code, I suggest you bring that up in the original thread where Linus was discussing this stuff and codify it there as part of the style guide. Please don't derail this patch before net-next closes tomorrow; that will make things a larger headache than necessary.

Jason

maintainer
#4 lore raw
In reply to Jason A. Donenfeld

From: "Jason A. Donenfeld" <[email protected]>
Date: Mon, 1 Jun 2020 00:29:45 -0600

Quoted 9 lines

This is a series of 1, and the sole patch inside of it has justification regarding that patch itself. But I thought I'd mention in the cover letter that this is being sent right at the tail end of the net-next cycle, before you close it tomorrow afternoon, so that when net-next subsequently opens up, this patch has already made it to net, and we don't have any hassles with merges. I realize that in general this isn't the type of patch anyone really likes because of the merge hassle, but I think the timing is right for it, and WireGuard is still young enough that this should be still pretty easily possible.

This is going to make nearly every -stable backport not apply cleanly, which is a severe burdon for everyone having to maintain stable trees.

I'm not applying this, sorry Jason.

author maintainer
#5 lore raw

Hi Dave,

Quoted 2 lines · David Miller

This is going to make nearly every -stable backport not apply cleanly, which is a severe burdon for everyone having to maintain stable trees.

This possibility had occurred to me too, which is why I mentioned the project being sufficiently young that this can work out. It's not actually in any LTS yet, which means at the worst, this will apply temporarily for 5.6, and only then on the off chance that a patch is near code that this touches. Alternatively, it'd be easy enough to add a Fixes: to this, just in case. I'll be sad but will understand if you decide to n'ack this in the end, but please do consider first that practically speaking this won't be nearly as bad as this kind of thing normally is.

Jason

#6 lore raw
Quoted 6 lines · Jason A. Donenfeld

Hi Dave,

Quoted 2 lines · David Miller

This is going to make nearly every -stable backport not apply cleanly, which is a severe burdon for everyone having to maintain stable trees.

Quoted 9 lines

This possibility had occurred to me too, which is why I mentioned the project being sufficiently young that this can work out. It's not actually in any LTS yet, which means at the worst, this will apply temporarily for 5.6, and only then on the off chance that a patch is near code that this touches. Alternatively, it'd be easy enough to add a Fixes: to this, just in case. I'll be sad but will understand if you decide to n'ack this in the end, but please do consider first that practically speaking this won't be nearly as bad as this kind of thing normally is.

It seems just this handful of wireguard patches in -next are missing from 5.6.9.

a9e90d9931f3a474f04bab782ccd9d77904941e9 wireguard: noise: separate receive counter from send counter c78a0b4a78839d572d8a80f6a62221c0d7843135 wireguard: queueing: preserve flow hash across packet scrubbing bc67d371256f5c47d824e2eec51e46c8d62d022e wireguard: noise: read preshared key while taking lock 243f2148937adc72bcaaa590d482d599c936efde wireguard: send/receive: use explicit unlikely branch instead of implicit coalescing 4fed818ef54b08d4b29200e416cce65546ad5312 wireguard: selftests: initalize ipv6 members to NULL to squelch clang warning 4005f5c3c9d006157ba716594e0d70c88a235c5e wireguard: send/receive: cond_resched() when processing worker ringbuffers b673e24aad36981f327a6570412ffa7754de8911 wireguard: socket: remove errant restriction on looping to self eebabcb26ea1e3295704477c6cd4e772c96a9559 wireguard: receive: use tunnel helpers for decapsulating ECN markings 130c58606171326c81841a49cc913cd354113dd9 wireguard: queueing: cleanup ptr_ring in error path of packet_queue_init d6833e42786e050e7522d6a91a9361e54085897d wireguard: send: remove errant newline from packet_encrypt_worker

It seems at least some of them fix defects.
Assuming they all get applied to 5.6.10, likely
it'd be reasonably simple to apply this cleanup.

The reformatting does make the code easier to read and is a fair bit shorter.

maintainer
#7 lore raw
In reply to Jason A. Donenfeld

Jason, I'm not discussing this.

I have to backport these fixes and it makes more work for me, as well as others.

I'm also quite sad that the most important thing you could find to work on was figuring out how many columns should be in a line.

author maintainer
#8 lore raw

Hi Dave,

Quoted 4 lines · David Miller

Jason, I'm not discussing this.

I have to backport these fixes and it makes more work for me, as well as others.

As I said earlier, no problem, and I understand.

Quoted 2 lines

I'm also quite sad that the most important thing you could find to work on was figuring out how many columns should be in a line.

That seems kind of uncalled for, don't you think? But I guess I'll take the bait: this is very much not the only thing I've been working on, far from it in fact. There was a small window between Linus committing the 100 column patch and net-next closing, so I took a break from other things to make sure this at least had a shot. Turns out that the backporting concern was paramount, which is completely understandable, and now I'll continue on my way working on the stuff that I resumed last night after sending this patch.

Jason

#9 lore raw
In reply to Jason A. Donenfeld
Quoted 10 lines · Jason A. Donenfeld

Hi Dave,

Quoted 2 lines · David Miller

This is going to make nearly every -stable backport not apply cleanly, which is a severe burdon for everyone having to maintain stable trees.

This possibility had occurred to me too, which is why I mentioned the project being sufficiently young that this can work out. It's not actually in any LTS yet, which means at the worst, this will apply temporarily for 5.6,

It's not only about stable. The code has been backported e.g. into SLE15 SP2 and openSUSE Leap 15.2 kernels which which are deep in RC phase so that we would face the choice between backporting this huge patch in a maintenance update and keeping to stumble over it in most of future backports (for years). Neither is very appealing (to put it mildly). I have no idea how many other distributions would be affected or for how long but I doubt we are the only ones.

Of course, if this really brought some value, it would be easier to live with it. But you want to reshuffle the code just because checkpatch will no longer complain. There are places where your changes obviously improve readability of the code - but it's a minority.

Moreover, reading the message of commit bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning"), I don't think the intent was for people to start rewriting existing code to use 100 columns whereever possible. Right in the first sentence, it clearly says "staying withing 80 columns is certainly still _preferred_". And then there is also the concern "to avoid unnecessary whitespace changes in files".

Quoted 2 lines

and only then on the off chance that a patch is near code that this touches.

The patch has ~4400 lines, IIRC the whole wireguard submission had something like 8000 or 9000. I'm afraid the chance is actually much bigger than you claim.

Quoted 2 lines

Alternatively, it'd be easy enough to add a Fixes: to this, just in case.

I don't understand what you meant by this sentence but I hope you didn't mean to suggest that this patch should go into stable.

Michal

author maintainer
#10 lore raw
Quoted 7 lines · Michal Kubecek

It's not only about stable. The code has been backported e.g. into SLE15 SP2 and openSUSE Leap 15.2 kernels which which are deep in RC phase so that we would face the choice between backporting this huge patch in a maintenance update and keeping to stumble over it in most of future backports (for years). Neither is very appealing (to put it mildly). I have no idea how many other distributions would be affected or for how long but I doubt we are the only ones.

Understood, no problem at all.

maintainer
#11 lore raw
In reply to Michal Kubecek

From: Michal Kubecek <[email protected]>
Date: Mon, 1 Jun 2020 23:13:07 +0200

Quoted 6 lines · Jason A. Donenfeld
Quoted 4 lines

This possibility had occurred to me too, which is why I mentioned the project being sufficiently young that this can work out. It's not actually in any LTS yet, which means at the worst, this will apply temporarily for 5.6,

Quoted 7 lines

It's not only about stable. The code has been backported e.g. into SLE15 SP2 and openSUSE Leap 15.2 kernels which which are deep in RC phase so that we would face the choice between backporting this huge patch in a maintenance update and keeping to stumble over it in most of future backports (for years). Neither is very appealing (to put it mildly). I have no idea how many other distributions would be affected or for how long but I doubt we are the only ones.

And google and Facebook and twitter and Amazon and whatever else major infrastructure provider decides to pull Wireguard into their tree.

Jason, I bet you're pretty happy about the uptake of Wireguard but that popularity and distribution has consequences. Small things have huge ramifications for developers all over the place who now have to keep up with your work and do backports of your fixes.

author maintainer
#12 lore raw
Quoted 18 lines · David Miller

From: Michal Kubecek <[email protected]>
Date: Mon, 1 Jun 2020 23:13:07 +0200

Quoted 6 lines · Jason A. Donenfeld
Quoted 4 lines

This possibility had occurred to me too, which is why I mentioned the project being sufficiently young that this can work out. It's not actually in any LTS yet, which means at the worst, this will apply temporarily for 5.6,

Quoted 7 lines

It's not only about stable. The code has been backported e.g. into SLE15 SP2 and openSUSE Leap 15.2 kernels which which are deep in RC phase so that we would face the choice between backporting this huge patch in a maintenance update and keeping to stumble over it in most of future backports (for years). Neither is very appealing (to put it mildly). I have no idea how many other distributions would be affected or for how long but I doubt we are the only ones.

Quoted 7 lines

And google and Facebook and twitter and Amazon and whatever else major infrastructure provider decides to pull Wireguard into their tree.

Jason, I bet you're pretty happy about the uptake of Wireguard but that popularity and distribution has consequences. Small things have huge ramifications for developers all over the place who now have to keep up with your work and do backports of your fixes.

You're right, a fair point. Folks are indeed backporting this with their own processes. I'm maintaining a 5.4.y backport, but it'd be foolish to assume that's the only one.

Jason