From 263043fbc84663da948745e1a328460f1acf7f3d Mon Sep 17 00:00:00 2001 From: Mohit Ghuley Date: Mon, 10 Jul 2017 11:52:46 +0530 Subject: [PATCH] [9610][7885][7872] wlbt : Enabling NAT KeepAlive Offload Feature. Enabling NAT KeepAlive Offload Feature. Change-Id: I9e6538b5ab5eabad0018e91be322456ad56d5ab1 SCSC-Bug-Id:SSB-28747 Signed-off-by: Mohit Ghuley --- wifi_offload.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) mode change 100755 => 100644 wifi_offload.cpp diff --git a/wifi_offload.cpp b/wifi_offload.cpp old mode 100755 new mode 100644 index 5882927..726c81c --- a/wifi_offload.cpp +++ b/wifi_offload.cpp @@ -197,17 +197,35 @@ public: } }; + /* API to send specified mkeep_alive packet periodically. */ wifi_error wifi_start_sending_offloaded_packet(wifi_request_id index, wifi_interface_handle iface, u8 *ip_packet, u16 ip_packet_len, u8 *src_mac_addr, u8 *dst_mac_addr, u32 period_msec) { - ALOGE("Returning WIFI_ERROR_NOT_SUPPORTED, as NAT KeepAlive Feature is disabled as of now."); - return WIFI_ERROR_NOT_SUPPORTED; + if ((index > 0 && index <= N_AVAIL_ID) && (ip_packet != NULL) && (src_mac_addr != NULL) + && (dst_mac_addr != NULL) && (period_msec > 0) + && (ip_packet_len <= MKEEP_ALIVE_IP_PKT_MAX)) { + MKeepAliveCommand *cmd = new MKeepAliveCommand(iface, index, ip_packet, ip_packet_len, + src_mac_addr, dst_mac_addr, period_msec, START_MKEEP_ALIVE); + wifi_error result = (wifi_error)cmd->start(); + delete cmd; + return result; + } else { + ALOGE("Invalid mkeep_alive parameters"); + return WIFI_ERROR_INVALID_ARGS; + } } /* API to stop sending mkeep_alive packet. */ wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id index, wifi_interface_handle iface) { - ALOGE("Returning WIFI_ERROR_NOT_SUPPORTED, as NAT KeepAlive Feature is disabled as of now."); - return WIFI_ERROR_NOT_SUPPORTED; + if (index > 0 && index <= N_AVAIL_ID) { + MKeepAliveCommand *cmd = new MKeepAliveCommand(iface, index, STOP_MKEEP_ALIVE); + wifi_error result = (wifi_error)cmd->start(); + delete cmd; + return result; + } else { + ALOGE("Invalid mkeep_alive parameters"); + return WIFI_ERROR_INVALID_ARGS; + } } -- 2.20.1