summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2009-08-25 16:46:52 -0400
committerDan Williams <dcbw@redhat.com>2009-08-25 16:46:52 -0400
commit99db3d89725c4f1853107111bc601f422e70900b (patch)
treeef3ec9eccab34a2e0b20d05a0677ac33763b23fe
parentdfe5cacf4aedbe5e2cfa91e35014de61647a5249 (diff)
ppp: work around PPP bug that returns bogus nameservers
Work around a PPP bug (#1732) which causes many mobile broadband providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers. Apparently fixed in ppp-2.4.5 but we've had some reports that this is not the case. http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=2e09ef6886bbf00bc5a9a641110f801e372ffde6 http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=f8191bf07df374f119a07910a79217c7618f113e
-rw-r--r--src/ppp-manager/nm-ppp-manager.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 13a1f2aee0..615e0c1563 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -479,6 +479,42 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
for (i = 0; i < dns->len; i++)
nm_ip4_config_add_nameserver (config, g_array_index (dns, guint, i));
+
+ /* Work around a PPP bug (#1732) which causes many mobile broadband
+ * providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers.
+ * Apparently fixed in ppp-2.4.5 but we've had some reports that this is
+ * not the case.
+ *
+ * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=2e09ef6886bbf00bc5a9a641110f801e372ffde6
+ * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=f8191bf07df374f119a07910a79217c7618f113e
+ */
+
+ if (dns->len == 2) {
+ guint32 bad_dns1 = htonl (0x0A0B0C0D);
+ guint32 good_dns1 = htonl (0x04020201); /* GTE nameserver */
+ guint32 bad_dns2 = htonl (0x0A0B0C0E);
+ guint32 good_dns2 = htonl (0x04020202); /* GTE nameserver */
+ gboolean found1 = FALSE, found2 = FALSE;
+
+ for (i = 0; i < dns->len; i++) {
+ guint32 ns = nm_ip4_config_get_nameserver (config, i);
+
+ if (ns == bad_dns1)
+ found1 = TRUE;
+ else if (ns == bad_dns2)
+ found2 = TRUE;
+ }
+
+ /* Be somewhat conservative about substitutions; the "bad" nameservers
+ * could actually be valid in some cases, so only substitute if ppp
+ * returns *only* the two bad nameservers.
+ */
+ if (found1 && found2) {
+ nm_ip4_config_reset_nameservers (config);
+ nm_ip4_config_add_nameserver (config, good_dns1);
+ nm_ip4_config_add_nameserver (config, good_dns2);
+ }
+ }
}
val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_WINS);