ipa : Addition of diag log messages for IPA NAT
Addition of diag log messages for IPA NAT to ease debugging
Change-Id: I2551bb15e17def9a7153b2061bd1c4b19ee1951f
diff --git a/ipacm/inc/IPACM_ConntrackClient.h b/ipacm/inc/IPACM_ConntrackClient.h
index ea956da..58c6316 100644
--- a/ipacm/inc/IPACM_ConntrackClient.h
+++ b/ipacm/inc/IPACM_ConntrackClient.h
@@ -108,6 +108,9 @@
IPACMLOG(" %s(0x%x): %d.%d.%d.%d\n", X, Y, ((Y>>24) & 0xFF), ((Y>>16) & 0xFF), ((Y>>8) & 0xFF), (Y & 0xFF));
#endif
+#define log_nat(A,B,C,D,E,F) \
+ IPACMDBG_H("protocol %d Private IP: %d.%d.%d.%d\t Target IP: %d.%d.%d.%d\t private port: %d public port: %d %s",A,((B>>24) & 0xFF), ((B>>16) & 0xFF), ((B>>8) & 0xFF), (B & 0xFF), ((C>>24) & 0xFF), ((C>>16) & 0xFF),((C>>8) & 0xFF),(C & 0xFF),D,E,F);
+
};
#endif /* IPACM_CONNTRACK_FILTER_H */
diff --git a/ipacm/src/IPACM_Conntrack_NATApp.cpp b/ipacm/src/IPACM_Conntrack_NATApp.cpp
index 0915fda..e9bfd4e 100644
--- a/ipacm/src/IPACM_Conntrack_NATApp.cpp
+++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp
@@ -131,7 +131,7 @@
int ret;
int cnt = 0;
ipa_nat_ipv4_rule nat_rule;
- IPACMDBG("%s() %d\n", __FUNCTION__, __LINE__);
+ IPACMDBG_H("%s() %d\n", __FUNCTION__, __LINE__);
/* Not reset the cache wait it timeout by destroy event */
#if 0
@@ -204,7 +204,7 @@
int NatApp::DeleteTable(uint32_t pub_ip)
{
int ret;
- IPACMDBG("%s() %d\n", __FUNCTION__, __LINE__);
+ IPACMDBG_H("%s() %d\n", __FUNCTION__, __LINE__);
CHK_TBL_HDL();
@@ -232,7 +232,6 @@
{
int cnt = 0;
IPACMDBG("%s() %d\n", __FUNCTION__, __LINE__);
-
for(; cnt < max_entries; cnt++)
{
if(cache[cnt].private_ip == rule->private_ip &&
@@ -241,11 +240,8 @@
cache[cnt].target_port == rule->target_port &&
cache[cnt].protocol == rule->protocol)
{
- IPACMDBG("Duplicate Rule\n");
- iptodot("Private IP", rule->private_ip);
- iptodot("Target IP", rule->target_ip);
- IPACMDBG("Private Port: %d\t Target Port: %d\t", rule->private_port, rule->target_port);
- IPACMDBG("protocolcol: %d\n", rule->protocol);
+ log_nat(rule->protocol,rule->private_ip,rule->target_ip,rule->private_port,\
+ rule->target_port,"Duplicate Rule");
return true;
}
}
@@ -259,11 +255,9 @@
int cnt = 0;
IPACMDBG("%s() %d\n", __FUNCTION__, __LINE__);
- IPACMDBG("Received below nat entry for deletion\n");
- iptodot("Private IP", rule->private_ip);
- iptodot("Target IP", rule->target_ip);
- IPACMDBG("Private Port: %d\t Target Port: %d\t", rule->private_port, rule->target_port);
- IPACMDBG("protocolcol: %d\n", rule->protocol);
+ log_nat(rule->protocol,rule->private_ip,rule->target_ip,rule->private_port,\
+ rule->target_port,"for deletion");
+
for(; cnt < max_entries; cnt++)
{
@@ -306,13 +300,8 @@
IPACMDBG("%s() %d\n", __FUNCTION__, __LINE__);
CHK_TBL_HDL();
-
- IPACMDBG("Received below nat entry for addition\n");
- iptodot("Private IP", rule->private_ip);
- iptodot("Target IP", rule->target_ip);
- IPACMDBG("Private Port: %d\t Target Port: %d\t", rule->private_port, rule->target_port);
- IPACMDBG("protocolcol: %d\n", rule->protocol);
-
+ log_nat(rule->protocol,rule->private_ip,rule->target_ip,rule->private_port,\
+ rule->target_port,"for addition");
if(isAlgPort(rule->protocol, rule->private_port) ||
isAlgPort(rule->protocol, rule->target_port))
{