From 3ec896179c547d54a18b40494a2871d7e328c0bf Mon Sep 17 00:00:00 2001 From: Anand B Jyoti Date: Fri, 28 Jul 2017 13:11:19 +0530 Subject: 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 --- common/vnf_common/vnf_common.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'common/vnf_common') 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 #include #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; -- cgit 1.2.3-korg