diff options
author | Anand B Jyoti <anand.b.jyoti@intel.com> | 2017-10-04 10:15:40 +0530 |
---|---|---|
committer | Anand B Jyoti <anand.b.jyoti@intel.com> | 2017-10-05 07:23:14 +0530 |
commit | 2e53911bb32745221fdc077d06237abc44ad9962 (patch) | |
tree | e9accecdae16f114058776eaeed7a1346dd3ca85 /VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c | |
parent | 58c7eb1100e51176c20e5d57250cb46ed7020fa3 (diff) |
VNFs: Fixing klocwork issue in VNFs code
JIRA: SAMPLEVNF-83
This patch fixes the klocwork reported issues
Change-Id: I190d024777be1bf53cdc97feca1e5934781f3582
Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>
Diffstat (limited to 'VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c')
-rw-r--r-- | VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c b/VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c index 7758c5b3..a1779aa0 100644 --- a/VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c +++ b/VNFs/vCGNAPT/pipeline/pipeline_cgnapt_be.c @@ -2235,7 +2235,7 @@ static int cgnapt_in_port_ah_mix(struct rte_pipeline *rte_p, *outport_id = p_nat->outport_id[dest_if]; ret_arp_data = get_dest_mac_addr_ipv4(nhip, - dest_if, (struct ether_addr *)eth_dest); + dest_if, (struct ether_addr *)&hw_addr); if (unlikely(ret_arp_data == NULL)) { @@ -3695,6 +3695,12 @@ pkt_work_cgnapt_ipv4_prv( src_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, src_port_offset); dst_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, dst_port_offset); break; + default: /* KW fix: unknown is treated as TCP/UDP */ + src_port_offset = SRC_PRT_OFST_IP4_TCP; + dst_port_offset = DST_PRT_OFST_IP4_TCP; + src_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, src_port_offset); + dst_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, dst_port_offset); + break; } uint8_t *eth_dest = RTE_MBUF_METADATA_UINT8_PTR(pkt, MBUF_HDR_ROOM); @@ -4481,6 +4487,14 @@ pkt4_work_cgnapt_ipv4_prv( dst_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, dst_port_offset); break; + default: /* KW fix: unknown is treated as TCP/UDP */ + src_port_offset = SRC_PRT_OFST_IP4_TCP; + dst_port_offset = DST_PRT_OFST_IP4_TCP; + src_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, + src_port_offset); + dst_port = RTE_MBUF_METADATA_UINT16_PTR(pkt, + dst_port_offset); + break; } @@ -8107,7 +8121,7 @@ static void *pipeline_cgnapt_init(struct pipeline_params *params, void *arg) all_pipeline_cgnapt[n_cgnapt_pipeline++] = p_nat; - strcpy(p->name, params->name); + strncpy(p->name, params->name,PIPELINE_NAME_SIZE); p->log_level = params->log_level; PLOG(p, HIGH, "CG-NAPT"); @@ -10502,7 +10516,7 @@ void all_cgnapt_stats(char *buf) len += sprintf(buf + len, "egress %" PRIu64 "\n", p_nat->enaptedPktCount); len += sprintf(buf + len, "arpicmp pkts %" PRIu64 "\n", p_nat->arpicmpPktCount); - printf("\nCG-NAPT Packet Stats:\n"); + printf("\nCG-NAPT Packet Stats:\n"); printf("pipeline %d stats:\n", p_nat->pipeline_num); printf("Received %" PRIu64 ",", p_nat->receivedPktCount); printf("Missed %" PRIu64 ",", p_nat->missedPktCount); @@ -10557,7 +10571,7 @@ void all_cgnapt_stats(char *buf) len += sprintf(buf + len, "egress %" PRIu64 "\n", enaptedPktCount); len += sprintf(buf + len, "arpicmp pkts %" PRIu64 "\n", arpicmpPktCount); - printf("\nTotal pipeline stats:\n"); + printf("\nTotal pipeline stats:\n"); printf("Received %" PRIu64 ",", receivedPktCount); printf("Missed %" PRIu64 ",", missedPktCount); printf("Dropped %" PRIu64 ",", naptDroppedPktCount); |