Skip to contentSkip to conversation

netconfig: Make gateway optional for client

PATCH Applied Andrew Zaborowski 2 participants 2 messages Jun 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netconfig: Make gateway optional for client

Don't require a gateway address from the settings file or from the DHCP server when doing netconfig. Failing when the gateway address was missing was breaking P2P but also small local networks.

---
 src/netconfig.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/netconfig.c +8 -2
index 7665d786..316431ee 100644
@@ -652,11 +652,17 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
 
 	gateway = netconfig_ipv4_get_gateway(netconfig);
 	if (!gateway) {
-		l_error("netconfig: Failed to obtain gateway from %s.",
+		l_debug("No gateway obtained from %s.",
 				netconfig->rtm_protocol == RTPROT_STATIC ?
 				"setting file" : "DHCPv4 lease");
 
-		return false;
+		if (netconfig->notify) {
+			netconfig->notify(NETCONFIG_EVENT_CONNECTED,
+						netconfig->user_data);
+			netconfig->notify = NULL;
+		}
+
+		return true;
 	}
 
 	netconfig->route4_add_gateway_cmd_id =
Signature · 1 line
2.30.2
#1 lore raw

Hi Andrew,

Quoted 7 lines · Andrew Zaborowski

Don't require a gateway address from the settings file or from the DHCP server when doing netconfig. Failing when the gateway address was missing was breaking P2P but also small local networks.

---
  src/netconfig.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)

Applied, thanks.

Regards,
-Denis