summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2021-11-19 00:35:03 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2021-11-19 00:35:03 +0900
commit3b0014134b2153de07f0c0b953a243a07d9029a9 (patch)
treeef2a3cc87ebbd406fbf83a7f7a57efc14a7d2508
parent0146c3a9fbc4a96ed6bf8b0da03a43fadba19352 (diff)
downloadconnman-3b0014134b2153de07f0c0b953a243a07d9029a9.tar.gz
connman-3b0014134b2153de07f0c0b953a243a07d9029a9.tar.bz2
connman-3b0014134b2153de07f0c0b953a243a07d9029a9.zip
Restore the default route even when the IP is updated due to external factors. Change-Id: Id44732f84cac7a26c494fe8f3bcd77a75c7daf19 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xsrc/connection.c17
-rwxr-xr-xsrc/connman.h3
-rwxr-xr-xsrc/ipconfig.c24
3 files changed, 44 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c
index 6036db31..c18701a7 100755
--- a/src/connection.c
+++ b/src/connection.c
@@ -1114,6 +1114,23 @@ bool __connman_connection_update_gateway(void)
return updated;
}
+#if defined TIZEN_EXT
+void __connman_connection_update_default_gateway(void)
+{
+ struct gateway_data *default_gateway;
+
+ default_gateway = find_default_gateway();
+ DBG("default %p", default_gateway);
+
+ if (!default_gateway)
+ return;
+
+ if (default_gateway->ipv4_gateway)
+ set_default_gateway(default_gateway,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+}
+#endif
+
int __connman_connection_get_vpn_index(int phy_index)
{
GHashTableIter iter;
diff --git a/src/connman.h b/src/connman.h
index e92f2b1a..e63eb9d5 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -541,6 +541,9 @@ void __connman_connection_gateway_remove(struct connman_service *service,
int __connman_connection_get_vpn_index(int phy_index);
bool __connman_connection_update_gateway(void);
+#if defined TIZEN_EXT
+void __connman_connection_update_default_gateway(void);
+#endif
typedef void (*__connman_ntp_cb_t) (bool success, void *user_data);
int __connman_ntp_start(char *server, __connman_ntp_cb_t callback,
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 8c21db5d..ec4c396f 100755
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -785,6 +785,30 @@ int __connman_ipconfig_newaddr(int index, int family, const char *label,
ipconfig->ops->ip_bound(ipconfig, ifname);
}
+#if defined TIZEN_EXT
+ const char *local;
+ struct connman_service *service;
+ struct connman_ipconfig *local_ipconfig;
+
+ service = connman_service_get_default();
+ if (!service)
+ goto out;
+
+ local_ipconfig = __connman_service_get_ip4config(service);
+ if (!local_ipconfig)
+ goto out;
+
+ local = __connman_ipconfig_get_local(local_ipconfig);
+ if (!local)
+ goto out;
+
+ DBG("local %s", local);
+
+ if (g_strcmp0(local, address) != 0)
+ goto out;
+
+ __connman_connection_update_default_gateway();
+#endif
out:
g_free(ifname);
return 0;