netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Disable tcp MSS option in three way handshake?
@ 2012-10-25 22:27 Vincent Li
  2012-10-25 22:42 ` Eric Dumazet
  2012-10-25 22:50 ` Rick Jones
  0 siblings, 2 replies; 7+ messages in thread
From: Vincent Li @ 2012-10-25 22:27 UTC (permalink / raw)
  To: netdev@vger.kernel.org

Hi,

this sounds crazy, we have a weird situation that an unknown tcp
implementation not putting tcp MSS option in the SYN/ACK which caused
us some issue. I am tasked to mimic the unknown tcp immplementation on
not sending MSS in tcp SYN/ACK, I am wondering if I can achieve that
by modifying linux kernel tcp code,  there is socket option
TCP_MAXSEG, but that seems only affecting the size of MSS, not
removing the MSS option. do you have any pointer on how to do that in
kernel tcp code?

Thanks

Vincent

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

* Re: Disable tcp MSS option in three way handshake?
  2012-10-25 22:27 Disable tcp MSS option in three way handshake? Vincent Li
@ 2012-10-25 22:42 ` Eric Dumazet
  2012-10-25 22:52   ` Vincent Li
                     ` (2 more replies)
  2012-10-25 22:50 ` Rick Jones
  1 sibling, 3 replies; 7+ messages in thread
From: Eric Dumazet @ 2012-10-25 22:42 UTC (permalink / raw)
  To: Vincent Li; +Cc: netdev@vger.kernel.org

On Thu, 2012-10-25 at 15:27 -0700, Vincent Li wrote:
> Hi,
> 
> this sounds crazy, we have a weird situation that an unknown tcp
> implementation not putting tcp MSS option in the SYN/ACK which caused
> us some issue. I am tasked to mimic the unknown tcp immplementation on
> not sending MSS in tcp SYN/ACK, I am wondering if I can achieve that
> by modifying linux kernel tcp code,  there is socket option
> TCP_MAXSEG, but that seems only affecting the size of MSS, not
> removing the MSS option. do you have any pointer on how to do that in
> kernel tcp code?

You'll have to patch the code.

Or else, you could add a new feature to net/netfilter/xt_TCPMSS.c

