Merge 7f79eca627b95fdaaba6798cb30a346a45a092f8 on remote branch

Change-Id: Ide09d14e5bc7bd2745ed6dc2f524da64c5d8c249
diff --git a/hal/src/CtUpdateAmbassador.cpp b/hal/src/CtUpdateAmbassador.cpp
index 4843fe2..eba6b93 100644
--- a/hal/src/CtUpdateAmbassador.cpp
+++ b/hal/src/CtUpdateAmbassador.cpp
@@ -78,7 +78,10 @@
          */
         ALOGE("Failed to translate timeout event :(");
     } else {
-        mFramework->updateTimeout(out);
+        auto ret = mFramework->updateTimeout(out);
+        if (!ret.isOk()) {
+            ALOGE("Triggering updateTimeout Callback failed.");
+        }
     }
 } /* updateTimeout */
 
diff --git a/hal/src/IpaEventRelay.cpp b/hal/src/IpaEventRelay.cpp
index 788b152..137092f 100644
--- a/hal/src/IpaEventRelay.cpp
+++ b/hal/src/IpaEventRelay.cpp
@@ -47,37 +47,50 @@
 
 void IpaEventRelay::onOffloadStarted() {
     ALOGI("onOffloadStarted()");
-    mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STARTED);
+    auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STARTED);
+    if (!ret.isOk()) {
+        ALOGE("Triggering OffloadStarted Callback failed.");
+    }
 } /* onOffloadStarted */
 
 void IpaEventRelay::onOffloadStopped(StoppedReason reason) {
     ALOGI("onOffloadStopped(%d)", reason);
-    switch (reason) {
-        case REQUESTED:
-            /*
-             * No way to communicate this to Framework right now, they make an
-             * assumption that offload is stopped when they remove the
-             * configuration.
-             */
-             break;
-        case ERROR:
-            mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_ERROR);
-            break;
-        case UNSUPPORTED:
-            mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_UNSUPPORTED);
-            break;
-        default:
-            ALOGE("Unknown stopped reason(%d)", reason);
-            break;
+    if( reason == StoppedReason::REQUESTED ) {
+        /*
+         * No way to communicate this to Framework right now, they make an
+         * assumption that offload is stopped when they remove the
+         * configuration.
+         */
+    }
+    else if ( reason == StoppedReason::ERROR ) {
+        auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_ERROR);
+        if (!ret.isOk()) {
+            ALOGE("Triggering OffloadStopped Callback failed.");
+        }
+    }
+    else if ( reason == StoppedReason::UNSUPPORTED ) {
+        auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_UNSUPPORTED);
+        if (!ret.isOk()) {
+            ALOGE("Triggering OffloadStopped Callback failed.");
+        }
+    }
+    else {
+        ALOGE("Unknown stopped reason(%d)", reason);
     }
 } /* onOffloadStopped */
 
 void IpaEventRelay::onOffloadSupportAvailable() {
     ALOGI("onOffloadSupportAvailable()");
-    mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_SUPPORT_AVAILABLE);
+    auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_SUPPORT_AVAILABLE);
+    if (!ret.isOk()) {
+        ALOGE("Triggering OffloadSupportAvailable Callback failed.");
+    }
 } /* onOffloadSupportAvailable */
 
 void IpaEventRelay::onLimitReached() {
     ALOGI("onLimitReached()");
-    mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_LIMIT_REACHED);
+    auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_LIMIT_REACHED);
+    if (!ret.isOk()) {
+        ALOGE("Triggering LimitReached Callback failed.");
+    }
 } /* onLimitReached */
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 5d884fc..be2c0a2 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -3799,34 +3799,11 @@
 
 		memcpy(&(rules[rule_offset + 2]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
 
-		/* Add the fragment filtering rule. */
-		memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add));
-
-		flt_rule_entry.at_rear = true;
-		flt_rule_entry.flt_rule_hdl = -1;
-		flt_rule_entry.status = -1;
-
-		flt_rule_entry.rule.retain_hdr = 1;
-		flt_rule_entry.rule.to_uc = 0;
-		flt_rule_entry.rule.eq_attrib_type = 1;
-		flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
-#ifdef FEATURE_IPA_V3
-		flt_rule_entry.rule.hashable = true;
-#endif
-		flt_rule_entry.rule.rt_tbl_idx = rt_tbl_idx.idx;
-		flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<1);
-		flt_rule_entry.rule.eq_attrib.protocol_eq_present = 1;
-		flt_rule_entry.rule.eq_attrib.protocol_eq = IPACM_FIREWALL_IPPROTO_TCP;
-		flt_rule_entry.rule.attrib.u.v6.next_hdr = (uint8_t)IPACM_FIREWALL_IPPROTO_TCP;
-
 		/* Configuring fragment Filtering Rule */
-		memcpy(&flt_rule_entry.rule.attrib,
-					 &rx_prop->rx[0].attrib,
-					 sizeof(flt_rule_entry.rule.attrib));
-		/* remove meta data mask since we only install default flt rules once for all modem PDN*/
-		flt_rule_entry.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);
-
+		flt_rule_entry.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_DST_ADDR);
 		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_FRAGMENT;
+		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_NEXT_HDR;
+		flt_rule_entry.rule.attrib.u.v6.next_hdr = IPACM_FIREWALL_IPPROTO_TCP;
 
 		memset(&flt_eq, 0, sizeof(flt_eq));
 		memcpy(&flt_eq.attrib, &flt_rule_entry.rule.attrib, sizeof(flt_eq.attrib));