Skip to contentSkip to conversation

Disconnecting a connected UDP socket

PATCH In review Shibu LKML 2 participants 3 messages Jul 3, 2003

Subsystems (3)
lore
Share & tools
lore

Shibu LKML

author
#0 lore raw

Hi,

I am wondering if Linux supports disconnecting a connected UDP socket. The manpage for connect lists it in the BUGS section. It says disconnect is still not supported. I was wondering if it involves more than adding the following lines to udp_connect in udp.c

if (usin->sin_family == AF_UNSPEC)
return udp_disconnect(sk, 0);

(just above sk_dst_reset(sk))

Will this fix the problem for IPV4 stuff?

Regards
Shibu

---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

#1 lore raw

PATCH 1/1 NET: disconnect support by null address (is Re: Disconnecting a connected UDP socket)

Hello.

In article <[email protected]> (at Wed, 2 Jul 2003 20:16:10 -0700 (PDT)), Shibu LKML <[email protected]> says:

Quoted 8 lines

I am wondering if Linux supports disconnecting a connected UDP socket. The manpage for connect lists it in the BUGS section. It says disconnect is still not supported. I was wondering if it involves more than adding the following lines to udp_connect in udp.c

if (usin->sin_family == AF_UNSPEC)
return udp_disconnect(sk, 0);

(just above sk_dst_reset(sk))

Will this fix the problem for IPV4 stuff?

It seems. Please apply this.

Index: linux-2.5/net/ipv4/udp.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv4/udp.c,v
retrieving revision 1.36

net/ipv4/udp.c +3 -0
diff -u -r1.36 udp.c
@@ -868,6 +868,9 @@
 	if (addr_len < sizeof(*usin)) 
 	  	return -EINVAL;
 
+	if (usin->sin_family == AF_UNSPEC)
+		return udp_disconnect(sk, 0);
+
 	if (usin->sin_family != AF_INET) 
 	  	return -EAFNOSUPPORT;
 

Index: linux-2.5/net/ipv6/udp.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/udp.c,v
retrieving revision 1.39

net/ipv6/udp.c +3 -0
diff -u -r1.39 udp.c
@@ -213,6 +213,9 @@
 	int			addr_type;
 	int			err;
 
+	if (usin->sin6_family == AF_UNSPEC)
+		return udp_disconnect(sk, 0);
+
 	if (usin->sin6_family == AF_INET) {
 		if (__ipv6_only_sock(sk))
 			return -EAFNOSUPPORT;
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
#2 lore raw

Re: [PATCH] NET: disconnect support by null address (is Re: Disconnecting a connected UDP socket)

In article <[email protected]> (at Fri, 04 Jul 2003 02:28:57 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 <[email protected]> says:

Quoted 1 line

It seems. Please apply this.

Sorry, I was too hurry. net/ipv4/af_inet.c:inet_dgram_connect() cares this case. Please forget the patch...

Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA