summaryrefslogtreecommitdiffstats
path: root/common/vnf_common/vnf_common.c
diff options
context:
space:
mode:
authorAnand B Jyoti <anand.b.jyoti@intel.com>2017-07-28 13:11:19 +0530
committerAnand B Jyoti <anand.b.jyoti@intel.com>2017-09-27 03:29:26 +0530
commit3ec896179c547d54a18b40494a2871d7e328c0bf (patch)
treea7a0fcba876cbad15a1c75fc48b3a33855ddddab /common/vnf_common/vnf_common.c
parent88180c786ad5a7f983e5868376b0db167fffc13c (diff)
common: Changes to common code for gateway support
JIRA: SAMPLEVNF-58 Common code changes for gateway packet forwarding. Change-Id: Ie002c94b8febab9c0923e1bb261e5ea931cd4712 Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>
Diffstat (limited to 'common/vnf_common/vnf_common.c')
-rw-r--r--common/vnf_common/vnf_common.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/common/vnf_common/vnf_common.c b/common/vnf_common/vnf_common.c
index 97f90210..93687fd6 100644
--- a/common/vnf_common/vnf_common.c
+++ b/common/vnf_common/vnf_common.c
@@ -17,6 +17,7 @@
#include <stdint.h>
#include <stdio.h>
#include "vnf_common.h"
+#include "gateway.h"
#include "pipeline_arpicmp_be.h"
#ifndef VNF_ACL
#include "lib_arp.h"
@@ -47,13 +48,12 @@ uint8_t is_port_index_privte(uint16_t phy_port)
uint32_t get_prv_to_pub_port(uint32_t *ip_addr, uint8_t type)
{
uint32_t dest_if = 0xff;
- struct ether_addr addr;
switch (type) {
case 4:
{
uint32_t nhip;
- nhip = get_nh(ip_addr[0], &dest_if, &addr);
+ gw_get_nh_port_ipv4(*ip_addr, &dest_if, &nhip);
if (nhip)
return dest_if;
@@ -63,7 +63,8 @@ uint32_t get_prv_to_pub_port(uint32_t *ip_addr, uint8_t type)
case 6:
{
uint8_t nhipv6[16];
- get_nh_ipv6((uint8_t *)ip_addr, &dest_if, &nhipv6[0], &addr);
+ gw_get_nh_port_ipv6((uint8_t *)ip_addr, &dest_if, nhipv6);
+
if (dest_if != 0xff)
return dest_if;
return 0xff;
@@ -76,13 +77,13 @@ uint32_t get_prv_to_pub_port(uint32_t *ip_addr, uint8_t type)
uint32_t get_pub_to_prv_port(uint32_t *ip_addr, uint8_t type)
{
uint32_t dest_if = 0xff;
- struct ether_addr addr;
switch (type) {
case 4:
{
uint32_t nhip;
- nhip = get_nh(ip_addr[0], &dest_if, &addr);
+
+ gw_get_nh_port_ipv4(*ip_addr, &dest_if, &nhip);
if (nhip)
return dest_if;
@@ -92,7 +93,8 @@ uint32_t get_pub_to_prv_port(uint32_t *ip_addr, uint8_t type)
case 6:
{
uint8_t nhipv6[16];
- get_nh_ipv6((uint8_t *)ip_addr, &dest_if, &nhipv6[0], &addr);
+
+ gw_get_nh_port_ipv6((uint8_t *)ip_addr, &dest_if, nhipv6);
if (dest_if != 0xff)
return dest_if;
return 0xff;