[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] libmachdev: fix net_rcv_msg-messages
From: |
Justus Winter |
Subject: |
[PATCH] libmachdev: fix net_rcv_msg-messages |
Date: |
Tue, 10 Jun 2014 11:47:00 +0200 |
Previously, all net_rcv_msg-messages sent by netif_rx_handle were
malformed. It never was a problem in practice, since the messages are
not complex and thus the kernel does not try to parse the message.
struct net_rcv_msg contains an additional field of type
boolean_t. This field has no associated type descriptor, so it must
not be included in the message.
* libmachdev/net.c (netif_rx_handle): Account for the extra field in
the msgh_size calculation.
---
libmachdev/net.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libmachdev/net.c b/libmachdev/net.c
index 07bb74a..e04b558 100644
--- a/libmachdev/net.c
+++ b/libmachdev/net.c
@@ -243,8 +243,10 @@ netif_rx_handle (char *data, int len, struct net_device
*dev)
pack_size = len - sizeof (struct ethhdr);
/* remember message sizes must be rounded up */
- net_msg->msg_hdr.msgh_size = (((mach_msg_size_t) (sizeof(struct net_rcv_msg)
- - NET_RCV_MAX + pack_size)) + 3)
& ~3;
+ net_msg->msg_hdr.msgh_size =
+ (((mach_msg_size_t) (sizeof (struct net_rcv_msg)
+ - sizeof net_msg->sent
+ - NET_RCV_MAX + pack_size)) + 3) & ~3;
/* Copy packet into message buffer. */
eh = (struct ether_header *) (net_msg->header);
--
2.0.0