[SK_BUFF]: Convert skb->tail to sk_buff_data_t
So that it is also an offset from skb->head, reduces its size from 8 to 4 bytes
on 64bit architectures, allowing us to combine the 4 bytes hole left by the
layer headers conversion, reducing struct sk_buff size to 256 bytes, i.e. 4
64byte cachelines, and since the sk_buff slab cache is SLAB_HWCACHE_ALIGN...
:-)
Many calculations that previously required that skb->{transport,network,
mac}_header be first converted to a pointer now can be done directly, being
meaningful as offsets or pointers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
	
	
This commit is contained in:
		
					parent
					
						
							
								be8bd86321
							
						
					
				
			
			
				commit
				
					
						27a884dc3c
					
				
			
		
					 110 changed files with 396 additions and 329 deletions
				
			
		|  | @ -264,7 +264,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | ||||||
| 
 | 
 | ||||||
| 	dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 	dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | ||||||
| 		"skb->end=0x%p skb->len=%d\n", (void *) skb->head, | 		"skb->end=0x%p skb->len=%d\n", (void *) skb->head, | ||||||
| 		(void *) skb->data, (void *) skb->tail, (void *) skb->end, | 		(void *)skb->data, skb_tail_pointer(skb), (void *)skb->end, | ||||||
| 		skb->len); | 		skb->len); | ||||||
| 
 | 
 | ||||||
| 	skb->protocol = eth_type_trans(skb, xpnet_device); | 	skb->protocol = eth_type_trans(skb, xpnet_device); | ||||||
|  | @ -272,7 +272,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | ||||||
| 
 | 
 | ||||||
| 	dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " | 	dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " | ||||||
| 		"skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", | 		"skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", | ||||||
| 		(void *) skb->head, (void *) skb->data, (void *) skb->tail, | 		(void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), | ||||||
| 		(void *) skb->end, skb->len); | 		(void *) skb->end, skb->len); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -475,7 +475,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||||||
| 
 | 
 | ||||||
| 	dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 	dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | ||||||
| 		"skb->end=0x%p skb->len=%d\n", (void *) skb->head, | 		"skb->end=0x%p skb->len=%d\n", (void *) skb->head, | ||||||
| 		(void *) skb->data, (void *) skb->tail, (void *) skb->end, | 		(void *)skb->data, skb_tail_pointer(skb), (void *)skb->end, | ||||||
| 		skb->len); | 		skb->len); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -497,7 +497,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||||||
| 
 | 
 | ||||||
| 	/* get the beginning of the first cacheline and end of last */ | 	/* get the beginning of the first cacheline and end of last */ | ||||||
| 	start_addr = ((u64) skb->data & ~(L1_CACHE_BYTES - 1)); | 	start_addr = ((u64) skb->data & ~(L1_CACHE_BYTES - 1)); | ||||||
| 	end_addr = L1_CACHE_ALIGN((u64) skb->tail); | 	end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb)); | ||||||
| 
 | 
 | ||||||
| 	/* calculate how many bytes to embed in the XPC message */ | 	/* calculate how many bytes to embed in the XPC message */ | ||||||
| 	embedded_bytes = 0; | 	embedded_bytes = 0; | ||||||
|  | @ -573,7 +573,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||||||
| 		msg->magic = XPNET_MAGIC; | 		msg->magic = XPNET_MAGIC; | ||||||
| 		msg->size = end_addr - start_addr; | 		msg->size = end_addr - start_addr; | ||||||
| 		msg->leadin_ignore = (u64) skb->data - start_addr; | 		msg->leadin_ignore = (u64) skb->data - start_addr; | ||||||
| 		msg->tailout_ignore = end_addr - (u64) skb->tail; | 		msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); | ||||||
| 		msg->buf_pa = __pa(start_addr); | 		msg->buf_pa = __pa(start_addr); | ||||||
| 
 | 
 | ||||||
| 		dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa=" | 		dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa=" | ||||||
|  |  | ||||||
|  | @ -1901,13 +1901,13 @@ he_service_rbrq(struct he_dev *he_dev, int group) | ||||||
| 			case ATM_AAL0: | 			case ATM_AAL0: | ||||||
| 				/* 2.10.1.5 raw cell receive */ | 				/* 2.10.1.5 raw cell receive */ | ||||||
| 				skb->len = ATM_AAL0_SDU; | 				skb->len = ATM_AAL0_SDU; | ||||||
| 				skb->tail = skb->data + skb->len; | 				skb_set_tail_pointer(skb, skb->len); | ||||||
| 				break; | 				break; | ||||||
| 			case ATM_AAL5: | 			case ATM_AAL5: | ||||||
| 				/* 2.10.1.2 aal5 receive */ | 				/* 2.10.1.2 aal5 receive */ | ||||||
| 
 | 
 | ||||||
| 				skb->len = AAL5_LEN(skb->data, he_vcc->pdu_len); | 				skb->len = AAL5_LEN(skb->data, he_vcc->pdu_len); | ||||||
| 				skb->tail = skb->data + skb->len; | 				skb_set_tail_pointer(skb, skb->len); | ||||||
| #ifdef USE_CHECKSUM_HW | #ifdef USE_CHECKSUM_HW | ||||||
| 				if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) { | 				if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) { | ||||||
| 					skb->ip_summed = CHECKSUM_COMPLETE; | 					skb->ip_summed = CHECKSUM_COMPLETE; | ||||||
|  |  | ||||||
|  | @ -1816,7 +1816,8 @@ push_rx_skb(struct idt77252_dev *card, struct sk_buff *skb, int queue) | ||||||
| 	u32 handle; | 	u32 handle; | ||||||
| 	u32 addr; | 	u32 addr; | ||||||
| 
 | 
 | ||||||
| 	skb->data = skb->tail = skb->head; | 	skb->data = skb->head; | ||||||
|  | 	skb_reset_tail_pointer(skb); | ||||||
| 	skb->len = 0; | 	skb->len = 0; | ||||||
| 
 | 
 | ||||||
| 	skb_reserve(skb, 16); | 	skb_reserve(skb, 16); | ||||||
|  |  | ||||||
|  | @ -2208,7 +2208,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | ||||||
|          if (i == 1 && ns_rsqe_eopdu(rsqe)) |          if (i == 1 && ns_rsqe_eopdu(rsqe)) | ||||||
|             *((u32 *) sb->data) |= 0x00000002; |             *((u32 *) sb->data) |= 0x00000002; | ||||||
|          skb_put(sb, NS_AAL0_HEADER); |          skb_put(sb, NS_AAL0_HEADER); | ||||||
|          memcpy(sb->tail, cell, ATM_CELL_PAYLOAD); |          memcpy(skb_tail_pointer(sb), cell, ATM_CELL_PAYLOAD); | ||||||
|          skb_put(sb, ATM_CELL_PAYLOAD); |          skb_put(sb, ATM_CELL_PAYLOAD); | ||||||
|          ATM_SKB(sb)->vcc = vcc; |          ATM_SKB(sb)->vcc = vcc; | ||||||
| 	 __net_timestamp(sb); | 	 __net_timestamp(sb); | ||||||
|  | @ -2252,7 +2252,8 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | ||||||
|       vc->rx_iov = iovb; |       vc->rx_iov = iovb; | ||||||
|       NS_SKB(iovb)->iovcnt = 0; |       NS_SKB(iovb)->iovcnt = 0; | ||||||
|       iovb->len = 0; |       iovb->len = 0; | ||||||
|       iovb->tail = iovb->data = iovb->head; |       iovb->data = iovb->head; | ||||||
|  |       skb_reset_tail_pointer(iovb); | ||||||
|       NS_SKB(iovb)->vcc = vcc; |       NS_SKB(iovb)->vcc = vcc; | ||||||
|       /* IMPORTANT: a pointer to the sk_buff containing the small or large
 |       /* IMPORTANT: a pointer to the sk_buff containing the small or large
 | ||||||
|                     buffer is stored as iovec base, NOT a pointer to the  |                     buffer is stored as iovec base, NOT a pointer to the  | ||||||
|  | @ -2265,7 +2266,8 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | ||||||
|       recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS); |       recycle_iovec_rx_bufs(card, (struct iovec *) iovb->data, NS_MAX_IOVECS); | ||||||
|       NS_SKB(iovb)->iovcnt = 0; |       NS_SKB(iovb)->iovcnt = 0; | ||||||
|       iovb->len = 0; |       iovb->len = 0; | ||||||
|       iovb->tail = iovb->data = iovb->head; |       iovb->data = iovb->head; | ||||||
|  |       skb_reset_tail_pointer(iovb); | ||||||
|       NS_SKB(iovb)->vcc = vcc; |       NS_SKB(iovb)->vcc = vcc; | ||||||
|    } |    } | ||||||
|    iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++]; |    iov = &((struct iovec *) iovb->data)[NS_SKB(iovb)->iovcnt++]; | ||||||
|  | @ -2489,7 +2491,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe) | ||||||
|             { |             { | ||||||
|                lb = (struct sk_buff *) iov->iov_base; |                lb = (struct sk_buff *) iov->iov_base; | ||||||
|                tocopy = min_t(int, remaining, iov->iov_len); |                tocopy = min_t(int, remaining, iov->iov_len); | ||||||
|                memcpy(hb->tail, lb->data, tocopy); |                memcpy(skb_tail_pointer(hb), lb->data, tocopy); | ||||||
|                skb_put(hb, tocopy); |                skb_put(hb, tocopy); | ||||||
|                iov++; |                iov++; | ||||||
|                remaining -= tocopy; |                remaining -= tocopy; | ||||||
|  |  | ||||||
|  | @ -439,7 +439,8 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Setup the skb for reuse since we're dropping this pkt */ | 	/* Setup the skb for reuse since we're dropping this pkt */ | ||||||
| 	elem->skb->tail = elem->skb->data = elem->skb->head; | 	elem->skb->data = elem->skb->head; | ||||||
|  | 	skb_reset_tail_pointer(elem->skb); | ||||||
| 
 | 
 | ||||||
| 	/* Zero out the rxp hdr in the sk_buff */ | 	/* Zero out the rxp hdr in the sk_buff */ | ||||||
| 	memset(elem->skb->data, 0, sizeof(*rxp_hdr)); | 	memset(elem->skb->data, 0, sizeof(*rxp_hdr)); | ||||||
|  | @ -521,7 +522,7 @@ static void c2_rx_interrupt(struct net_device *netdev) | ||||||
| 		 * "sizeof(struct c2_rxp_hdr)". | 		 * "sizeof(struct c2_rxp_hdr)". | ||||||
| 		 */ | 		 */ | ||||||
| 		skb->data += sizeof(*rxp_hdr); | 		skb->data += sizeof(*rxp_hdr); | ||||||
| 		skb->tail = skb->data + buflen; | 		skb_set_tail_pointer(skb, buflen); | ||||||
| 		skb->len = buflen; | 		skb->len = buflen; | ||||||
| 		skb->protocol = eth_type_trans(skb, netdev); | 		skb->protocol = eth_type_trans(skb, netdev); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -881,7 +881,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) | ||||||
| 
 | 
 | ||||||
| 	addinfo[0] = '\0'; | 	addinfo[0] = '\0'; | ||||||
| 	/* This check stolen from 2.1.72 dev_queue_xmit_nit() */ | 	/* This check stolen from 2.1.72 dev_queue_xmit_nit() */ | ||||||
| 	if (p < skb->data || p >= skb->tail) { | 	if (p < skb->data || skb->network_header >= skb->tail) { | ||||||
| 		/* fall back to old isdn_net_log_packet method() */ | 		/* fall back to old isdn_net_log_packet method() */ | ||||||
| 		char * buf = skb->data; | 		char * buf = skb->data; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -600,6 +600,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | ||||||
| 			/* Check CRC32, we've got it in our skb already. */ | 			/* Check CRC32, we've got it in our skb already. */ | ||||||
| 			unsigned short ulen = htons(priv->ule_sndu_len); | 			unsigned short ulen = htons(priv->ule_sndu_len); | ||||||
| 			unsigned short utype = htons(priv->ule_sndu_type); | 			unsigned short utype = htons(priv->ule_sndu_type); | ||||||
|  | 			const u8 *tail; | ||||||
| 			struct kvec iov[3] = { | 			struct kvec iov[3] = { | ||||||
| 				{ &ulen, sizeof ulen }, | 				{ &ulen, sizeof ulen }, | ||||||
| 				{ &utype, sizeof utype }, | 				{ &utype, sizeof utype }, | ||||||
|  | @ -613,10 +614,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			ule_crc = iov_crc32(ule_crc, iov, 3); | 			ule_crc = iov_crc32(ule_crc, iov, 3); | ||||||
| 			expected_crc = *((u8 *)priv->ule_skb->tail - 4) << 24 | | 			tail = skb_tail_pointer(priv->ule_skb); | ||||||
| 				       *((u8 *)priv->ule_skb->tail - 3) << 16 | | 			expected_crc = *(tail - 4) << 24 | | ||||||
| 				       *((u8 *)priv->ule_skb->tail - 2) << 8 | | 				       *(tail - 3) << 16 | | ||||||
| 				       *((u8 *)priv->ule_skb->tail - 1); | 				       *(tail - 2) << 8 | | ||||||
|  | 				       *(tail - 1); | ||||||
| 			if (ule_crc != expected_crc) { | 			if (ule_crc != expected_crc) { | ||||||
| 				printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n", | 				printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n", | ||||||
| 				       priv->ts_count, ule_crc, expected_crc, priv->ule_sndu_len, priv->ule_sndu_type, ts_remain, ts_remain > 2 ? *(unsigned short *)from_where : 0); | 				       priv->ts_count, ule_crc, expected_crc, priv->ule_sndu_len, priv->ule_sndu_type, ts_remain, ts_remain > 2 ? *(unsigned short *)from_where : 0); | ||||||
|  |  | ||||||
|  | @ -1348,7 +1348,7 @@ e100_rx(struct net_device *dev) | ||||||
| 
 | 
 | ||||||
| #ifdef ETHDEBUG | #ifdef ETHDEBUG | ||||||
| 		printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", | 		printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", | ||||||
| 		  skb->head, skb->data, skb->tail, skb->end); | 		  skb->head, skb->data, skb_tail_pointer(skb), skb->end); | ||||||
| 		printk("copying packet to 0x%x.\n", skb_data_ptr); | 		printk("copying packet to 0x%x.\n", skb_data_ptr); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1325,13 +1325,13 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | ||||||
| 	flits = skb_transport_offset(skb) / 8; | 	flits = skb_transport_offset(skb) / 8; | ||||||
| 	sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 	sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | ||||||
| 	sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), | 	sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), | ||||||
| 			     skb->tail - skb_transport_header(skb), | 			     skb->tail - skb->transport_header, | ||||||
| 			     adap->pdev); | 			     adap->pdev); | ||||||
| 	if (need_skb_unmap()) { | 	if (need_skb_unmap()) { | ||||||
| 		setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | 		setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | ||||||
| 		skb->destructor = deferred_unmap_destructor; | 		skb->destructor = deferred_unmap_destructor; | ||||||
| 		((struct unmap_info *)skb->cb)->len = (skb->tail - | 		((struct unmap_info *)skb->cb)->len = (skb->tail - | ||||||
| 						       skb_transport_header(skb)); | 						       skb->transport_header); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, | 	write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, | ||||||
|  | @ -1353,7 +1353,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb) | ||||||
| 		return 1;	/* packet fits as immediate data */ | 		return 1;	/* packet fits as immediate data */ | ||||||
| 
 | 
 | ||||||
| 	flits = skb_transport_offset(skb) / 8;	/* headers */ | 	flits = skb_transport_offset(skb) / 8;	/* headers */ | ||||||
| 	if (skb->tail != skb_transport_header(skb)) | 	if (skb->tail != skb->transport_header) | ||||||
| 		cnt++; | 		cnt++; | ||||||
| 	return flits_to_desc(flits + sgl_len(cnt)); | 	return flits_to_desc(flits + sgl_len(cnt)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3304,7 +3304,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | ||||||
| 				 * NOTE: this is a TSO only workaround | 				 * NOTE: this is a TSO only workaround | ||||||
| 				 * if end byte alignment not correct move us | 				 * if end byte alignment not correct move us | ||||||
| 				 * into the next dword */ | 				 * into the next dword */ | ||||||
| 				if ((unsigned long)(skb->tail - 1) & 4) | 				if ((unsigned long)(skb_tail_pointer(skb) - 1) & 4) | ||||||
| 					break; | 					break; | ||||||
| 				/* fall through */ | 				/* fall through */ | ||||||
| 			case e1000_82571: | 			case e1000_82571: | ||||||
|  | @ -4388,7 +4388,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | ||||||
| 				PCI_DMA_FROMDEVICE); | 				PCI_DMA_FROMDEVICE); | ||||||
| 			vaddr = kmap_atomic(ps_page->ps_page[0], | 			vaddr = kmap_atomic(ps_page->ps_page[0], | ||||||
| 			                    KM_SKB_DATA_SOFTIRQ); | 			                    KM_SKB_DATA_SOFTIRQ); | ||||||
| 			memcpy(skb->tail, vaddr, l1); | 			memcpy(skb_tail_pointer(skb), vaddr, l1); | ||||||
| 			kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 			kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | ||||||
| 			pci_dma_sync_single_for_device(pdev, | 			pci_dma_sync_single_for_device(pdev, | ||||||
| 				ps_page_dma->ps_page_dma[0], | 				ps_page_dma->ps_page_dma[0], | ||||||
|  |  | ||||||
|  | @ -1338,7 +1338,7 @@ static inline int emac_rx_sg_append(struct ocp_enet_private *dev, int slot) | ||||||
| 			dev_kfree_skb(dev->rx_sg_skb); | 			dev_kfree_skb(dev->rx_sg_skb); | ||||||
| 			dev->rx_sg_skb = NULL; | 			dev->rx_sg_skb = NULL; | ||||||
| 		} else { | 		} else { | ||||||
| 			cacheable_memcpy(dev->rx_sg_skb->tail, | 			cacheable_memcpy(skb_tail_pointer(dev->rx_sg_skb), | ||||||
| 					 dev->rx_skb[slot]->data, len); | 					 dev->rx_skb[slot]->data, len); | ||||||
| 			skb_put(dev->rx_sg_skb, len); | 			skb_put(dev->rx_sg_skb, len); | ||||||
| 			emac_recycle_rx_skb(dev, slot, len); | 			emac_recycle_rx_skb(dev, slot, len); | ||||||
|  |  | ||||||
|  | @ -575,7 +575,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||||||
| 	int i; | 	int i; | ||||||
| 	dev_dbg(&bp->pdev->dev, | 	dev_dbg(&bp->pdev->dev, | ||||||
| 		"start_xmit: len %u head %p data %p tail %p end %p\n", | 		"start_xmit: len %u head %p data %p tail %p end %p\n", | ||||||
| 		skb->len, skb->head, skb->data, skb->tail, skb->end); | 		skb->len, skb->head, skb->data, | ||||||
|  | 		skb_tail_pointer(skb), skb->end); | ||||||
| 	dev_dbg(&bp->pdev->dev, | 	dev_dbg(&bp->pdev->dev, | ||||||
| 		"data:"); | 		"data:"); | ||||||
| 	for (i = 0; i < 16; i++) | 	for (i = 0; i < 16; i++) | ||||||
|  |  | ||||||
|  | @ -1185,7 +1185,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | ||||||
| 	skb_reserve(skb, 2); | 	skb_reserve(skb, 2); | ||||||
| 	insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); | 	insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); | ||||||
| 	if (pkt_len & 1) | 	if (pkt_len & 1) | ||||||
| 	    *(skb->tail-1) = inb(ioaddr + AM2150_RCV); | 	    *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV); | ||||||
| 	skb->protocol = eth_type_trans(skb, dev); | 	skb->protocol = eth_type_trans(skb, dev); | ||||||
| 	 | 	 | ||||||
| 	netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ | 	netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ | ||||||
|  |  | ||||||
|  | @ -2195,7 +2195,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \ | ||||||
| 	frag_list->next = NULL; | 	frag_list->next = NULL; | ||||||
| 	tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); | 	tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); | ||||||
| 	frag_list->data = tmp; | 	frag_list->data = tmp; | ||||||
| 	frag_list->tail = tmp; | 	skb_reset_tail_pointer(frag_list); | ||||||
| 
 | 
 | ||||||
