[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/4] linux-user: SOCK_PACKET uses network end
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/4] linux-user: SOCK_PACKET uses network endian to encode protocol in socket() |
Date: |
Wed, 28 Oct 2015 19:14:53 +0000 |
On 28 October 2015 at 19:13, Laurent Vivier <address@hidden> wrote:
> in PACKET(7) :
>
> packet_socket = socket(AF_PACKET, int socket_type, int protocol);
> [...]
> protocol is the IEEE 802.3 protocol
> number in network order. See the <linux/if_ether.h> include file for a
> list of allowed protocols. When protocol is set to htons(ETH_P_ALL)
> then all protocols are received. All incoming packets of that protocol
> type will be passed to the packet socket before they are passed to the
> protocols implemented in the kernel.
> [...]
> Compatibility
>
> In Linux 2.0, the only way to get a packet socket was by calling
> socket(AF_INET, SOCK_PACKET, protocol).
>
> We need to tswap16() the protocol because on big-endian, the ABI is
> waiting for, for instance for ETH_P_ALL, 0x0003 (big endian ==
> network order), whereas on little-endian it is waiting for 0x0300.
>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-devel] [PATCH v2 0/4] linux-user: manage SOCK_PACKET socket type, Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v2 3/4] linux-user: add a function hook to translate sockaddr, Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v2 2/4] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly, Laurent Vivier, 2015/10/28
- [Qemu-devel] [PATCH v2 1/4] linux-user: SOCK_PACKET uses network endian to encode protocol in socket(), Laurent Vivier, 2015/10/28
- Re: [Qemu-devel] [PATCH v2 1/4] linux-user: SOCK_PACKET uses network endian to encode protocol in socket(),
Peter Maydell <=
- [Qemu-devel] [PATCH v2 4/4] linux-user: manage bind with a socket of SOCK_PACKET type., Laurent Vivier, 2015/10/28
- Re: [Qemu-devel] [PATCH v2 0/4] linux-user: manage SOCK_PACKET socket type, Peter Maydell, 2015/10/28