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);
#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
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
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') {
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");
dbus_message_unref(message);
dbus_connection_unref(connection);
+ DBG("-");
return err;
}
_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();
}
_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);