diff options
author | Mohammed Javid <mjavid@codeaurora.org> | 2018-02-08 01:12:59 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-03-05 02:07:19 -0800 |
commit | b4c6bef20728997359e9f11adbf249d7511f4285 (patch) | |
tree | 691b55f4450f842ef52ee97623d3556556690ffa /ipacm/src/IPACM_Config.cpp | |
parent | 5d6fa22014bb12dbf9c919fb369c35cb6f6483bc (diff) | |
download | ipacfg-mgr-b4c6bef20728997359e9f11adbf249d7511f4285.tar.gz |
ipacm: cache framework event if IPACM not ready
When set_upstream/add_downstream events received from framework,
IPACM can't handle them if those events are coming earlier than
the new_address netlink event. The fix is to cache those framework
events in offload_manager if IPACM haven't got the netdev
ip-address.
Change-Id: I7826ada63fdc093632b06fba5b43c7a4cf101fb0
Diffstat (limited to 'ipacm/src/IPACM_Config.cpp')
-rw-r--r-- | ipacm/src/IPACM_Config.cpp | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp index babc847..ad0cdd3 100644 --- a/ipacm/src/IPACM_Config.cpp +++ b/ipacm/src/IPACM_Config.cpp @@ -467,7 +467,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*/ @@ -477,7 +477,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; } } @@ -494,8 +502,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; } @@ -514,14 +529,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); @@ -534,23 +555,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); + 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; } |