Patchwork [5/6] tcp: Report mss_clamp with TCP_MAXSEG option in repair mode

login
register
mail settings
Submitter Pavel Emelyanov
Date April 19, 2012, 1:41 p.m.
Message ID <4F90160C.1070605@parallels.com>
Download mbox | patch
Permalink /patch/153762/
State Accepted
Delegated to: David Miller
Headers show

Comments

Pavel Emelyanov - April 19, 2012, 1:41 p.m.
The mss_clamp is the only connection-time negotiated option which
cannot be obtained from the user space. Make the TCP_MAXSEG sockopt
report one in the repair mode.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
 net/ipv4/tcp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 47e2f49..b4e690d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2659,6 +2659,8 @@  static int do_tcp_getsockopt(struct sock *sk, int level,
 		val = tp->mss_cache;
 		if (!val && ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)))
 			val = tp->rx_opt.user_mss;
+		if (tp->repair)
+			val = tp->rx_opt.mss_clamp;
 		break;
 	case TCP_NODELAY:
 		val = !!(tp->nonagle&TCP_NAGLE_OFF);