Module Name:    src
Committed By:   maxv
Date:           Thu Feb  8 20:41:36 UTC 2018

Modified Files:
        src/sys/netinet: tcp_input.c

Log Message:
Move the IPv4 multicast check earlier; we want to kick multicast packets
all the time, and not just when they are SYNs.

The IPv6 multicast check is already done earlier, so this block of code
can be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.372 -r1.373 src/sys/netinet/tcp_input.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.372 src/sys/netinet/tcp_input.c:1.373
--- src/sys/netinet/tcp_input.c:1.372	Thu Feb  8 20:19:30 2018
+++ src/sys/netinet/tcp_input.c	Thu Feb  8 20:41:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.372 2018/02/08 20:19:30 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.373 2018/02/08 20:41:36 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.372 2018/02/08 20:19:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.373 2018/02/08 20:41:36 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1294,6 +1294,10 @@ tcp_input(struct mbuf *m, ...)
 		af = AF_INET;
 		iphlen = sizeof(struct ip);
 
+		if (IN_MULTICAST(ip->ip_dst.s_addr) ||
+		    in_broadcast(ip->ip_dst, m_get_rcvif_NOMPSAFE(m)))
+			goto drop;
+
 		/* We do the checksum after PCB lookup... */
 		len = ntohs(ip->ip_len);
 		tlen = len - toff;
@@ -1715,21 +1719,6 @@ nosave:;
 			 * Received a SYN.
 			 */
 
-			switch (af) {
-#ifdef INET6
-			case AF_INET6:
-				if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst))
-					goto drop;
-				break;
-#endif /* INET6 */
-			case AF_INET:
-				if (IN_MULTICAST(ip->ip_dst.s_addr) ||
-				    in_broadcast(ip->ip_dst,
-				                 m_get_rcvif_NOMPSAFE(m)))
-					goto drop;
-				break;
-			}
-
 #ifdef INET6
 			/*
 			 * If deprecated address is forbidden, we do

Reply via email to