net/colo.c: Add vnet packet parse feature in colo-proxy
Make colo-compare and filter-rewriter can parse vnet packet. Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
		
							parent
							
								
									aa3a7032f7
								
							
						
					
					
						commit
						5cc444d367
					
				@ -43,11 +43,11 @@ int parse_packet_early(Packet *pkt)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    int network_length;
 | 
					    int network_length;
 | 
				
			||||||
    static const uint8_t vlan[] = {0x81, 0x00};
 | 
					    static const uint8_t vlan[] = {0x81, 0x00};
 | 
				
			||||||
    uint8_t *data = pkt->data;
 | 
					    uint8_t *data = pkt->data + pkt->vnet_hdr_len;
 | 
				
			||||||
    uint16_t l3_proto;
 | 
					    uint16_t l3_proto;
 | 
				
			||||||
    ssize_t l2hdr_len = eth_get_l2_hdr_length(data);
 | 
					    ssize_t l2hdr_len = eth_get_l2_hdr_length(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pkt->size < ETH_HLEN) {
 | 
					    if (pkt->size < ETH_HLEN + pkt->vnet_hdr_len) {
 | 
				
			||||||
        trace_colo_proxy_main("pkt->size < ETH_HLEN");
 | 
					        trace_colo_proxy_main("pkt->size < ETH_HLEN");
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -73,7 +73,7 @@ int parse_packet_early(Packet *pkt)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    network_length = pkt->ip->ip_hl * 4;
 | 
					    network_length = pkt->ip->ip_hl * 4;
 | 
				
			||||||
    if (pkt->size < l2hdr_len + network_length) {
 | 
					    if (pkt->size < l2hdr_len + network_length + pkt->vnet_hdr_len) {
 | 
				
			||||||
        trace_colo_proxy_main("pkt->size < network_header + network_length");
 | 
					        trace_colo_proxy_main("pkt->size < network_header + network_length");
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user