tcp: Multicast sockopts do not make sense on TCP sockets
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 7 May 2014 14:33:40 +0000 (22:33 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 8 May 2014 08:53:46 +0000 (16:53 +0800)
sys/netinet/tcp_usrreq.c

index e8ec6b0..6f36557 100644 (file)
@@ -1369,6 +1369,19 @@ tcp_ctloutput(netmsg_t msg)
        }
 
        if (sopt->sopt_level != IPPROTO_TCP) {
+               switch (sopt->sopt_name) {
+               case IP_MULTICAST_IF:
+               case IP_MULTICAST_VIF:
+               case IP_MULTICAST_TTL:
+               case IP_MULTICAST_LOOP:
+               case IP_ADD_MEMBERSHIP:
+               case IP_DROP_MEMBERSHIP:
+                       /*
+                        * Multicast does not make sense on TCP sockets.
+                        */
+                       error = EOPNOTSUPP;
+                       goto done;
+               }
 #ifdef INET6
                if (INP_CHECK_SOCKAF(so, AF_INET6))
                        ip6_ctloutput_dispatch(msg);