diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-01-19 23:50:42 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-01-19 23:50:42 +0000 |
commit | 86393f41bc45f4e1f87771ad5bd4d510a0d30863 (patch) | |
tree | 41b2e1ffcbaaaa9c26e326ffd2d7dbe0b8cb2ab0 | |
parent | 2962ff3054e268200e8750f8b82dcd3a09926d0e (diff) | |
download | drakx-net-86393f41bc45f4e1f87771ad5bd4d510a0d30863.tar drakx-net-86393f41bc45f4e1f87771ad5bd4d510a0d30863.tar.gz drakx-net-86393f41bc45f4e1f87771ad5bd4d510a0d30863.tar.bz2 drakx-net-86393f41bc45f4e1f87771ad5bd4d510a0d30863.tar.xz drakx-net-86393f41bc45f4e1f87771ad5bd4d510a0d30863.zip |
- Added draknetadvanced to control advanced network parameters
such as IPv6 and TCP Window Scaling (#27070, #28829, #33623, #38662).
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rwxr-xr-x | bin/draknetadvanced | 77 | ||||
-rw-r--r-- | lib/network/network.pm | 13 |
4 files changed, 96 insertions, 2 deletions
@@ -1,5 +1,5 @@ NAME = drakx-net -VERSION = 0.57 +VERSION = 0.58 DESTDIR= libdir=/usr/lib @@ -15,7 +15,7 @@ pamdir=/etc/pam.d consoleappsdir=/etc/security/console.apps BIN_TOOLS= net_applet -SBIN_TOOLS=drakconnect drakfirewall drakgw drakhosts drakids drakinvictus draknetprofile draknfs drakproxy drakroam draksambashare drakvpn net_monitor draknetcenter +SBIN_TOOLS=drakconnect drakfirewall drakgw drakhosts drakids drakinvictus draknetprofile draknfs drakproxy draknetadvanced drakroam draksambashare drakvpn net_monitor draknetcenter all: (find lib -name '*.pm'; find bin -type f) | xargs perl -pi -e 's/\s*use\s+(diagnostics|vars|strict).*//g' @@ -1,3 +1,7 @@ +0.58: +- Added draknetadvanced to control advanced network parameters + such as IPv6 and TCP Window Scaling (#27070, #28829, #33623, #38662). + 0.57: - firewall: o fixed issue with drakfirewall not saving settings (#46256) diff --git a/bin/draknetadvanced b/bin/draknetadvanced new file mode 100755 index 0000000..9c88040 --- /dev/null +++ b/bin/draknetadvanced @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +# DrakNetAdvanced + +# Copyright (C) 2009 Mandriva (eugeni@mandriva.com) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +use lib qw(/usr/lib/libDrakX); + +# i18n: IMPORTANT: to get correct namespace (drakx-net instead of libDrakX) +BEGIN { unshift @::textdomains, 'drakx-net' } +use standalone; #- warning, standalone must be loaded very first, for 'explanations' +use interactive; +use network::network; +use any; +use common; + +sub replace_in_file { + my ($f, $old, $new) = @_; + my @lines; + foreach (cat_($f)) { + # remove + /$old/ or push(@lines, $_); + } + open(my $F, ">$f") or die "output in file $f failed: $!\n"; + foreach (@lines) { + print $F $_; + } + # saving new line + $new and print $F $new."\n"; + close($F); +} + +$ugtk2::wm_icon = "/usr/share/mcc/themes/default/drakproxy-mdk.png"; +my $modprobe = "$::prefix/etc/modprobe.conf"; +my $sysctl = "$::prefix/etc/sysctl.conf"; + +# ipv6 +my $ipv6_disabled=0; +foreach (cat_($modprobe)) { + /^install ipv6 \/bin\/true$/ and $ipv6_disabled=1; +} cat_($modprobe); + +# sysctl +my $window_scaling=0; +foreach (cat_($sysctl)) { + /^net\.ipv4\.tcp_window_scaling\s*=\s*0/ and $window_scaling=1; +} cat_($modprobe); + +my $u = { ipv6_disabled => $ipv6_disabled, window_scaling => $window_scaling }; +my $in = 'interactive'->vnew('su'); +if (network::network::advanced_choose($in, $u)) { + if ($u->{ipv6_disabled}) { + replace_in_file("$::prefix/etc/modprobe.conf", "^install ipv6", "install ipv6 \/bin\/true"); + } else { + replace_in_file("$::prefix/etc/modprobe.conf", "^install ipv6 \/bin\/true"); + } + if ($u->{window_scaling}) { + replace_in_file("$::prefix/etc/sysctl.conf", "^net.ipv4.tcp_window_scaling", "net.ipv4.tcp_window_scaling=0"); + } else { + replace_in_file("$::prefix/etc/sysctl.conf", "net\.ipv4\.tcp_window_scaling", "net.ipv4.tcp_window_scaling=1"); + } +} +$in->exit(0); diff --git a/lib/network/network.pm b/lib/network/network.pm index 587efeb..8bb291d 100644 --- a/lib/network/network.pm +++ b/lib/network/network.pm @@ -435,6 +435,19 @@ sub netprofile_read { } +sub advanced_choose { + my ($in, $u) = @_; + + my $use_http_for_https = $u->{https_proxy} eq $u->{http_proxy}; + $in->ask_from(N("Advanced network settings"), + N("Here you can configure advanced network settings"), + [ { text => N("Disable IPv6"), val => \$u->{ipv6_disabled}, type => "bool" }, + { text => N("Disable TCP Window Scaling"), val => \$u->{window_scaling}, type => "bool"}, + ] + ) or return; + 1; +} + sub miscellaneous_choose { my ($in, $u) = @_; |