Skip to contentSkip to conversation

connection: Rename 'connection.c' to 'gateway.c'

PATCH In review Grant Erickson 3 participants 10 messages Dec 13, 2023 – Jan 2, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

cover connection: Rename 'connection.c' to 'gateway.c'

While historically, "connection.c" might have been a contextually-apt name, today it might be better named "gateway.c" since its primary focus is gateway routes and gateway route management.

Reflective of that, this renames "connection.c" to "gateway.c" and updates public and private symbol names accordingly.

Grant Erickson (3):
connection: Rename 'connection.c' to 'gateway.c'.
gateway: Updated @file comment to reflect recent rename.
gateway: Rename public and private symbols after file rename.

 Makefile.am                     |  2 +-
 src/connman.h                   | 14 +++----
 src/dnsproxy.c                  |  2 +-
 src/{connection.c => gateway.c} | 65 ++++++++++++++++-----------------
 src/inet.c                      |  2 +-
 src/ipconfig.c                  |  8 ++--
 src/main.c                      |  4 +-
 src/network.c                   |  2 +-
 src/provider.c                  |  4 +-
 src/service.c                   | 22 +++++------
 10 files changed, 62 insertions(+), 63 deletions(-)
 rename src/{connection.c => gateway.c} (98%)
Signature · 1 line
2.42.0
#1 lore raw

PATCH 1/3 connection: Rename 'connection.c' to 'gateway.c'.

While historically, "connection.c" might have been a contextually-apt name, today it might be better named "gateway.c" since its primary focus is gateway routes and gateway route management.

Reflective of that, this renames "connection.c" to "gateway.c".

---
 Makefile.am                     | 2 +-
 src/{connection.c => gateway.c} | 0
 src/inet.c                      | 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename src/{connection.c => gateway.c} (100%)
Makefile.am +1 -1
index 169b4bc66bd5..fad129c81b47 100644
@@ -117,7 +117,7 @@ src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) $(stats_sources) \
 			$(backtrace_sources) $(builtin_sources) $(shared_sources) \
 			src/connman.ver src/main.c src/connman.h src/log.c \
 			src/error.c src/plugin.c src/task.c \
-			src/device.c src/network.c src/connection.c \
+			src/device.c src/network.c src/gateway.c \
 			src/manager.c src/service.c \
 			src/clock.c src/timezone.c src/agent-connman.c \
 			src/agent.c src/notifier.c src/provider.c \
src/gateway.c renamed from src/connection.c +0 -0
similarity index 100%
rename from src/connection.c
rename to src/gateway.c
src/inet.c +1 -1
index 31596a76a140..779ed7b2b995 100644
@@ -3079,7 +3079,7 @@ bool connman_inet_is_ipv6_supported()
  * connmand and vpnd use inet.c, getting the route is via ipconfig and ipconfig
  * is different for both. Gateway is left here for possible future use.
  *