| 	/* Buffer-2 receives L4 data payload */ | 	/* Buffer-2 receives L4 data payload */ | ||||||
| 	((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, | 	((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, | ||||||
|  | @ -2349,7 +2349,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | ||||||
| 			tmp += ALIGN_SIZE; | 			tmp += ALIGN_SIZE; | ||||||
| 			tmp &= ~ALIGN_SIZE; | 			tmp &= ~ALIGN_SIZE; | ||||||
| 			skb->data = (void *) (unsigned long)tmp; | 			skb->data = (void *) (unsigned long)tmp; | ||||||
| 			skb->tail = (void *) (unsigned long)tmp; | 			skb_reset_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 			if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) | 			if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) | ||||||
| 				((struct RxD3*)rxdp)->Buffer0_ptr = | 				((struct RxD3*)rxdp)->Buffer0_ptr = | ||||||
|  |  | ||||||
|  | @ -829,7 +829,9 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | ||||||
| 					!= NULL) ) { | 					!= NULL) ) { | ||||||
| 					/* size less than COPY_SIZE, allocate a rxlen SKB */ | 					/* size less than COPY_SIZE, allocate a rxlen SKB */ | ||||||
| 					skb_reserve(skb, 2); /* 16byte align */ | 					skb_reserve(skb, 2); /* 16byte align */ | ||||||
| 					memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen); | 					memcpy(skb_put(skb, rxlen), | ||||||
|  | 					       skb_tail_pointer(rxptr->rx_skb_ptr), | ||||||
|  | 					       rxlen); | ||||||
| 					uli526x_reuse_skb(db, rxptr->rx_skb_ptr); | 					uli526x_reuse_skb(db, rxptr->rx_skb_ptr); | ||||||
| 				} else | 				} else | ||||||
| 					skb_put(skb, rxlen); | 					skb_put(skb, rxlen); | ||||||
|  | @ -1175,7 +1177,10 @@ static void uli526x_reuse_skb(struct uli526x_board_info *db, struct sk_buff * sk | ||||||
| 
 | 
 | ||||||
| 	if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { | 	if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { | ||||||
| 		rxptr->rx_skb_ptr = skb; | 		rxptr->rx_skb_ptr = skb; | ||||||
| 		rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 		rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, | ||||||
|  | 							  skb_tail_pointer(skb), | ||||||
|  | 							  RX_ALLOC_SIZE, | ||||||
|  | 							  PCI_DMA_FROMDEVICE)); | ||||||
| 		wmb(); | 		wmb(); | ||||||
| 		rxptr->rdes0 = cpu_to_le32(0x80000000); | 		rxptr->rdes0 = cpu_to_le32(0x80000000); | ||||||
| 		db->rx_avail_cnt++; | 		db->rx_avail_cnt++; | ||||||
|  | @ -1339,7 +1344,10 @@ static void allocate_rx_buffer(struct uli526x_board_info *db) | ||||||
| 		if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) | 		if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) | ||||||
| 			break; | 			break; | ||||||
| 		rxptr->rx_skb_ptr = skb; /* FIXME (?) */ | 		rxptr->rx_skb_ptr = skb; /* FIXME (?) */ | ||||||
| 		rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 		rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, | ||||||
|  | 							  skb_tail_pointer(skb), | ||||||
|  | 							  RX_ALLOC_SIZE, | ||||||
|  | 							  PCI_DMA_FROMDEVICE)); | ||||||
| 		wmb(); | 		wmb(); | ||||||
| 		rxptr->rdes0 = cpu_to_le32(0x80000000); | 		rxptr->rdes0 = cpu_to_le32(0x80000000); | ||||||
| 		rxptr = rxptr->next_rx_desc; | 		rxptr = rxptr->next_rx_desc; | ||||||
|  |  | ||||||
|  | @ -533,7 +533,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) | ||||||
| 		skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); | 		skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); | ||||||
| 		fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); | 		fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); | ||||||
| 	} | 	} | ||||||
| 	data = skb->tail; | 	data = skb_tail_pointer(skb); | ||||||
| 	data[i++] = LMI_CALLREF; | 	data[i++] = LMI_CALLREF; | ||||||
| 	data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; | 	data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; | ||||||
| 	if (lmi == LMI_ANSI) | 	if (lmi == LMI_ANSI) | ||||||
|  |  | ||||||
|  | @ -1636,7 +1636,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | ||||||
|             if (nsb) { |             if (nsb) { | ||||||
|                 sc->lmc_rxq[i] = nsb; |                 sc->lmc_rxq[i] = nsb; | ||||||
|                 nsb->dev = dev; |                 nsb->dev = dev; | ||||||
|                 sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); |                 sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); | ||||||
|             } |             } | ||||||
|             sc->failed_recv_alloc = 1; |             sc->failed_recv_alloc = 1; | ||||||
|             goto skip_packet; |             goto skip_packet; | ||||||
|  | @ -1679,7 +1679,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | ||||||
|             if (nsb) { |             if (nsb) { | ||||||
|                 sc->lmc_rxq[i] = nsb; |                 sc->lmc_rxq[i] = nsb; | ||||||
|                 nsb->dev = dev; |                 nsb->dev = dev; | ||||||
|                 sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); |                 sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); | ||||||
|                 /* Transferred to 21140 below */ |                 /* Transferred to 21140 below */ | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|  |  | ||||||
|  | @ -922,7 +922,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | ||||||
| 		if (frag != 0) | 		if (frag != 0) | ||||||
| 			flen -= hdrlen; | 			flen -= hdrlen; | ||||||
| 
 | 
 | ||||||
