IPA-HAL: Send null ipv4/ipv6 address to IPACM

Send null ipv4/ipv6 address to IPACM while sending the upstream parameters if
there are no v4/v6 addresses.

Change-Id: Ice32b666b301c2dd41bf182866253063efb208a2
CRs-Fixed: 2149882
diff --git a/hal/inc/PrefixParser.h b/hal/inc/PrefixParser.h
index 4682aa5..99afbe0 100644
--- a/hal/inc/PrefixParser.h
+++ b/hal/inc/PrefixParser.h
@@ -57,6 +57,7 @@
     int size();
     bool allAreFullyQualified();
     Prefix getFirstPrefix();
+    Prefix getFirstPrefix(IP_FAM);
     string getLastErrAsStr();
 private:
     bool add(string /* in */, IP_FAM /* famHint */);
diff --git a/hal/src/HAL.cpp b/hal/src/HAL.cpp
index c4d9722..d1d10fd 100644
--- a/hal/src/HAL.cpp
+++ b/hal/src/HAL.cpp
@@ -521,8 +521,8 @@
     } else if (iface.size()>= 1) {
         RET ipaReturn = mIPA->setUpstream(
                 iface.c_str(),
-                v4GwParser.getFirstPrefix(),
-                v6GwParser.getFirstPrefix());
+                v4GwParser.getFirstPrefix(IP_FAM::V4),
+                v6GwParser.getFirstPrefix(IP_FAM::V6));
         BoolResult res = ipaResultToBoolResult(ipaReturn);
         hidl_cb(res.success, res.errMsg);
         fl.setResult(res.success, res.errMsg);
@@ -530,8 +530,8 @@
 	/* send NULL iface string when upstream down */
         RET ipaReturn = mIPA->setUpstream(
                 NULL,
-                v4GwParser.getFirstPrefix(),
-                v6GwParser.getFirstPrefix());
+                v4GwParser.getFirstPrefix(IP_FAM::V4),
+                v6GwParser.getFirstPrefix(IP_FAM::V6));
         BoolResult res = ipaResultToBoolResult(ipaReturn);
         hidl_cb(res.success, res.errMsg);
         fl.setResult(res.success, res.errMsg);
diff --git a/hal/src/PrefixParser.cpp b/hal/src/PrefixParser.cpp
index d38bec0..ff55147 100644
--- a/hal/src/PrefixParser.cpp
+++ b/hal/src/PrefixParser.cpp
@@ -111,6 +111,12 @@
     return makeBlankPrefix(IP_FAM::INVALID);
 } /* getFirstPrefix */
 
+Prefix PrefixParser::getFirstPrefix(IP_FAM famHint) {
+    if (size() >= 1)
+        return mPrefixes[0];
+    return makeBlankPrefix(famHint);
+} /* getFirstPrefix */
+
 string PrefixParser::getLastErrAsStr() {
     return mLastErr;
 } /* getLastErrAsStr */