rpms/kernel/FC-6 linux-2.6-xen-add-packet_auxdata-cmsg.patch, NONE, 1.1 linux-2.6-xen-avoid-touching-watchdog-when-gone-too-long.patch, NONE, 1.1 linux-2.6-xen-blkback-copy-shared-data-before-verification.patch, NONE, 1.1 linux-2.6-xen-blkback-fix-first_sect-check.patch, NONE, 1.1 linux-2.6-xen-blkback-fix-potential-grant-entry-leaks-on-error.patch, NONE, 1.1 linux-2.6-xen-blktap-fix-potential-grant-entry-leaks-on-error.patch, NONE, 1.1 linux-2.6-xen-copy-shared-data-before-verification.patch, NONE, 1.1 linux-2.6-xen-fix-2tb-overflow-in-virtual-disk-driver.patch, NONE, 1.1 linux-2.6-xen-fix-agp-on-x86_64-under-xen.patch, NONE, 1.1 linux-2.6-xen-fix-nosegneg-detection.patch, NONE, 1.1 linux-2.6-xen-fix-profiling.patch, NONE, 1.1 linux-2.6-xen-fix-spinlock-when-removing-xennet-device.patch, NONE, 1.1 linux-2.6-xen-fix-swiotlb-for-b44-module-kernel-patch.patch, NONE, 1.1 linux-2.6-xen-iscsi-oops-on-x86_64-xen-domu.patch, 1.2, 1.3 linux-2.6-xen-make-ballooning-work-right.patch, NONE, 1.1 linux-2.6-x! en-make-netfront-device-permanent.patch, NONE, 1.1 linux-2.6-xen-netback-fix-transmit-credit-scheduler-wrap.patch, NONE, 1.1 linux-2.6-xen-netback-reenable-tx-queueing.patch, NONE, 1.1 linux-2.6-xen-pae-handle-64bit-addresses-correctly.patch, NONE, 1.1 linux-2.6-xen-privcmd-range-check-hypercall-index.patch, NONE, 1.1 linux-2.6-xen-properly-close-blkfront-on-non-existant-file.patch, NONE, 1.1 linux-2.6-xen-use-swiotlb-mask-for-coherent-mappings-too.patch, NONE, 1.1 kernel-2.6.spec, 1.2940, 1.2941

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Apr 2 12:51:11 UTC 2007


Author: armbru

Update of /cvs/dist/rpms/kernel/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv19711

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-xen-add-packet_auxdata-cmsg.patch 
	linux-2.6-xen-avoid-touching-watchdog-when-gone-too-long.patch 
	linux-2.6-xen-blkback-copy-shared-data-before-verification.patch 
	linux-2.6-xen-blkback-fix-first_sect-check.patch 
	linux-2.6-xen-blkback-fix-potential-grant-entry-leaks-on-error.patch 
	linux-2.6-xen-blktap-fix-potential-grant-entry-leaks-on-error.patch 
	linux-2.6-xen-copy-shared-data-before-verification.patch 
	linux-2.6-xen-fix-2tb-overflow-in-virtual-disk-driver.patch 
	linux-2.6-xen-fix-agp-on-x86_64-under-xen.patch 
	linux-2.6-xen-fix-nosegneg-detection.patch 
	linux-2.6-xen-fix-profiling.patch 
	linux-2.6-xen-fix-spinlock-when-removing-xennet-device.patch 
	linux-2.6-xen-fix-swiotlb-for-b44-module-kernel-patch.patch 
	linux-2.6-xen-iscsi-oops-on-x86_64-xen-domu.patch 
	linux-2.6-xen-make-ballooning-work-right.patch 
	linux-2.6-xen-make-netfront-device-permanent.patch 
	linux-2.6-xen-netback-fix-transmit-credit-scheduler-wrap.patch 
	linux-2.6-xen-netback-reenable-tx-queueing.patch 
	linux-2.6-xen-pae-handle-64bit-addresses-correctly.patch 
	linux-2.6-xen-privcmd-range-check-hypercall-index.patch 
	linux-2.6-xen-properly-close-blkfront-on-non-existant-file.patch 
	linux-2.6-xen-use-swiotlb-mask-for-coherent-mappings-too.patch 
