Add TCP_REPAIR_WINDOW from Linux 4.8

Message ID alpine.DEB.2.20.1610032057290.25878@digraph.polyomino.org.uk
State Committed
Headers

Commit Message

Joseph Myers Oct. 3, 2016, 8:57 p.m. UTC
  On Mon, 3 Oct 2016, Florian Weimer wrote:

> * Joseph Myers:
> 
> > Linux 4.8 adds TCP_REPAIR_WINDOW to include/uapi/linux/tcp.h.  This
> > patch adds it to sysdeps/gnu/netinet/tcp.h accordingly.
> >
> > Tested for x86_64 and x86 (testsuite, and that installed shared
> > libraries are unchanged by the patch).
> 
> Please also add struct tcp_repair_window, otherwise the #define
> doesn't make much sense.  Thanks.

Here is a version that adds that structure as well.

Add TCP_REPAIR_WINDOW from Linux 4.8.

Linux 4.8 adds TCP_REPAIR_WINDOW to include/uapi/linux/tcp.h.  This
patch adds it to sysdeps/gnu/netinet/tcp.h accordingly, along with
struct tcp_repair_window as requested in
<https://sourceware.org/ml/libc-alpha/2016-10/msg00019.html>.

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

2016-10-03  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/gnu/netinet/tcp.h (TCP_REPAIR_WINDOW): New macro.
	(struct tcp_repair_window): New type.
  

Comments

Florian Weimer Oct. 3, 2016, 9 p.m. UTC | #1
* Joseph Myers:

> 2016-10-03  Joseph Myers  <joseph@codesourcery.com>
>
> 	* sysdeps/gnu/netinet/tcp.h (TCP_REPAIR_WINDOW): New macro.
> 	(struct tcp_repair_window): New type.

Looks good.  Thanks.
  

Patch

diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h
index 3fbea54..241bdc7 100644
--- a/sysdeps/gnu/netinet/tcp.h
+++ b/sysdeps/gnu/netinet/tcp.h
@@ -69,6 +69,7 @@ 
 				       connections.  */
 #define TCP_SAVED_SYN		 28 /* Get SYN headers recorded for
 				       connection.  */
+#define TCP_REPAIR_WINDOW	 29 /* Get/set window parameters.  */
 
 #ifdef __USE_MISC
 # include <sys/types.h>
@@ -307,6 +308,16 @@  struct tcp_cookie_transactions
   uint8_t	tcpct_value[TCP_MSS_DEFAULT];
 };
 
+/* For use with TCP_REPAIR_WINDOW.  */
+struct tcp_repair_window
+{
+  uint32_t snd_wl1;
+  uint32_t snd_wnd;
+  uint32_t max_window;
+  uint32_t rcv_wnd;
+  uint32_t rcv_wup;
+};
+
 #endif /* Misc.  */
 
 #endif /* netinet/tcp.h */