| 		if (frag_skb->tail + flen > frag_skb->end) { | 		if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { | ||||||
| 			printk(KERN_WARNING "%s: host decrypted and " | 			printk(KERN_WARNING "%s: host decrypted and " | ||||||
| 			       "reassembled frame did not fit skb\n", | 			       "reassembled frame did not fit skb\n", | ||||||
| 			       dev->name); | 			       dev->name); | ||||||
|  |  | ||||||
|  | @ -706,7 +706,8 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg) | ||||||
| 			spin_unlock(&ch->collect_lock); | 			spin_unlock(&ch->collect_lock); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		ch->trans_skb->tail = ch->trans_skb->data = ch->trans_skb_data; | 		ch->trans_skb->data = ch->trans_skb_data; | ||||||
|  | 		skb_reset_tail_pointer(ch->trans_skb); | ||||||
| 		ch->trans_skb->len = 0; | 		ch->trans_skb->len = 0; | ||||||
| 		if (ch->prof.maxmulti < (ch->collect_len + 2)) | 		if (ch->prof.maxmulti < (ch->collect_len + 2)) | ||||||
| 			ch->prof.maxmulti = ch->collect_len + 2; | 			ch->prof.maxmulti = ch->collect_len + 2; | ||||||
|  | @ -831,7 +832,8 @@ ch_action_rx(fsm_instance * fi, int event, void *arg) | ||||||
| 		ctc_unpack_skb(ch, skb); | 		ctc_unpack_skb(ch, skb); | ||||||
| 	} | 	} | ||||||
|  again: |  again: | ||||||
| 	skb->data = skb->tail = ch->trans_skb_data; | 	skb->data = ch->trans_skb_data; | ||||||
|  | 	skb_reset_tail_pointer(skb); | ||||||
| 	skb->len = 0; | 	skb->len = 0; | ||||||
| 	if (ctc_checkalloc_buffer(ch, 1)) | 	if (ctc_checkalloc_buffer(ch, 1)) | ||||||
| 		return; | 		return; | ||||||
|  | @ -2226,7 +2228,8 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | ||||||
| 		 * IDAL support in CTC is broken, so we have to | 		 * IDAL support in CTC is broken, so we have to | ||||||
| 		 * care about skb's above 2G ourselves. | 		 * care about skb's above 2G ourselves. | ||||||
| 		 */ | 		 */ | ||||||
| 		hi = ((unsigned long) skb->tail + LL_HEADER_LENGTH) >> 31; | 		hi = ((unsigned long)skb_tail_pointer(skb) + | ||||||
|  | 		      LL_HEADER_LENGTH) >> 31; | ||||||
| 		if (hi) { | 		if (hi) { | ||||||
| 			nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 			nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | ||||||
| 			if (!nskb) { | 			if (!nskb) { | ||||||
|  | @ -2262,7 +2265,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) | ||||||
| 				return -EBUSY; | 				return -EBUSY; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			ch->trans_skb->tail = ch->trans_skb->data; | 			skb_reset_tail_pointer(ch->trans_skb); | ||||||
| 			ch->trans_skb->len = 0; | 			ch->trans_skb->len = 0; | ||||||
| 			ch->ccw[1].count = skb->len; | 			ch->ccw[1].count = skb->len; | ||||||
| 			memcpy(skb_put(ch->trans_skb, skb->len), skb->data, | 			memcpy(skb_put(ch->trans_skb, skb->len), skb->data, | ||||||
|  |  | ||||||
|  | @ -689,7 +689,8 @@ static void conn_action_rx(fsm_instance *fi, int event, void *arg) | ||||||
| 			       msg->length, conn->max_buffsize); | 			       msg->length, conn->max_buffsize); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	conn->rx_buff->data = conn->rx_buff->tail = conn->rx_buff->head; | 	conn->rx_buff->data = conn->rx_buff->head; | ||||||
|  | 	skb_reset_tail_pointer(conn->rx_buff); | ||||||
| 	conn->rx_buff->len = 0; | 	conn->rx_buff->len = 0; | ||||||
| 	rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, | 	rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, | ||||||
| 				  msg->length, NULL); | 				  msg->length, NULL); | ||||||
|  | @ -735,7 +736,8 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	conn->tx_buff->data = conn->tx_buff->tail = conn->tx_buff->head; | 	conn->tx_buff->data = conn->tx_buff->head; | ||||||
|  | 	skb_reset_tail_pointer(conn->tx_buff); | ||||||
| 	conn->tx_buff->len = 0; | 	conn->tx_buff->len = 0; | ||||||
| 	spin_lock_irqsave(&conn->collect_lock, saveflags); | 	spin_lock_irqsave(&conn->collect_lock, saveflags); | ||||||
| 	while ((skb = skb_dequeue(&conn->collect_queue))) { | 	while ((skb = skb_dequeue(&conn->collect_queue))) { | ||||||
|  | @ -1164,8 +1166,8 @@ static int netiucv_transmit_skb(struct iucv_connection *conn, | ||||||
| 		 * Copy the skb to a new allocated skb in lowmem only if the | 		 * Copy the skb to a new allocated skb in lowmem only if the | ||||||
| 		 * data is located above 2G in memory or tailroom is < 2. | 		 * data is located above 2G in memory or tailroom is < 2. | ||||||
| 		 */ | 		 */ | ||||||
| 		unsigned long hi = | 		unsigned long hi = ((unsigned long)(skb_tail_pointer(skb) + | ||||||
| 			((unsigned long)(skb->tail + NETIUCV_HDRLEN)) >> 31; | 				    NETIUCV_HDRLEN)) >> 31; | ||||||
| 		int copied = 0; | 		int copied = 0; | ||||||
| 		if (hi || (skb_tailroom(skb) < 2)) { | 		if (hi || (skb_tailroom(skb) < 2)) { | ||||||
| 			nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + | 			nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + | ||||||
|  |  | ||||||
|  | @ -335,15 +335,15 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | ||||||
| 
 | 
 | ||||||
| 	sarb = instance->cached_vcc->sarb; | 	sarb = instance->cached_vcc->sarb; | ||||||
| 
 | 
 | ||||||
| 	if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { | 	if (skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD > sarb->end) { | ||||||
| 		atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", | 		atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", | ||||||
| 				__func__, sarb->len, vcc); | 				__func__, sarb->len, vcc); | ||||||
| 		/* discard cells already received */ | 		/* discard cells already received */ | ||||||
| 		skb_trim(sarb, 0); | 		skb_trim(sarb, 0); | ||||||
| 		UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); | 		UDSL_ASSERT(skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD <= sarb->end); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); | 	memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); | ||||||
| 	__skb_put(sarb, ATM_CELL_PAYLOAD); | 	__skb_put(sarb, ATM_CELL_PAYLOAD); | ||||||
| 
 | 
 | ||||||
| 	if (pti & 1) { | 	if (pti & 1) { | ||||||
|  | @ -370,7 +370,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { | 		if (crc32_be(~0, skb_tail_pointer(sarb) - pdu_length, pdu_length) != 0xc704dd7b) { | ||||||
| 			atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", | 			atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", | ||||||
| 				  __func__, vcc); | 				  __func__, vcc); | ||||||
| 			atomic_inc(&vcc->stats->rx_err); | 			atomic_inc(&vcc->stats->rx_err); | ||||||
|  | @ -396,7 +396,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | ||||||
| 			goto out;	/* atm_charge increments rx_drop */ | 			goto out;	/* atm_charge increments rx_drop */ | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		memcpy(skb->data, sarb->tail - pdu_length, length); | 		memcpy(skb->data, skb_tail_pointer(sarb) - pdu_length, length); | ||||||
| 		__skb_put(skb, length); | 		__skb_put(skb, length); | ||||||
| 
 | 
 | ||||||
| 		vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", | 		vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", | ||||||
|  |  | ||||||
|  | @ -298,7 +298,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||||||
| 		if (ax_skb) { | 		if (ax_skb) { | ||||||
| 			ax_skb->len = size; | 			ax_skb->len = size; | ||||||
| 			ax_skb->data = packet; | 			ax_skb->data = packet; | ||||||
| 			ax_skb->tail = packet + size; | 			skb_set_tail_pointer(ax_skb, size); | ||||||
| 			usbnet_skb_return(dev, ax_skb); | 			usbnet_skb_return(dev, ax_skb); | ||||||
| 		} else { | 		} else { | ||||||
| 			return 0; | 			return 0; | ||||||
|  | @ -338,7 +338,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | ||||||
| 	    && ((headroom + tailroom) >= (4 + padlen))) { | 	    && ((headroom + tailroom) >= (4 + padlen))) { | ||||||
| 		if ((headroom < 4) || (tailroom < padlen)) { | 		if ((headroom < 4) || (tailroom < padlen)) { | ||||||
| 			skb->data = memmove(skb->head + 4, skb->data, skb->len); | 			skb->data = memmove(skb->head + 4, skb->data, skb->len); | ||||||
| 			skb->tail = skb->data + skb->len; | 			skb_set_tail_pointer(skb, skb->len); | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		struct sk_buff *skb2; | 		struct sk_buff *skb2; | ||||||
|  | @ -356,7 +356,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | ||||||
| 
 | 
 | ||||||
| 	if ((skb->len % 512) == 0) { | 	if ((skb->len % 512) == 0) { | ||||||
| 		cpu_to_le32s(&padbytes); | 		cpu_to_le32s(&padbytes); | ||||||
| 		memcpy( skb->tail, &padbytes, sizeof(padbytes)); | 		memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); | ||||||
| 		skb_put(skb, sizeof(padbytes)); | 		skb_put(skb, sizeof(padbytes)); | ||||||
| 	} | 	} | ||||||
| 	return skb; | 	return skb; | ||||||
|  |  | ||||||
|  | @ -157,7 +157,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | ||||||
| 		if ((headroom < (4 + 4*1)) || (tailroom < padlen)) { | 		if ((headroom < (4 + 4*1)) || (tailroom < padlen)) { | ||||||
| 			skb->data = memmove(skb->head + (4 + 4*1), | 			skb->data = memmove(skb->head + (4 + 4*1), | ||||||
| 					     skb->data, skb->len); | 					     skb->data, skb->len); | ||||||
| 			skb->tail = skb->data + skb->len; | 			skb_set_tail_pointer(skb, skb->len); | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		struct sk_buff	*skb2; | 		struct sk_buff	*skb2; | ||||||
|  |  | ||||||
|  | @ -520,7 +520,7 @@ net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | ||||||
| 			skb->data = memmove(skb->head | 			skb->data = memmove(skb->head | ||||||
| 						+ sizeof (struct nc_header), | 						+ sizeof (struct nc_header), | ||||||
| 					    skb->data, skb->len); | 					    skb->data, skb->len); | ||||||
| 			skb->tail = skb->data + len; | 			skb_set_tail_pointer(skb, len); | ||||||
| 			goto encapsulate; | 			goto encapsulate; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -588,7 +588,7 @@ rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | ||||||
| 		if (likely((sizeof *hdr) <= room)) { | 		if (likely((sizeof *hdr) <= room)) { | ||||||
| 			skb->data = memmove(skb->head + sizeof *hdr, | 			skb->data = memmove(skb->head + sizeof *hdr, | ||||||
| 					    skb->data, len); | 					    skb->data, len); | ||||||
| 			skb->tail = skb->data + len; | 			skb_set_tail_pointer(skb, len); | ||||||
| 			goto fill; | 			goto fill; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -62,11 +62,11 @@ struct nfattr | ||||||
| #define NFA_DATA(nfa)   ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | #define NFA_DATA(nfa)   ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | ||||||
| #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | ||||||
| #define NFA_NEST(skb, type) \ | #define NFA_NEST(skb, type) \ | ||||||
| ({	struct nfattr *__start = (struct nfattr *) (skb)->tail; \ | ({	struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ | ||||||
| 	NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | 	NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | ||||||
| 	__start;  }) | 	__start;  }) | ||||||
| #define NFA_NEST_END(skb, start) \ | #define NFA_NEST_END(skb, start) \ | ||||||
| ({      (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ | ({      (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ | ||||||
|         (skb)->len; }) |         (skb)->len; }) | ||||||
| #define NFA_NEST_CANCEL(skb, start) \ | #define NFA_NEST_CANCEL(skb, start) \ | ||||||
| ({      if (start) \ | ({      if (start) \ | ||||||
|  |  | ||||||
|  | @ -229,7 +229,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | ||||||
| 		  (cb)->nlh->nlmsg_seq, type, len, flags) | 		  (cb)->nlh->nlmsg_seq, type, len, flags) | ||||||
| 
 | 
 | ||||||
| #define NLMSG_END(skb, nlh) \ | #define NLMSG_END(skb, nlh) \ | ||||||
| ({	(nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ | ({	(nlh)->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)(nlh); \ | ||||||
| 	(skb)->len; }) | 	(skb)->len; }) | ||||||
| 
 | 
 | ||||||
| #define NLMSG_CANCEL(skb, nlh) \ | #define NLMSG_CANCEL(skb, nlh) \ | ||||||
|  |  | ||||||
|  | @ -605,7 +605,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | ||||||
| 
 | 
 | ||||||
| #define RTA_PUT_NOHDR(skb, attrlen, data) \ | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | ||||||
| ({	RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ | ({	RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ | ||||||
| 	memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ | 	memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \ | ||||||
| 	       RTA_ALIGN(attrlen) - attrlen); }) | 	       RTA_ALIGN(attrlen) - attrlen); }) | ||||||
| 
 | 
 | ||||||
| #define RTA_PUT_U8(skb, attrtype, value) \ | #define RTA_PUT_U8(skb, attrtype, value) \ | ||||||
|  | @ -637,12 +637,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | ||||||
| 	RTA_PUT(skb, attrtype, 0, NULL); | 	RTA_PUT(skb, attrtype, 0, NULL); | ||||||
| 
 | 
 | ||||||
| #define RTA_NEST(skb, type) \ | #define RTA_NEST(skb, type) \ | ||||||
| ({	struct rtattr *__start = (struct rtattr *) (skb)->tail; \ | ({	struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \ | ||||||
| 	RTA_PUT(skb, type, 0, NULL); \ | 	RTA_PUT(skb, type, 0, NULL); \ | ||||||
| 	__start;  }) | 	__start;  }) | ||||||
| 
 | 
 | ||||||
| #define RTA_NEST_END(skb, start) \ | #define RTA_NEST_END(skb, start) \ | ||||||
| ({	(start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ | ({	(start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ | ||||||
| 	(skb)->len; }) | 	(skb)->len; }) | ||||||
| 
 | 
 | ||||||
| #define RTA_NEST_CANCEL(skb, start) \ | #define RTA_NEST_CANCEL(skb, start) \ | ||||||
|  |  | ||||||
|  | @ -246,9 +246,6 @@ struct sk_buff { | ||||||
| 	int			iif; | 	int			iif; | ||||||
| 	/* 4 byte hole on 64 bit*/ | 	/* 4 byte hole on 64 bit*/ | ||||||
| 
 | 
 | ||||||
| 	sk_buff_data_t		transport_header; |  | ||||||
| 	sk_buff_data_t		network_header; |  | ||||||
| 	sk_buff_data_t		mac_header; |  | ||||||
| 	struct  dst_entry	*dst; | 	struct  dst_entry	*dst; | ||||||
| 	struct	sec_path	*sp; | 	struct	sec_path	*sp; | ||||||
| 
 | 
 | ||||||
|  | @ -303,13 +300,16 @@ struct sk_buff { | ||||||
| 
 | 
 | ||||||
| 	__u32			mark; | 	__u32			mark; | ||||||
| 
 | 
 | ||||||
|  | 	sk_buff_data_t		transport_header; | ||||||
|  | 	sk_buff_data_t		network_header; | ||||||
|  | 	sk_buff_data_t		mac_header; | ||||||
| 	/* These elements must be at the end, see alloc_skb() for details.  */ | 	/* These elements must be at the end, see alloc_skb() for details.  */ | ||||||
| 	unsigned int		truesize; | 	sk_buff_data_t		tail; | ||||||
| 	atomic_t		users; |  | ||||||
| 	unsigned char		*head, | 	unsigned char		*head, | ||||||
| 				*data, | 				*data, | ||||||
| 				*tail, |  | ||||||
| 				*end; | 				*end; | ||||||
|  | 	unsigned int		truesize; | ||||||
|  | 	atomic_t		users; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #ifdef __KERNEL__ | #ifdef __KERNEL__ | ||||||
|  | @ -812,12 +812,45 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | ||||||
| #define SKB_FRAG_ASSERT(skb) 	BUG_ON(skb_shinfo(skb)->frag_list) | #define SKB_FRAG_ASSERT(skb) 	BUG_ON(skb_shinfo(skb)->frag_list) | ||||||
| #define SKB_LINEAR_ASSERT(skb)  BUG_ON(skb_is_nonlinear(skb)) | #define SKB_LINEAR_ASSERT(skb)  BUG_ON(skb_is_nonlinear(skb)) | ||||||
| 
 | 
 | ||||||
|  | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||||||
|  | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||||||
|  | { | ||||||
|  | 	return skb->head + skb->tail; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||||||
|  | { | ||||||
|  | 	skb->tail = skb->data - skb->head; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||||||
|  | { | ||||||
|  | 	skb_reset_tail_pointer(skb); | ||||||
|  | 	skb->tail += offset; | ||||||
|  | } | ||||||
|  | #else /* NET_SKBUFF_DATA_USES_OFFSET */ | ||||||
|  | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||||||
|  | { | ||||||
|  | 	return skb->tail; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||||||
|  | { | ||||||
|  | 	skb->tail = skb->data; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||||||
|  | { | ||||||
|  | 	skb->tail = skb->data + offset; | ||||||
|  | } | ||||||
|  | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  *	Add data to an sk_buff |  *	Add data to an sk_buff | ||||||
|  */ |  */ | ||||||
| static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | ||||||
| { | { | ||||||
| 	unsigned char *tmp = skb->tail; | 	unsigned char *tmp = skb_tail_pointer(skb); | ||||||
| 	SKB_LINEAR_ASSERT(skb); | 	SKB_LINEAR_ASSERT(skb); | ||||||
| 	skb->tail += len; | 	skb->tail += len; | ||||||
| 	skb->len  += len; | 	skb->len  += len; | ||||||
|  | @ -835,11 +868,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | ||||||
|  */ |  */ | ||||||
| static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | ||||||
| { | { | ||||||
| 	unsigned char *tmp = skb->tail; | 	unsigned char *tmp = skb_tail_pointer(skb); | ||||||
| 	SKB_LINEAR_ASSERT(skb); | 	SKB_LINEAR_ASSERT(skb); | ||||||
| 	skb->tail += len; | 	skb->tail += len; | ||||||
| 	skb->len  += len; | 	skb->len  += len; | ||||||
| 	if (unlikely(skb->tail>skb->end)) | 	if (unlikely(skb_tail_pointer(skb) > skb->end)) | ||||||
| 		skb_over_panic(skb, len, current_text_addr()); | 		skb_over_panic(skb, len, current_text_addr()); | ||||||
| 	return tmp; | 	return tmp; | ||||||
| } | } | ||||||
|  | @ -935,7 +968,7 @@ static inline int skb_headroom(const struct sk_buff *skb) | ||||||
|  */ |  */ | ||||||
| static inline int skb_tailroom(const struct sk_buff *skb) | static inline int skb_tailroom(const struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; | 	return skb_is_nonlinear(skb) ? 0 : skb->end - skb_tail_pointer(skb); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | @ -1127,8 +1160,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len) | ||||||
| 		WARN_ON(1); | 		WARN_ON(1); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	skb->len  = len; | 	skb->len = len; | ||||||
| 	skb->tail = skb->data + len; | 	skb_set_tail_pointer(skb, len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
|  | @ -114,14 +114,12 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	switch (skb->protocol) { | 	switch (skb->protocol) { | ||||||
| 	case __constant_htons(ETH_P_IP): | 	case __constant_htons(ETH_P_IP): | ||||||
| 		if (skb_network_header(skb) + sizeof(struct iphdr) <= | 		if (skb->network_header + sizeof(struct iphdr) <= skb->tail) | ||||||
| 		    skb->tail) |  | ||||||
| 			return IP_ECN_set_ce(ip_hdr(skb)); | 			return IP_ECN_set_ce(ip_hdr(skb)); | ||||||
| 		break; | 		break; | ||||||
| 
 | 
 | ||||||
| 	case __constant_htons(ETH_P_IPV6): | 	case __constant_htons(ETH_P_IPV6): | ||||||
| 		if (skb_network_header(skb) + sizeof(struct ipv6hdr) <= | 		if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) | ||||||
| 		    skb->tail) |  | ||||||
| 			return IP6_ECN_set_ce(ipv6_hdr(skb)); | 			return IP6_ECN_set_ce(ipv6_hdr(skb)); | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags) | ||||||
|  */ |  */ | ||||||
| static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | ||||||
| { | { | ||||||
| 	nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; | ||||||
| 
 | 
 | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| } | } | ||||||
|  | @ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | ||||||
|  */ |  */ | ||||||
| static inline void *nlmsg_get_pos(struct sk_buff *skb) | static inline void *nlmsg_get_pos(struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	return skb->tail; | 	return skb_tail_pointer(skb); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | @ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla) | ||||||
|  */ |  */ | ||||||
| static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | ||||||
| { | { | ||||||
| 	struct nlattr *start = (struct nlattr *) skb->tail; | 	struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	if (nla_put(skb, attrtype, 0, NULL) < 0) | 	if (nla_put(skb, attrtype, 0, NULL) < 0) | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  | @ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | ||||||
|  */ |  */ | ||||||
| static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | ||||||
| { | { | ||||||
| 	start->nla_len = skb->tail - (unsigned char *) start; | 	start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -337,7 +337,7 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer) | ||||||
| static inline int tcf_valid_offset(const struct sk_buff *skb, | static inline int tcf_valid_offset(const struct sk_buff *skb, | ||||||
| 				   const unsigned char *ptr, const int len) | 				   const unsigned char *ptr, const int len) | ||||||
| { | { | ||||||
| 	return unlikely((ptr + len) < skb->tail && ptr > skb->head); | 	return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_NET_CLS_IND | #ifdef CONFIG_NET_CLS_IND | ||||||
|  |  | ||||||
|  | @ -1073,7 +1073,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | ||||||
| 			goto out; | 			goto out; | ||||||
| 	} | 	} | ||||||
| 	va_copy(args2, args); | 	va_copy(args2, args); | ||||||
| 	len = vsnprintf(skb->tail, avail, fmt, args); | 	len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args); | ||||||
| 	if (len >= avail) { | 	if (len >= avail) { | ||||||
| 		/* The printk buffer is 1024 bytes long, so if we get
 | 		/* The printk buffer is 1024 bytes long, so if we get
 | ||||||
| 		 * here and AUDIT_BUFSIZ is at least 1024, then we can | 		 * here and AUDIT_BUFSIZ is at least 1024, then we can | ||||||
|  | @ -1082,7 +1082,7 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt, | ||||||
| 			max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); | 			max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail)); | ||||||
| 		if (!avail) | 		if (!avail) | ||||||
| 			goto out; | 			goto out; | ||||||
| 		len = vsnprintf(skb->tail, avail, fmt, args2); | 		len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2); | ||||||
| 	} | 	} | ||||||
| 	if (len > 0) | 	if (len > 0) | ||||||
| 		skb_put(skb, len); | 		skb_put(skb, len); | ||||||
|  | @ -1143,7 +1143,7 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf, | ||||||
| 			return; | 			return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	ptr = skb->tail; | 	ptr = skb_tail_pointer(skb); | ||||||
| 	for (i=0; i<len; i++) { | 	for (i=0; i<len; i++) { | ||||||
| 		*ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ | 		*ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */ | ||||||
| 		*ptr++ = hex[buf[i] & 0x0F];	  /* Lower nibble */ | 		*ptr++ = hex[buf[i] & 0x0F];	  /* Lower nibble */ | ||||||
|  | @ -1175,7 +1175,7 @@ static void audit_log_n_string(struct audit_buffer *ab, size_t slen, | ||||||
| 		if (!avail) | 		if (!avail) | ||||||
| 			return; | 			return; | ||||||
| 	} | 	} | ||||||
| 	ptr = skb->tail; | 	ptr = skb_tail_pointer(skb); | ||||||
| 	*ptr++ = '"'; | 	*ptr++ = '"'; | ||||||
| 	memcpy(ptr, string, slen); | 	memcpy(ptr, string, slen); | ||||||
| 	ptr += slen; | 	ptr += slen; | ||||||
|  |  | ||||||
|  | @ -283,7 +283,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n", | 	DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n", | ||||||
| 		(long)skb->head, (long)skb->data, (long)skb->tail, | 		(long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb), | ||||||
| 		(long)skb->end); | 		(long)skb->end); | ||||||
| #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) | #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) | ||||||
| 	if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) | 	if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) | ||||||
|  |  | ||||||
|  | @ -1567,7 +1567,7 @@ static int rfcomm_recv_frame(struct rfcomm_session *s, struct sk_buff *skb) | ||||||
| 
 | 
 | ||||||
| 	/* Trim FCS */ | 	/* Trim FCS */ | ||||||
| 	skb->len--; skb->tail--; | 	skb->len--; skb->tail--; | ||||||
| 	fcs = *(u8 *) skb->tail; | 	fcs = *(u8 *)skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	if (__check_fcs(skb->data, type, fcs)) { | 	if (__check_fcs(skb->data, type, fcs)) { | ||||||
| 		BT_ERR("bad checksum in packet"); | 		BT_ERR("bad checksum in packet"); | ||||||
|  |  | ||||||
|  | @ -1069,7 +1069,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | ||||||
| 			skb_reset_mac_header(skb2); | 			skb_reset_mac_header(skb2); | ||||||
| 
 | 
 | ||||||
| 			if (skb_network_header(skb2) < skb2->data || | 			if (skb_network_header(skb2) < skb2->data || | ||||||
| 			    skb_network_header(skb2) > skb2->tail) { | 			    skb2->network_header > skb2->tail) { | ||||||
| 				if (net_ratelimit()) | 				if (net_ratelimit()) | ||||||
| 					printk(KERN_CRIT "protocol %04x is " | 					printk(KERN_CRIT "protocol %04x is " | ||||||
| 					       "buggy, dev %s\n", | 					       "buggy, dev %s\n", | ||||||
|  | @ -1175,7 +1175,7 @@ int skb_checksum_help(struct sk_buff *skb) | ||||||
| 	BUG_ON(offset > (int)skb->len); | 	BUG_ON(offset > (int)skb->len); | ||||||
| 	csum = skb_checksum(skb, offset, skb->len-offset, 0); | 	csum = skb_checksum(skb, offset, skb->len-offset, 0); | ||||||
| 
 | 
 | ||||||
| 	offset = skb->tail - skb_transport_header(skb); | 	offset = skb->tail - skb->transport_header; | ||||||
| 	BUG_ON(offset <= 0); | 	BUG_ON(offset <= 0); | ||||||
| 	BUG_ON(skb->csum_offset + 2 > offset); | 	BUG_ON(skb->csum_offset + 2 > offset); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ static void *__load_pointer(struct sk_buff *skb, int k) | ||||||
| 	else if (k >= SKF_LL_OFF) | 	else if (k >= SKF_LL_OFF) | ||||||
| 		ptr = skb_mac_header(skb) + k - SKF_LL_OFF; | 		ptr = skb_mac_header(skb) + k - SKF_LL_OFF; | ||||||
| 
 | 
 | ||||||
| 	if (ptr >= skb->head && ptr < skb->tail) | 	if (ptr >= skb->head && ptr < skb_tail_pointer(skb)) | ||||||
| 		return ptr; | 		return ptr; | ||||||
| 	return NULL; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -61,7 +61,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type, | ||||||
| 	spin_lock_bh(lock); | 	spin_lock_bh(lock); | ||||||
| 	d->lock = lock; | 	d->lock = lock; | ||||||
| 	if (type) | 	if (type) | ||||||
| 		d->tail = (struct rtattr *) skb->tail; | 		d->tail = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	d->skb = skb; | 	d->skb = skb; | ||||||
| 	d->compat_tc_stats = tc_stats_type; | 	d->compat_tc_stats = tc_stats_type; | ||||||
| 	d->compat_xstats = xstats_type; | 	d->compat_xstats = xstats_type; | ||||||
|  | @ -212,7 +212,7 @@ int | ||||||
| gnet_stats_finish_copy(struct gnet_dump *d) | gnet_stats_finish_copy(struct gnet_dump *d) | ||||||
| { | { | ||||||
| 	if (d->tail) | 	if (d->tail) | ||||||
| 		d->tail->rta_len = d->skb->tail - (u8 *) d->tail; | 		d->tail->rta_len = skb_tail_pointer(d->skb) - (u8 *)d->tail; | ||||||
| 
 | 
 | ||||||
| 	if (d->compat_tc_stats) | 	if (d->compat_tc_stats) | ||||||
| 		if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats, | 		if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats, | ||||||
|  |  | ||||||
|  | @ -2357,7 +2357,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | ||||||
| 		*vlan_encapsulated_proto = htons(ETH_P_IP); | 		*vlan_encapsulated_proto = htons(ETH_P_IP); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	skb_set_network_header(skb, skb->tail - skb->data); | 	skb->network_header = skb->tail; | ||||||
| 	skb->transport_header = skb->network_header + sizeof(struct iphdr); | 	skb->transport_header = skb->network_header + sizeof(struct iphdr); | ||||||
| 	skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr)); | 	skb_put(skb, sizeof(struct iphdr) + sizeof(struct udphdr)); | ||||||
| 
 | 
 | ||||||
|  | @ -2696,7 +2696,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | ||||||
| 		*vlan_encapsulated_proto = htons(ETH_P_IPV6); | 		*vlan_encapsulated_proto = htons(ETH_P_IPV6); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	skb_set_network_header(skb, skb->tail - skb->data); | 	skb->network_header = skb->tail; | ||||||
| 	skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); | 	skb->transport_header = skb->network_header + sizeof(struct ipv6hdr); | ||||||
| 	skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr)); | 	skb_put(skb, sizeof(struct ipv6hdr) + sizeof(struct udphdr)); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -87,8 +87,9 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly; | ||||||
| void skb_over_panic(struct sk_buff *skb, int sz, void *here) | void skb_over_panic(struct sk_buff *skb, int sz, void *here) | ||||||
| { | { | ||||||
| 	printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " | 	printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " | ||||||
| 			  "data:%p tail:%p end:%p dev:%s\n", | 			  "data:%p tail:%#lx end:%p dev:%s\n", | ||||||
| 	       here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, | 	       here, skb->len, sz, skb->head, skb->data, | ||||||
|  | 	       (unsigned long)skb->tail, skb->end, | ||||||
| 	       skb->dev ? skb->dev->name : "<NULL>"); | 	       skb->dev ? skb->dev->name : "<NULL>"); | ||||||
| 	BUG(); | 	BUG(); | ||||||
| } | } | ||||||
|  | @ -105,8 +106,9 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here) | ||||||
| void skb_under_panic(struct sk_buff *skb, int sz, void *here) | void skb_under_panic(struct sk_buff *skb, int sz, void *here) | ||||||
| { | { | ||||||
| 	printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " | 	printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " | ||||||
| 			  "data:%p tail:%p end:%p dev:%s\n", | 			  "data:%p tail:%#lx end:%p dev:%s\n", | ||||||
| 	       here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, | 	       here, skb->len, sz, skb->head, skb->data, | ||||||
|  | 	       (unsigned long)skb->tail, skb->end, | ||||||
| 	       skb->dev ? skb->dev->name : "<NULL>"); | 	       skb->dev ? skb->dev->name : "<NULL>"); | ||||||
| 	BUG(); | 	BUG(); | ||||||
| } | } | ||||||
|  | @ -167,7 +169,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | ||||||
| 	atomic_set(&skb->users, 1); | 	atomic_set(&skb->users, 1); | ||||||
| 	skb->head = data; | 	skb->head = data; | ||||||
| 	skb->data = data; | 	skb->data = data; | ||||||
| 	skb->tail = data; | 	skb_reset_tail_pointer(skb); | ||||||
| 	skb->end  = data + size; | 	skb->end  = data + size; | ||||||
| 	/* make sure we initialize shinfo sequentially */ | 	/* make sure we initialize shinfo sequentially */ | ||||||
| 	shinfo = skb_shinfo(skb); | 	shinfo = skb_shinfo(skb); | ||||||
|  | @ -629,7 +631,12 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | ||||||
| 
 | 
 | ||||||
| 	/* Copy only real data... and, alas, header. This should be
 | 	/* Copy only real data... and, alas, header. This should be
 | ||||||
| 	 * optimized for the cases when header is void. */ | 	 * optimized for the cases when header is void. */ | ||||||
| 	memcpy(data + nhead, skb->head, skb->tail - skb->head); | 	memcpy(data + nhead, skb->head, | ||||||
|  | 		skb->tail | ||||||
|  | #ifndef NET_SKBUFF_DATA_USES_OFFSET | ||||||
|  | 		- skb->head | ||||||
|  | #endif | ||||||
|  | 		); | ||||||
| 	memcpy(data + size, skb->end, sizeof(struct skb_shared_info)); | 	memcpy(data + size, skb->end, sizeof(struct skb_shared_info)); | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | ||||||
|  | @ -645,9 +652,9 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | ||||||
| 	skb->head     = data; | 	skb->head     = data; | ||||||
| 	skb->end      = data + size; | 	skb->end      = data + size; | ||||||
| 	skb->data    += off; | 	skb->data    += off; | ||||||
| 	skb->tail    += off; |  | ||||||
| #ifndef NET_SKBUFF_DATA_USES_OFFSET | #ifndef NET_SKBUFF_DATA_USES_OFFSET | ||||||
| 	/* {transport,network,mac}_header are relative to skb->head */ | 	/* {transport,network,mac}_header and tail are relative to skb->head */ | ||||||
|  | 	skb->tail	      += off; | ||||||
| 	skb->transport_header += off; | 	skb->transport_header += off; | ||||||
| 	skb->network_header   += off; | 	skb->network_header   += off; | ||||||
| 	skb->mac_header	      += off; | 	skb->mac_header	      += off; | ||||||
|  | @ -762,7 +769,7 @@ int skb_pad(struct sk_buff *skb, int pad) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	ntail = skb->data_len + pad - (skb->end - skb->tail); | 	ntail = skb->data_len + pad - (skb->end - skb_tail_pointer(skb)); | ||||||
| 	if (likely(skb_cloned(skb) || ntail > 0)) { | 	if (likely(skb_cloned(skb) || ntail > 0)) { | ||||||
| 		err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); | 		err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); | ||||||
| 		if (unlikely(err)) | 		if (unlikely(err)) | ||||||
|  | @ -863,7 +870,7 @@ done: | ||||||
| 	} else { | 	} else { | ||||||
| 		skb->len       = len; | 		skb->len       = len; | ||||||
| 		skb->data_len  = 0; | 		skb->data_len  = 0; | ||||||
| 		skb->tail      = skb->data + len; | 		skb_set_tail_pointer(skb, len); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -900,7 +907,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) | ||||||
| 	 * plus 128 bytes for future expansions. If we have enough | 	 * plus 128 bytes for future expansions. If we have enough | ||||||
| 	 * room at tail, reallocate without expansion only if skb is cloned. | 	 * room at tail, reallocate without expansion only if skb is cloned. | ||||||
| 	 */ | 	 */ | ||||||
| 	int i, k, eat = (skb->tail + delta) - skb->end; | 	int i, k, eat = (skb_tail_pointer(skb) + delta) - skb->end; | ||||||
| 
 | 
 | ||||||
| 	if (eat > 0 || skb_cloned(skb)) { | 	if (eat > 0 || skb_cloned(skb)) { | ||||||
| 		if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, | 		if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, | ||||||
|  | @ -908,7 +915,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) | ||||||
| 			return NULL; | 			return NULL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (skb_copy_bits(skb, skb_headlen(skb), skb->tail, delta)) | 	if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta)) | ||||||
| 		BUG(); | 		BUG(); | ||||||
| 
 | 
 | ||||||
| 	/* Optimization: no fragments, no reasons to preestimate
 | 	/* Optimization: no fragments, no reasons to preestimate
 | ||||||
|  | @ -1004,7 +1011,7 @@ pull_pages: | ||||||
| 	skb->tail     += delta; | 	skb->tail     += delta; | ||||||
| 	skb->data_len -= delta; | 	skb->data_len -= delta; | ||||||
| 
 | 
 | ||||||
| 	return skb->tail; | 	return skb_tail_pointer(skb); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Copy some data bits from skb to kernel buffer. */ | /* Copy some data bits from skb to kernel buffer. */ | ||||||
|  | @ -1539,7 +1546,7 @@ static inline void skb_split_inside_header(struct sk_buff *skb, | ||||||
| 	skb1->len		   += skb1->data_len; | 	skb1->len		   += skb1->data_len; | ||||||
| 	skb->data_len		   = 0; | 	skb->data_len		   = 0; | ||||||
| 	skb->len		   = len; | 	skb->len		   = len; | ||||||
| 	skb->tail		   = skb->data + len; | 	skb_set_tail_pointer(skb, len); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static inline void skb_split_no_header(struct sk_buff *skb, | static inline void skb_split_no_header(struct sk_buff *skb, | ||||||
|  |  | ||||||
|  | @ -1938,7 +1938,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff *	skb, | ||||||
| { | { | ||||||
| 	struct ifinfomsg *r; | 	struct ifinfomsg *r; | ||||||
| 	struct nlmsghdr  *nlh; | 	struct nlmsghdr  *nlh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char	 *b = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r)); | 	nlh = NLMSG_PUT(skb, 0, 0, type, sizeof(*r)); | ||||||
| 	r = NLMSG_DATA(nlh); | 	r = NLMSG_DATA(nlh); | ||||||
|  | @ -1952,7 +1952,7 @@ static inline int rtnetlink_fill_iwinfo(struct sk_buff *	skb, | ||||||
| 	/* Add the wireless events in the netlink packet */ | 	/* Add the wireless events in the netlink packet */ | ||||||
| 	RTA_PUT(skb, IFLA_WIRELESS, event_len, event); | 	RTA_PUT(skb, IFLA_WIRELESS, event_len, event); | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  |  | ||||||
|  | @ -681,8 +681,10 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | ||||||
| 	if (scp->peer.sdn_objnum) | 	if (scp->peer.sdn_objnum) | ||||||
| 		type = 0; | 		type = 0; | ||||||
| 
 | 
 | ||||||
| 	skb_put(skb, dn_sockaddr2username(&scp->peer, skb->tail, type)); | 	skb_put(skb, dn_sockaddr2username(&scp->peer, | ||||||
| 	skb_put(skb, dn_sockaddr2username(&scp->addr, skb->tail, 2)); | 					  skb_tail_pointer(skb), type)); | ||||||
|  | 	skb_put(skb, dn_sockaddr2username(&scp->addr, | ||||||
|  | 					  skb_tail_pointer(skb), 2)); | ||||||
| 
 | 
 | ||||||
| 	menuver = DN_MENUVER_ACC | DN_MENUVER_USR; | 	menuver = DN_MENUVER_ACC | DN_MENUVER_USR; | ||||||
| 	if (scp->peer.sdn_flags & SDF_PROXY) | 	if (scp->peer.sdn_flags & SDF_PROXY) | ||||||
|  |  | ||||||
|  | @ -1468,7 +1468,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | ||||||
| 	struct dn_route *rt = (struct dn_route *)skb->dst; | 	struct dn_route *rt = (struct dn_route *)skb->dst; | ||||||
| 	struct rtmsg *r; | 	struct rtmsg *r; | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	long expires; | 	long expires; | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); | 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); | ||||||
|  | @ -1509,7 +1509,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | ||||||
| 	if (rt->fl.iif) | 	if (rt->fl.iif) | ||||||
| 		RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); | 		RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  |  | ||||||
|  | @ -295,7 +295,7 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | ||||||
| { | { | ||||||
| 	struct rtmsg *rtm; | 	struct rtmsg *rtm; | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); | 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*rtm), flags); | ||||||
| 	rtm = NLMSG_DATA(nlh); | 	rtm = NLMSG_DATA(nlh); | ||||||
|  | @ -337,13 +337,13 @@ static int dn_fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | ||||||
| 			nhp->rtnh_ifindex = nh->nh_oif; | 			nhp->rtnh_ifindex = nh->nh_oif; | ||||||
| 			if (nh->nh_gw) | 			if (nh->nh_gw) | ||||||
| 				RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); | 				RTA_PUT(skb, RTA_GATEWAY, 2, &nh->nh_gw); | ||||||
| 			nhp->rtnh_len = skb->tail - (unsigned char *)nhp; | 			nhp->rtnh_len = skb_tail_pointer(skb) - (unsigned char *)nhp; | ||||||
| 		} endfor_nexthops(fi); | 		} endfor_nexthops(fi); | ||||||
| 		mp_head->rta_type = RTA_MULTIPATH; | 		mp_head->rta_type = RTA_MULTIPATH; | ||||||
| 		mp_head->rta_len = skb->tail - (u8*)mp_head; | 		mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ static struct sk_buff *dnrmg_build_message(struct sk_buff *rt_skb, int *errp) | ||||||
| { | { | ||||||
| 	struct sk_buff *skb = NULL; | 	struct sk_buff *skb = NULL; | ||||||
| 	size_t size; | 	size_t size; | ||||||
| 	unsigned char *old_tail; | 	sk_buff_data_t old_tail; | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	unsigned char *ptr; | 	unsigned char *ptr; | ||||||
| 	struct nf_dn_rtmsg *rtm; | 	struct nf_dn_rtmsg *rtm; | ||||||
|  |  | ||||||
|  | @ -366,7 +366,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | ||||||
| 			fh->cb = cb; | 			fh->cb = cb; | ||||||
| 			fh->port = port; | 			fh->port = port; | ||||||
| 			if (sock->type != SOCK_DGRAM) { | 			if (sock->type != SOCK_DGRAM) { | ||||||
| 				skb->tail = skb->data; | 				skb_reset_tail_pointer(skb); | ||||||
| 				skb->len = 0; | 				skb->len = 0; | ||||||
| 			} else if (res < 0) | 			} else if (res < 0) | ||||||
| 				goto out_free; | 				goto out_free; | ||||||
|  |  | ||||||
|  | @ -595,7 +595,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | ||||||
| 		if (frag != 0) | 		if (frag != 0) | ||||||
| 			flen -= hdrlen; | 			flen -= hdrlen; | ||||||
| 
 | 
 | ||||||
| 		if (frag_skb->tail + flen > frag_skb->end) { | 		if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { | ||||||
| 			printk(KERN_WARNING "%s: host decrypted and " | 			printk(KERN_WARNING "%s: host decrypted and " | ||||||
| 			       "reassembled frame did not fit skb\n", | 			       "reassembled frame did not fit skb\n", | ||||||
| 			       dev->name); | 			       dev->name); | ||||||
|  |  | ||||||
|  | @ -21,6 +21,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | ||||||
| 	struct blkcipher_desc desc; | 	struct blkcipher_desc desc; | ||||||
| 	struct esp_data *esp; | 	struct esp_data *esp; | ||||||
| 	struct sk_buff *trailer; | 	struct sk_buff *trailer; | ||||||
|  | 	u8 *tail; | ||||||
| 	int blksize; | 	int blksize; | ||||||
| 	int clen; | 	int clen; | ||||||
| 	int alen; | 	int alen; | ||||||
|  | @ -49,12 +50,13 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | ||||||
| 		goto error; | 		goto error; | ||||||
| 
 | 
 | ||||||
| 	/* Fill padding... */ | 	/* Fill padding... */ | ||||||
|  | 	tail = skb_tail_pointer(trailer); | ||||||
| 	do { | 	do { | ||||||
| 		int i; | 		int i; | ||||||
| 		for (i=0; i<clen-skb->len - 2; i++) | 		for (i=0; i<clen-skb->len - 2; i++) | ||||||
| 			*(u8*)(trailer->tail + i) = i+1; | 			tail[i] = i + 1; | ||||||
| 	} while (0); | 	} while (0); | ||||||
| 	*(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; | 	tail[clen - skb->len - 2] = (clen - skb->len) - 2; | ||||||
| 	pskb_put(skb, trailer, clen - skb->len); | 	pskb_put(skb, trailer, clen - skb->len); | ||||||
| 
 | 
 | ||||||
| 	__skb_push(skb, skb->data - skb_network_header(skb)); | 	__skb_push(skb, skb->data - skb_network_header(skb)); | ||||||
|  | @ -62,7 +64,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | ||||||
| 	esph = (struct ip_esp_hdr *)(skb_network_header(skb) + | 	esph = (struct ip_esp_hdr *)(skb_network_header(skb) + | ||||||
| 				     top_iph->ihl * 4); | 				     top_iph->ihl * 4); | ||||||
| 	top_iph->tot_len = htons(skb->len + alen); | 	top_iph->tot_len = htons(skb->len + alen); | ||||||
| 	*(u8*)(trailer->tail - 1) = top_iph->protocol; | 	*(skb_tail_pointer(skb) - 1) = top_iph->protocol; | ||||||
| 
 | 
 | ||||||
| 	/* this is non-NULL only with UDP Encapsulation */ | 	/* this is non-NULL only with UDP Encapsulation */ | ||||||
| 	if (x->encap) { | 	if (x->encap) { | ||||||
|  |  | ||||||
|  | @ -450,7 +450,8 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | ||||||
| 	 */ | 	 */ | ||||||
| 	iph = ip_hdr(skb_in); | 	iph = ip_hdr(skb_in); | ||||||
| 
 | 
 | ||||||
| 	if ((u8 *)iph < skb_in->head || (u8 *)(iph + 1) > skb_in->tail) | 	if ((u8 *)iph < skb_in->head || | ||||||
|  | 	    (skb_in->network_header + sizeof(*iph)) > skb_in->tail) | ||||||
| 		goto out; | 		goto out; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  |  | ||||||
|  | @ -348,8 +348,8 @@ static int igmpv3_sendpack(struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	struct iphdr *pip = ip_hdr(skb); | 	struct iphdr *pip = ip_hdr(skb); | ||||||
| 	struct igmphdr *pig = igmp_hdr(skb); | 	struct igmphdr *pig = igmp_hdr(skb); | ||||||
| 	const int iplen = skb->tail - skb_network_header(skb); | 	const int iplen = skb->tail - skb->network_header; | ||||||
| 	const int igmplen = skb->tail - skb_transport_header(skb); | 	const int igmplen = skb->tail - skb->transport_header; | ||||||
| 
 | 
 | ||||||
| 	pip->tot_len = htons(iplen); | 	pip->tot_len = htons(iplen); | ||||||
| 	ip_send_check(pip); | 	ip_send_check(pip); | ||||||
|  |  | ||||||
|  | @ -60,7 +60,7 @@ static int inet_csk_diag_fill(struct sock *sk, | ||||||
| 	struct nlmsghdr  *nlh; | 	struct nlmsghdr  *nlh; | ||||||
| 	void *info = NULL; | 	void *info = NULL; | ||||||
| 	struct inet_diag_meminfo  *minfo = NULL; | 	struct inet_diag_meminfo  *minfo = NULL; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char	 *b = skb_tail_pointer(skb); | ||||||
| 	const struct inet_diag_handler *handler; | 	const struct inet_diag_handler *handler; | ||||||
| 
 | 
 | ||||||
| 	handler = inet_diag_table[unlh->nlmsg_type]; | 	handler = inet_diag_table[unlh->nlmsg_type]; | ||||||
|  | @ -147,7 +147,7 @@ static int inet_csk_diag_fill(struct sock *sk, | ||||||
| 	    icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) | 	    icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) | ||||||
| 		icsk->icsk_ca_ops->get_info(sk, ext, skb); | 		icsk->icsk_ca_ops->get_info(sk, ext, skb); | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  | @ -163,7 +163,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | ||||||
| { | { | ||||||
| 	long tmo; | 	long tmo; | ||||||
| 	struct inet_diag_msg *r; | 	struct inet_diag_msg *r; | ||||||
| 	const unsigned char *previous_tail = skb->tail; | 	const unsigned char *previous_tail = skb_tail_pointer(skb); | ||||||
| 	struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq, | 	struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq, | ||||||
| 					 unlh->nlmsg_type, sizeof(*r)); | 					 unlh->nlmsg_type, sizeof(*r)); | ||||||
| 
 | 
 | ||||||
|  | @ -205,7 +205,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, | ||||||
| 			       &tw6->tw_v6_daddr); | 			       &tw6->tw_v6_daddr); | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 	nlh->nlmsg_len = skb->tail - previous_tail; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
| 	skb_trim(skb, previous_tail - skb->data); | 	skb_trim(skb, previous_tail - skb->data); | ||||||
|  | @ -535,7 +535,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | ||||||
| { | { | ||||||
| 	const struct inet_request_sock *ireq = inet_rsk(req); | 	const struct inet_request_sock *ireq = inet_rsk(req); | ||||||
| 	struct inet_sock *inet = inet_sk(sk); | 	struct inet_sock *inet = inet_sk(sk); | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct inet_diag_msg *r; | 	struct inet_diag_msg *r; | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	long tmo; | 	long tmo; | ||||||
|  | @ -574,7 +574,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, | ||||||
| 			       &inet6_rsk(req)->rmt_addr); | 			       &inet6_rsk(req)->rmt_addr); | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 
 | 
 | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -316,7 +316,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf | ||||||
| 	serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); | 	serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); | ||||||
| 	serr->port = port; | 	serr->port = port; | ||||||
| 
 | 
 | ||||||
| 	__skb_pull(skb, skb->tail - skb->data); | 	__skb_pull(skb, skb_tail_pointer(skb) - skb->data); | ||||||
| 	skb_reset_transport_header(skb); | 	skb_reset_transport_header(skb); | ||||||
| 
 | 
 | ||||||
| 	if (sock_queue_err_skb(sk, skb)) | 	if (sock_queue_err_skb(sk, skb)) | ||||||
|  |  | ||||||
|  | @ -513,7 +513,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) | ||||||
| 			struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | 			struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); | ||||||
| 
 | 
 | ||||||
| 			if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { | 			if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { | ||||||
| 				nlh->nlmsg_len = skb->tail - (u8*)nlh; | 				nlh->nlmsg_len = (skb_tail_pointer(skb) - | ||||||
|  | 						  (u8 *)nlh); | ||||||
| 			} else { | 			} else { | ||||||
| 				nlh->nlmsg_type = NLMSG_ERROR; | 				nlh->nlmsg_type = NLMSG_ERROR; | ||||||
| 				nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | 				nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); | ||||||
|  | @ -580,7 +581,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) | ||||||
| 	 *	Copy the IP header | 	 *	Copy the IP header | ||||||
| 	 */ | 	 */ | ||||||
| 
 | 
 | ||||||
| 	skb_set_network_header(skb, skb->tail - skb->data); | 	skb->network_header = skb->tail; | ||||||
| 	skb_put(skb, ihl); | 	skb_put(skb, ihl); | ||||||
| 	memcpy(skb->data,pkt->data,ihl); | 	memcpy(skb->data,pkt->data,ihl); | ||||||
| 	ip_hdr(skb)->protocol = 0;			/* Flag to the kernel this is a route add */ | 	ip_hdr(skb)->protocol = 0;			/* Flag to the kernel this is a route add */ | ||||||
|  | @ -1544,7 +1545,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) | ||||||
| 	int ct; | 	int ct; | ||||||
| 	struct rtnexthop *nhp; | 	struct rtnexthop *nhp; | ||||||
| 	struct net_device *dev = vif_table[c->mfc_parent].dev; | 	struct net_device *dev = vif_table[c->mfc_parent].dev; | ||||||
| 	u8 *b = skb->tail; | 	u8 *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *mp_head; | 	struct rtattr *mp_head; | ||||||
| 
 | 
 | ||||||
| 	if (dev) | 	if (dev) | ||||||
|  | @ -1564,7 +1565,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	mp_head->rta_type = RTA_MULTIPATH; | 	mp_head->rta_type = RTA_MULTIPATH; | ||||||
| 	mp_head->rta_len = skb->tail - (u8*)mp_head; | 	mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head; | ||||||
| 	rtm->rtm_type = RTN_MULTICAST; | 	rtm->rtm_type = RTN_MULTICAST; | ||||||
| 	return 1; | 	return 1; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -162,7 +162,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | ||||||
| 		iph = ip_hdr(*pskb); | 		iph = ip_hdr(*pskb); | ||||||
| 		th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); | 		th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); | ||||||
| 		data = (char *)th + (th->doff << 2); | 		data = (char *)th + (th->doff << 2); | ||||||
| 		data_limit = (*pskb)->tail; | 		data_limit = skb_tail_pointer(*pskb); | ||||||
| 
 | 
 | ||||||
| 		if (ip_vs_ftp_get_addrport(data, data_limit, | 		if (ip_vs_ftp_get_addrport(data, data_limit, | ||||||
| 					   SERVER_STRING, | 					   SERVER_STRING, | ||||||
|  | @ -269,7 +269,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | ||||||
| 	   the length of the header in 32-bit multiples, it is accurate | 	   the length of the header in 32-bit multiples, it is accurate | ||||||
| 	   to calculate data address by th+HLEN*4 */ | 	   to calculate data address by th+HLEN*4 */ | ||||||
| 	data = data_start = (char *)th + (th->doff << 2); | 	data = data_start = (char *)th + (th->doff << 2); | ||||||
| 	data_limit = (*pskb)->tail; | 	data_limit = skb_tail_pointer(*pskb); | ||||||
| 
 | 
 | ||||||
| 	while (data <= data_limit - 6) { | 	while (data <= data_limit - 6) { | ||||||
| 		if (strnicmp(data, "PASV\r\n", 6) == 0) { | 		if (strnicmp(data, "PASV\r\n", 6) == 0) { | ||||||
|  |  | ||||||
|  | @ -37,28 +37,28 @@ target(struct sk_buff **pskb, | ||||||
| 	/* We assume that pln and hln were checked in the match */ | 	/* We assume that pln and hln were checked in the match */ | ||||||
| 	if (mangle->flags & ARPT_MANGLE_SDEV) { | 	if (mangle->flags & ARPT_MANGLE_SDEV) { | ||||||
| 		if (ARPT_DEV_ADDR_LEN_MAX < hln || | 		if (ARPT_DEV_ADDR_LEN_MAX < hln || | ||||||
| 		   (arpptr + hln > (**pskb).tail)) | 		   (arpptr + hln > skb_tail_pointer(*pskb))) | ||||||
| 			return NF_DROP; | 			return NF_DROP; | ||||||
| 		memcpy(arpptr, mangle->src_devaddr, hln); | 		memcpy(arpptr, mangle->src_devaddr, hln); | ||||||
| 	} | 	} | ||||||
| 	arpptr += hln; | 	arpptr += hln; | ||||||
| 	if (mangle->flags & ARPT_MANGLE_SIP) { | 	if (mangle->flags & ARPT_MANGLE_SIP) { | ||||||
| 		if (ARPT_MANGLE_ADDR_LEN_MAX < pln || | 		if (ARPT_MANGLE_ADDR_LEN_MAX < pln || | ||||||
| 		   (arpptr + pln > (**pskb).tail)) | 		   (arpptr + pln > skb_tail_pointer(*pskb))) | ||||||
| 			return NF_DROP; | 			return NF_DROP; | ||||||
| 		memcpy(arpptr, &mangle->u_s.src_ip, pln); | 		memcpy(arpptr, &mangle->u_s.src_ip, pln); | ||||||
| 	} | 	} | ||||||
| 	arpptr += pln; | 	arpptr += pln; | ||||||
| 	if (mangle->flags & ARPT_MANGLE_TDEV) { | 	if (mangle->flags & ARPT_MANGLE_TDEV) { | ||||||
| 		if (ARPT_DEV_ADDR_LEN_MAX < hln || | 		if (ARPT_DEV_ADDR_LEN_MAX < hln || | ||||||
| 		   (arpptr + hln > (**pskb).tail)) | 		   (arpptr + hln > skb_tail_pointer(*pskb))) | ||||||
| 			return NF_DROP; | 			return NF_DROP; | ||||||
| 		memcpy(arpptr, mangle->tgt_devaddr, hln); | 		memcpy(arpptr, mangle->tgt_devaddr, hln); | ||||||
| 	} | 	} | ||||||
| 	arpptr += hln; | 	arpptr += hln; | ||||||
| 	if (mangle->flags & ARPT_MANGLE_TIP) { | 	if (mangle->flags & ARPT_MANGLE_TIP) { | ||||||
| 		if (ARPT_MANGLE_ADDR_LEN_MAX < pln || | 		if (ARPT_MANGLE_ADDR_LEN_MAX < pln || | ||||||
| 		   (arpptr + pln > (**pskb).tail)) | 		   (arpptr + pln > skb_tail_pointer(*pskb))) | ||||||
| 			return NF_DROP; | 			return NF_DROP; | ||||||
| 		memcpy(arpptr, &mangle->u_t.tgt_ip, pln); | 		memcpy(arpptr, &mangle->u_t.tgt_ip, pln); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -191,7 +191,7 @@ ipq_flush(int verdict) | ||||||
| static struct sk_buff * | static struct sk_buff * | ||||||
| ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | ||||||
| { | { | ||||||
| 	unsigned char *old_tail; | 	sk_buff_data_t old_tail; | ||||||
| 	size_t size = 0; | 	size_t size = 0; | ||||||
| 	size_t data_len = 0; | 	size_t data_len = 0; | ||||||
| 	struct sk_buff *skb; | 	struct sk_buff *skb; | ||||||
|  | @ -235,7 +235,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | ||||||
| 	if (!skb) | 	if (!skb) | ||||||
| 		goto nlmsg_failure; | 		goto nlmsg_failure; | ||||||
| 
 | 
 | ||||||
| 	old_tail= skb->tail; | 	old_tail = skb->tail; | ||||||
| 	nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); | 	nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); | ||||||
| 	pmsg = NLMSG_DATA(nlh); | 	pmsg = NLMSG_DATA(nlh); | ||||||
| 	memset(pmsg, 0, sizeof(*pmsg)); | 	memset(pmsg, 0, sizeof(*pmsg)); | ||||||
|  |  | ||||||
|  | @ -92,7 +92,8 @@ static void mangle_contents(struct sk_buff *skb, | ||||||
| 	/* move post-replacement */ | 	/* move post-replacement */ | ||||||
| 	memmove(data + match_offset + rep_len, | 	memmove(data + match_offset + rep_len, | ||||||
| 		data + match_offset + match_len, | 		data + match_offset + match_len, | ||||||
| 		skb->tail - (data + match_offset + match_len)); | 		skb->tail - (skb->network_header + dataoff + | ||||||
|  | 			     match_offset + match_len)); | ||||||
| 
 | 
 | ||||||
| 	/* insert data from buffer */ | 	/* insert data from buffer */ | ||||||
| 	memcpy(data + match_offset, rep_buffer, rep_len); | 	memcpy(data + match_offset, rep_buffer, rep_len); | ||||||
|  |  | ||||||
|  | @ -2231,7 +2231,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features) | ||||||
| 		th->cwr = 0; | 		th->cwr = 0; | ||||||
| 	} while (skb->next); | 	} while (skb->next); | ||||||
| 
 | 
 | ||||||
| 	delta = htonl(oldlen + (skb->tail - skb_transport_header(skb)) + | 	delta = htonl(oldlen + (skb->tail - skb->transport_header) + | ||||||
| 		      skb->data_len); | 		      skb->data_len); | ||||||
| 	th->check = ~csum_fold((__force __wsum)((__force u32)th->check + | 	th->check = ~csum_fold((__force __wsum)((__force u32)th->check + | ||||||
| 				(__force u32)delta)); | 				(__force u32)delta)); | ||||||
|  |  | ||||||
|  | @ -733,7 +733,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | ||||||
| 	} | 	} | ||||||
| 	skb_shinfo(skb)->nr_frags = k; | 	skb_shinfo(skb)->nr_frags = k; | ||||||
| 
 | 
 | ||||||
| 	skb->tail = skb->data; | 	skb_reset_tail_pointer(skb); | ||||||
| 	skb->data_len -= len; | 	skb->data_len -= len; | ||||||
| 	skb->len = skb->data_len; | 	skb->len = skb->data_len; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -268,7 +268,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info) | ||||||
| 	serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); | 	serr->addr_offset = (u8 *)&iph->daddr - skb_network_header(skb); | ||||||
| 	serr->port = fl->fl_ip_dport; | 	serr->port = fl->fl_ip_dport; | ||||||
| 
 | 
 | ||||||
| 	__skb_pull(skb, skb->tail - skb->data); | 	__skb_pull(skb, skb_tail_pointer(skb) - skb->data); | ||||||
| 	skb_reset_transport_header(skb); | 	skb_reset_transport_header(skb); | ||||||
| 
 | 
 | ||||||
| 	if (sock_queue_err_skb(sk, skb)) | 	if (sock_queue_err_skb(sk, skb)) | ||||||
|  |  | ||||||
|  | @ -51,6 +51,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | ||||||
| 	int clen; | 	int clen; | ||||||
| 	int alen; | 	int alen; | ||||||
| 	int nfrags; | 	int nfrags; | ||||||
|  | 	u8 *tail; | ||||||
| 	struct esp_data *esp = x->data; | 	struct esp_data *esp = x->data; | ||||||
| 	int hdr_len = (skb_transport_offset(skb) + | 	int hdr_len = (skb_transport_offset(skb) + | ||||||
| 		       sizeof(*esph) + esp->conf.ivlen); | 		       sizeof(*esph) + esp->conf.ivlen); | ||||||
|  | @ -78,18 +79,19 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Fill padding... */ | 	/* Fill padding... */ | ||||||
|  | 	tail = skb_tail_pointer(trailer); | ||||||
| 	do { | 	do { | ||||||
| 		int i; | 		int i; | ||||||
| 		for (i=0; i<clen-skb->len - 2; i++) | 		for (i=0; i<clen-skb->len - 2; i++) | ||||||
| 			*(u8*)(trailer->tail + i) = i+1; | 			tail[i] = i + 1; | ||||||
| 	} while (0); | 	} while (0); | ||||||
| 	*(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2; | 	tail[clen-skb->len - 2] = (clen - skb->len) - 2; | ||||||
| 	pskb_put(skb, trailer, clen - skb->len); | 	pskb_put(skb, trailer, clen - skb->len); | ||||||
| 
 | 
 | ||||||
| 	top_iph = (struct ipv6hdr *)__skb_push(skb, hdr_len); | 	top_iph = (struct ipv6hdr *)__skb_push(skb, hdr_len); | ||||||
| 	esph = (struct ipv6_esp_hdr *)skb_transport_header(skb); | 	esph = (struct ipv6_esp_hdr *)skb_transport_header(skb); | ||||||
| 	top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph)); | 	top_iph->payload_len = htons(skb->len + alen - sizeof(*top_iph)); | ||||||
| 	*(u8 *)(trailer->tail - 1) = *skb_network_header(skb); | 	*(skb_tail_pointer(skb) - 1) = *skb_network_header(skb); | ||||||
| 	*skb_network_header(skb) = IPPROTO_ESP; | 	*skb_network_header(skb) = IPPROTO_ESP; | ||||||
| 
 | 
 | ||||||
| 	esph->spi = x->id.spi; | 	esph->spi = x->id.spi; | ||||||
|  |  | ||||||
|  | @ -51,7 +51,7 @@ | ||||||
| int ipv6_find_tlv(struct sk_buff *skb, int offset, int type) | int ipv6_find_tlv(struct sk_buff *skb, int offset, int type) | ||||||
| { | { | ||||||
| 	const unsigned char *nh = skb_network_header(skb); | 	const unsigned char *nh = skb_network_header(skb); | ||||||
| 	int packet_len = skb->tail - nh; | 	int packet_len = skb->tail - skb->network_header; | ||||||
| 	struct ipv6_opt_hdr *hdr; | 	struct ipv6_opt_hdr *hdr; | ||||||
| 	int len; | 	int len; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -317,7 +317,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | ||||||
| 	int hlimit, tclass; | 	int hlimit, tclass; | ||||||
| 	int err = 0; | 	int err = 0; | ||||||
| 
 | 
 | ||||||
| 	if ((u8*)hdr < skb->head || (u8*)(hdr+1) > skb->tail) | 	if ((u8 *)hdr < skb->head || | ||||||
|  | 	    (skb->network_header + sizeof(*hdr)) > skb->tail) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
|  |  | ||||||
|  | @ -514,7 +514,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | ||||||
| 	u16 offset = sizeof(struct ipv6hdr); | 	u16 offset = sizeof(struct ipv6hdr); | ||||||
| 	struct ipv6_opt_hdr *exthdr = | 	struct ipv6_opt_hdr *exthdr = | ||||||
| 				(struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | 				(struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | ||||||
| 	unsigned int packet_len = skb->tail - skb_network_header(skb); | 	unsigned int packet_len = skb->tail - skb->network_header; | ||||||
| 	int found_rhdr = 0; | 	int found_rhdr = 0; | ||||||
| 	*nexthdr = &ipv6_hdr(skb)->nexthdr; | 	*nexthdr = &ipv6_hdr(skb)->nexthdr; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1423,7 +1423,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) | ||||||
| 
 | 
 | ||||||
| 	memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra)); | 	memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra)); | ||||||
| 
 | 
 | ||||||
| 	skb_set_transport_header(skb, skb->tail - skb->data); | 	skb_set_transport_header(skb, skb_tail_pointer(skb) - skb->data); | ||||||
| 	skb_put(skb, sizeof(*pmr)); | 	skb_put(skb, sizeof(*pmr)); | ||||||
| 	pmr = (struct mld2_report *)skb_transport_header(skb); | 	pmr = (struct mld2_report *)skb_transport_header(skb); | ||||||
| 	pmr->type = ICMPV6_MLD2_REPORT; | 	pmr->type = ICMPV6_MLD2_REPORT; | ||||||
|  | @ -1468,8 +1468,8 @@ static void mld_sendpack(struct sk_buff *skb) | ||||||
| 	int err; | 	int err; | ||||||
| 
 | 
 | ||||||
| 	IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); | 	IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); | ||||||
| 	payload_len = skb->tail - skb_network_header(skb) - sizeof(*pip6); | 	payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); | ||||||
| 	mldlen = skb->tail - skb_transport_header(skb); | 	mldlen = skb->tail - skb->transport_header; | ||||||
| 	pip6->payload_len = htons(payload_len); | 	pip6->payload_len = htons(payload_len); | ||||||
| 
 | 
 | ||||||
| 	pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, | 	pmr->csum = csum_ipv6_magic(&pip6->saddr, &pip6->daddr, mldlen, | ||||||
|  |  | ||||||
|  | @ -260,7 +260,7 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb, | ||||||
| 	struct ipv6_opt_hdr *exthdr = | 	struct ipv6_opt_hdr *exthdr = | ||||||
| 				   (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | 				   (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | ||||||
| 	const unsigned char *nh = skb_network_header(skb); | 	const unsigned char *nh = skb_network_header(skb); | ||||||
| 	unsigned int packet_len = skb->tail - nh; | 	unsigned int packet_len = skb->tail - skb->network_header; | ||||||
| 	int found_rhdr = 0; | 	int found_rhdr = 0; | ||||||
| 
 | 
 | ||||||
| 	*nexthdr = &ipv6_hdr(skb)->nexthdr; | 	*nexthdr = &ipv6_hdr(skb)->nexthdr; | ||||||
|  | @ -392,7 +392,7 @@ static int mip6_rthdr_offset(struct xfrm_state *x, struct sk_buff *skb, | ||||||
| 	struct ipv6_opt_hdr *exthdr = | 	struct ipv6_opt_hdr *exthdr = | ||||||
| 				   (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | 				   (struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1); | ||||||
| 	const unsigned char *nh = skb_network_header(skb); | 	const unsigned char *nh = skb_network_header(skb); | ||||||
| 	unsigned int packet_len = skb->tail - nh; | 	unsigned int packet_len = skb->tail - skb->network_header; | ||||||
| 	int found_rhdr = 0; | 	int found_rhdr = 0; | ||||||
| 
 | 
 | ||||||
| 	*nexthdr = &ipv6_hdr(skb)->nexthdr; | 	*nexthdr = &ipv6_hdr(skb)->nexthdr; | ||||||
|  |  | ||||||
|  | @ -492,7 +492,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | ||||||
| 	skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 	skb_reserve(skb, LL_RESERVED_SPACE(dev)); | ||||||
| 	ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); | 	ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); | ||||||
| 
 | 
 | ||||||
| 	skb_set_transport_header(skb, skb->tail - skb->data); | 	skb->transport_header = skb->tail; | ||||||
| 	skb_put(skb, len); | 	skb_put(skb, len); | ||||||
| 	msg = (struct nd_msg *)skb_transport_header(skb); | 	msg = (struct nd_msg *)skb_transport_header(skb); | ||||||
| 
 | 
 | ||||||
|  | @ -584,7 +584,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, | ||||||
| 	skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 	skb_reserve(skb, LL_RESERVED_SPACE(dev)); | ||||||
| 	ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); | 	ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); | ||||||
| 
 | 
 | ||||||
| 	skb_set_transport_header(skb, skb->tail - skb->data); | 	skb->transport_header = skb->tail; | ||||||
| 	skb_put(skb, len); | 	skb_put(skb, len); | ||||||
| 	msg = (struct nd_msg *)skb_transport_header(skb); | 	msg = (struct nd_msg *)skb_transport_header(skb); | ||||||
| 	msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION; | 	msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION; | ||||||
|  | @ -685,7 +685,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, | ||||||
| 	skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 	skb_reserve(skb, LL_RESERVED_SPACE(dev)); | ||||||
| 	ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); | 	ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); | ||||||
| 
 | 
 | ||||||
| 	skb_set_transport_header(skb, skb->tail - skb->data); | 	skb->transport_header = skb->tail; | ||||||
| 	skb_put(skb, len); | 	skb_put(skb, len); | ||||||
| 	hdr = icmp6_hdr(skb); | 	hdr = icmp6_hdr(skb); | ||||||
| 	hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; | 	hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; | ||||||
|  | @ -767,7 +767,8 @@ static void ndisc_recv_ns(struct sk_buff *skb) | ||||||
| 	struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 	struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | ||||||
| 	struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 	struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | ||||||
| 	u8 *lladdr = NULL; | 	u8 *lladdr = NULL; | ||||||
| 	u32 ndoptlen = skb->tail - msg->opt; | 	u32 ndoptlen = skb->tail - (skb->transport_header + | ||||||
|  | 				    offsetof(struct nd_msg, opt)); | ||||||
| 	struct ndisc_options ndopts; | 	struct ndisc_options ndopts; | ||||||
| 	struct net_device *dev = skb->dev; | 	struct net_device *dev = skb->dev; | ||||||
| 	struct inet6_ifaddr *ifp; | 	struct inet6_ifaddr *ifp; | ||||||
|  | @ -945,7 +946,8 @@ static void ndisc_recv_na(struct sk_buff *skb) | ||||||
| 	struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 	struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | ||||||
| 	struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 	struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | ||||||
| 	u8 *lladdr = NULL; | 	u8 *lladdr = NULL; | ||||||
| 	u32 ndoptlen = skb->tail - msg->opt; | 	u32 ndoptlen = skb->tail - (skb->transport_header + | ||||||
|  | 				    offsetof(struct nd_msg, opt)); | ||||||
| 	struct ndisc_options ndopts; | 	struct ndisc_options ndopts; | ||||||
| 	struct net_device *dev = skb->dev; | 	struct net_device *dev = skb->dev; | ||||||
| 	struct inet6_ifaddr *ifp; | 	struct inet6_ifaddr *ifp; | ||||||
|  | @ -1111,8 +1113,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | ||||||
| 
 | 
 | ||||||
| 	__u8 * opt = (__u8 *)(ra_msg + 1); | 	__u8 * opt = (__u8 *)(ra_msg + 1); | ||||||
| 
 | 
 | ||||||
| 	optlen = (skb->tail - skb_transport_header(skb)) - | 	optlen = (skb->tail - skb->transport_header) - sizeof(struct ra_msg); | ||||||
| 		  sizeof(struct ra_msg); |  | ||||||
| 
 | 
 | ||||||
| 	if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { | 	if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { | ||||||
| 		ND_PRINTK2(KERN_WARNING | 		ND_PRINTK2(KERN_WARNING | ||||||
|  | @ -1361,7 +1362,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	optlen = skb->tail - skb_transport_header(skb); | 	optlen = skb->tail - skb->transport_header; | ||||||
| 	optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | 	optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | ||||||
| 
 | 
 | ||||||
| 	if (optlen < 0) { | 	if (optlen < 0) { | ||||||
|  | @ -1522,7 +1523,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | ||||||
| 	ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr, | 	ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr, | ||||||
| 		   IPPROTO_ICMPV6, len); | 		   IPPROTO_ICMPV6, len); | ||||||
| 
 | 
 | ||||||
| 	skb_set_transport_header(buff, buff->tail - buff->data); | 	skb_set_transport_header(buff, skb_tail_pointer(buff) - buff->data); | ||||||
| 	skb_put(buff, len); | 	skb_put(buff, len); | ||||||
| 	icmph = icmp6_hdr(buff); | 	icmph = icmp6_hdr(buff); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -189,7 +189,7 @@ ipq_flush(int verdict) | ||||||
| static struct sk_buff * | static struct sk_buff * | ||||||
| ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | ||||||
| { | { | ||||||
| 	unsigned char *old_tail; | 	sk_buff_data_t old_tail; | ||||||
| 	size_t size = 0; | 	size_t size = 0; | ||||||
| 	size_t data_len = 0; | 	size_t data_len = 0; | ||||||
| 	struct sk_buff *skb; | 	struct sk_buff *skb; | ||||||
|  | @ -233,7 +233,7 @@ ipq_build_packet_message(struct ipq_queue_entry *entry, int *errp) | ||||||
| 	if (!skb) | 	if (!skb) | ||||||
| 		goto nlmsg_failure; | 		goto nlmsg_failure; | ||||||
| 
 | 
 | ||||||
| 	old_tail= skb->tail; | 	old_tail = skb->tail; | ||||||
| 	nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); | 	nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); | ||||||
| 	pmsg = NLMSG_DATA(nlh); | 	pmsg = NLMSG_DATA(nlh); | ||||||
| 	memset(pmsg, 0, sizeof(*pmsg)); | 	memset(pmsg, 0, sizeof(*pmsg)); | ||||||
|  |  | ||||||
|  | @ -1077,7 +1077,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | ||||||
| 			spin_lock_bh(&sk->sk_receive_queue.lock); | 			spin_lock_bh(&sk->sk_receive_queue.lock); | ||||||
| 			skb = skb_peek(&sk->sk_receive_queue); | 			skb = skb_peek(&sk->sk_receive_queue); | ||||||
| 			if (skb != NULL) | 			if (skb != NULL) | ||||||
| 				amount = skb->tail - skb_transport_header(skb); | 				amount = skb->tail - skb->transport_header; | ||||||
| 			spin_unlock_bh(&sk->sk_receive_queue.lock); | 			spin_unlock_bh(&sk->sk_receive_queue.lock); | ||||||
| 			return put_user(amount, (int __user *)arg); | 			return put_user(amount, (int __user *)arg); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -133,8 +133,8 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) | ||||||
| 	 * Inserting is a little bit tricky since we don't know how much | 	 * Inserting is a little bit tricky since we don't know how much | ||||||
| 	 * room we will need. But this should hopefully work OK | 	 * room we will need. But this should hopefully work OK | ||||||
| 	 */ | 	 */ | ||||||
| 	count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), | 	count = irda_param_insert(self, pi, skb_tail_pointer(skb), | ||||||
| 				  &ircomm_param_info); | 				  skb_tailroom(skb), &ircomm_param_info); | ||||||
| 	if (count < 0) { | 	if (count < 0) { | ||||||
| 		IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__); | 		IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__); | ||||||
| 		spin_unlock_irqrestore(&self->spinlock, flags); | 		spin_unlock_irqrestore(&self->spinlock, flags); | ||||||
|  |  | ||||||
|  | @ -1039,7 +1039,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Insert at end of sk-buffer */ | 	/* Insert at end of sk-buffer */ | ||||||
| 	frame = skb->tail; | 	frame = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	/* Make space for data */ | 	/* Make space for data */ | ||||||
| 	if (skb_tailroom(skb) < (param_len+value_len+3)) { | 	if (skb_tailroom(skb) < (param_len+value_len+3)) { | ||||||
|  |  | ||||||
|  | @ -469,49 +469,49 @@ int irlap_insert_qos_negotiation_params(struct irlap_cb *self, | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
| 	/* Insert data rate */ | 	/* Insert data rate */ | ||||||
| 	ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, | 	ret = irda_param_insert(self, PI_BAUD_RATE, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
| 	skb_put(skb, ret); | 	skb_put(skb, ret); | ||||||
| 
 | 
 | ||||||
| 	/* Insert max turnaround time */ | 	/* Insert max turnaround time */ | ||||||
| 	ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, | 	ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
| 	skb_put(skb, ret); | 	skb_put(skb, ret); | ||||||
| 
 | 
 | ||||||
| 	/* Insert data size */ | 	/* Insert data size */ | ||||||
| 	ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, | 	ret = irda_param_insert(self, PI_DATA_SIZE, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
| 	skb_put(skb, ret); | 	skb_put(skb, ret); | ||||||
| 
 | 
 | ||||||
| 	/* Insert window size */ | 	/* Insert window size */ | ||||||
| 	ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, | 	ret = irda_param_insert(self, PI_WINDOW_SIZE, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
| 	skb_put(skb, ret); | 	skb_put(skb, ret); | ||||||
| 
 | 
 | ||||||
| 	/* Insert additional BOFs */ | 	/* Insert additional BOFs */ | ||||||
| 	ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, | 	ret = irda_param_insert(self, PI_ADD_BOFS, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
| 	skb_put(skb, ret); | 	skb_put(skb, ret); | ||||||
| 
 | 
 | ||||||
| 	/* Insert minimum turnaround time */ | 	/* Insert minimum turnaround time */ | ||||||
| 	ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, | 	ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
| 	skb_put(skb, ret); | 	skb_put(skb, ret); | ||||||
| 
 | 
 | ||||||
| 	/* Insert link disconnect/threshold time */ | 	/* Insert link disconnect/threshold time */ | ||||||
| 	ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, | 	ret = irda_param_insert(self, PI_LINK_DISC, skb_tail_pointer(skb), | ||||||
| 				skb_tailroom(skb), &irlap_param_info); | 				skb_tailroom(skb), &irlap_param_info); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
|  | @ -268,9 +268,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	struct nfgenmsg *nfmsg; | 	struct nfgenmsg *nfmsg; | ||||||
| 	struct nfattr *nest_parms; | 	struct nfattr *nest_parms; | ||||||
| 	unsigned char *b; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 
 |  | ||||||
| 	b = skb->tail; |  | ||||||
| 
 | 
 | ||||||
| 	event |= NFNL_SUBSYS_CTNETLINK << 8; | 	event |= NFNL_SUBSYS_CTNETLINK << 8; | ||||||
| 	nlh    = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg)); | 	nlh    = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg)); | ||||||
|  | @ -303,7 +301,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | ||||||
| 	    ctnetlink_dump_use(skb, ct) < 0) | 	    ctnetlink_dump_use(skb, ct) < 0) | ||||||
| 		goto nfattr_failure; | 		goto nfattr_failure; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  | @ -322,7 +320,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, | ||||||
| 	struct nf_conn *ct = (struct nf_conn *)ptr; | 	struct nf_conn *ct = (struct nf_conn *)ptr; | ||||||
| 	struct sk_buff *skb; | 	struct sk_buff *skb; | ||||||
| 	unsigned int type; | 	unsigned int type; | ||||||
| 	unsigned char *b; | 	sk_buff_data_t b; | ||||||
| 	unsigned int flags = 0, group; | 	unsigned int flags = 0, group; | ||||||
| 
 | 
 | ||||||
| 	/* ignore our fake conntrack entry */ | 	/* ignore our fake conntrack entry */ | ||||||
|  | @ -1152,9 +1150,7 @@ ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | ||||||
| { | { | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	struct nfgenmsg *nfmsg; | 	struct nfgenmsg *nfmsg; | ||||||
| 	unsigned char *b; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 
 |  | ||||||
| 	b = skb->tail; |  | ||||||
| 
 | 
 | ||||||
| 	event |= NFNL_SUBSYS_CTNETLINK_EXP << 8; | 	event |= NFNL_SUBSYS_CTNETLINK_EXP << 8; | ||||||
| 	nlh    = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg)); | 	nlh    = NLMSG_PUT(skb, pid, seq, event, sizeof(struct nfgenmsg)); | ||||||
|  | @ -1168,7 +1164,7 @@ ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | ||||||
| 	if (ctnetlink_exp_dump_expect(skb, exp) < 0) | 	if (ctnetlink_exp_dump_expect(skb, exp) < 0) | ||||||
| 		goto nfattr_failure; | 		goto nfattr_failure; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  | @ -1186,7 +1182,7 @@ static int ctnetlink_expect_event(struct notifier_block *this, | ||||||
| 	struct nf_conntrack_expect *exp = (struct nf_conntrack_expect *)ptr; | 	struct nf_conntrack_expect *exp = (struct nf_conntrack_expect *)ptr; | ||||||
| 	struct sk_buff *skb; | 	struct sk_buff *skb; | ||||||
| 	unsigned int type; | 	unsigned int type; | ||||||
| 	unsigned char *b; | 	sk_buff_data_t b; | ||||||
| 	int flags = 0; | 	int flags = 0; | ||||||
| 
 | 
 | ||||||
| 	if (events & IPEXP_NEW) { | 	if (events & IPEXP_NEW) { | ||||||
|  |  | ||||||
|  | @ -409,15 +409,14 @@ __build_packet_message(struct nfulnl_instance *inst, | ||||||
| 			const struct nf_loginfo *li, | 			const struct nf_loginfo *li, | ||||||
| 			const char *prefix, unsigned int plen) | 			const char *prefix, unsigned int plen) | ||||||
| { | { | ||||||
| 	unsigned char *old_tail; |  | ||||||
| 	struct nfulnl_msg_packet_hdr pmsg; | 	struct nfulnl_msg_packet_hdr pmsg; | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	struct nfgenmsg *nfmsg; | 	struct nfgenmsg *nfmsg; | ||||||
| 	__be32 tmp_uint; | 	__be32 tmp_uint; | ||||||
|  | 	sk_buff_data_t old_tail = inst->skb->tail; | ||||||
| 
 | 
 | ||||||
| 	UDEBUG("entered\n"); | 	UDEBUG("entered\n"); | ||||||
| 
 | 
 | ||||||
| 	old_tail = inst->skb->tail; |  | ||||||
| 	nlh = NLMSG_PUT(inst->skb, 0, 0, | 	nlh = NLMSG_PUT(inst->skb, 0, 0, | ||||||
| 			NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, | 			NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, | ||||||
| 			sizeof(struct nfgenmsg)); | 			sizeof(struct nfgenmsg)); | ||||||
|  |  | ||||||
|  | @ -338,7 +338,7 @@ static struct sk_buff * | ||||||
| nfqnl_build_packet_message(struct nfqnl_instance *queue, | nfqnl_build_packet_message(struct nfqnl_instance *queue, | ||||||
| 			   struct nfqnl_queue_entry *entry, int *errp) | 			   struct nfqnl_queue_entry *entry, int *errp) | ||||||
| { | { | ||||||
| 	unsigned char *old_tail; | 	sk_buff_data_t old_tail; | ||||||
| 	size_t size; | 	size_t size; | ||||||
| 	size_t data_len = 0; | 	size_t data_len = 0; | ||||||
| 	struct sk_buff *skb; | 	struct sk_buff *skb; | ||||||
|  | @ -404,7 +404,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | ||||||
| 	if (!skb) | 	if (!skb) | ||||||
| 		goto nlmsg_failure; | 		goto nlmsg_failure; | ||||||
| 
 | 
 | ||||||
| 	old_tail= skb->tail; | 	old_tail = skb->tail; | ||||||
| 	nlh = NLMSG_PUT(skb, 0, 0, | 	nlh = NLMSG_PUT(skb, 0, 0, | ||||||
| 			NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, | 			NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, | ||||||
| 			sizeof(struct nfgenmsg)); | 			sizeof(struct nfgenmsg)); | ||||||
|  |  | ||||||
|  | @ -785,7 +785,7 @@ static inline struct sk_buff *netlink_trim(struct sk_buff *skb, | ||||||
| 
 | 
 | ||||||
| 	skb_orphan(skb); | 	skb_orphan(skb); | ||||||
| 
 | 
 | ||||||
| 	delta = skb->end - skb->tail; | 	delta = skb->end - skb_tail_pointer(skb); | ||||||
| 	if (delta * 2 < skb->truesize) | 	if (delta * 2 < skb->truesize) | ||||||
| 		return skb; | 		return skb; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -775,7 +775,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | ||||||
| 		err = -EINVAL; | 		err = -EINVAL; | ||||||
| 		res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len); | 		res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len); | ||||||
| 		if (sock->type != SOCK_DGRAM) { | 		if (sock->type != SOCK_DGRAM) { | ||||||
| 			skb->tail = skb->data; | 			skb_reset_tail_pointer(skb); | ||||||
| 			skb->len = 0; | 			skb->len = 0; | ||||||
| 		} else if (res < 0) | 		} else if (res < 0) | ||||||
| 			goto out_free; | 			goto out_free; | ||||||
|  |  | ||||||
|  | @ -93,7 +93,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | ||||||
| 				continue; | 				continue; | ||||||
| 			a->priv = p; | 			a->priv = p; | ||||||
| 			a->order = n_i; | 			a->order = n_i; | ||||||
| 			r = (struct rtattr*) skb->tail; | 			r = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 			RTA_PUT(skb, a->order, 0, NULL); | 			RTA_PUT(skb, a->order, 0, NULL); | ||||||
| 			err = tcf_action_dump_1(skb, a, 0, 0); | 			err = tcf_action_dump_1(skb, a, 0, 0); | ||||||
| 			if (err < 0) { | 			if (err < 0) { | ||||||
|  | @ -101,7 +101,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | ||||||
| 				skb_trim(skb, (u8*)r - skb->data); | 				skb_trim(skb, (u8*)r - skb->data); | ||||||
| 				goto done; | 				goto done; | ||||||
| 			} | 			} | ||||||
| 			r->rta_len = skb->tail - (u8*)r; | 			r->rta_len = skb_tail_pointer(skb) - (u8 *)r; | ||||||
| 			n_i++; | 			n_i++; | ||||||
| 			if (n_i >= TCA_ACT_MAX_PRIO) | 			if (n_i >= TCA_ACT_MAX_PRIO) | ||||||
| 				goto done; | 				goto done; | ||||||
|  | @ -125,7 +125,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | ||||||
| 	struct rtattr *r ; | 	struct rtattr *r ; | ||||||
| 	int i= 0, n_i = 0; | 	int i= 0, n_i = 0; | ||||||
| 
 | 
 | ||||||
| 	r = (struct rtattr*) skb->tail; | 	r = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, a->order, 0, NULL); | 	RTA_PUT(skb, a->order, 0, NULL); | ||||||
| 	RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | 	RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | ||||||
| 	for (i = 0; i < (hinfo->hmask + 1); i++) { | 	for (i = 0; i < (hinfo->hmask + 1); i++) { | ||||||
|  | @ -140,7 +140,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	RTA_PUT(skb, TCA_FCNT, 4, &n_i); | 	RTA_PUT(skb, TCA_FCNT, 4, &n_i); | ||||||
| 	r->rta_len = skb->tail - (u8*)r; | 	r->rta_len = skb_tail_pointer(skb) - (u8 *)r; | ||||||
| 
 | 
 | ||||||
| 	return n_i; | 	return n_i; | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  | @ -423,7 +423,7 @@ int | ||||||
| tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||||||
| { | { | ||||||
| 	int err = -EINVAL; | 	int err = -EINVAL; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *r; | 	struct rtattr *r; | ||||||
| 
 | 
 | ||||||
| 	if (a->ops == NULL || a->ops->dump == NULL) | 	if (a->ops == NULL || a->ops->dump == NULL) | ||||||
|  | @ -432,10 +432,10 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||||||
| 	RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | 	RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | ||||||
| 	if (tcf_action_copy_stats(skb, a, 0)) | 	if (tcf_action_copy_stats(skb, a, 0)) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 	r = (struct rtattr*) skb->tail; | 	r = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | ||||||
| 	if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) { | 	if ((err = tcf_action_dump_old(skb, a, bind, ref)) > 0) { | ||||||
| 		r->rta_len = skb->tail - (u8*)r; | 		r->rta_len = skb_tail_pointer(skb) - (u8 *)r; | ||||||
| 		return err; | 		return err; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -449,17 +449,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action *act, int bind, int ref) | ||||||
| { | { | ||||||
| 	struct tc_action *a; | 	struct tc_action *a; | ||||||
| 	int err = -EINVAL; | 	int err = -EINVAL; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *r ; | 	struct rtattr *r ; | ||||||
| 
 | 
 | ||||||
| 	while ((a = act) != NULL) { | 	while ((a = act) != NULL) { | ||||||
| 		r = (struct rtattr*) skb->tail; | 		r = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 		act = a->next; | 		act = a->next; | ||||||
| 		RTA_PUT(skb, a->order, 0, NULL); | 		RTA_PUT(skb, a->order, 0, NULL); | ||||||
| 		err = tcf_action_dump_1(skb, a, bind, ref); | 		err = tcf_action_dump_1(skb, a, bind, ref); | ||||||
| 		if (err < 0) | 		if (err < 0) | ||||||
| 			goto errout; | 			goto errout; | ||||||
| 		r->rta_len = skb->tail - (u8*)r; | 		r->rta_len = skb_tail_pointer(skb) - (u8 *)r; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -635,7 +635,7 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, | ||||||
| { | { | ||||||
| 	struct tcamsg *t; | 	struct tcamsg *t; | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *x; | 	struct rtattr *x; | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | ||||||
|  | @ -645,15 +645,15 @@ tca_get_fill(struct sk_buff *skb, struct tc_action *a, u32 pid, u32 seq, | ||||||
| 	t->tca__pad1 = 0; | 	t->tca__pad1 = 0; | ||||||
| 	t->tca__pad2 = 0; | 	t->tca__pad2 = 0; | ||||||
| 
 | 
 | ||||||
| 	x = (struct rtattr*) skb->tail; | 	x = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 	if (tcf_action_dump(skb, a, bind, ref) < 0) | 	if (tcf_action_dump(skb, a, bind, ref) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	x->rta_len = skb->tail - (u8*)x; | 	x->rta_len = skb_tail_pointer(skb) - (u8 *)x; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  | @ -767,7 +767,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid) | ||||||
| 		return -ENOBUFS; | 		return -ENOBUFS; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	b = (unsigned char *)skb->tail; | 	b = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0) | 	if (rtattr_parse_nested(tb, TCA_ACT_MAX, rta) < 0) | ||||||
| 		goto err_out; | 		goto err_out; | ||||||
|  | @ -783,16 +783,16 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid) | ||||||
| 	t->tca__pad1 = 0; | 	t->tca__pad1 = 0; | ||||||
| 	t->tca__pad2 = 0; | 	t->tca__pad2 = 0; | ||||||
| 
 | 
 | ||||||
| 	x = (struct rtattr *) skb->tail; | 	x = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 	err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); | 	err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); | ||||||
| 	if (err < 0) | 	if (err < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	x->rta_len = skb->tail - (u8 *) x; | 	x->rta_len = skb_tail_pointer(skb) - (u8 *)x; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	nlh->nlmsg_flags |= NLM_F_ROOT; | 	nlh->nlmsg_flags |= NLM_F_ROOT; | ||||||
| 	module_put(a->ops->owner); | 	module_put(a->ops->owner); | ||||||
| 	kfree(a); | 	kfree(a); | ||||||
|  | @ -884,7 +884,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | ||||||
| 	if (!skb) | 	if (!skb) | ||||||
| 		return -ENOBUFS; | 		return -ENOBUFS; | ||||||
| 
 | 
 | ||||||
| 	b = (unsigned char *)skb->tail; | 	b = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*t), flags); | ||||||
| 	t = NLMSG_DATA(nlh); | 	t = NLMSG_DATA(nlh); | ||||||
|  | @ -892,15 +892,15 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | ||||||
| 	t->tca__pad1 = 0; | 	t->tca__pad1 = 0; | ||||||
| 	t->tca__pad2 = 0; | 	t->tca__pad2 = 0; | ||||||
| 
 | 
 | ||||||
| 	x = (struct rtattr*) skb->tail; | 	x = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 	if (tcf_action_dump(skb, a, 0, 0) < 0) | 	if (tcf_action_dump(skb, a, 0, 0) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	x->rta_len = skb->tail - (u8*)x; | 	x->rta_len = skb_tail_pointer(skb) - (u8 *)x; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	NETLINK_CB(skb).dst_group = RTNLGRP_TC; | 	NETLINK_CB(skb).dst_group = RTNLGRP_TC; | ||||||
| 
 | 
 | ||||||
| 	err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); | 	err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); | ||||||
|  | @ -1015,7 +1015,7 @@ static int | ||||||
| tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | ||||||
| { | { | ||||||
| 	struct nlmsghdr *nlh; | 	struct nlmsghdr *nlh; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *x; | 	struct rtattr *x; | ||||||
| 	struct tc_action_ops *a_o; | 	struct tc_action_ops *a_o; | ||||||
| 	struct tc_action a; | 	struct tc_action a; | ||||||
|  | @ -1048,7 +1048,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | ||||||
| 	t->tca__pad1 = 0; | 	t->tca__pad1 = 0; | ||||||
| 	t->tca__pad2 = 0; | 	t->tca__pad2 = 0; | ||||||
| 
 | 
 | ||||||
| 	x = (struct rtattr *) skb->tail; | 	x = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | 	RTA_PUT(skb, TCA_ACT_TAB, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 	ret = a_o->walk(skb, cb, RTM_GETACTION, &a); | 	ret = a_o->walk(skb, cb, RTM_GETACTION, &a); | ||||||
|  | @ -1056,12 +1056,12 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	if (ret > 0) { | 	if (ret > 0) { | ||||||
| 		x->rta_len = skb->tail - (u8 *) x; | 		x->rta_len = skb_tail_pointer(skb) - (u8 *)x; | ||||||
| 		ret = skb->len; | 		ret = skb->len; | ||||||
| 	} else | 	} else | ||||||
| 		skb_trim(skb, (u8*)x - skb->data); | 		skb_trim(skb, (u8*)x - skb->data); | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	if (NETLINK_CB(cb->skb).pid && ret) | 	if (NETLINK_CB(cb->skb).pid && ret) | ||||||
| 		nlh->nlmsg_flags |= NLM_F_MULTI; | 		nlh->nlmsg_flags |= NLM_F_MULTI; | ||||||
| 	module_put(a_o->owner); | 	module_put(a_o->owner); | ||||||
|  |  | ||||||
|  | @ -155,7 +155,7 @@ static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result | ||||||
| 
 | 
 | ||||||
| static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_gact opt; | 	struct tc_gact opt; | ||||||
| 	struct tcf_gact *gact = a->priv; | 	struct tcf_gact *gact = a->priv; | ||||||
| 	struct tcf_t t; | 	struct tcf_t t; | ||||||
|  |  | ||||||
|  | @ -245,7 +245,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, | ||||||
| 
 | 
 | ||||||
| static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tcf_ipt *ipt = a->priv; | 	struct tcf_ipt *ipt = a->priv; | ||||||
| 	struct ipt_entry_target *t; | 	struct ipt_entry_target *t; | ||||||
| 	struct tcf_t tm; | 	struct tcf_t tm; | ||||||
|  |  | ||||||
|  | @ -206,7 +206,7 @@ bad_mirred: | ||||||
| 
 | 
 | ||||||
| static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tcf_mirred *m = a->priv; | 	struct tcf_mirred *m = a->priv; | ||||||
| 	struct tc_mirred opt; | 	struct tc_mirred opt; | ||||||
| 	struct tcf_t t; | 	struct tcf_t t; | ||||||
|  |  | ||||||
|  | @ -195,7 +195,7 @@ done: | ||||||
| static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, | static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a, | ||||||
| 			  int bind, int ref) | 			  int bind, int ref) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tcf_pedit *p = a->priv; | 	struct tcf_pedit *p = a->priv; | ||||||
| 	struct tc_pedit *opt; | 	struct tc_pedit *opt; | ||||||
| 	struct tcf_t t; | 	struct tcf_t t; | ||||||
|  |  | ||||||
|  | @ -80,7 +80,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c | ||||||
| 				continue; | 				continue; | ||||||
| 			a->priv = p; | 			a->priv = p; | ||||||
| 			a->order = index; | 			a->order = index; | ||||||
| 			r = (struct rtattr*) skb->tail; | 			r = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 			RTA_PUT(skb, a->order, 0, NULL); | 			RTA_PUT(skb, a->order, 0, NULL); | ||||||
| 			if (type == RTM_DELACTION) | 			if (type == RTM_DELACTION) | ||||||
| 				err = tcf_action_dump_1(skb, a, 0, 1); | 				err = tcf_action_dump_1(skb, a, 0, 1); | ||||||
|  | @ -91,7 +91,7 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c | ||||||
| 				skb_trim(skb, (u8*)r - skb->data); | 				skb_trim(skb, (u8*)r - skb->data); | ||||||
| 				goto done; | 				goto done; | ||||||
| 			} | 			} | ||||||
| 			r->rta_len = skb->tail - (u8*)r; | 			r->rta_len = skb_tail_pointer(skb) - (u8 *)r; | ||||||
| 			n_i++; | 			n_i++; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | @ -326,7 +326,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, | ||||||
| static int | static int | ||||||
| tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tcf_police *police = a->priv; | 	struct tcf_police *police = a->priv; | ||||||
| 	struct tc_police opt; | 	struct tc_police opt; | ||||||
| 
 | 
 | ||||||
|  | @ -572,7 +572,7 @@ EXPORT_SYMBOL(tcf_police); | ||||||
| 
 | 
 | ||||||
| int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police) | int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_police opt; | 	struct tc_police opt; | ||||||
| 
 | 
 | ||||||
| 	opt.index = police->tcf_index; | 	opt.index = police->tcf_index; | ||||||
|  |  | ||||||
|  | @ -155,7 +155,7 @@ static inline int tcf_simp_cleanup(struct tc_action *a, int bind) | ||||||
| static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, | static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, | ||||||
| 				int bind, int ref) | 				int bind, int ref) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tcf_defact *d = a->priv; | 	struct tcf_defact *d = a->priv; | ||||||
| 	struct tc_defact opt; | 	struct tc_defact opt; | ||||||
| 	struct tcf_t t; | 	struct tcf_t t; | ||||||
|  |  | ||||||
|  | @ -323,7 +323,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh, | ||||||
| { | { | ||||||
| 	struct tcmsg *tcm; | 	struct tcmsg *tcm; | ||||||
| 	struct nlmsghdr  *nlh; | 	struct nlmsghdr  *nlh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | ||||||
| 	tcm = NLMSG_DATA(nlh); | 	tcm = NLMSG_DATA(nlh); | ||||||
|  | @ -340,7 +340,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh, | ||||||
| 		if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0) | 		if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0) | ||||||
| 			goto rtattr_failure; | 			goto rtattr_failure; | ||||||
| 	} | 	} | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  | @ -563,30 +563,30 @@ tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, | ||||||
| 		 * to work with both old and new modes of entering | 		 * to work with both old and new modes of entering | ||||||
| 		 * tc data even if iproute2  was newer - jhs | 		 * tc data even if iproute2  was newer - jhs | ||||||
| 		 */ | 		 */ | ||||||
| 		struct rtattr * p_rta = (struct rtattr*) skb->tail; | 		struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 		if (exts->action->type != TCA_OLD_COMPAT) { | 		if (exts->action->type != TCA_OLD_COMPAT) { | ||||||
| 			RTA_PUT(skb, map->action, 0, NULL); | 			RTA_PUT(skb, map->action, 0, NULL); | ||||||
| 			if (tcf_action_dump(skb, exts->action, 0, 0) < 0) | 			if (tcf_action_dump(skb, exts->action, 0, 0) < 0) | ||||||
| 				goto rtattr_failure; | 				goto rtattr_failure; | ||||||
| 			p_rta->rta_len = skb->tail - (u8*)p_rta; | 			p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta; | ||||||
| 		} else if (map->police) { | 		} else if (map->police) { | ||||||
| 			RTA_PUT(skb, map->police, 0, NULL); | 			RTA_PUT(skb, map->police, 0, NULL); | ||||||
| 			if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0) | 			if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0) | ||||||
| 				goto rtattr_failure; | 				goto rtattr_failure; | ||||||
| 			p_rta->rta_len = skb->tail - (u8*)p_rta; | 			p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| #elif defined CONFIG_NET_CLS_POLICE | #elif defined CONFIG_NET_CLS_POLICE | ||||||
| 	if (map->police && exts->police) { | 	if (map->police && exts->police) { | ||||||
| 		struct rtattr * p_rta = (struct rtattr*) skb->tail; | 		struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 		RTA_PUT(skb, map->police, 0, NULL); | 		RTA_PUT(skb, map->police, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 		if (tcf_police_dump(skb, exts->police) < 0) | 		if (tcf_police_dump(skb, exts->police) < 0) | ||||||
| 			goto rtattr_failure; | 			goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 		p_rta->rta_len = skb->tail - (u8*)p_rta; | 		p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta; | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 	return 0; | 	return 0; | ||||||
|  |  | ||||||
|  | @ -245,7 +245,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 		      struct sk_buff *skb, struct tcmsg *t) | 		      struct sk_buff *skb, struct tcmsg *t) | ||||||
| { | { | ||||||
| 	struct basic_filter *f = (struct basic_filter *) fh; | 	struct basic_filter *f = (struct basic_filter *) fh; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	if (f == NULL) | 	if (f == NULL) | ||||||
|  | @ -263,7 +263,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 	    tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) | 	    tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	rta->rta_len = (skb->tail - b); | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  |  | ||||||
|  | @ -348,7 +348,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| { | { | ||||||
| 	struct fw_head *head = (struct fw_head *)tp->root; | 	struct fw_head *head = (struct fw_head *)tp->root; | ||||||
| 	struct fw_filter *f = (struct fw_filter*)fh; | 	struct fw_filter *f = (struct fw_filter*)fh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	if (f == NULL) | 	if (f == NULL) | ||||||
|  | @ -374,7 +374,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 	if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) | 	if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 
 | 
 | ||||||
| 	if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0) | 	if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
|  |  | ||||||
|  | @ -562,7 +562,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 		       struct sk_buff *skb, struct tcmsg *t) | 		       struct sk_buff *skb, struct tcmsg *t) | ||||||
| { | { | ||||||
| 	struct route4_filter *f = (struct route4_filter*)fh; | 	struct route4_filter *f = (struct route4_filter*)fh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 	u32 id; | 	u32 id; | ||||||
| 
 | 
 | ||||||
|  | @ -591,7 +591,7 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 	if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) | 	if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 
 | 
 | ||||||
| 	if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) | 	if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
|  |  | ||||||
|  | @ -593,7 +593,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| { | { | ||||||
| 	struct rsvp_filter *f = (struct rsvp_filter*)fh; | 	struct rsvp_filter *f = (struct rsvp_filter*)fh; | ||||||
| 	struct rsvp_session *s; | 	struct rsvp_session *s; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 	struct tc_rsvp_pinfo pinfo; | 	struct tc_rsvp_pinfo pinfo; | ||||||
| 
 | 
 | ||||||
|  | @ -623,7 +623,7 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 	if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) | 	if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 
 | 
 | ||||||
| 	if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0) | 	if (tcf_exts_dump_stats(skb, &f->exts, &rsvp_ext_map) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
|  |  | ||||||
|  | @ -448,7 +448,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| { | { | ||||||
| 	struct tcindex_data *p = PRIV(tp); | 	struct tcindex_data *p = PRIV(tp); | ||||||
| 	struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; | 	struct tcindex_filter_result *r = (struct tcindex_filter_result *) fh; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", | 	DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", | ||||||
|  | @ -463,7 +463,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 		RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift); | 		RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift); | ||||||
| 		RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through), | 		RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through), | ||||||
| 		    &p->fall_through); | 		    &p->fall_through); | ||||||
| 		rta->rta_len = skb->tail-b; | 		rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	} else { | 	} else { | ||||||
| 		if (p->perfect) { | 		if (p->perfect) { | ||||||
| 			t->tcm_handle = r-p->perfect; | 			t->tcm_handle = r-p->perfect; | ||||||
|  | @ -486,7 +486,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 
 | 
 | ||||||
| 		if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | 		if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0) | ||||||
| 			goto rtattr_failure; | 			goto rtattr_failure; | ||||||
| 		rta->rta_len = skb->tail-b; | 		rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 
 | 
 | ||||||
| 		if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) | 		if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0) | ||||||
| 			goto rtattr_failure; | 			goto rtattr_failure; | ||||||
|  |  | ||||||
|  | @ -213,7 +213,7 @@ check_terminal: | ||||||
| 			off2 = 0; | 			off2 = 0; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (ptr < skb->tail) | 		if (ptr < skb_tail_pointer(skb)) | ||||||
| 			goto next_ht; | 			goto next_ht; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -718,7 +718,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| 		     struct sk_buff *skb, struct tcmsg *t) | 		     struct sk_buff *skb, struct tcmsg *t) | ||||||
| { | { | ||||||
| 	struct tc_u_knode *n = (struct tc_u_knode*)fh; | 	struct tc_u_knode *n = (struct tc_u_knode*)fh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	if (n == NULL) | 	if (n == NULL) | ||||||
|  | @ -765,7 +765,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh, | ||||||
| #endif | #endif | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	if (TC_U32_KEY(n->handle)) | 	if (TC_U32_KEY(n->handle)) | ||||||
| 		if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) | 		if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0) | ||||||
| 			goto rtattr_failure; | 			goto rtattr_failure; | ||||||
|  |  | ||||||
|  | @ -418,17 +418,19 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) | ||||||
| int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	struct rtattr * top_start = (struct rtattr*) skb->tail; | 	u8 *tail; | ||||||
| 	struct rtattr * list_start; | 	struct rtattr *top_start = (struct rtattr *)skb_tail_pointer(skb); | ||||||
|  | 	struct rtattr *list_start; | ||||||
| 
 | 
 | ||||||
| 	RTA_PUT(skb, tlv, 0, NULL); | 	RTA_PUT(skb, tlv, 0, NULL); | ||||||
| 	RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); | 	RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); | ||||||
| 
 | 
 | ||||||
| 	list_start = (struct rtattr *) skb->tail; | 	list_start = (struct rtattr *)skb_tail_pointer(skb); | ||||||
| 	RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); | 	RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); | ||||||
| 
 | 
 | ||||||
|  | 	tail = skb_tail_pointer(skb); | ||||||
| 	for (i = 0; i < tree->hdr.nmatches; i++) { | 	for (i = 0; i < tree->hdr.nmatches; i++) { | ||||||
| 		struct rtattr *match_start = (struct rtattr*) skb->tail; | 		struct rtattr *match_start = (struct rtattr *)tail; | ||||||
| 		struct tcf_ematch *em = tcf_em_get_match(tree, i); | 		struct tcf_ematch *em = tcf_em_get_match(tree, i); | ||||||
| 		struct tcf_ematch_hdr em_hdr = { | 		struct tcf_ematch_hdr em_hdr = { | ||||||
| 			.kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER, | 			.kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER, | ||||||
|  | @ -447,11 +449,12 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) | ||||||
| 		} else if (em->datalen > 0) | 		} else if (em->datalen > 0) | ||||||
| 			RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); | 			RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); | ||||||
| 
 | 
 | ||||||
| 		match_start->rta_len = skb->tail - (u8*) match_start; | 		tail = skb_tail_pointer(skb); | ||||||
|  | 		match_start->rta_len = tail - (u8 *)match_start; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	list_start->rta_len = skb->tail - (u8 *) list_start; | 	list_start->rta_len = tail - (u8 *)list_start; | ||||||
| 	top_start->rta_len = skb->tail - (u8 *) top_start; | 	top_start->rta_len = tail - (u8 *)top_start; | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -813,7 +813,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | ||||||
| { | { | ||||||
| 	struct tcmsg *tcm; | 	struct tcmsg *tcm; | ||||||
| 	struct nlmsghdr  *nlh; | 	struct nlmsghdr  *nlh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct gnet_dump d; | 	struct gnet_dump d; | ||||||
| 
 | 
 | ||||||
| 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 	nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | ||||||
|  | @ -847,7 +847,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | ||||||
| 	if (gnet_stats_finish_copy(&d) < 0) | 	if (gnet_stats_finish_copy(&d) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  | @ -1051,7 +1051,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | ||||||
| { | { | ||||||
| 	struct tcmsg *tcm; | 	struct tcmsg *tcm; | ||||||
| 	struct nlmsghdr  *nlh; | 	struct nlmsghdr  *nlh; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct gnet_dump d; | 	struct gnet_dump d; | ||||||
| 	struct Qdisc_class_ops *cl_ops = q->ops->cl_ops; | 	struct Qdisc_class_ops *cl_ops = q->ops->cl_ops; | ||||||
| 
 | 
 | ||||||
|  | @ -1076,7 +1076,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | ||||||
| 	if (gnet_stats_finish_copy(&d) < 0) | 	if (gnet_stats_finish_copy(&d) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 
 | 
 | ||||||
| 	nlh->nlmsg_len = skb->tail - b; | 	nlh->nlmsg_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| nlmsg_failure: | nlmsg_failure: | ||||||
|  |  | ||||||
|  | @ -631,7 +631,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | ||||||
| { | { | ||||||
| 	struct atm_qdisc_data *p = PRIV(sch); | 	struct atm_qdisc_data *p = PRIV(sch); | ||||||
| 	struct atm_flow_data *flow = (struct atm_flow_data *) cl; | 	struct atm_flow_data *flow = (struct atm_flow_data *) cl; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", | 	DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", | ||||||
|  | @ -661,7 +661,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | ||||||
| 
 | 
 | ||||||
| 		RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero); | 		RTA_PUT(skb,TCA_ATM_EXCESS,sizeof(zero),&zero); | ||||||
| 	} | 	} | ||||||
| 	rta->rta_len = skb->tail-b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  |  | ||||||
|  | @ -1465,7 +1465,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt) | ||||||
| 
 | 
 | ||||||
| static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) | static __inline__ int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 
 | 
 | ||||||
| 	RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate); | 	RTA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate); | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
|  | @ -1477,7 +1477,7 @@ rtattr_failure: | ||||||
| 
 | 
 | ||||||
| static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) | static __inline__ int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_cbq_lssopt opt; | 	struct tc_cbq_lssopt opt; | ||||||
| 
 | 
 | ||||||
| 	opt.flags = 0; | 	opt.flags = 0; | ||||||
|  | @ -1502,7 +1502,7 @@ rtattr_failure: | ||||||
| 
 | 
 | ||||||
| static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) | static __inline__ int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_cbq_wrropt opt; | 	struct tc_cbq_wrropt opt; | ||||||
| 
 | 
 | ||||||
| 	opt.flags = 0; | 	opt.flags = 0; | ||||||
|  | @ -1520,7 +1520,7 @@ rtattr_failure: | ||||||
| 
 | 
 | ||||||
| static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) | static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_cbq_ovl opt; | 	struct tc_cbq_ovl opt; | ||||||
| 
 | 
 | ||||||
| 	opt.strategy = cl->ovl_strategy; | 	opt.strategy = cl->ovl_strategy; | ||||||
|  | @ -1537,7 +1537,7 @@ rtattr_failure: | ||||||
| 
 | 
 | ||||||
| static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) | static __inline__ int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_cbq_fopt opt; | 	struct tc_cbq_fopt opt; | ||||||
| 
 | 
 | ||||||
| 	if (cl->split || cl->defmap) { | 	if (cl->split || cl->defmap) { | ||||||
|  | @ -1556,7 +1556,7 @@ rtattr_failure: | ||||||
| #ifdef CONFIG_NET_CLS_POLICE | #ifdef CONFIG_NET_CLS_POLICE | ||||||
| static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) | static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| { | { | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_cbq_police opt; | 	struct tc_cbq_police opt; | ||||||
| 
 | 
 | ||||||
| 	if (cl->police) { | 	if (cl->police) { | ||||||
|  | @ -1590,14 +1590,14 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl) | ||||||
| static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) | static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	struct cbq_sched_data *q = qdisc_priv(sch); | 	struct cbq_sched_data *q = qdisc_priv(sch); | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	rta = (struct rtattr*)b; | 	rta = (struct rtattr*)b; | ||||||
| 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | ||||||
| 	if (cbq_dump_attr(skb, &q->link) < 0) | 	if (cbq_dump_attr(skb, &q->link) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  | @ -1619,7 +1619,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg, | ||||||
| 	       struct sk_buff *skb, struct tcmsg *tcm) | 	       struct sk_buff *skb, struct tcmsg *tcm) | ||||||
| { | { | ||||||
| 	struct cbq_class *cl = (struct cbq_class*)arg; | 	struct cbq_class *cl = (struct cbq_class*)arg; | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	if (cl->tparent) | 	if (cl->tparent) | ||||||
|  | @ -1633,7 +1633,7 @@ cbq_dump_class(struct Qdisc *sch, unsigned long arg, | ||||||
| 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | ||||||
| 	if (cbq_dump_attr(skb, cl) < 0) | 	if (cbq_dump_attr(skb, cl) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  |  | ||||||
|  | @ -1363,7 +1363,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, | ||||||
| 		struct tcmsg *tcm) | 		struct tcmsg *tcm) | ||||||
| { | { | ||||||
| 	struct hfsc_class *cl = (struct hfsc_class *)arg; | 	struct hfsc_class *cl = (struct hfsc_class *)arg; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta = (struct rtattr *)b; | 	struct rtattr *rta = (struct rtattr *)b; | ||||||
| 
 | 
 | ||||||
| 	tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT; | 	tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT; | ||||||
|  | @ -1374,7 +1374,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, | ||||||
| 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | ||||||
| 	if (hfsc_dump_curves(skb, cl) < 0) | 	if (hfsc_dump_curves(skb, cl) < 0) | ||||||
| 		goto rtattr_failure; | 		goto rtattr_failure; | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
|  rtattr_failure: |  rtattr_failure: | ||||||
|  | @ -1576,7 +1576,7 @@ static int | ||||||
| hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) | hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	struct hfsc_sched *q = qdisc_priv(sch); | 	struct hfsc_sched *q = qdisc_priv(sch); | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_hfsc_qopt qopt; | 	struct tc_hfsc_qopt qopt; | ||||||
| 
 | 
 | ||||||
| 	qopt.defcls = q->defcls; | 	qopt.defcls = q->defcls; | ||||||
|  |  | ||||||
|  | @ -1110,7 +1110,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt) | ||||||
| static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	struct htb_sched *q = qdisc_priv(sch); | 	struct htb_sched *q = qdisc_priv(sch); | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 	struct tc_htb_glob gopt; | 	struct tc_htb_glob gopt; | ||||||
| 	spin_lock_bh(&sch->dev->queue_lock); | 	spin_lock_bh(&sch->dev->queue_lock); | ||||||
|  | @ -1123,12 +1123,12 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| 	rta = (struct rtattr *)b; | 	rta = (struct rtattr *)b; | ||||||
| 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | ||||||
| 	RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt); | 	RTA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt); | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	spin_unlock_bh(&sch->dev->queue_lock); | 	spin_unlock_bh(&sch->dev->queue_lock); | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
| 	spin_unlock_bh(&sch->dev->queue_lock); | 	spin_unlock_bh(&sch->dev->queue_lock); | ||||||
| 	skb_trim(skb, skb->tail - skb->data); | 	skb_trim(skb, skb_tail_pointer(skb) - skb->data); | ||||||
| 	return -1; | 	return -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1136,7 +1136,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | ||||||
| 			  struct sk_buff *skb, struct tcmsg *tcm) | 			  struct sk_buff *skb, struct tcmsg *tcm) | ||||||
| { | { | ||||||
| 	struct htb_class *cl = (struct htb_class *)arg; | 	struct htb_class *cl = (struct htb_class *)arg; | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 	struct tc_htb_opt opt; | 	struct tc_htb_opt opt; | ||||||
| 
 | 
 | ||||||
|  | @ -1159,7 +1159,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | ||||||
| 	opt.prio = cl->un.leaf.prio; | 	opt.prio = cl->un.leaf.prio; | ||||||
| 	opt.level = cl->level; | 	opt.level = cl->level; | ||||||
| 	RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt); | 	RTA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt); | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	spin_unlock_bh(&sch->dev->queue_lock); | 	spin_unlock_bh(&sch->dev->queue_lock); | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  |  | ||||||
|  | @ -362,12 +362,12 @@ static void ingress_destroy(struct Qdisc *sch) | ||||||
| 
 | 
 | ||||||
| static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) | static int ingress_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	unsigned char *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta; | 	struct rtattr *rta; | ||||||
| 
 | 
 | ||||||
| 	rta = (struct rtattr *) b; | 	rta = (struct rtattr *) b; | ||||||
| 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL); | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
| rtattr_failure: | rtattr_failure: | ||||||
|  |  | ||||||
|  | @ -583,7 +583,7 @@ static void netem_destroy(struct Qdisc *sch) | ||||||
| static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) | static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	const struct netem_sched_data *q = qdisc_priv(sch); | 	const struct netem_sched_data *q = qdisc_priv(sch); | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct rtattr *rta = (struct rtattr *) b; | 	struct rtattr *rta = (struct rtattr *) b; | ||||||
| 	struct tc_netem_qopt qopt; | 	struct tc_netem_qopt qopt; | ||||||
| 	struct tc_netem_corr cor; | 	struct tc_netem_corr cor; | ||||||
|  | @ -611,7 +611,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| 	corrupt.correlation = q->corrupt_cor.rho; | 	corrupt.correlation = q->corrupt_cor.rho; | ||||||
| 	RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); | 	RTA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt); | ||||||
| 
 | 
 | ||||||
| 	rta->rta_len = skb->tail - b; | 	rta->rta_len = skb_tail_pointer(skb) - b; | ||||||
| 
 | 
 | ||||||
| 	return skb->len; | 	return skb->len; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -271,7 +271,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt) | ||||||
| static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) | static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) | ||||||
| { | { | ||||||
| 	struct prio_sched_data *q = qdisc_priv(sch); | 	struct prio_sched_data *q = qdisc_priv(sch); | ||||||
| 	unsigned char	 *b = skb->tail; | 	unsigned char *b = skb_tail_pointer(skb); | ||||||
| 	struct tc_prio_qopt opt; | 	struct tc_prio_qopt opt; | ||||||
| 
 | 
 | ||||||
| 	opt.bands = q->bands; | 	opt.bands = q->bands; | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Arnaldo Carvalho de Melo
				Arnaldo Carvalho de Melo