Log Message:
- Xen kernel:
  >4G guest fix (Steven Rostedt )
  fix nosegneg detection (Rik van Riel )
  Use swiotlb mask for coherent mappings too (Herbert Xu )
  Fix potential grant entry leaks on error (Herbert Xu )
  Fix agp on x86_64 under Xen (Stephen C. Tweedie )
  netback: Reenable TX queueing and drop pkts after timeout (Herbert Xu )
  make ballooning work right (Rik van Riel )
  Fix xen swiotlb for b44 module (Stephen C. Tweedie )
  Copy shared data before verification (Herbert Xu )
  Properly close block frontend on non-existant file (Glauber de Oliveira Costa )
  blkback: Fix potential grant entry leaks on error (Rik van Riel )
  blkback: Copy shared data before verification (Rik van Riel)
  netback: Fix wrap to zero in transmit credit scheduler. (Herbert Xu )
  fix 2TB overflow in virtual disk driver (Rik van Riel )
  blkback: Fix first_sect check. (Rik van Riel )
  make netfront device permanent (Glauber de Oliveira Costa )
  fix iSCSI root oops on x86_64 xen domU (Rik van Riel )
  Avoid touching the watchdog when gone for too long (Glauber de Oliveira Costa )
  fix profiling (Rik van Riel )
  privcmd: Range-check hypercall index. (Herbert Xu )
  Fix spinlock bad magic when removing xennet device (Chris Lalancette )
- Add PACKET_AUXDATA cmsg (Herbert Xu )

linux-2.6-xen-add-packet_auxdata-cmsg.patch:
 b/include/linux/if_packet.h |   10 +++++++
 b/net/packet/af_packet.c    |   57 +++++++++++++++++++++++++++++++++++++-------
 net/packet/af_packet.c      |   46 +++++++++++++++++++++++------------
 3 files changed, 88 insertions(+), 25 deletions(-)

--- NEW FILE linux-2.6-xen-add-packet_auxdata-cmsg.patch ---
>From 8dc4194474159660d7f37c495e3fc3f10d0db8cc Mon Sep 17 00:00:00 2001
From: Herbert Xu <herbert at gondor.apana.org.au>
Date: Sun, 4 Feb 2007 23:31:32 -0800
Subject: [PATCH] [PACKET]: Add optional checksum computation for recvmsg

This patch is needed to make ISC's DHCP server (and probably other
DHCP servers/clients using AF_PACKET) to be able to serve another
client on the same Xen host.

The problem is that packets between different domains on the same
Xen host only have partial checksums.  Unfortunately this piece of
information is not passed along in AF_PACKET unless you're using
the mmap interface.  Since dhcpd doesn't support packet-mmap, UDP
packets from the same host come out with apparently bogus checksums.

This patch adds a mechanism for AF_PACKET recvmsg(2) to return the
status along with the packet.  It does so by adding a new cmsg that
contains this information along with some other relevant data such
as the original packet length.

I didn't include the time stamp information since there is already
a cmsg for that.

This patch also changes the mmap code to set the CSUMNOTREADY flag
on all packets instead of just outoing packets on cooked sockets.

Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: David S. Miller <davem at davemloft.net>
---
 include/linux/if_packet.h |   10 ++++++++
 net/packet/af_packet.c    |   57 +++++++++++++++++++++++++++++++++++++-------
 2 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 99393ef..f3de05c 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -41,6 +41,7 @@ struct sockaddr_ll
 #define PACKET_RX_RING			5
 #define PACKET_STATISTICS		6
 #define PACKET_COPY_THRESH		7
+#define PACKET_AUXDATA			8
 
 struct tpacket_stats
 {
@@ -48,6 +49,15 @@ struct tpacket_stats
 	unsigned int	tp_drops;
 };
 
