From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 21:29:20 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5D02ED8; Thu, 27 Nov 2014 21:29:20 +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 B827DFA2; Thu, 27 Nov 2014 21:29:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sARLTKt2064550; Thu, 27 Nov 2014 21:29:20 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sARLTK2g064549; Thu, 27 Nov 2014 21:29:20 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201411272129.sARLTK2g064549@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 27 Nov 2014 21:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275195 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 21:29:21 -0000 Author: melifaro Date: Thu Nov 27 21:29:19 2014 New Revision: 275195 URL: https://svnweb.freebsd.org/changeset/base/275195 Log: Do not try to copy header to @dst and than back to ethernet in case of pseudo_AF_HDRCMPLT: we copy media header from mbuf to 'struct sockaddr' @dst in bpf_movein, so mbuf already contains valid info. Modified: head/sys/net/if_ethersubr.c Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Thu Nov 27 20:24:58 2014 (r275194) +++ head/sys/net/if_ethersubr.c Thu Nov 27 21:29:19 2014 (r275195) @@ -147,7 +147,7 @@ ether_output(struct ifnet *ifp, struct m { short type; int error = 0, hdrcmplt = 0; - u_char esrc[ETHER_ADDR_LEN], edst[ETHER_ADDR_LEN]; + u_char edst[ETHER_ADDR_LEN]; struct llentry *lle = NULL; struct rtentry *rt0 = NULL; struct ether_header *eh; @@ -226,16 +226,12 @@ ether_output(struct ifnet *ifp, struct m #endif case pseudo_AF_HDRCMPLT: { - const struct ether_header *eh; - hdrcmplt = 1; - eh = (const struct ether_header *)dst->sa_data; - (void)memcpy(esrc, eh->ether_shost, sizeof (esrc)); /* FALLTHROUGH */ case AF_UNSPEC: loop_copy = 0; /* if this is for us, don't do it */ - eh = (const struct ether_header *)dst->sa_data; + eh = (struct ether_header *)dst->sa_data; (void)memcpy(edst, eh->ether_dhost, sizeof (edst)); type = eh->ether_type; break; @@ -258,15 +254,11 @@ ether_output(struct ifnet *ifp, struct m if (m == NULL) senderr(ENOBUFS); eh = mtod(m, struct ether_header *); - (void)memcpy(&eh->ether_type, &type, - sizeof(eh->ether_type)); - (void)memcpy(eh->ether_dhost, edst, sizeof (edst)); - if (hdrcmplt) - (void)memcpy(eh->ether_shost, esrc, - sizeof(eh->ether_shost)); - else - (void)memcpy(eh->ether_shost, IF_LLADDR(ifp), - sizeof(eh->ether_shost)); + if (hdrcmplt == 0) { + memcpy(&eh->ether_type, &type, sizeof(eh->ether_type)); + memcpy(eh->ether_dhost, edst, sizeof (edst)); + memcpy(eh->ether_shost, IF_LLADDR(ifp),sizeof(eh->ether_shost)); + } /* * If a simplex interface, and the packet is being sent to our