is sk->reuse truly a boolean?
Subsystems (2)
Quoted 1 line
From what I see in the code and from references in, for instance, Unix
Network Programming (W. Richard Stevens) it is, but then how can this work?
net/ipv4/tcp_ipv4.c, line 265
if (sk->reuse > 1)
goto success;In net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace passes > 1 it becomes 1, is this the intended behaviour? I think we have a bug in tcp_ipv4 or in core/sock.c 8)
Comments?
- Arnaldo
In article <[email protected]> (at Tue, 20 May 2003 12:57:45 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 11 lines
From what I see in the code and from references in, for instance, Unix Network Programming (W. Richard Stevens) it is, but then how can this work?
net/ipv4/tcp_ipv4.c, line 265if (sk->reuse > 1) goto success;In
net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace passes > 1 it becomes 1, is this the intended behaviour? I think we have a bug intcp_ipv4or incore/sock.c8)
Good point. However, SO_REUSEADDR works because we have tcp_bind_conflict().
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
Em Wed, May 21, 2003 at 01:15:20AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu:
Quoted 7 lines
In article <[email protected]> (at Tue, 20 May 2003 12:57:45 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 5 lines
From what I see in the code and from references in, for instance, Unix Network Programming (W. Richard Stevens) it is, but then how can this work?
net/ipv4/tcp_ipv4.c, line 265
Quoted 8 lines
Quoted 6 lines
if (sk->reuse > 1) goto success;In
net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace passes > 1 it becomes 1, is this the intended behaviour? I think we have a bug intcp_ipv4or incore/sock.c8)Good point. However,
SO_REUSEADDRworks because we havetcp_bind_conflict().
mmmkay, so we have to fix it by changing the test to:
if (sk->reuse) goto success;
Isn't it?
Another one I found in this audit:
sk->no_check, as per setsockopt is a boolean, but sunrpc code wants tree values, does that need receiving this three values from userspace? if so we have a bug in setsockopt, but without looking at sunrpc code I guess this is only internal...
- Arnaldo
In article <[email protected]> (at Tue, 20 May 2003 13:29:07 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
In
net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace passes > 1 it becomes 1, is this the intended behaviour? I think we have a bug intcp_ipv4or incore/sock.c8)
Quoted 8 lines
Quoted 1 line
Good point. However,
SO_REUSEADDRworks because we havetcp_bind_conflict().mmmkay, so we have to fix it by changing the test to:
if (sk->reuse) goto success;Isn't it?
I don't think so. Above modification will break current reasonable bind(2) behavior.
Well, it would be dead code, which would be used for (still unsupported) SO_REUSEPORT.
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
Em Wed, May 21, 2003 at 01:53:17AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu:
Quoted 13 lines
In article <[email protected]> (at Tue, 20 May 2003 13:29:07 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines
In
net/core/sock.c, setsockopt it just assigns 1 or 0, i.e. if userspace passes > 1 it becomes 1, is this the intended behaviour? I think we have a bug intcp_ipv4or incore/sock.c8)Good point. However,
SO_REUSEADDRworks because we havetcp_bind_conflict().mmmkay, so we have to fix it by changing the test to:
if (sk->reuse) goto success;
Quoted 7 lines
Quoted 1 line
Isn't it?
I don't think so. Above modification will break current reasonable bind(2) behavior.
Well, it would be dead code, which would be used for (still unsupported)
SO_REUSEPORT.
So just delete the test?
- Arnaldo
In article <[email protected]> (at Tue, 20 May 2003 13:58:31 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 7 lines
Quoted 5 lines
I don't think so. Above modification will break current reasonable bind(2) behavior.
Well, it would be dead code, which would be used for (still unsupported)
SO_REUSEPORT.So just delete the test?
Hmm, (bacause I want to remember this path in the code,) how about #if 0 ? David?
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
Em Wed, May 21, 2003 at 02:02:42AM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu:
Quoted 5 lines
In article <[email protected]> (at Tue, 20 May 2003 13:58:31 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 3 lines
Quoted 3 lines
I don't think so. Above modification will break current reasonable bind(2) behavior.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Well, it would be dead code, which would be used for (still unsupported)
SO_REUSEPORT.So just delete the test?
Hmm, (bacause I want to remember this path in the code,) how about #if 0 ? David?
Sounds good to me.
From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Wed, 21 May 2003 02:02:42 +0900 (JST)
In article <[email protected]> (at Tue, 20 May 2003 13:58:31 -0300), Arnaldo Carvalho de Melo <[email protected]> says:
Quoted 1 line
So just delete the test?
Hmm, (bacause I want to remember this path in the code,) how about #if 0 ? David?
You may #if 0 this as long as you:
1) Add comment.
2) Add identical code block to tcp_ipv6.c
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue, 20 May 2003 13:29:07 -0300
Another one I found in this audit:
sk->no_check, as per setsockopt is a boolean, but sunrpc code wants tree values, does that need receiving this three values from userspace? if so we have a bug in setsockopt, but without looking at sunrpc code I guess this is only internal...
This UDP_CSUM_NORCV value made sense when we did UDP checksumming at packet receive time, but now that we delay checksumming until user recvmsg() call runs it is quite useless.
net/sunrpc/xprt.c:udp_data_ready() wants to see packets which have not been checksummed yet, so it may do this and copy at the same time. This is the only behavior made by UDP, it never checks sk->no_check value.
So UDP_CSUM_NORCV and the sk->no_check setting in net/sunrpc/xprt.c can be both deleted. It is true for 2.4.x too, and you probably want to run this patch by the NFS guys first so they do not have a heart attack when they notice this hit the tree :-)