(We already have 

#define XT_TCPMSS_CLAMP_PMTU 0xffff

You could add

#define XT_TCPMSS_REMOVE 0xfffe

and replace MSS option by NOP

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

* Re: Disable tcp MSS option in three way handshake?
  2012-10-25 22:27 Disable tcp MSS option in three way handshake? Vincent Li
  2012-10-25 22:42 ` Eric Dumazet
@ 2012-10-25 22:50 ` Rick Jones
  1 sibling, 0 replies; 7+ messages in thread
From: Rick Jones @ 2012-10-25 22:50 UTC (permalink / raw)
  To: Vincent Li, netdev

On 10/25/2012 03:27 PM, Vincent Li wrote:
> Hi,
>
> this sounds crazy, we have a weird situation that an unknown tcp
> implementation not putting tcp MSS option in the SYN/ACK which caused
> us some issue.

All that means is you/your TCP stack are to assume an MSS of 536 bytes. 
  In that sense at least, there is nothing (supposed to be) weird about it.

rick jones

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

* Re: Disable tcp MSS option in three way handshake?
  2012-10-25 22:42 ` Eric Dumazet
@ 2012-10-25 22:52   ` Vincent Li
  2012-10-25 23:15     ` Vijay Subramanian
  2012-10-26 22:54   ` Vincent Li
  2012-11-04  0:25   ` Jan Engelhardt
  2 siblings, 1 reply; 7+ messages in thread
From: Vincent Li @ 2012-10-25 22:52 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev@vger.kernel.org

On Thu, Oct 25, 2012 at 3:42 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2012-10-25 at 15:27 -0700, Vincent Li wrote:
>> Hi,
>>
>> this sounds crazy, we have a weird situation that an unknown tcp
>> implementation not putting tcp MSS option in the SYN/ACK which caused
>> us some issue. I am tasked to mimic the unknown tcp immplementation on
>> not sending MSS in tcp SYN/ACK, I am wondering if I can achieve that
>> by modifying linux kernel tcp code,  there is socket option
>> TCP_MAXSEG, but that seems only affecting the size of MSS, not
>> removing the MSS option. do you have any pointer on how to do that in
>> kernel tcp code?
>
> You'll have to patch the code.
>
> Or else, you could add a new feature to net/netfilter/xt_TCPMSS.c
>
> (We already have
>
> #define XT_TCPMSS_CLAMP_PMTU 0xffff
>
> You could add
>
> #define XT_TCPMSS_REMOVE 0xfffe
>
> and replace MSS option by NOP
>
>
>
thanks for the reply, I did a quick look at the code, as a quick dirty
hack, can I change the

 699 /* Set up TCP options for SYN-ACKs. */
 700 static unsigned int tcp_synack_options(struct sock *sk,
 701                                    struct request_sock *req,
 702                                    unsigned int mss, struct sk_buff *skb,
 703                                    struct tcp_out_options *opts,
 704                                    struct tcp_md5sig_key **md5,
 705                                    struct tcp_extend_values *xvp)
 706 {

..................
 730         /* We always send an MSS option. */
 731         opts->mss = mss; <---------here set opts->mss = 0 ?

would that work?

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

* Re: Disable tcp MSS option in three way handshake?
  2012-10-25 22:52   ` Vincent Li
@ 2012-10-25 23:15     ` Vijay Subramanian
  0 siblings, 0 replies; 7+ messages in thread
From: Vijay Subramanian @ 2012-10-25 23:15 UTC (permalink / raw)
  To: Vincent Li; +Cc: Eric Dumazet, netdev@vger.kernel.org

> thanks for the reply, I did a quick look at the code, as a quick dirty
> hack, can I change the
>
>  699 /* Set up TCP options for SYN-ACKs. */
>  700 static unsigned int tcp_synack_options(struct sock *sk,
>  701                                    struct request_sock *req,
>  702                                    unsigned int mss, struct sk_buff *skb,
>  703                                    struct tcp_out_options *opts,
>  704                                    struct tcp_md5sig_key **md5,
>  705                                    struct tcp_extend_values *xvp)
>  706 {
>
> ..................
>  730         /* We always send an MSS option. */
>  731         opts->mss = mss; <---------here set opts->mss = 0 ?
>
> would that work?


tcp_make_synack() calls tcp_options_write() has this:

        if (unlikely(opts->mss)) {
                *ptr++ = htonl((TCPOPT_MSS << 24) |
                               (TCPOLEN_MSS << 16) |
                               opts->mss);
        }

It will not add the option if opts->mss is zero, so this should work too.

Vijay

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

* Re: Disable tcp MSS option in three way handshake?
  2012-10-25 22:42 ` Eric Dumazet
  2012-10-25 22:52   ` Vincent Li
@ 2012-10-26 22:54   ` Vincent Li
  2012-11-04  0:25   ` Jan Engelhardt
  2 siblings, 0 replies; 7+ messages in thread
From: Vincent Li @ 2012-10-26 22:54 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev@vger.kernel.org

On Thu, Oct 25, 2012 at 3:42 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2012-10-25 at 15:27 -0700, Vincent Li wrote:
>> Hi,
>>
>> this sounds crazy, we have a weird situation that an unknown tcp
>> implementation not putting tcp MSS option in the SYN/ACK which caused
>> us some issue. I am tasked to mimic the unknown tcp immplementation on
>> not sending MSS in tcp SYN/ACK, I am wondering if I can achieve that
>> by modifying linux kernel tcp code,  there is socket option
>> TCP_MAXSEG, but that seems only affecting the size of MSS, not
>> removing the MSS option. do you have any pointer on how to do that in
>> kernel tcp code?
>
> You'll have to patch the code.
>
> Or else, you could add a new feature to net/netfilter/xt_TCPMSS.c
>
> (We already have
>
> #define XT_TCPMSS_CLAMP_PMTU 0xffff
>
> You could add
>
> #define XT_TCPMSS_REMOVE 0xfffe
>
> and replace MSS option by NOP
>
>
>

for the sake of complete information, net/netfilter/xt_TCPOPTSTRIP.c
already have this feature to strip tcp option

Vincent

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

* Re: Disable tcp MSS option in three way handshake?
  2012-10-25 22:42 ` Eric Dumazet
  2012-10-25 22:52   ` Vincent Li
  2012-10-26 22:54   ` Vincent Li
@ 2012-11-04  0:25   ` Jan Engelhardt
  2 siblings, 0 replies; 7+ messages in thread
From: Jan Engelhardt @ 2012-11-04  0:25 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Vincent Li, netdev@vger.kernel.org


On Friday 2012-10-26 00:42, Eric Dumazet wrote:
>On Thu, 2012-10-25 at 15:27 -0700, Vincent Li wrote:
>> 
>> this sounds crazy, we have a weird situation that an unknown tcp
>> implementation not putting tcp MSS option in the SYN/ACK which caused
>> us some issue. I am tasked to mimic the unknown tcp immplementation on
>> not sending MSS in tcp SYN/ACK, I am wondering if I can achieve that
>> by modifying linux kernel tcp code,  there is socket option
>> TCP_MAXSEG, but that seems only affecting the size of MSS, not
>> removing the MSS option. do you have any pointer on how to do that in
>> kernel tcp code?
>
>You'll have to patch the code.
>
>Or else, you could add a new feature to net/netfilter/xt_TCPMSS.c

Or you could just use -j TCPOPTSTRIP.

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

end of thread, other threads:[~2012-11-04  0:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25 22:27 Disable tcp MSS option in three way handshake? Vincent Li
2012-10-25 22:42 ` Eric Dumazet
2012-10-25 22:52   ` Vincent Li
2012-10-25 23:15     ` Vijay Subramanian
2012-10-26 22:54   ` Vincent Li
2012-11-04  0:25   ` Jan Engelhardt
2012-10-25 22:50 ` Rick Jones

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).