* [Qemu-devel] [PATCH v3 1/5] linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
2015-10-28 20:40 [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Laurent Vivier
@ 2015-10-28 20:40 ` Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 2/5] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly Laurent Vivier
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-10-28 20:40 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, riku.voipio, Laurent Vivier
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 <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
linux-user/syscall.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4b4159d..7c724ab 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2089,6 +2089,12 @@ static abi_long do_socket(int domain, int type, int protocol)
if (domain == PF_NETLINK)
return -TARGET_EAFNOSUPPORT;
+
+ if (domain == AF_PACKET ||
+ (domain == AF_INET && type == SOCK_PACKET)) {
+ protocol = tswap16(protocol);
+ }
+
ret = get_errno(socket(domain, type, protocol));
if (ret >= 0) {
ret = sock_flags_fixup(ret, target_type);
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v3 2/5] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly
2015-10-28 20:40 [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 1/5] linux-user: SOCK_PACKET uses network endian to encode protocol in socket() Laurent Vivier
@ 2015-10-28 20:40 ` Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 3/5] linux-user: add a function hook to translate sockaddr Laurent Vivier
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-10-28 20:40 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, riku.voipio, Laurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
linux-user/syscall.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7c724ab..41b85b4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -295,20 +295,20 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
{ 0, 0, 0, 0 }
};
-typedef abi_long (*TargetFdFunc)(void *, size_t);
+typedef abi_long (*TargetFdDataFunc)(void *, size_t);
typedef struct TargetFdTrans {
- TargetFdFunc host_to_target;
- TargetFdFunc target_to_host;
+ TargetFdDataFunc host_to_target_data;
+ TargetFdDataFunc target_to_host_data;
} TargetFdTrans;
static TargetFdTrans **target_fd_trans;
static unsigned int target_fd_max;
-static TargetFdFunc fd_trans_host_to_target(int fd)
+static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
{
if (fd < target_fd_max && target_fd_trans[fd]) {
- return target_fd_trans[fd]->host_to_target;
+ return target_fd_trans[fd]->host_to_target_data;
}
return NULL;
}
@@ -5438,7 +5438,7 @@ host_to_target_signalfd_siginfo(struct signalfd_siginfo *tinfo,
tinfo->ssi_addr = tswap64(info->ssi_addr);
}
-static abi_long host_to_target_signalfd(void *buf, size_t len)
+static abi_long host_to_target_data_signalfd(void *buf, size_t len)
{
int i;
@@ -5450,7 +5450,7 @@ static abi_long host_to_target_signalfd(void *buf, size_t len)
}
static TargetFdTrans target_signalfd_trans = {
- .host_to_target = host_to_target_signalfd,
+ .host_to_target_data = host_to_target_data_signalfd,
};
static abi_long do_signalfd4(int fd, abi_long mask, int flags)
@@ -5867,8 +5867,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
goto efault;
ret = get_errno(read(arg1, p, arg3));
if (ret >= 0 &&
- fd_trans_host_to_target(arg1)) {
- ret = fd_trans_host_to_target(arg1)(p, ret);
+ fd_trans_host_to_target_data(arg1)) {
+ ret = fd_trans_host_to_target_data(arg1)(p, ret);
}
unlock_user(p, arg2, ret);
}
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v3 3/5] linux-user: add a function hook to translate sockaddr
2015-10-28 20:40 [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 1/5] linux-user: SOCK_PACKET uses network endian to encode protocol in socket() Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 2/5] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly Laurent Vivier
@ 2015-10-28 20:40 ` Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 4/5] linux-user: manage bind with a socket of SOCK_PACKET type Laurent Vivier
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-10-28 20:40 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, riku.voipio, Laurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
v3: insert fd_trans_target_to_host_addr() into target_to_host_sockaddr() and
pass fd.
linux-user/syscall.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 41b85b4..a313846 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -296,9 +296,11 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
};
typedef abi_long (*TargetFdDataFunc)(void *, size_t);
+typedef abi_long (*TargetFdAddrFunc)(void *, abi_ulong, socklen_t);
typedef struct TargetFdTrans {
TargetFdDataFunc host_to_target_data;
TargetFdDataFunc target_to_host_data;
+ TargetFdAddrFunc target_to_host_addr;
} TargetFdTrans;
static TargetFdTrans **target_fd_trans;
@@ -313,6 +315,14 @@ static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
return NULL;
}
+static TargetFdAddrFunc fd_trans_target_to_host_addr(int fd)
+{
+ if (fd < target_fd_max && target_fd_trans[fd]) {
+ return target_fd_trans[fd]->target_to_host_addr;
+ }
+ return NULL;
+}
+
static void fd_trans_register(int fd, TargetFdTrans *trans)
{
unsigned int oldmax;
@@ -1162,7 +1172,7 @@ static inline abi_long target_to_host_ip_mreq(struct ip_mreqn *mreqn,
return 0;
}
-static inline abi_long target_to_host_sockaddr(struct sockaddr *addr,
+static inline abi_long target_to_host_sockaddr(int fd, struct sockaddr *addr,
abi_ulong target_addr,
socklen_t len)
{
@@ -1170,6 +1180,10 @@ static inline abi_long target_to_host_sockaddr(struct sockaddr *addr,
sa_family_t sa_family;
struct target_sockaddr *target_saddr;
+ if (fd_trans_target_to_host_addr(fd)) {
+ return fd_trans_target_to_host_addr(fd)(addr, target_addr, len);
+ }
+
target_saddr = lock_user(VERIFY_READ, target_addr, len, 1);
if (!target_saddr)
return -TARGET_EFAULT;
@@ -2115,7 +2129,7 @@ static abi_long do_bind(int sockfd, abi_ulong target_addr,
addr = alloca(addrlen+1);
- ret = target_to_host_sockaddr(addr, target_addr, addrlen);
+ ret = target_to_host_sockaddr(sockfd, addr, target_addr, addrlen);
if (ret)
return ret;
@@ -2135,7 +2149,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr,
addr = alloca(addrlen+1);
- ret = target_to_host_sockaddr(addr, target_addr, addrlen);
+ ret = target_to_host_sockaddr(sockfd, addr, target_addr, addrlen);
if (ret)
return ret;
@@ -2155,8 +2169,9 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
if (msgp->msg_name) {
msg.msg_namelen = tswap32(msgp->msg_namelen);
msg.msg_name = alloca(msg.msg_namelen+1);
- ret = target_to_host_sockaddr(msg.msg_name, tswapal(msgp->msg_name),
- msg.msg_namelen);
+ ret = target_to_host_sockaddr(fd, msg.msg_name,
+ tswapal(msgp->msg_name),
+ msg.msg_namelen);
if (ret) {
goto out2;
}
@@ -2418,7 +2433,7 @@ static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags,
return -TARGET_EFAULT;
if (target_addr) {
addr = alloca(addrlen+1);
- ret = target_to_host_sockaddr(addr, target_addr, addrlen);
+ ret = target_to_host_sockaddr(fd, addr, target_addr, addrlen);
if (ret) {
unlock_user(host_msg, msg, 0);
return ret;
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v3 4/5] linux-user: manage bind with a socket of SOCK_PACKET type.
2015-10-28 20:40 [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Laurent Vivier
` (2 preceding siblings ...)
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 3/5] linux-user: add a function hook to translate sockaddr Laurent Vivier
@ 2015-10-28 20:40 ` Laurent Vivier
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 5/5] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr Laurent Vivier
2015-10-28 23:12 ` [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Peter Maydell
5 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-10-28 20:40 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, riku.voipio, Laurent Vivier
This is obsolete, but if we want to use dhcp with an old distro (like debian
etch), we need it. Some users (like dhclient) use SOCK_PACKET with AF_PACKET
and the kernel allows that.
packet(7)
In Linux 2.0, the only way to get a packet socket was by calling
socket(AF_INET, SOCK_PACKET, protocol). This is still supported but
strongly deprecated. The main difference between the two methods is
that SOCK_PACKET uses the old struct sockaddr_pkt to specify an inter‐
face, which doesn't provide physical layer independence.
struct sockaddr_pkt {
unsigned short spkt_family;
unsigned char spkt_device[14];
unsigned short spkt_protocol;
};
spkt_family contains the device type, spkt_protocol is the IEEE 802.3
protocol type as defined in <sys/if_ether.h> and spkt_device is the
device name as a null-terminated string, for example, eth0.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
v3: rename packet_target_to_host_addr to packet_target_to_host_sockaddr
linux-user/syscall.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a313846..22b28a4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2090,6 +2090,30 @@ static int sock_flags_fixup(int fd, int target_type)
return fd;
}
+static abi_long packet_target_to_host_sockaddr(void *host_addr,
+ abi_ulong target_addr,
+ socklen_t len)
+{
+ struct sockaddr *addr = host_addr;
+ struct target_sockaddr *target_saddr;
+
+ target_saddr = lock_user(VERIFY_READ, target_addr, len, 1);
+ if (!target_saddr) {
+ return -TARGET_EFAULT;
+ }
+
+ memcpy(addr, target_saddr, len);
+ addr->sa_family = tswap16(target_saddr->sa_family);
+ /* spkt_protocol is big-endian */
+
+ unlock_user(target_saddr, target_addr, 0);
+ return 0;
+}
+
+static TargetFdTrans target_packet_trans = {
+ .target_to_host_addr = packet_target_to_host_sockaddr,
+};
+
/* do_socket() Must return target values and target errnos. */
static abi_long do_socket(int domain, int type, int protocol)
{
@@ -2112,6 +2136,12 @@ static abi_long do_socket(int domain, int type, int protocol)
ret = get_errno(socket(domain, type, protocol));
if (ret >= 0) {
ret = sock_flags_fixup(ret, target_type);
+ if (type == SOCK_PACKET) {
+ /* Manage an obsolete case :
+ * if socket type is SOCK_PACKET, bind by name
+ */
+ fd_trans_register(ret, &target_packet_trans);
+ }
}
return ret;
}
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v3 5/5] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr
2015-10-28 20:40 [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Laurent Vivier
` (3 preceding siblings ...)
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 4/5] linux-user: manage bind with a socket of SOCK_PACKET type Laurent Vivier
@ 2015-10-28 20:40 ` Laurent Vivier
2015-10-28 23:12 ` [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Peter Maydell
5 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-10-28 20:40 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, riku.voipio, Laurent Vivier
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 22b28a4..eb45e72 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -309,7 +309,7 @@ static unsigned int target_fd_max;
static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
{
- if (fd < target_fd_max && target_fd_trans[fd]) {
+ if (fd >= 0 && fd < target_fd_max && target_fd_trans[fd]) {
return target_fd_trans[fd]->host_to_target_data;
}
return NULL;
@@ -317,7 +317,7 @@ static TargetFdDataFunc fd_trans_host_to_target_data(int fd)
static TargetFdAddrFunc fd_trans_target_to_host_addr(int fd)
{
- if (fd < target_fd_max && target_fd_trans[fd]) {
+ if (fd >= 0 && fd < target_fd_max && target_fd_trans[fd]) {
return target_fd_trans[fd]->target_to_host_addr;
}
return NULL;
--
2.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type
2015-10-28 20:40 [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Laurent Vivier
` (4 preceding siblings ...)
2015-10-28 20:40 ` [Qemu-devel] [PATCH v3 5/5] linux-user: check fd is >= 0 in fd_trans_host_to_target_data/fd_trans_host_to_target_addr Laurent Vivier
@ 2015-10-28 23:12 ` Peter Maydell
2015-10-29 8:52 ` Laurent Vivier
2015-12-18 15:13 ` Laurent Vivier
5 siblings, 2 replies; 12+ messages in thread
From: Peter Maydell @ 2015-10-28 23:12 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Riku Voipio, QEMU Developers
On 28 October 2015 at 20:40, Laurent Vivier <laurent@vivier.eu> wrote:
> This is obsolete, but if we want to use dhcp with some distros (like debian
> ppc 8.2 jessie), we need it.
>
> bind() uses an interface name instead an interface index, and socket()
> needs network order value to encode the protocol.
>
> v3: update cover letter message,
> insert Reviewed-by: in PATCH 1 and PATCH 2
> insert fd_trans_target_to_host_addr into target_to_host_sockaddr and
> pass fd, check fd is >= 0, rename packet_target_to_host_addr to
> packet_target_to_host_sockaddr
>
> v2: Split the patch in 4 parts to manage protocol endianness (socket()) and
> interface name (bind()) in different patches.
> Use TargetFdTrans array to manage the SOCK_PACKET type special case in
> bind().
> The two others patches are here to introduce a new function in TargetFdTrans
> to translate sockaddr data structure (rename previous functions to be
> clear).
>
> Laurent Fiver (5):
This name doesn't match the names on the actual patch mails,
but those are right so I guess it doesn't matter.
> linux-user: SOCK_PACKET uses network endian to encode protocol in
> socket()
> linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure
> fields accordingly
> linux-user: add a function hook to translate sockaddr
> linux-user: manage bind with a socket of SOCK_PACKET type.
> linux-user: check fd is >= 0 in
> fd_trans_host_to_target_data/fd_trans_host_to_target_addr
Series
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type
2015-10-28 23:12 ` [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Peter Maydell
@ 2015-10-29 8:52 ` Laurent Vivier
2015-12-18 15:13 ` Laurent Vivier
1 sibling, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-10-29 8:52 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, QEMU Developers
Le 29/10/2015 00:12, Peter Maydell a écrit :
> On 28 October 2015 at 20:40, Laurent Vivier <laurent@vivier.eu> wrote:
>> This is obsolete, but if we want to use dhcp with some distros (like debian
>> ppc 8.2 jessie), we need it.
>>
>> bind() uses an interface name instead an interface index, and socket()
>> needs network order value to encode the protocol.
>>
>> v3: update cover letter message,
>> insert Reviewed-by: in PATCH 1 and PATCH 2
>> insert fd_trans_target_to_host_addr into target_to_host_sockaddr and
>> pass fd, check fd is >= 0, rename packet_target_to_host_addr to
>> packet_target_to_host_sockaddr
>>
>> v2: Split the patch in 4 parts to manage protocol endianness (socket()) and
>> interface name (bind()) in different patches.
>> Use TargetFdTrans array to manage the SOCK_PACKET type special case in
>> bind().
>> The two others patches are here to introduce a new function in TargetFdTrans
>> to translate sockaddr data structure (rename previous functions to be
>> clear).
>>
>> Laurent Fiver (5):
Sorry for that. "vi" is a joker.
>
> This name doesn't match the names on the actual patch mails,
> but those are right so I guess it doesn't matter.
>
>> linux-user: SOCK_PACKET uses network endian to encode protocol in
>> socket()
>> linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure
>> fields accordingly
>> linux-user: add a function hook to translate sockaddr
>> linux-user: manage bind with a socket of SOCK_PACKET type.
>> linux-user: check fd is >= 0 in
>> fd_trans_host_to_target_data/fd_trans_host_to_target_addr
>
> Series
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> thanks
> -- PMM
>
thanks,
Laurent
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type
2015-10-28 23:12 ` [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type Peter Maydell
2015-10-29 8:52 ` Laurent Vivier
@ 2015-12-18 15:13 ` Laurent Vivier
2015-12-21 15:14 ` Riku Voipio
1 sibling, 1 reply; 12+ messages in thread
From: Laurent Vivier @ 2015-12-18 15:13 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, QEMU Developers
Le 29/10/2015 00:12, Peter Maydell a écrit :
> On 28 October 2015 at 20:40, Laurent Vivier <laurent@vivier.eu> wrote:
>> This is obsolete, but if we want to use dhcp with some distros (like debian
>> ppc 8.2 jessie), we need it.
>>
>> bind() uses an interface name instead an interface index, and socket()
>> needs network order value to encode the protocol.
>>
>> v3: update cover letter message,
>> insert Reviewed-by: in PATCH 1 and PATCH 2
>> insert fd_trans_target_to_host_addr into target_to_host_sockaddr and
>> pass fd, check fd is >= 0, rename packet_target_to_host_addr to
>> packet_target_to_host_sockaddr
>>
>> v2: Split the patch in 4 parts to manage protocol endianness (socket()) and
>> interface name (bind()) in different patches.
>> Use TargetFdTrans array to manage the SOCK_PACKET type special case in
>> bind().
>> The two others patches are here to introduce a new function in TargetFdTrans
>> to translate sockaddr data structure (rename previous functions to be
>> clear).
>>
>> Laurent Fiver (5):
>
> This name doesn't match the names on the actual patch mails,
> but those are right so I guess it doesn't matter.
>
>> linux-user: SOCK_PACKET uses network endian to encode protocol in
>> socket()
>> linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure
>> fields accordingly
>> linux-user: add a function hook to translate sockaddr
>> linux-user: manage bind with a socket of SOCK_PACKET type.
>> linux-user: check fd is >= 0 in
>> fd_trans_host_to_target_data/fd_trans_host_to_target_addr
>
> Series
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Can we have this series applied ?
Thanks,
Laurent
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type
2015-12-18 15:13 ` Laurent Vivier
@ 2015-12-21 15:14 ` Riku Voipio
2015-12-21 16:20 ` Laurent Vivier
2015-12-23 13:13 ` Laurent Vivier
0 siblings, 2 replies; 12+ messages in thread
From: Riku Voipio @ 2015-12-21 15:14 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Peter Maydell, QEMU Developers
On Fri, Dec 18, 2015 at 04:13:20PM +0100, Laurent Vivier wrote:
> Le 29/10/2015 00:12, Peter Maydell a écrit :
> > On 28 October 2015 at 20:40, Laurent Vivier <laurent@vivier.eu> wrote:
> >> This is obsolete, but if we want to use dhcp with some distros (like debian
> >> ppc 8.2 jessie), we need it.
> >>
> >> bind() uses an interface name instead an interface index, and socket()
> >> needs network order value to encode the protocol.
> >>
> >> v3: update cover letter message,
> >> insert Reviewed-by: in PATCH 1 and PATCH 2
> >> insert fd_trans_target_to_host_addr into target_to_host_sockaddr and
> >> pass fd, check fd is >= 0, rename packet_target_to_host_addr to
> >> packet_target_to_host_sockaddr
> >>
> >> v2: Split the patch in 4 parts to manage protocol endianness (socket()) and
> >> interface name (bind()) in different patches.
> >> Use TargetFdTrans array to manage the SOCK_PACKET type special case in
> >> bind().
> >> The two others patches are here to introduce a new function in TargetFdTrans
> >> to translate sockaddr data structure (rename previous functions to be
> >> clear).
> >>
> >> Laurent Fiver (5):
> >
> > This name doesn't match the names on the actual patch mails,
> > but those are right so I guess it doesn't matter.
> >
> >> linux-user: SOCK_PACKET uses network endian to encode protocol in
> >> socket()
> >> linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure
> >> fields accordingly
> >> linux-user: add a function hook to translate sockaddr
> >> linux-user: manage bind with a socket of SOCK_PACKET type.
> >> linux-user: check fd is >= 0 in
> >> fd_trans_host_to_target_data/fd_trans_host_to_target_addr
> >
> > Series
> > Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Can we have this series applied ?
I'll create next pull req next week, right now I'm a bit busy. If someone
else wants to merge the series before me, you have my Acked-by.
Riku
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type
2015-12-21 15:14 ` Riku Voipio
@ 2015-12-21 16:20 ` Laurent Vivier
2015-12-23 13:13 ` Laurent Vivier
1 sibling, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-12-21 16:20 UTC (permalink / raw)
To: Riku Voipio; +Cc: Peter Maydell, QEMU Developers
Le 21/12/2015 16:14, Riku Voipio a écrit :
> On Fri, Dec 18, 2015 at 04:13:20PM +0100, Laurent Vivier wrote:
>> Le 29/10/2015 00:12, Peter Maydell a écrit :
>>> On 28 October 2015 at 20:40, Laurent Vivier <laurent@vivier.eu> wrote:
>>>> This is obsolete, but if we want to use dhcp with some distros (like debian
>>>> ppc 8.2 jessie), we need it.
>>>>
>>>> bind() uses an interface name instead an interface index, and socket()
>>>> needs network order value to encode the protocol.
>>>>
>>>> v3: update cover letter message,
>>>> insert Reviewed-by: in PATCH 1 and PATCH 2
>>>> insert fd_trans_target_to_host_addr into target_to_host_sockaddr and
>>>> pass fd, check fd is >= 0, rename packet_target_to_host_addr to
>>>> packet_target_to_host_sockaddr
>>>>
>>>> v2: Split the patch in 4 parts to manage protocol endianness (socket()) and
>>>> interface name (bind()) in different patches.
>>>> Use TargetFdTrans array to manage the SOCK_PACKET type special case in
>>>> bind().
>>>> The two others patches are here to introduce a new function in TargetFdTrans
>>>> to translate sockaddr data structure (rename previous functions to be
>>>> clear).
>>>>
>>>> Laurent Fiver (5):
>>>
>>> This name doesn't match the names on the actual patch mails,
>>> but those are right so I guess it doesn't matter.
>>>
>>>> linux-user: SOCK_PACKET uses network endian to encode protocol in
>>>> socket()
>>>> linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure
>>>> fields accordingly
>>>> linux-user: add a function hook to translate sockaddr
>>>> linux-user: manage bind with a socket of SOCK_PACKET type.
>>>> linux-user: check fd is >= 0 in
>>>> fd_trans_host_to_target_data/fd_trans_host_to_target_addr
>>>
>>> Series
>>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
>> Can we have this series applied ?
>
> I'll create next pull req next week, right now I'm a bit busy. If someone
> else wants to merge the series before me, you have my Acked-by.
Thank you, but remember in your branch "linux-user-for-upstream" you
have a commit which breaks errno: "linux-user: Fix array bounds in errno
conversion".
Return parameters must stay signed.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/5] linux-user: manage SOCK_PACKET socket type
2015-12-21 15:14 ` Riku Voipio
2015-12-21 16:20 ` Laurent Vivier
@ 2015-12-23 13:13 ` Laurent Vivier
1 sibling, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2015-12-23 13:13 UTC (permalink / raw)
To: Riku Voipio; +Cc: Peter Maydell, QEMU Developers
Le 21/12/2015 16:14, Riku Voipio a écrit :
> On Fri, Dec 18, 2015 at 04:13:20PM +0100, Laurent Vivier wrote:
>> Le 29/10/2015 00:12, Peter Maydell a écrit :
>>> On 28 October 2015 at 20:40, Laurent Vivier <laurent@vivier.eu> wrote:
>>>> This is obsolete, but if we want to use dhcp with some distros (like debian
>>>> ppc 8.2 jessie), we need it.
>>>>
>>>> bind() uses an interface name instead an interface index, and socket()
>>>> needs network order value to encode the protocol.
>>>>
>>>> v3: update cover letter message,
>>>> insert Reviewed-by: in PATCH 1 and PATCH 2
>>>> insert fd_trans_target_to_host_addr into target_to_host_sockaddr and
>>>> pass fd, check fd is >= 0, rename packet_target_to_host_addr to
>>>> packet_target_to_host_sockaddr
>>>>
>>>> v2: Split the patch in 4 parts to manage protocol endianness (socket()) and
>>>> interface name (bind()) in different patches.
>>>> Use TargetFdTrans array to manage the SOCK_PACKET type special case in
>>>> bind().
>>>> The two others patches are here to introduce a new function in TargetFdTrans
>>>> to translate sockaddr data structure (rename previous functions to be
>>>> clear).
>>>>
>>>> Laurent Fiver (5):
>>>
>>> This name doesn't match the names on the actual patch mails,
>>> but those are right so I guess it doesn't matter.
>>>
>>>> linux-user: SOCK_PACKET uses network endian to encode protocol in
>>>> socket()
>>>> linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure
>>>> fields accordingly
>>>> linux-user: add a function hook to translate sockaddr
>>>> linux-user: manage bind with a socket of SOCK_PACKET type.
>>>> linux-user: check fd is >= 0 in
>>>> fd_trans_host_to_target_data/fd_trans_host_to_target_addr
>>>
>>> Series
>>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
>> Can we have this series applied ?
>
> I'll create next pull req next week, right now I'm a bit busy. If someone
> else wants to merge the series before me, you have my Acked-by.
If you want, I can do the pull request:
- I take your branch linux-user-for-upstream
from https://git.linaro.org/people/riku.voipio/qemu.git
- remove "linux-user: Fix array bounds in errno conversion"
because it is broken,
- add "linux-user: manage SOCK_PACKET socket type"
I'd like to add "linux-user, sh4: fix signal retcode address",
"linux-user: Enable sigaltstack syscall for sh4" but they have no
reviewer except me.
Laurent
^ permalink raw reply [flat|nested] 12+ messages in thread