packet: fill the gap of TPACKET_ALIGNMENT with zeros
struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT.
Explicitly defining and zeroing the gap of this makes additional changes
easier.
Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
	
	
This commit is contained in:
		
					parent
					
						
							
								51846355bc
							
						
					
				
			
			
				commit
				
					
						e4d26f4b08
					
				
			
		
					 2 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -133,7 +133,7 @@ struct tpacket2_hdr {
 | 
				
			||||||
	__u32		tp_sec;
 | 
						__u32		tp_sec;
 | 
				
			||||||
	__u32		tp_nsec;
 | 
						__u32		tp_nsec;
 | 
				
			||||||
	__u16		tp_vlan_tci;
 | 
						__u16		tp_vlan_tci;
 | 
				
			||||||
	__u16		tp_padding;
 | 
						__u8		tp_padding[6];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct tpacket_hdr_variant1 {
 | 
					struct tpacket_hdr_variant1 {
 | 
				
			||||||
| 
						 | 
					@ -154,6 +154,7 @@ struct tpacket3_hdr {
 | 
				
			||||||
	union {
 | 
						union {
 | 
				
			||||||
		struct tpacket_hdr_variant1 hv1;
 | 
							struct tpacket_hdr_variant1 hv1;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
						__u8		tp_padding[12];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct tpacket_bd_ts {
 | 
					struct tpacket_bd_ts {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1929,7 +1929,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			h.h2->tp_vlan_tci = 0;
 | 
								h.h2->tp_vlan_tci = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		h.h2->tp_padding = 0;
 | 
							memset(h.h2->tp_padding, 0, sizeof(h.h2->tp_padding));
 | 
				
			||||||
		hdrlen = sizeof(*h.h2);
 | 
							hdrlen = sizeof(*h.h2);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case TPACKET_V3:
 | 
						case TPACKET_V3:
 | 
				
			||||||
| 
						 | 
					@ -1943,6 +1943,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
 | 
				
			||||||
		h.h3->tp_net = netoff;
 | 
							h.h3->tp_net = netoff;
 | 
				
			||||||
		h.h3->tp_sec  = ts.tv_sec;
 | 
							h.h3->tp_sec  = ts.tv_sec;
 | 
				
			||||||
		h.h3->tp_nsec = ts.tv_nsec;
 | 
							h.h3->tp_nsec = ts.tv_nsec;
 | 
				
			||||||
 | 
							memset(h.h3->tp_padding, 0, sizeof(h.h3->tp_padding));
 | 
				
			||||||
		hdrlen = sizeof(*h.h3);
 | 
							hdrlen = sizeof(*h.h3);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue