Skip to contentSkip to conversation

ipconfig: Don't add invalid gateway routes

PATCH Applied Daniel Wagner 1 participant 2 messages Aug 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipconfig: Don't add invalid gateway routes

When we assign an IPV4LL address we are calling __connman_ipconfig_gateway_add() with an invalid GW set. It's propably a safe bet to say NULL is never a valid GW, so let's filter it out for all callers.

---
 src/ipconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/ipconfig.c +1 -1
index 34b1724a22bb..9f17f4989ea8 100644
@@ -1172,7 +1172,7 @@ int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig)
 
 	DBG("");
 
-	if (!ipconfig->address)
+	if (!ipconfig->address || !ipconfig->address->gateway)
 		return -EINVAL;
 
 	service = __connman_service_lookup_from_index(ipconfig->index);
Signature · 1 line
2.37.2
author Applied
#1 lore raw
Quoted 4 lines · Daniel Wagner

When we assign an IPV4LL address we are calling __connman_ipconfig_gateway_add() with an invalid GW set. It's propably a safe bet to say NULL is never a valid GW, so let's filter it out for all callers.

applied