+struct tpacket_auxdata
+{
+	__u32		tp_status;
+	__u32		tp_len;
+	__u32		tp_snaplen;
+	__u16		tp_mac;
+	__u16		tp_net;
+};
+
 struct tpacket_hdr
 {
 	unsigned long	tp_status;
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 6dc01bd..8973ea7 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -200,7 +200,8 @@ struct packet_sock {
 #endif
 	struct packet_type	prot_hook;
 	spinlock_t		bind_lock;
-	char			running;	/* prot_hook is attached*/
+	unsigned int		running:1,	/* prot_hook is attached*/
+				auxdata:1;
 	int			ifindex;	/* bound device		*/
 	__be16			num;
 #ifdef CONFIG_PACKET_MULTICAST
@@ -214,6 +215,8 @@ struct packet_sock {
 #endif
 };
 
+#define PACKET_SKB_CB(__skb)	((struct tpacket_auxdata *)((__skb)->cb))
+
 #ifdef CONFIG_PACKET_MMAP
 
 static inline char *packet_lookup_frame(struct packet_sock *po, unsigned int position)
@@ -462,6 +465,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
 	u8 * skb_head = skb->data;
 	int skb_len = skb->len;
 	unsigned int snaplen, res;
+	struct tpacket_auxdata *aux;
 
 	if (skb->pkt_type == PACKET_LOOPBACK)
 		goto drop;
@@ -523,6 +527,15 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
 	if (dev->hard_header_parse)
 		sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
 
+	aux = PACKET_SKB_CB(skb);
+	aux->tp_status = TP_STATUS_USER;
+	if (skb->ip_summed == CHECKSUM_PARTIAL)
+		aux->tp_status |= TP_STATUS_CSUMNOTREADY;
+	aux->tp_len = skb->len;
+	aux->tp_snaplen = snaplen;
+	aux->tp_mac = 0;
+	aux->tp_net = skb->nh.raw - skb->data;
+
 	if (pskb_trim(skb, snaplen))
 		goto drop_n_acct;
 
@@ -582,11 +595,12 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
 		else if (skb->pkt_type == PACKET_OUTGOING) {
 			/* Special case: outgoing packets have ll header at head */
 			skb_pull(skb, skb->nh.raw - skb->data);
-			if (skb->ip_summed == CHECKSUM_PARTIAL)
-				status |= TP_STATUS_CSUMNOTREADY;
 		}
 	}
 
+	if (skb->ip_summed == CHECKSUM_PARTIAL)
+		status |= TP_STATUS_CSUMNOTREADY;
+
 	snaplen = skb->len;
 
 	res = run_filter(skb, sk, snaplen);
@@ -1119,6 +1133,11 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
 	if (msg->msg_name)
 		memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
 
+	if (pkt_sk(sk)->auxdata) {
+		struct tpacket_auxdata *aux = PACKET_SKB_CB(skb);
+		put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(*aux), aux);
+	}
+
 	/*
 	 *	Free or return the buffer as appropriate. Again this
 	 *	hides all the races and re-entrancy issues from us.
@@ -1317,6 +1336,7 @@ static int
 packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
+	struct packet_sock *po = pkt_sk(sk);
 	int ret;
 
 	if (level != SOL_PACKET)
@@ -1369,6 +1389,18 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
 		return 0;
 	}
 #endif
+	case PACKET_AUXDATA:
+	{
+		int val;
+
+		if (optlen < sizeof(val))
+			return -EINVAL;
+		if (copy_from_user(&val, optval, sizeof(val)))
+			return -EFAULT;
+
+		po->auxdata = !!val;
+		return 0;
+	}
 	default:
 		return -ENOPROTOOPT;
 	}
@@ -1378,8 +1410,11 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
 			     char __user *optval, int __user *optlen)
 {
 	int len;
+	int val;
 	struct sock *sk = sock->sk;
 	struct packet_sock *po = pkt_sk(sk);
+	void *data;
+	struct tpacket_stats st;
 
 	if (level != SOL_PACKET)
 		return -ENOPROTOOPT;
@@ -1392,9 +1427,6 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
 		
 	switch(optname)	{
 	case PACKET_STATISTICS:
-	{
-		struct tpacket_stats st;
-
 		if (len > sizeof(struct tpacket_stats))
 			len = sizeof(struct tpacket_stats);
 		spin_lock_bh(&sk->sk_receive_queue.lock);
@@ -1403,16 +1435,23 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
 		spin_unlock_bh(&sk->sk_receive_queue.lock);
 		st.tp_packets += st.tp_drops;
 
-		if (copy_to_user(optval, &st, len))
-			return -EFAULT;
+		data = &st;
+		break;
+	case PACKET_AUXDATA:
+		if (len > sizeof(int))
+			len = sizeof(int);
+		val = po->auxdata;
+
+		data = &val;
 		break;
-	}
 	default:
 		return -ENOPROTOOPT;
 	}
 
 	if (put_user(len, optlen))
 		return -EFAULT;
+	if (copy_to_user(optval, data, len))
+		return -EFAULT;
 	return 0;
 }
 
-- 
1.5.0.5





More information about the fedora-cvs-commits mailing list