summaryrefslogtreecommitdiffstats
path: root/lib/network
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2013-12-21 03:09:24 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2013-12-21 03:09:24 +0100
commit67cbacd2c1cc61fcc8a4cb8ca2d567bebec7a814 (patch)
treee901b523010b7c089e213e8d023a1a350bbd4c5f /lib/network
parente2fed8e93c245b2fd1d4fd8059e25862c0abd47c (diff)
downloaddrakx-net-67cbacd2c1cc61fcc8a4cb8ca2d567bebec7a814.tar
drakx-net-67cbacd2c1cc61fcc8a4cb8ca2d567bebec7a814.tar.gz
drakx-net-67cbacd2c1cc61fcc8a4cb8ca2d567bebec7a814.tar.bz2
drakx-net-67cbacd2c1cc61fcc8a4cb8ca2d567bebec7a814.tar.xz
drakx-net-67cbacd2c1cc61fcc8a4cb8ca2d567bebec7a814.zip
prevent segfaulting b/c of fork vs threads (mga#12041)
the issue is that glib/gtk create threads behind us however threads & fork() don't behave well when mixed...
Diffstat (limited to 'lib/network')
-rw-r--r--lib/network/tools.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/network/tools.pm b/lib/network/tools.pm
index c80c269..c8e0cf6 100644
--- a/lib/network/tools.pm
+++ b/lib/network/tools.pm
@@ -216,8 +216,20 @@ sub get_default_connection {
return $gw_intf, get_interface_status($gw_intf), $net->{resolv}{dnsServer};
}
+#- returns the gateway address
+# advantage over get_default_connection() is that we don't fork,
+# which prevent segfaulting when glib/gtk create threads behind us (mga#12041)
+sub get_gw_address() {
+ my $gateway;
+ foreach (cat_('/proc/net/route')) {
+ $gateway = $1 if /^\S+\s+00000000\s+([0-9A-F]+)/;
+ }
+ # Linux gives it as a hex number in network byte order:
+ $gateway ? join(".", unpack "CCCC", pack "L", hex $gateway) : undef;
+}
+
sub has_network_connection() {
- (undef, undef, my $gw_address) = get_default_connection({});
+ my $gw_address = get_gw_address();
to_bool($gw_address);
}
mmit/?id=acf87105a49fcc937f98f2b21683b80eb7f9c45f'>perl_checker compliantDamien Chaumette2003-05-201-8/+7 * first bits of 9.2-0.1mdkThierry Vignaud2003-05-201-2/+6 * fix #3952: do not pass extra argument (gc alteredThierry Vignaud2003-05-201-1/+1 * - fix #3616 (draksec discarding changes)Thierry Vignaud2003-05-201-2/+2 * perl_checker fixThierry Vignaud2003-05-201-2/+2 * add a bug referenceThierry Vignaud2003-05-191-1/+1 * some drakconnect cleanupsThierry Vignaud2003-05-191-5/+2 * in standalone drakboot, raise a wait message window so that the user can figureThierry Vignaud2003-05-191-0/+2 * dialog window is already modalThierry Vignaud2003-05-191-1/+0 * - (read_location, rip_location): simplify loop condition since once we getThierry Vignaud2003-05-191-5/+3 * - (get_cups_autoconf, set_cups_autoconf, get_usermode, set_usermode): simplifyThierry Vignaud2003-05-191-72/+13 * (gimp::pop_spaces): consolidate skipping of lines that are space endedThierry Vignaud2003-05-191-8/+9 * perl_checker fixesThierry Vignaud2003-05-198-308/+297 * localize drive capabilites (aka burning, dvd managment, ...)Thierry Vignaud2003-05-191-0/+5 * fix #3560 (drakboot not updating bootloader label): the only confusingThierry Vignaud2003-05-192-3/+15 * further fix #2826 (lilo failling to handle entry with spaces): replaceThierry Vignaud2003-05-191-0/+1 * when configuring to install grub bootloader, we first install lilo, then grub.Thierry Vignaud2003-05-191-1/+1 * let further consolidate make_label_lilo_compatible()Thierry Vignaud2003-05-191-2/+2 * fix network::netconnect::save_conf() calleeThierry Vignaud2003-05-191-1/+1 * updated Spanish translationsFabián Mandelbaum2003-05-191-221/+176 * simplifyThierry Vignaud2003-05-191-5/+2 * do not drop return values from regexp but use them to ensure we do notThierry Vignaud2003-05-191-1/+1 * move expert stuff under the "advanced" button like in all other drakx/drakxto...Thierry Vignaud2003-05-191-7/+6 * %langs: first column is supposed to be localized in englishThierry Vignaud2003-05-191-3/+3 * last 9.1-38mdk bitsThierry Vignaud2003-05-191-1/+7 * update perl-gtk0 users list (drakcronat being ported to gtk+2)Thierry Vignaud2003-05-191-1/+4 * first bits of 9.1-38mdkThierry Vignaud2003-05-161-2/+5 * updated pot filePablo Saratxaga2003-05-16