All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 1/1] net: tcp: Permit user set TCP_MAXSEG to default value
@ 2017-03-21  0:45 fgao
  2017-03-21  1:23 ` Neal Cardwell
  0 siblings, 1 reply; 3+ messages in thread
From: fgao @ 2017-03-21  0:45 UTC (permalink / raw)
  To: davem, kuznet, jmorris, eric.dumazet, netdev, gfree.wind; +Cc: Gao Feng

From: Gao Feng <fgao@ikuai8.com>

When user_mss is zero, it means use the default value. But the current
codes don't permit user set TCP_MAXSEG to the default value.
It would return the -EINVAL when val is zero.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
 v2: Make codes more clearer, per Eric
 v1: initial version

 net/ipv4/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1e319a5..4f7f163 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2470,7 +2470,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
 		/* Values greater than interface MTU won't take effect. However
 		 * at the point when this call is done we typically don't yet
 		 * know which interface is going to be used */
-		if (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW) {
+		if (!val && (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW)) {
 			err = -EINVAL;
 			break;
 		}
-- 
1.9.1

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

* Re: [PATCH net v2 1/1] net: tcp: Permit user set TCP_MAXSEG to default value
  2017-03-21  0:45 [PATCH net v2 1/1] net: tcp: Permit user set TCP_MAXSEG to default value fgao
@ 2017-03-21  1:23 ` Neal Cardwell
  2017-03-21  1:27   ` Feng Gao
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Cardwell @ 2017-03-21  1:23 UTC (permalink / raw)
  To: fgao
  Cc: David Miller, Alexey Kuznetsov, James Morris, Eric Dumazet,
	Netdev, gfree.wind

On Mon, Mar 20, 2017 at 8:45 PM, <fgao@ikuai8.com> wrote:
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 1e319a5..4f7f163 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2470,7 +2470,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
>                 /* Values greater than interface MTU won't take effect. However
>                  * at the point when this call is done we typically don't yet
>                  * know which interface is going to be used */
> -               if (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW) {
> +               if (!val && (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW)) {
>                         err = -EINVAL;
>                         break;

I believe the sense of the val check is flipped in the proposed patch.

I believe Eric suggested:

  if (val && (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW)) {

Has this been tested?

neal

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

* Re: [PATCH net v2 1/1] net: tcp: Permit user set TCP_MAXSEG to default value
  2017-03-21  1:23 ` Neal Cardwell
@ 2017-03-21  1:27   ` Feng Gao
  0 siblings, 0 replies; 3+ messages in thread
From: Feng Gao @ 2017-03-21  1:27 UTC (permalink / raw)
  To: Neal Cardwell
  Cc: David Miller, Alexey Kuznetsov, James Morris, Eric Dumazet, Netdev

On Tue, Mar 21, 2017 at 9:23 AM, Neal Cardwell <ncardwell@google.com> wrote:
> On Mon, Mar 20, 2017 at 8:45 PM, <fgao@ikuai8.com> wrote:
>> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
>> index 1e319a5..4f7f163 100644
>> --- a/net/ipv4/tcp.c
>> +++ b/net/ipv4/tcp.c
>> @@ -2470,7 +2470,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
>>                 /* Values greater than interface MTU won't take effect. However
>>                  * at the point when this call is done we typically don't yet
>>                  * know which interface is going to be used */
>> -               if (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW) {
>> +               if (!val && (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW)) {
>>                         err = -EINVAL;
>>                         break;
>
> I believe the sense of the val check is flipped in the proposed patch.
>
> I believe Eric suggested:
>
>   if (val && (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW)) {
>
> Has this been tested?
>
> neal

Sorry, I missed the test this time because of the minor fix.
As a result, wrote the wrong logic.

Regards
Feng

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

end of thread, other threads:[~2017-03-21  1:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21  0:45 [PATCH net v2 1/1] net: tcp: Permit user set TCP_MAXSEG to default value fgao
2017-03-21  1:23 ` Neal Cardwell
2017-03-21  1:27   ` Feng Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.