From patchwork Tue Jul 15 14:24:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 33668 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A30B21141 for ; Tue, 15 Jul 2014 14:26:17 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id x13sf2607481qcv.4 for ; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=i/nqlFLsi/qPlZbStiNVpQbIzDWqgeAyY43fCKHFzZI=; b=hPapLRl+LsfjweD2YqBNMyJGMXP/ErC1th8zuE2DGoxRNTicnEg29ryzhxiITBOsLW mAoiLZWIYMxDkE6GMBorm4uzxkR/ULEx/6dGTw06oiGIiGNNEALVsrcCjyULU/abzOYt bhrAGgIXrs5CUeyzon5pbnHRFIeXoVLyS4pq6bOyo6rjZcYKZ88+u3YMlFr5GFHRawlb Ab0vltHK6jm5ZkGc+pcFgAiim1n8UHefsaS5fJpkLrHuwAplBKlIdZ7YPP8V5vkauV1i 2pk0tQlIDFdOKYWTwJ11vKyHaRocNgvKpCNYLy/u2+0H4RKY0Pc6FjLJEY27UPzhvCBw 9IKw== X-Gm-Message-State: ALoCoQkuuw+jOUodPiK9iR306CTIZVFMiCH1f67Pj9T6GJDE1+XVGzjNpbSCLBB0gHICILevFAhy X-Received: by 10.236.26.206 with SMTP id c54mr1770860yha.44.1405434376933; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.201 with SMTP id z67ls106371qgd.94.gmail; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) X-Received: by 10.220.92.135 with SMTP id r7mr22272468vcm.11.1405434376835; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id n9si6765877vcx.91.2014.07.15.07.26.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jul 2014 07:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so3716256vcb.9 for ; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) X-Received: by 10.53.5.230 with SMTP id cp6mr17704280vdd.25.1405434376774; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp218804vcb; Tue, 15 Jul 2014 07:26:16 -0700 (PDT) X-Received: by 10.224.30.137 with SMTP id u9mr9150072qac.57.1405434374657; Tue, 15 Jul 2014 07:26:14 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i8si20692704qch.24.2014.07.15.07.26.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 15 Jul 2014 07:26:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:34972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73gL-0006bs-TD for patch@linaro.org; Tue, 15 Jul 2014 10:26:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73fG-0005gN-UP for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X73fA-0007WO-8l for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:06 -0400 Received: from afflict.kos.to ([92.243.29.197]:37252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73fA-0007W7-2T for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:00 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 18E822654D; Tue, 15 Jul 2014 16:24:59 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 15 Jul 2014 17:24:55 +0300 Message-Id: <33a29b51c9fb56abd94d751dd3a51b84b82c8379.1405434118.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Peter Maydell , Joakim Tjernlund Subject: [Qemu-devel] [PULL for-2.1 3/5] linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Joakim Tjernlund Implement conversion of the AF_PACKET sockaddr subtype in target_to_host_sockaddr. Signed-off-by: Joakim Tjernlund Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 7 +++++++ linux-user/syscall_defs.h | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index dcf1323..7163ade 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1140,6 +1140,13 @@ static inline abi_long target_to_host_sockaddr(struct sockaddr *addr, memcpy(addr, target_saddr, len); addr->sa_family = sa_family; + if (sa_family == AF_PACKET) { + struct target_sockaddr_ll *lladdr; + + lladdr = (struct target_sockaddr_ll *)addr; + lladdr->sll_ifindex = tswap32(lladdr->sll_ifindex); + lladdr->sll_hatype = tswap16(lladdr->sll_hatype); + } unlock_user(target_saddr, target_addr, 0); return 0; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 8563027..c9e6323 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -121,6 +121,16 @@ struct target_sockaddr { uint8_t sa_data[14]; }; +struct target_sockaddr_ll { + uint16_t sll_family; /* Always AF_PACKET */ + uint16_t sll_protocol; /* Physical layer protocol */ + int sll_ifindex; /* Interface number */ + uint16_t sll_hatype; /* ARP hardware type */ + uint8_t sll_pkttype; /* Packet type */ + uint8_t sll_halen; /* Length of address */ + uint8_t sll_addr[8]; /* Physical layer address */ +}; + struct target_sock_filter { abi_ushort code; uint8_t jt;