From owner-svn-src-stable@FreeBSD.ORG Sun Jun 22 16:50:47 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E9E74F2A; Sun, 22 Jun 2014 16:50:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D672523D4; Sun, 22 Jun 2014 16:50:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5MGokvC046822; Sun, 22 Jun 2014 16:50:46 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5MGok2B046820; Sun, 22 Jun 2014 16:50:46 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201406221650.s5MGok2B046820@svn.freebsd.org> From: Michael Tuexen Date: Sun, 22 Jun 2014 16:50:46 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jun 2014 16:50:47 -0000 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 #include +#include +#include + #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;