From 7cd631deaf9032a76236851d8ae6732620a81805 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Wed, 14 Mar 2018 23:33:50 +0000 Subject: msm8996-common: Update IPA-CFG-MGR from upstream * Tag: LA.UM.6.6.r1-06700-89xx.0 Change-Id: Ib3962909c52b6170efa14beb652e05506aa254c8 --- data-ipa-cfg-mgr/ipacm/src/IPACM_Config.cpp | 55 ++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'data-ipa-cfg-mgr/ipacm/src/IPACM_Config.cpp') diff --git a/data-ipa-cfg-mgr/ipacm/src/IPACM_Config.cpp b/data-ipa-cfg-mgr/ipacm/src/IPACM_Config.cpp index 9e66367..c46bc71 100644 --- a/data-ipa-cfg-mgr/ipacm/src/IPACM_Config.cpp +++ b/data-ipa-cfg-mgr/ipacm/src/IPACM_Config.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -466,7 +466,7 @@ int IPACM_Config::GetNatIfaces(int nIfaces, NatIfaces *pIfaces) } -int IPACM_Config::AddNatIfaces(char *dev_name) +int IPACM_Config::AddNatIfaces(char *dev_name, ipa_ip_type ip_type) { int i; /* Check if this iface already in NAT-iface*/ @@ -476,7 +476,15 @@ int IPACM_Config::AddNatIfaces(char *dev_name) pNatIfaces[i].iface_name, sizeof(pNatIfaces[i].iface_name)) == 0) { - IPACMDBG("Interface (%s) is add to nat iface already\n", dev_name); + IPACMDBG_H("Interface (%s) is add to nat iface already\n", dev_name); + if (ip_type == IPA_IP_v4) { + pNatIfaces[i].v4_up = true; + IPACMDBG_H("Change v4_up to (%d) \n", pNatIfaces[i].v4_up); + } + if (ip_type == IPA_IP_v6) { + pNatIfaces[i].v6_up = true; + IPACMDBG_H("Change v6_up to (%d) \n", pNatIfaces[i].v6_up); + } return 0; } } @@ -493,8 +501,15 @@ int IPACM_Config::AddNatIfaces(char *dev_name) IPACMDBG_H("Add Nat IfaceName: %s ,update nat-ifaces number: %d\n", pNatIfaces[ipa_nat_iface_entries - 1].iface_name, ipa_nat_iface_entries); + if (ip_type == IPA_IP_v4) { + pNatIfaces[ipa_nat_iface_entries - 1].v4_up = true; + IPACMDBG_H("Change v4_up to (%d) \n", pNatIfaces[ipa_nat_iface_entries - 1].v4_up); + } + if (ip_type == IPA_IP_v6) { + pNatIfaces[ipa_nat_iface_entries - 1].v6_up = true; + IPACMDBG_H("Change v6_up to (%d) \n", pNatIfaces[ipa_nat_iface_entries - 1].v6_up); + } } - return 0; } @@ -513,14 +528,20 @@ int IPACM_Config::DelNatIfaces(char *dev_name) /* Reset the matched entry */ memset(pNatIfaces[i].iface_name, 0, IPA_IFACE_NAME_LEN); + pNatIfaces[i].v4_up = false; + pNatIfaces[i].v6_up = false; for (; i < ipa_nat_iface_entries - 1; i++) { memcpy(pNatIfaces[i].iface_name, pNatIfaces[i + 1].iface_name, IPA_IFACE_NAME_LEN); + pNatIfaces[i].v4_up = pNatIfaces[i + 1].v4_up; + pNatIfaces[i].v6_up = pNatIfaces[i + 1].v6_up; /* Reset the copied entry */ memset(pNatIfaces[i + 1].iface_name, 0, IPA_IFACE_NAME_LEN); + pNatIfaces[i + 1].v4_up = false; + pNatIfaces[i + 1].v6_up = false; } ipa_nat_iface_entries--; IPACMDBG_H("Update nat-ifaces number: %d\n", ipa_nat_iface_entries); @@ -533,23 +554,33 @@ int IPACM_Config::DelNatIfaces(char *dev_name) return 0; } -int IPACM_Config::CheckNatIfaces(const char *dev_name) +int IPACM_Config::CheckNatIfaces(const char *dev_name, ipa_ip_type ip_type) { int i = 0; - IPACMDBG_H("Check iface %s from NAT-ifaces, currently it has %d nat ifaces\n", - dev_name, ipa_nat_iface_entries); + IPACMDBG_H("Check iface %s for ip-type %d from NAT-ifaces, currently it has %d nat ifaces\n", + dev_name, ip_type, ipa_nat_iface_entries); for (i = 0; i < ipa_nat_iface_entries; i++) { if (strcmp(dev_name, pNatIfaces[i].iface_name) == 0) { - IPACMDBG_H("Find Nat IfaceName: %s ,previous nat-ifaces number: %d\n", - pNatIfaces[i].iface_name, ipa_nat_iface_entries); - return 0; + IPACMDBG_H("Find Nat IfaceName: %s ,previous nat-ifaces number: %d, v4_up %d, v6_up %d \n", + pNatIfaces[i].iface_name, ipa_nat_iface_entries, pNatIfaces[i].v4_up, pNatIfaces[i].v6_up); + if (ip_type == IPA_IP_v4 && pNatIfaces[i].v4_up == true) + { + IPACMDBG_H(" v4_up=%d\n", pNatIfaces[i].v4_up); + return 0; + } + if (ip_type == IPA_IP_v6 && pNatIfaces[i].v6_up == true) + { + IPACMDBG_H(" v6_up=%d\n", pNatIfaces[i].v6_up); + return 0; + } + return -1; } } - IPACMDBG_H("Can't find Nat IfaceName: %s with total nat-ifaces number: %d\n", - dev_name, ipa_nat_iface_entries); + IPACMDBG_H("Can't find Nat IfaceName: %s for ip_type %d up with total nat-ifaces number: %d\n", + dev_name, ip_type, ipa_nat_iface_entries); return -1; } -- cgit v1.2.3