Skip to contentSkip to conversation

Removing unneeded statement from tcp_ipv4.c

PATCH In review Arnd Hannemann 3 participants 6 messages Mar 3, 2008 – Mar 6, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Removing unneeded statement from tcp_ipv4.c

Avoid setting tstamp_ok because this is done two lines later anyway.

net/ipv4/tcp_ipv4.c +2 -3
index 00156bf..a28c4c2 100644
@@ -1302,15 +1302,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                tmp_opt.saw_tstamp = 0;
        }
 
-       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {
+       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval)
                /* Some OSes (unknown ones, but I see them on web server, which
                 * contains information interesting only for windows'
                 * users) do not send their stamp in SYN. It is easy case.
                 * We simply do not advertise TS support.
                 */
                tmp_opt.saw_tstamp = 0;
-               tmp_opt.tstamp_ok  = 0;
-       }
+
        tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
 
        tcp_openreq_init(req, &tmp_opt, skb);
#1 lore raw
Quoted 13 lines · Arnd Hannemann

Avoid setting tstamp_ok because this is done two lines later anyway.

net/ipv4/tcp_ipv4.c +0 -1
index 00156bf..a28c4c2 100644
@@ -1302,15 +1302,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                tmp_opt.saw_tstamp = 0;
        }
 
-       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {

net/ipv4/tcp_ipv4.c int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) · line 1312

Quoted 10 lines
net/ipv4/tcp_ipv4.c +2 -2
+       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval)
                /* Some OSes (unknown ones, but I see them on web server, which
                 * contains information interesting only for windows'
                 * users) do not send their stamp in SYN. It is easy case.
                 * We simply do not advertise TS support.
                 */
                tmp_opt.saw_tstamp = 0;
-               tmp_opt.tstamp_ok  = 0;
-       }
+

Please move the comment before the if (), only then can you remove those braces safely (without affecting readability, etc.).

Quoted 3 lines
net/ipv4/tcp_ipv4.c +0 -0
        tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
 
        tcp_openreq_init(req, &tmp_opt, skb);
Signature · 1 line
 i.
#2 lore raw
Quoted 14 lines · Ilpo Järvinen
Quoted 12 lines · Arnd Hannemann

Avoid setting tstamp_ok because this is done two lines later anyway.

net/ipv4/tcp_ipv4.c +0 -0
index 00156bf..a28c4c2 100644
@@ -1302,15 +1302,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                tmp_opt.saw_tstamp = 0;
        }
 
Quoted 12 lines

net/ipv4/tcp_ipv4.c int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) · line 1312

Quoted 9 lines
net/ipv4/tcp_ipv4.c +1 -2
-       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {
+       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval)
                /* Some OSes (unknown ones, but I see them on web server, which
                 * contains information interesting only for windows'
                 * users) do not send their stamp in SYN. It is easy case.
                 * We simply do not advertise TS support.
                 */
                tmp_opt.saw_tstamp = 0;
-               tmp_opt.tstamp_ok 

Please move the comment before the if (), only then can you remove those braces safely (without affecting readability, etc.).

Avoid setting tstamp_ok because this is done two lines later anyway.

net/ipv4/tcp_ipv4.c +7 -8
index 00156bf..ecef356 100644
@@ -1302,15 +1302,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                tmp_opt.saw_tstamp = 0;
        }
 
-       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {
-               /* Some OSes (unknown ones, but I see them on web server, which
-                * contains information interesting only for windows'
-                * users) do not send their stamp in SYN. It is easy case.
-                * We simply do not advertise TS support.
-                */
+       /* Some OSes (unknown ones, but I see them on web server, which
+        * contains information interesting only for windows'
+        * users) do not send their stamp in SYN. It is easy case.
+        * We simply do not advertise TS support.
+        */
+       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval)
                tmp_opt.saw_tstamp = 0;
-               tmp_opt.tstamp_ok  = 0;
-       }
+
        tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
 
        tcp_openreq_init(req, &tmp_opt, skb);
#4 lore raw
Quoted 10 lines · David Miller

From: Arnd Hannemann <[email protected]>
Date: Tue, 04 Mar 2008 00:18:07 +0100

Quoted 3 lines

Avoid setting tstamp_ok because this is done two lines later anyway.

Patch does not apply, your email client has corrupted the patch by turning tabs into spaces etc.

Sorry, this one should apply.

Avoid setting tstamp_ok because this is done two lines later anyway.

net/ipv4/tcp_ipv4.c +7 -8
index 00156bf..ecef356 100644
@@ -1302,15 +1302,14 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 		tmp_opt.saw_tstamp = 0;
 	}
 
-	if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {
-		/* Some OSes (unknown ones, but I see them on web server, which
-		 * contains information interesting only for windows'
-		 * users) do not send their stamp in SYN. It is easy case.
-		 * We simply do not advertise TS support.
-		 */
+	/* Some OSes (unknown ones, but I see them on web server, which
+	 * contains information interesting only for windows'
+	 * users) do not send their stamp in SYN. It is easy case.
+	 * We simply do not advertise TS support.
+	 */
+	if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval)
 		tmp_opt.saw_tstamp = 0;
-		tmp_opt.tstamp_ok  = 0;
-	}
+	
 	tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
 
 	tcp_openreq_init(req, &tmp_opt, skb);
maintainer
#5 lore raw
In reply to Arnd Hannemann

From: Arnd Hannemann <[email protected]>
Date: Mon, 03 Mar 2008 14:23:38 +0100

net/ipv4/tcp_ipv4.c int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) · line 1312

Quoted 11 lines
net/ipv4/tcp_ipv4.c +2 -3
-       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval) {
+       if (tmp_opt.saw_tstamp && !tmp_opt.rcv_tsval)
                /* Some OSes (unknown ones, but I see them on web server, which
                 * contains information interesting only for windows'
                 * users) do not send their stamp in SYN. It is easy case.
                 * We simply do not advertise TS support.
                 */
                tmp_opt.saw_tstamp = 0;
-               tmp_opt.tstamp_ok  = 0;
-       }
+

Please don't format it like this.

When there is a multi-line comment, you should still enclose the basic block in braces. It's unreadable otherwise.