Skip to content

Commit

Permalink
Remove Pcap header in mirrored packet
Browse files Browse the repository at this point in the history
Currently while mirroring the packet, in addition to Mirroring metadata,
even pcap header is inserted by Vrouter. This pcap header is added
immediately after UDP header in Dynamic mirroring. Wireshark is not
decoding this pcap header as such.

Hence this pcap header is removed as part of additional headers added by
mirroring

Change-Id: Icd5e8da30c685665cadfe7907f030c7c580f742a
closes-bug: #1619271
  • Loading branch information
divakardhar committed Sep 2, 2016
1 parent 7aaadbd commit f1a2c21
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 f1a2c21

Please sign in to comment.