From 585fe8c94a1d60e1e575dbdc980a9a73d1d6447f Mon Sep 17 00:00:00 2001 From: Kyle Rankin Date: Fri, 21 Feb 2020 01:28:13 +0000 Subject: [PATCH] Lower WWAN DNS Priority The current DNS priority settings for WWAN were set far too low. Most connections (including WiFi) do not set DNS priority (set to 0) and per https://developer.gnome.org/NetworkManager/stable/nm-settings.html : "A lower value is better (higher priority). Zero selects a globally configured default value. If the latter is missing or zero too, it defaults to 50 for VPNs and 100 for other connections." By setting both the "low" and "high" settings to 15 and 20 respectively, the WWAN DNS servers were always appearing above WiFi, even though WiFi had routing priority. This caused latency and other problems when the wwan connection was slow because the system would query those DNS servers before WiFi ones. Beyond that, it would even cause WWAN to override VPN DNS settings which isn't what we want. This change puts the "low priority" setting above the default 100 that connections get when they don't otherwise set a priority, and the "high priority" slightly below 100. I did this instead of setting the values to 0 because I noticed that NM doesn't seem to be aware it should prioritize WiFi in that case so WWAN DNS servers were still sometimes taking precedence. --- panels/wwan/cc-wwan-data.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/panels/wwan/cc-wwan-data.c b/panels/wwan/cc-wwan-data.c index 0be8f3403..4062d78fd 100644 --- a/panels/wwan/cc-wwan-data.c +++ b/panels/wwan/cc-wwan-data.c @@ -47,9 +47,20 @@ * of #CcWwanData changes when SIM is changed. */ -/* Priority for connections. larger the number, lower the priority */ -#define CC_WWAN_DNS_PRIORITY_LOW (20) -#define CC_WWAN_DNS_PRIORITY_HIGH (15) +/* + * Priority for connections. The larger the number, the lower the priority + * https://developer.gnome.org/NetworkManager/stable/nm-settings.html: + * + * A lower value is better (higher priority). Zero selects a globally + * configured default value. If the latter is missing or zero too, it + * defaults to 50 for VPNs and 100 for other connections. + * + * Since WiFi and other network connections will likely get the default + * setting of 100, set WWAN DNS priorities higher than the default, with + * room to allow multiple modems to set priority above/below each other. + */ +#define CC_WWAN_DNS_PRIORITY_LOW (120) +#define CC_WWAN_DNS_PRIORITY_HIGH (115) /* These are to be set as route metric */ #define CC_WWAN_ROUTE_PRIORITY_LOW (1050)