Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2014 16:50:46 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r267735 - in stable/10/sys: dev/usb/net netinet
Message-ID:  <201406221650.s5MGok2B046820@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sun Jun 22 16:50:46 2014
New Revision: 267735
URL: http://svnweb.freebsd.org/changeset/base/267735

Log:
  MFC r265455:
  
  Remove unused code. This is triggered by the bugreport of Sylvestre Ledru
  which deal with useless code in the user land stack:
  https://bugzilla.mozilla.org/show_bug.cgi?id=1003929

Modified:
  stable/10/sys/dev/usb/net/if_smsc.c
  stable/10/sys/netinet/sctp_pcb.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/net/if_smsc.c
==============================================================================
--- stable/10/sys/dev/usb/net/if_smsc.c	Sun Jun 22 16:48:21 2014	(r267734)
+++ stable/10/sys/dev/usb/net/if_smsc.c	Sun Jun 22 16:50:46 2014	(r267735)
@@ -82,6 +82,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/priv.h>
 #include <sys/random.h>
 
+#include <netinet/in.h>
+#include <netinet/ip.h>
+
 #include "opt_platform.h"
 
 #ifdef FDT
@@ -1021,25 +1024,32 @@ smsc_bulk_read_callback(struct usb_xfer 
 					 *
 					 * Ignore H/W csum for non-IPv4 packets.
 					 */
-					if (be16toh(eh->ether_type) == ETHERTYPE_IP && pktlen > ETHER_MIN_LEN) {
-					
-						/* Indicate the UDP/TCP csum has been calculated */
-						m->m_pkthdr.csum_flags |= CSUM_DATA_VALID;
-										 
-						/* Copy the TCP/UDP checksum from the last 2 bytes
-						 * of the transfer and put in the csum_data field.
-						 */
-						usbd_copy_out(pc, (off + pktlen),
-									  &m->m_pkthdr.csum_data, 2);
-					
-						/* The data is copied in network order, but the
-						 * csum algorithm in the kernel expects it to be
-						 * in host network order.
-						 */
-						m->m_pkthdr.csum_data = ntohs(m->m_pkthdr.csum_data);
-					
-						smsc_dbg_printf(sc, "RX checksum offloaded (0x%04x)\n",
-										m->m_pkthdr.csum_data);
+					if ((be16toh(eh->ether_type) == ETHERTYPE_IP) &&
+					    (pktlen > ETHER_MIN_LEN)) {
+						struct ip *ip;
+
+						ip = (struct ip *)(eh + 1);
+						if ((ip->ip_v == IPVERSION) &&
+						    ((ip->ip_p == IPPROTO_TCP) ||
+						     (ip->ip_p == IPPROTO_UDP))) {
+							/* Indicate the UDP/TCP csum has been calculated */
+							m->m_pkthdr.csum_flags |= CSUM_DATA_VALID;
+
+							/* Copy the TCP/UDP checksum from the last 2 bytes
+							 * of the transfer and put in the csum_data field.
+							 */
+							usbd_copy_out(pc, (off + pktlen),
+							              &m->m_pkthdr.csum_data, 2);
+
+							/* The data is copied in network order, but the
+							 * csum algorithm in the kernel expects it to be
+							 * in host network order.
+							 */
+							m->m_pkthdr.csum_data = ntohs(m->m_pkthdr.csum_data);
+
+							smsc_dbg_printf(sc, "RX checksum offloaded (0x%04x)\n",
+							                m->m_pkthdr.csum_data);
+						}
 					}
 					
 					/* Need to adjust the offset as well or we'll be off

Modified: stable/10/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/10/sys/netinet/sctp_pcb.c	Sun Jun 22 16:48:21 2014	(r267734)
+++ stable/10/sys/netinet/sctp_pcb.c	Sun Jun 22 16:50:46 2014	(r267735)
@@ -2735,7 +2735,6 @@ sctp_inpcb_bind(struct socket *so, struc
 	uint32_t vrf_id;
 
 	lport = 0;
-	error = 0;
 	bindall = 1;
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	ip_inp = (struct inpcb *)so->so_pcb;
@@ -2856,13 +2855,6 @@ sctp_inpcb_bind(struct socket *so, struc
 				return (error);
 			}
 		}
-		if (p == NULL) {
-			SCTP_INP_DECR_REF(inp);
-			SCTP_INP_WUNLOCK(inp);
-			SCTP_INP_INFO_WUNLOCK();
-			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error);
-			return (error);
-		}
 		SCTP_INP_WUNLOCK(inp);
 		if (bindall) {
 			vrf_id = inp->def_vrf_id;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406221650.s5MGok2B046820>