Skip to content

Commit

Permalink
Merge "Remove Pcap header in mirrored packet" into R3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Sep 2, 2016
2 parents 7027d01 + f1a2c21 commit 24d26ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
22 changes: 0 additions & 22 deletions dp-core/vr_mirror.c
Expand Up @@ -350,11 +350,9 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id, struct vr_packet *pkt,
{
bool reset = true;
unsigned int captured_len, clone_len = 0, mirror_md_len = 0;
unsigned long sec, usec;
void *mirror_md;
unsigned char *buf;
struct vr_nexthop *nh, *pkt_nh;
struct vr_pcap *pcap;
struct vr_mirror_entry *mirror;
struct vr_mirror_meta_entry *mme;
unsigned char default_mme[2] = {0xff, 0x0};
Expand Down Expand Up @@ -397,8 +395,6 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id, struct vr_packet *pkt,

if (mirror->mir_flags & VR_MIRROR_FLAG_DYNAMIC) {

clone_len += sizeof(struct vr_pcap);

if (mtype == MIRROR_TYPE_ACL) {
if (fmd->fmd_flow_index >= 0) {
mme = vr_mirror_meta_entry_get(router, fmd->fmd_flow_index);
Expand Down Expand Up @@ -449,7 +445,6 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id, struct vr_packet *pkt,

clone_len += pkt_nh->nh_encap_len;


if (vr_pcow(pkt, clone_len))
goto fail;
clone_len = 0;
Expand All @@ -471,27 +466,10 @@ vr_mirror(struct vrouter *router, uint8_t mirror_id, struct vr_packet *pkt,

captured_len = htonl(pkt_len(pkt));
if (mirror_md_len) {

buf = pkt_push(pkt, mirror_md_len);
if (!buf)
goto fail;
memcpy(buf, mirror_md, mirror_md_len);

/* Add the pcap header */
pcap = (struct vr_pcap *)pkt_push(pkt, sizeof(struct vr_pcap));
if (!pcap)
goto fail;

pcap->pcap_incl_len = captured_len;
pcap->pcap_orig_len = captured_len;

vr_get_time(&sec, &usec);

pcap->pcap_ts_sec = sec;
pcap->pcap_ts_usec = usec;

pcap->pcap_ts_sec = htonl(pcap->pcap_ts_sec);
pcap->pcap_ts_usec = htonl(pcap->pcap_ts_usec);
}

if (nh->nh_vrf >= 0)
Expand Down
3 changes: 1 addition & 2 deletions include/vr_mirror.h
Expand Up @@ -22,8 +22,7 @@ typedef enum {

/* Mirror packet can be either MPLSoGre or MPLSoUDP. Lets calculate the
* highest for head space */
#define VR_MIRROR_PKT_HEAD_SPACE (sizeof(struct vr_pcap) + \
sizeof(struct vr_udp) + sizeof(struct vr_ip6) + \
#define VR_MIRROR_PKT_HEAD_SPACE (sizeof(struct vr_udp) + sizeof(struct vr_ip6) + \
VR_MPLS_HDR_LEN + sizeof(struct vr_udp) + sizeof(struct vr_ip) + \
VR_ETHER_HLEN)

Expand Down

0 comments on commit 24d26ed

Please sign in to comment.