IPACM: call ioctl IPA_IOC_PUT_RT_TBL
Call ioctl IPA_IOC_PUT_RT_TBL after calling ioctl
IPA_IOC_GET_RT_TBL to maintain correct ref_cnt of
routing table.
Change-Id: I1f8893190c78a2749d64699809fff0ccba80943a
diff --git a/ipacm/inc/IPACM_Routing.h b/ipacm/inc/IPACM_Routing.h
index 4f5488f..b5ffabc 100644
--- a/ipacm/inc/IPACM_Routing.h
+++ b/ipacm/inc/IPACM_Routing.h
@@ -61,7 +61,6 @@
bool Reset(enum ipa_ip_type ip);
bool GetRoutingTable(struct ipa_ioc_get_rt_tbl *routingTable);
- bool PutRoutingTable(uint32_t routingTableHandle);
bool DeviceNodeIsOpened();
bool DeleteRoutingHdl(uint32_t rt_rule_hdl, ipa_ip_type ip);
@@ -71,6 +70,8 @@
private:
static const char *DEVICE_NAME;
int m_fd; /* File descriptor of the IPA device node /dev/ipa */
+
+ bool PutRoutingTable(uint32_t routingTableHandle);
};
#endif //IPACM_ROUTING_H
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 6085aca..1c4ed6f 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -1135,13 +1135,6 @@
m_pFilteringTable->ip = IPA_IP_v4;
m_pFilteringTable->num_rules = (uint8_t)IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
- if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_lan_v4))
- {
- IPACMERR("LAN m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_lan_v4=0x%p) Failed.\n", &IPACM_Iface::ipacmcfg->rt_tbl_lan_v4);
- free(m_pFilteringTable);
- return IPACM_FAILURE;
- }
-
/* Make LAN-traffic always go A5, use default IPA-RT table */
if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_default_v4))
{
diff --git a/ipacm/src/IPACM_LanToLan.cpp b/ipacm/src/IPACM_LanToLan.cpp
index be33acd..6817177 100644
--- a/ipacm/src/IPACM_LanToLan.cpp
+++ b/ipacm/src/IPACM_LanToLan.cpp
@@ -593,7 +593,6 @@
m_p_iface->eth_bridge_add_flt_rule(client->mac_addr, rt_tbl.hdl,
iptype, &flt_rule_hdl);
IPACMDBG_H("Installed flt rule for IP type %d: handle %d\n", iptype, flt_rule_hdl);
- IPACM_Iface::m_routing.PutRoutingTable(rt_tbl.hdl);
for(it_flt = peer->flt_rule.begin(); it_flt != peer->flt_rule.end(); it_flt++)
{
diff --git a/ipacm/src/IPACM_Routing.cpp b/ipacm/src/IPACM_Routing.cpp
index 7ae6131..2a2555a 100644
--- a/ipacm/src/IPACM_Routing.cpp
+++ b/ipacm/src/IPACM_Routing.cpp
@@ -176,8 +176,10 @@
IPACMERR("IPA_IOCTL_GET_RT_TBL ioctl failed, routingTable =0x%p, retval=0x%x.\n", routingTable, retval);
return false;
}
-
IPACMDBG_H("IPA_IOCTL_GET_RT_TBL ioctl issued to IPA routing block.\n");
+ /* put routing table right after successfully get routing table */
+ PutRoutingTable(routingTable->hdl);
+
return true;
}