svn commit: r267735 - in stable/10/sys: dev/usb/net netinet
Michael Tuexen
tuexen at FreeBSD.org
Sun Jun 22 16:50:47 UTC 2014
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;
More information about the svn-src-all
mailing list