Added a route entry for multicast support 67/92667/2 accepted/tizen/3.0/ivi/20161028.151425 accepted/tizen/3.0/mobile/20161028.143318 accepted/tizen/3.0/tv/20161028.143612 accepted/tizen/3.0/wearable/20161028.150916 accepted/tizen/common/20161019.145729 accepted/tizen/ivi/20161021.062434 accepted/tizen/mobile/20161021.062330 accepted/tizen/tv/20161021.062347 accepted/tizen/wearable/20161021.062407 submit/tizen/20161019.063605 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.092423 submit/tizen_3.0_common/20161104.104000
authorchleun.moon <chleun.moon@samsung.com>
Tue, 18 Oct 2016 05:00:41 +0000 (14:00 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Tue, 18 Oct 2016 05:02:00 +0000 (14:02 +0900)
Change-Id: Idd89bee987a22954a35cfaffa769e2f30abf5e83
Signed-off-by: cheoleun <chleun.moon@samsung.com>
include/mobileap_common.h
include/mobileap_softap.h
packaging/mobileap-agent.spec
src/mobileap_common.c
src/mobileap_softap.c
src/mobileap_wifi.c

index 6b07683..ca505df 100755 (executable)
@@ -43,6 +43,8 @@ int _get_station_info(gconstpointer data, GCompareFunc func,
                mobile_ap_station_info_t **si);
 int _get_station_count(gconstpointer data, GCompareFunc func, int *count);
 GVariant *_station_info_foreach(void);
+int _add_multicast_routing(const char *interface);
+int _del_multicast_routing(const char *interface);
 int _add_interface_routing(const char *interface, const in_addr_t gateway);
 int _del_interface_routing(const char *interface, const in_addr_t gateway);
 int _add_routing_rule(const char *interface);
index 678eccb..50b4aec 100755 (executable)
 #define TCP_DNS_FORWARD_RULE   "-i %s -p tcp --dport 53 -j DNAT --to %s:53"
 #define UDP_DNS_FORWARD_RULE   "-i %s -p udp --dport 53 -j DNAT --to %s:53"
 
+#define ROUTE_CMD      "/usr/sbin/route"
+#define ROUTE_ADD      "add -net %s netmask %s %s"
+#define ROUTE_DEL      "del -net %s netmask %s %s"
+#define MULTICAST_ADDR "224.0.0.0"
+#define MULTICAST_NETMASK "224.0.0.0"
+
 #define MOBILE_AP_STATE_NONE   0
 #define MOBILE_AP_STATE_WIFI   1
 #define MOBILE_AP_STATE_USB    2
index 62d0d74..14ac161 100644 (file)
@@ -1,6 +1,6 @@
 Name:          mobileap-agent
 Summary:       Mobile AP daemon for setting tethering environments
-Version:       1.0.76
+Version:       1.0.77
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 27e371b..ad32c99 100755 (executable)
@@ -345,6 +345,42 @@ GVariant * _station_info_foreach()
        return params;
 }
 
+int _add_multicast_routing(const char *interface)
+{
+       if (interface == NULL || interface[0] == '\0') {
+               ERR("Invalid parameter\n");
+               return MOBILE_AP_ERROR_INVALID_PARAM;
+       }
+
+       char cmd[MAX_BUF_SIZE] = {0, };
+
+       snprintf(cmd, sizeof(cmd), "%s "ROUTE_ADD, ROUTE_CMD, MULTICAST_ADDR, MULTICAST_NETMASK, interface);
+       if (_execute_command(cmd)) {
+               ERR("cmd failed : %s\n", cmd);
+               return MOBILE_AP_ERROR_INTERNAL;
+       }
+
+       return MOBILE_AP_ERROR_NONE;
+}
+
+int _del_multicast_routing(const char *interface)
+{
+       if (interface == NULL || interface[0] == '\0') {
+               ERR("Invalid parameter\n");
+               return MOBILE_AP_ERROR_INVALID_PARAM;
+       }
+
+       char cmd[MAX_BUF_SIZE] = {0, };
+
+       snprintf(cmd, sizeof(cmd), "%s "ROUTE_DEL, ROUTE_CMD, MULTICAST_ADDR, MULTICAST_NETMASK, interface);
+       if (_execute_command(cmd)) {
+               ERR("cmd failed : %s\n", cmd);
+               return MOBILE_AP_ERROR_INTERNAL;
+       }
+
+       return MOBILE_AP_ERROR_NONE;
+}
+
 int _add_interface_routing(const char *interface, const in_addr_t gateway)
 {
        if (interface == NULL || interface[0] == '\0') {
index 448994a..80fb2bb 100755 (executable)
@@ -770,6 +770,7 @@ static int __mh_core_softap_firmware_start(void)
        DBusConnection *connection = NULL;
        const char *device = "softap";
 
+       DBG("+");
        connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
        if (connection == NULL) {
                ERR("Failed to get system bus");
@@ -812,6 +813,7 @@ static int __mh_core_softap_firmware_start(void)
        dbus_message_unref(message);
        dbus_connection_unref(connection);
 
+       DBG("-");
        return err;
 }
 
index 60c19d0..154a470 100755 (executable)
@@ -804,6 +804,8 @@ mobile_ap_error_code_e _enable_soft_ap(Softap *obj,
        _start_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, time(NULL) + WIFI_AP_CONN_TIMEOUT);
        _add_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
        _add_routing_rule(WIFI_IF);
+       if (is_softap)
+               _add_multicast_routing(WIFI_IF);
 
 DONE:
        _unblock_device_sleep();
@@ -826,6 +828,8 @@ mobile_ap_error_code_e _disable_soft_ap(Softap *obj)
        }
 
        _block_device_sleep();
+       if (is_softap)
+               _del_multicast_routing(WIFI_IF);
        _del_routing_rule(WIFI_IF);
        _del_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
        _flush_ip_address(WIFI_IF);