From f8c5811615c0685813df8ab04fbe9b778d145e61 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Wed, 25 Feb 2015 11:17:35 +0800 Subject: [PATCH] udp: Disable direct detach, if multicast options are set. Add additional comment about disabling direct detach when setting multicast options. Submitted-by: Romick DragonFly-bug: http://bugs.dragonflybsd.org/issues/2792 --- sys/netinet/udp_usrreq.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index bb11fb0325..b58825664d 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -268,14 +268,18 @@ udp_ctloutput(netmsg_t msg) case IP_MULTICAST_LOOP: case IP_ADD_MEMBERSHIP: case IP_DROP_MEMBERSHIP: - if (&curthread->td_msgport != netisr_cpuport(0)) { - /* - * This pr_ctloutput msg will be forwarded - * to netisr0 to run; we can't do direct - * detaching anymore. - */ - inp->inp_flags &= ~INP_DIRECT_DETACH; - } + /* + * This pr_ctloutput msg will be forwarded + * to netisr0 to run; we can't do direct + * detaching anymore. + * + * NOTE: + * Don't optimize for the sockets whose + * current so_port is netisr0's msgport. + * These sockets could be connect(2)'ed + * later and the so_port will be changed. + */ + inp->inp_flags &= ~INP_DIRECT_DETACH; break; } } -- 2.41.0