- * Gateway can be NULL and connection.c then assigns 0.0.0.0 address or ::,
+ * Gateway can be NULL and gateway.c then assigns 0.0.0.0 address or ::,
  * depending on IP family.
  */
 bool connman_inet_is_default_route(int family, const char *host,
Signature · 1 line
2.42.0
#2 lore raw

PATCH 2/3 gateway: Updated @file comment to reflect recent rename.

In reply to Grant Erickson

This updates the @file comment to reflect the recent rename of this file from "connection.c" to "gateway.c".

---
 src/gateway.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
src/gateway.c +2 -3
index 30e7d736e1e0..35ca9cc6cfc5 100644
@@ -222,9 +222,8 @@
  *        'compute_low_priority_metric'.
  *
  *    Historically, this file started life as "connection.c". However,
- *    today it might be better named "route.c" or, perhaps more
- *    precisely, "gateway.c" since its primary focus is gateway routes
- *    and gateway route management.
+ *    it was renamed to "gateway.c" since its primary focus is gateway
+ *    routes and gateway route management.
  *
  */
 
Signature · 1 line
2.42.0
#3 lore raw

PATCH 3/3 gateway: Rename public and private symbols after file rename.

In reply to Grant Erickson

This renames public and private symbols in "gateway.c" reflective of the recent name change of the file from "connection.c" to "gateway.c".

---
 src/connman.h  | 14 ++++++------
 src/dnsproxy.c |  2 +-
 src/gateway.c  | 60 +++++++++++++++++++++++++-------------------------
 src/ipconfig.c |  8 +++----
 src/main.c     |  4 ++--
 src/network.c  |  2 +-
 src/provider.c |  4 ++--
 src/service.c  | 22 +++++++++---------
 8 files changed, 58 insertions(+), 58 deletions(-)
src/connman.h +7 -7
index 472429bfc1a2..d179374e2247 100644
@@ -522,19 +522,19 @@ int __connman_dhcpv6_start_pd_release(struct connman_network *network,
 int __connman_ipv4_init(void);
 void __connman_ipv4_cleanup(void);
 
-int __connman_connection_init(void);
-void __connman_connection_cleanup(void);
+int __connman_gateway_init(void);
+void __connman_gateway_cleanup(void);
 
-int __connman_connection_gateway_add(struct connman_service *service,
+int __connman_gateway_add(struct connman_service *service,
 					const char *gateway,
 					enum connman_ipconfig_type type,
 					const char *peer);
-void __connman_connection_gateway_remove(struct connman_service *service,
+void __connman_gateway_remove(struct connman_service *service,
 					enum connman_ipconfig_type type);
-int __connman_connection_get_vpn_index(int phy_index);
-int __connman_connection_get_vpn_phy_index(int vpn_index);
+int __connman_gateway_get_vpn_index(int phy_index);
+int __connman_gateway_get_vpn_phy_index(int vpn_index);
 
-bool __connman_connection_update_gateway(void);
+bool __connman_gateway_update(void);
 
 typedef void (*__connman_ntp_cb_t) (bool success, void *user_data);
 int __connman_ntp_start(char *server, __connman_ntp_cb_t callback,
src/dnsproxy.c +1 -1
index 4ae485f12439..d4242560f3f3 100644
@@ -3020,7 +3020,7 @@ static void dnsproxy_default_changed(struct connman_service *service)
 	 * the VPN must be enabled as well, when the transport becomes the
 	 * default service.
 	 */
-	vpn_index = __connman_connection_get_vpn_index(index);
+	vpn_index = __connman_gateway_get_vpn_index(index);
 
 	for (GSList *list = server_list; list; list = list->next) {
 		struct server_data *data = list->data;
src/gateway.c +30 -30

166 lines not on this page · raw message

src/ipconfig.c +4 -4
index e26fc13799fb..5ec619fa7e6b 100644
@@ -1359,7 +1359,7 @@ void __connman_ipconfig_set_gateway(struct connman_ipconfig *ipconfig,
  *                    associated with @a service is invalid.
  *
  *  @sa __connman_ipconfig_gateway_remove
- *  @sa __connman_connection_gateway_add
+ *  @sa __connman_gateway_add
  *
  */
 int __connman_ipconfig_gateway_add(const struct connman_ipconfig *ipconfig)
@@ -1385,7 +1385,7 @@ int __connman_ipconfig_gateway_add(const struct connman_ipconfig *ipconfig)
 
 	if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV6 ||
 				ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4)
-		return __connman_connection_gateway_add(service,
+		return __connman_gateway_add(service,
 						ipconfig->address->gateway,
 						ipconfig->type,
 						ipconfig->address->peer);
@@ -1408,7 +1408,7 @@ int __connman_ipconfig_gateway_add(const struct connman_ipconfig *ipconfig)
  *                        gateway.
  *
  *  @sa __connman_ipconfig_gateway_add
- *  @sa __connman_connection_gateway_remove
+ *  @sa __connman_gateway_remove
  *
  */
 void __connman_ipconfig_gateway_remove(const struct connman_ipconfig *ipconfig)
@@ -1424,7 +1424,7 @@ void __connman_ipconfig_gateway_remove(const struct connman_ipconfig *ipconfig)
 
 	service = __connman_service_lookup_from_index(ipconfig->index);
 	if (service)
-		__connman_connection_gateway_remove(service, ipconfig->type);
+		__connman_gateway_remove(service, ipconfig->type);
 }
 
 unsigned char __connman_ipconfig_get_prefixlen(struct connman_ipconfig *ipconfig)
src/main.c +2 -2
index e9419a603eba..d2ec8296f490 100644
@@ -1067,7 +1067,7 @@ int main(int argc, char *argv[])
 	__connman_detect_init();
 	__connman_session_init();
 	__connman_timeserver_init();
-	__connman_connection_init();
+	__connman_gateway_init();
 
 	__connman_plugin_init(option_plugin, option_noplugin);
 
@@ -1098,7 +1098,7 @@ int main(int argc, char *argv[])
 	__connman_session_cleanup();
 	__connman_plugin_cleanup();
 	__connman_provider_cleanup();
-	__connman_connection_cleanup();
+	__connman_gateway_cleanup();
 	__connman_timeserver_cleanup();
 	__connman_detect_cleanup();
 	__connman_proxy_cleanup();
src/network.c +1 -1
index 3f844f76120d..416a7e74670c 100644
@@ -1022,7 +1022,7 @@ static void set_disconnected(struct connman_network *network)
 					CONNMAN_IPCONFIG_TYPE_IPV6);
 
 	if (network->connected) {
-		__connman_connection_gateway_remove(service,
+		__connman_gateway_remove(service,
 						CONNMAN_IPCONFIG_TYPE_ALL);
 
 		__connman_ipconfig_address_unset(ipconfig_ipv4);
src/provider.c +2 -2
index e3d34d8f2cd1..1f0ce10da796 100644
@@ -666,7 +666,7 @@ int connman_provider_set_split_routing(struct connman_provider *provider,
 	}
 
 	vpn_index = __connman_service_get_index(provider->vpn_service);
-	service_index = __connman_connection_get_vpn_phy_index(vpn_index);
+	service_index = __connman_gateway_get_vpn_phy_index(vpn_index);
 	service = __connman_service_lookup_from_index(service_index);
 	if (!service)
 		goto save;
@@ -857,7 +857,7 @@ static void provider_service_changed(struct connman_service *service,
 
 	service_index = __connman_service_get_index(service);
 
-	vpn_index = __connman_connection_get_vpn_index(service_index);
+	vpn_index = __connman_gateway_get_vpn_index(service_index);
 
 	DBG("service %p %s state %d index %d/%d", service,
 		connman_service_get_identifier(service),
src/service.c +11 -11
index 16b561f48a41..5ead14ac6d98 100644
@@ -5851,7 +5851,7 @@ int __connman_service_move(struct connman_service *service,
 	else
 		switch_service_order(service, target);
 
-	__connman_connection_update_gateway();
+	__connman_gateway_update();
 
 	service_schedule_changed();
 
@@ -6002,7 +6002,7 @@ static void service_free(gpointer user_data)
 	service->path = NULL;
 
 	if (path) {
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 
 		g_dbus_unregister_interface(connection, path,
 						CONNMAN_SERVICE_INTERFACE);
@@ -6627,7 +6627,7 @@ int __connman_service_set_favorite_delayed(struct connman_service *service,
 
 		service_list_sort();
 
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 	}
 
 	return 0;
@@ -6765,7 +6765,7 @@ static void report_error_cb(void *user_context, bool retry,
 
 		service_complete(service);
 		service_list_sort();
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 	}
 }
 
@@ -6905,7 +6905,7 @@ static void request_input_cb(struct connman_service *service,
 		}
 
 		service_complete(service);
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 	}
 }
 
@@ -6972,7 +6972,7 @@ static int service_update_preferred_order(struct connman_service *default_servic
 	if (service_compare_preferred(default_service, new_service) > 0) {
 		switch_service_order(default_service,
 				new_service);
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 		return 0;
 	}
 
@@ -7208,7 +7208,7 @@ static int service_indicate_state(struct connman_service *service)
 
 	service_list_sort();
 
-	__connman_connection_update_gateway();
+	__connman_gateway_update();
 
 notifier:
 	if ((old_state == CONNMAN_SERVICE_STATE_ONLINE &&
@@ -7893,7 +7893,7 @@ int __connman_service_provision_changed(const char *ident)
 
 		service_list_sort();
 
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 	}
 
 	return data.ret;
@@ -7966,7 +7966,7 @@ static int service_register(struct connman_service *service)
 
 	service_list_sort();
 
-	__connman_connection_update_gateway();
+	__connman_gateway_update();
 
 	return 0;
 }
@@ -8463,7 +8463,7 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
 			__connman_ipconfig_set_index(service->ipconfig_ipv6,
 									index);
 
-		__connman_connection_update_gateway();
+		__connman_gateway_update();
 		return service;
 	}
 
@@ -8589,7 +8589,7 @@ void __connman_service_remove_from_network(struct connman_network *network)
 
 	service->ignore = true;
 
-	__connman_connection_gateway_remove(service,
+	__connman_gateway_remove(service,
 					CONNMAN_IPCONFIG_TYPE_ALL);
 
 	connman_service_unref(service);
Signature · 1 line
2.42.0
#4 lore raw
In reply to Grant Erickson

Hi Grant,

Quoted 23 lines

While historically, "connection.c" might have been a contextually-apt name, today it might be better named "gateway.c" since its primary focus is gateway routes and gateway route management.

Reflective of that, this renames "connection.c" to "gateway.c" and updates public and private symbol names accordingly.

Grant Erickson (3):
connection: Rename 'connection.c' to 'gateway.c'.
gateway: Updated @file comment to reflect recent rename.
gateway: Rename public and private symbols after file rename.

Makefile.am                     |  2 +-
src/connman.h                   | 14 +++----
src/dnsproxy.c                  |  2 +-
src/{connection.c => gateway.c} | 65 ++++++++++++++++-----------------
src/inet.c                      |  2 +-
src/ipconfig.c                  |  8 ++--
src/main.c                      |  4 +-
src/network.c                   |  2 +-
src/provider.c                  |  4 +-
src/service.c                   | 22 +++++------
10 files changed, 62 insertions(+), 63 deletions(-)
Quoted 1 line

rename src/{connection.c => gateway.c} (98%)

all 3 patches have been applied.

Regards

Marcel

#5 lore raw
In reply to Grant Erickson

Hello Grant and Marcel,

I'm not really understanding what is the real benefit here in renaming connection.c to gateway.c. Granted (pun), it is more clear name for it but it still has some vpn-related functionality to get the physical device index etc. so it is still misleading.

My point here is that this just brings a lot of drawbacks:
- It is rather complex now to apply patches from older versions, forks
or heavily patched forks to upstream that contain changes to old connection.c
- It is really not straightforward just to pick an upstream patch made
with changes to connection.c into these older versions or forks that from one reason or another, or like million reasons, like with our fork, cannot just be updated directly to latest upstream.
- And the name was there for... 15 years? It really hasn't gone
through so much changes that it would need to be renamed from my opinion.

From my perspective the simple SWOT analysis here would result a negative outcome to renaming and positive towards keeping the name.

Also, choose vs. yield, well, for non-native English speakers the first would be more obvious in definition and one glance of the name would tell what it is supposed to do. Personally I'd prefer concise language throughout the project, the function does not really give up anything but selects the most suitable one, right? The commit:
https://git.kernel.org/pub/scm/network/connman/connman.git/commit/src/connection.c?id=64a986109880828a4aa727ecb7a82cb97b004623

It is good that stuff gets documented here but reformatting should not be done just because reformatting needs. I'd say that compatibility should weight there a lot when deciding whether to rename or not.

If the process of upstreaming because of this kind of changes becomes rather complex (even more than it already is because of historic reasons) and time required to do them increases a lot it just might be that those patches do not get done/sent. But this is just my view on the matter.

- Jussi

Quoted 25 lines · Grant Erickson

While historically, "connection.c" might have been a contextually-apt name, today it might be better named "gateway.c" since its primary focus is gateway routes and gateway route management.

Reflective of that, this renames "connection.c" to "gateway.c" and updates public and private symbol names accordingly.

Grant Erickson (3):
connection: Rename 'connection.c' to 'gateway.c'.
gateway: Updated @file comment to reflect recent rename.
gateway: Rename public and private symbols after file rename.

  Makefile.am                     |  2 +-
  src/connman.h                   | 14 +++----
  src/dnsproxy.c                  |  2 +-
  src/{connection.c => gateway.c} | 65 ++++++++++++++++-----------------
  src/inet.c                      |  2 +-
  src/ipconfig.c                  |  8 ++--
  src/main.c                      |  4 +-
  src/network.c                   |  2 +-
  src/provider.c                  |  4 +-
  src/service.c                   | 22 +++++------
  10 files changed, 62 insertions(+), 63 deletions(-)

rename src/{connection.c => gateway.c} (98%)

#6 lore raw
Quoted 7 lines · Jussi Laakkonen

I'm not really understanding what is the real benefit here in renaming connection.c to gateway.c. Granted (pun), it is more clear name for it but it still has some vpn-related functionality to get the physical device index etc. so it is still misleading.

My point here is that this just brings a lot of drawbacks:
- It is rather complex now to apply patches from older versions, forks or heavily patched forks to upstream that contain changes to old connection.c
- It is really not straightforward just to pick an upstream patch made with changes to connection.c into these older versions or forks that from one reason or another, or like million reasons, like with our fork, cannot just be updated directly to latest upstream.
- And the name was there for... 15 years? It really hasn't gone through so much changes that it would need to be renamed from my opinion.

Quoted 8 lines

From my perspective the simple SWOT analysis here would result a negative outcome to renaming and positive towards keeping the name.

Also, choose vs. yield, well, for non-native English speakers the first would be more obvious in definition and one glance of the name would tell what it is supposed to do. Personally I'd prefer concise language throughout the project, the function does not really give up anything but selects the most suitable one, right? The commit:
https://git.kernel.org/pub/scm/network/connman/connman.git/commit/src/connection.c?id=64a986109880828a4aa727ecb7a82cb97b004623

It is good that stuff gets documented here but reformatting should not be done just because reformatting needs. I'd say that compatibility should weight there a lot when deciding whether to rename or not.

If the process of upstreaming because of this kind of changes becomes rather complex (even more than it already is because of historic reasons) and time required to do them increases a lot it just might be that those patches do not get done/sent. But this is just my view on the matter.

Jussi,

In terms of the file and function rename(s), I approached both as someone who was somewhat-initiated in having worked on connman some 13 years ago but was coming back to it with fresh eyes. I reasoned that if file and function names (those in connection.c/gateway.c, in particular) were confusing to me, then they would be more so to someone even less initiated than I. To the extent Marcel and the community were supportive, I submitted the patches. Having substantially refactored a large portion of connection.c/gateway.c, I believe it is more understandable for the uninitiated today than it was before.

For my own insight, are there specific down-revision features of connman on which Sailfish (I assume Sailfish is the fork in question) would not or could not work with top-of-tree connman?

Best,

Grant

Signature · 5 lines
Principal
Nuovations

[email protected]
http://www.nuovations.com/
#7 lore raw
Quoted 19 lines · Grant Erickson
Quoted 7 lines · Jussi Laakkonen

I'm not really understanding what is the real benefit here in renaming connection.c to gateway.c. Granted (pun), it is more clear name for it but it still has some vpn-related functionality to get the physical device index etc. so it is still misleading.

My point here is that this just brings a lot of drawbacks:
- It is rather complex now to apply patches from older versions, forks or heavily patched forks to upstream that contain changes to old connection.c
- It is really not straightforward just to pick an upstream patch made with changes to connection.c into these older versions or forks that from one reason or another, or like million reasons, like with our fork, cannot just be updated directly to latest upstream.
- And the name was there for... 15 years? It really hasn't gone through so much changes that it would need to be renamed from my opinion.

Quoted 8 lines

From my perspective the simple SWOT analysis here would result a negative outcome to renaming and positive towards keeping the name.

Also, choose vs. yield, well, for non-native English speakers the first would be more obvious in definition and one glance of the name would tell what it is supposed to do. Personally I'd prefer concise language throughout the project, the function does not really give up anything but selects the most suitable one, right? The commit:
https://git.kernel.org/pub/scm/network/connman/connman.git/commit/src/connection.c?id=64a986109880828a4aa727ecb7a82cb97b004623

It is good that stuff gets documented here but reformatting should not be done just because reformatting needs. I'd say that compatibility should weight there a lot when deciding whether to rename or not.

If the process of upstreaming because of this kind of changes becomes rather complex (even more than it already is because of historic reasons) and time required to do them increases a lot it just might be that those patches do not get done/sent. But this is just my view on the matter.

Jussi,

Quoted 7 lines

In terms of the file and function rename(s), I approached both as someone who was somewhat-initiated in having worked on connman some 13 years ago but was coming back to it with fresh eyes. I reasoned that if file and function names (those in connection.c/gateway.c, in particular) were confusing to me, then they would be more so to someone even less initiated than I. To the extent Marcel and the community were supportive, I submitted the patches. Having substantially refactored a large portion of connection.c/gateway.c, I believe it is more understandable for the uninitiated today than it was before.

For my own insight, are there specific down-revision features of connman on which Sailfish (I assume Sailfish is the fork in question) would not or could not work with top-of-tree connman?

Best,

Grant

Hi Grant,

I was just concerned that the contributions in form of new features and fixing existing we and many others have been doing becomes even more difficult with renaming of the content hence the differences of the forks. Personally I try to avoid renaming much in order to not to break any workflows people already have. I'd just reason it in this way that better to have a bit of odd naming than break anything ;).

But this "yield" word just really sounded odd, especially since the definition would be, from my perspective, ok in thread/fork-related cases, or in what https://www.merriam-webster.com/dictionary/yield defines but in selecting the default gw it just seems a bit off? Sorry about the nag on this.

Yes I'm talking here about Sailfish OS fork of ConnMan. We have had a bit different direction, I think since 2014, in some service struct reference counting use. I think that is one of them that makes it quite difficult to make some changes to work with upstream of make upstream work directly with ours. There are other differences as well, which haven't been upstreamed throughout the years. But the plan is to gradually try to get closer to upstream by each version upgrade, which should be started next year.

We do have some interesting features I'd like to someday push as an RFC (when time allows), such as firewall via configuration files, multiuser support with systemd and a recent CLAT support feature that enables dual-index support for the core to name but the biggest changes. These just drag with them so much of the old content that is done in a different way as the upstream has so it'll take quite a lot of time to usually make the patches.

The reason I'd push them as an RFC is that there is no guarantee of how they'd really work with upstream. We've had those either in production or testing already for months or up to years.

Added Marcel here too if he'd wish to participate/comment.

Cheers,
Jussi

#8 lore raw
Quoted 23 lines · Jussi Laakkonen
Quoted 13 lines · Grant Erickson
Quoted 12 lines · Jussi Laakkonen

I'm not really understanding what is the real benefit here in renaming connection.c to gateway.c. Granted (pun), it is more clear name for it but it still has some vpn-related functionality to get the physical device index etc. so it is still misleading.

My point here is that this just brings a lot of drawbacks:
- It is rather complex now to apply patches from older versions, forks or heavily patched forks to upstream that contain changes to old connection.c
- It is really not straightforward just to pick an upstream patch made with changes to connection.c into these older versions or forks that from one reason or another, or like million reasons, like with our fork, cannot just be updated directly to latest upstream.
- And the name was there for... 15 years? It really hasn't gone through so much changes that it would need to be renamed from my opinion.

From my perspective the simple SWOT analysis here would result a negative outcome to renaming and positive towards keeping the name.

Also, choose vs. yield, well, for non-native English speakers the first would be more obvious in definition and one glance of the name would tell what it is supposed to do. Personally I'd prefer concise language throughout the project, the function does not really give up anything but selects the most suitable one, right? The commit:
https://git.kernel.org/pub/scm/network/connman/connman.git/commit/src/connection.c?id=64a986109880828a4aa727ecb7a82cb97b004623

Quoted 8 lines
Quoted 3 lines

It is good that stuff gets documented here but reformatting should not be done just because reformatting needs. I'd say that compatibility should weight there a lot when deciding whether to rename or not.

If the process of upstreaming because of this kind of changes becomes rather complex (even more than it already is because of historic reasons) and time required to do them increases a lot it just might be that those patches do not get done/sent. But this is just my view on the matter.

Jussi,
In terms of the file and function rename(s), I approached both as someone who was somewhat-initiated in having worked on connman some 13 years ago but was coming back to it with fresh eyes. I reasoned that if file and function names (those in connection.c/gateway.c, in particular) were confusing to me, then they would be more so to someone even less initiated than I. To the extent Marcel and the community were supportive, I submitted the patches. Having substantially refactored a large portion of connection.c/gateway.c, I believe it is more understandable for the uninitiated today than it was before. For my own insight, are there specific down-revision features of connman on which Sailfish (I assume Sailfish is the fork in question) would not or could not work with top-of-tree connman?
Best,
Grant

Quoted 5 lines

Hi Grant,

I was just concerned that the contributions in form of new features and fixing existing we and many others have been doing becomes even more difficult with renaming of the content hence the differences of the forks. Personally I try to avoid renaming much in order to not to break any workflows people already have. I'd just reason it in this way that better to have a bit of odd naming than break anything ;).

But this "yield" word just really sounded odd, especially since the definition would be, from my perspective, ok in thread/fork-related cases, or in what https://www.merriam-webster.com/dictionary/yield defines but in selecting the default gw it just seems a bit off? Sorry about the nag on this.

In breaking down the syntactic and semantic choice of “choose” versus “yield”, to me, “choose” implied “you have two gateways to consider that are, at the outset, equal. That is, choose one of the two specified gateways and then give it the (what is now) high-priority (that is, metric 0) default route. However, the reality (somewhat complicated more now by the existence of BOTH high- and low-priority default routes) is not only that the action of the function is not simply a side-effect-free choice but also that it is a demotion / unset / give up / yielding of the high-priority default route for one of the two gateways.

Regardless of its function name, on entry to the function one of the two gateways holds the high-priority (that is, metric 0) default route, so there is not such much a choice between equal gateways. On exit from the function, one of those two gateways will have unset it / given it up / have “yielded” the high-priority default route and will have assumed a low-priority (that is, metric > 0) default route. It is not until after ‘yield_default_gateway’ is called that the activated, if it was not the gateway to unset / give up / yield the high-priority route, is promoted from its low-priority route to the high-priority route.

Given that this demotion / unset / give up / yielding of the high-priority default route was a central and key side-effect of this function being called, I felt that “yield” was a much more apt action verb than “choose”.

Comparing it to, say, “pthread_yield”, in that case it is a thread giving up or yielding the processor / scheduler. In this case, it is a gateway giving up or yielding the high-priority default route.

Does that help color and explain the rationale I had?

Signature · 5 lines
Principal
Nuovations

[email protected]
http://www.nuovations.com/
#9 lore raw
Quoted 32 lines · Grant Erickson
Quoted 23 lines · Jussi Laakkonen
Quoted 13 lines · Grant Erickson
Quoted 12 lines · Jussi Laakkonen

I'm not really understanding what is the real benefit here in renaming connection.c to gateway.c. Granted (pun), it is more clear name for it but it still has some vpn-related functionality to get the physical device index etc. so it is still misleading.

My point here is that this just brings a lot of drawbacks:
- It is rather complex now to apply patches from older versions, forks or heavily patched forks to upstream that contain changes to old connection.c
- It is really not straightforward just to pick an upstream patch made with changes to connection.c into these older versions or forks that from one reason or another, or like million reasons, like with our fork, cannot just be updated directly to latest upstream.
- And the name was there for... 15 years? It really hasn't gone through so much changes that it would need to be renamed from my opinion.

From my perspective the simple SWOT analysis here would result a negative outcome to renaming and positive towards keeping the name.

Also, choose vs. yield, well, for non-native English speakers the first would be more obvious in definition and one glance of the name would tell what it is supposed to do. Personally I'd prefer concise language throughout the project, the function does not really give up anything but selects the most suitable one, right? The commit:
https://git.kernel.org/pub/scm/network/connman/connman.git/commit/src/connection.c?id=64a986109880828a4aa727ecb7a82cb97b004623

Quoted 8 lines
Quoted 3 lines

It is good that stuff gets documented here but reformatting should not be done just because reformatting needs. I'd say that compatibility should weight there a lot when deciding whether to rename or not.

If the process of upstreaming because of this kind of changes becomes rather complex (even more than it already is because of historic reasons) and time required to do them increases a lot it just might be that those patches do not get done/sent. But this is just my view on the matter.

Jussi,
In terms of the file and function rename(s), I approached both as someone who was somewhat-initiated in having worked on connman some 13 years ago but was coming back to it with fresh eyes. I reasoned that if file and function names (those in connection.c/gateway.c, in particular) were confusing to me, then they would be more so to someone even less initiated than I. To the extent Marcel and the community were supportive, I submitted the patches. Having substantially refactored a large portion of connection.c/gateway.c, I believe it is more understandable for the uninitiated today than it was before. For my own insight, are there specific down-revision features of connman on which Sailfish (I assume Sailfish is the fork in question) would not or could not work with top-of-tree connman?
Best,
Grant

Quoted 5 lines

Hi Grant,

I was just concerned that the contributions in form of new features and fixing existing we and many others have been doing becomes even more difficult with renaming of the content hence the differences of the forks. Personally I try to avoid renaming much in order to not to break any workflows people already have. I'd just reason it in this way that better to have a bit of odd naming than break anything ;).

But this "yield" word just really sounded odd, especially since the definition would be, from my perspective, ok in thread/fork-related cases, or in what https://www.merriam-webster.com/dictionary/yield defines but in selecting the default gw it just seems a bit off? Sorry about the nag on this.

In breaking down the syntactic and semantic choice of “choose” versus “yield”, to me, “choose” implied “you have two gateways to consider that are, at the outset, equal. That is, choose one of the two specified gateways and then give it the (what is now) high-priority (that is, metric 0) default route. However, the reality (somewhat complicated more now by the existence of BOTH high- and low-priority default routes) is not only that the action of the function is not simply a side-effect-free choice but also that it is a demotion / unset / give up / yielding of the high-priority default route for one of the two gateways.

Quoted 8 lines

Regardless of its function name, on entry to the function one of the two gateways holds the high-priority (that is, metric 0) default route, so there is not such much a choice between equal gateways. On exit from the function, one of those two gateways will have unset it / given it up / have “yielded” the high-priority default route and will have assumed a low-priority (that is, metric > 0) default route. It is not until after ‘yield_default_gateway’ is called that the activated, if it was not the gateway to unset / give up / yield the high-priority route, is promoted from its low-priority route to the high-priority route.

Given that this demotion / unset / give up / yielding of the high-priority default route was a central and key side-effect of this function being called, I felt that “yield” was a much more apt action verb than “choose”.

Comparing it to, say, “pthread_yield”, in that case it is a thread giving up or yielding the processor / scheduler. In this case, it is a gateway giving up or yielding the high-priority default route.

Does that help color and explain the rationale I had?

Hi Grant,

Thanks for the explanation, with the two priorities of routes it makes a bit more sense. Still, it just occurred to me that "provide" might also work now that I thought this again after this detailed explanation of yours. However, would that confuse as "provider" is already used as a term for the VPNs inside ConnMan.

Lots of changes happening here and getting hard to keep up with all of those. Oh well, it just takes time.

Sorry for the late reply, I was bit of indisposed during the holidays.

Cheers!

- Jussi