summaryrefslogtreecommitdiffstats
path: root/lib/network/network.pm
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-01-20 12:45:33 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-01-20 12:45:33 +0000
commit983a1c6b96950e142ef9752c61b31c359d5fcad6 (patch)
treec3afc562695b5667b912a8592d88cd0ee6d5caee /lib/network/network.pm
parent86393f41bc45f4e1f87771ad5bd4d510a0d30863 (diff)
downloaddrakx-net-983a1c6b96950e142ef9752c61b31c359d5fcad6.tar
drakx-net-983a1c6b96950e142ef9752c61b31c359d5fcad6.tar.gz
drakx-net-983a1c6b96950e142ef9752c61b31c359d5fcad6.tar.bz2
drakx-net-983a1c6b96950e142ef9752c61b31c359d5fcad6.tar.xz
drakx-net-983a1c6b96950e142ef9752c61b31c359d5fcad6.zip
Moved advanced network settings to draknetcenter, and removed draknetadvanced.
Diffstat (limited to 'lib/network/network.pm')
-rw-r--r--lib/network/network.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/network/network.pm b/lib/network/network.pm
index 8bb291d..e2bdb54 100644
--- a/lib/network/network.pm
+++ b/lib/network/network.pm
@@ -434,6 +434,40 @@ sub netprofile_read {
$net->{PROFILE} = $config->{PROFILE} || 'default';
}
+sub advanced_settings_read {
+ 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);
+ { ipv6_disabled => $ipv6_disabled, window_scaling => $window_scaling };
+}
+
+sub advanced_settings_write {
+ my ($u) = @_;
+ if ($u->{ipv6_disabled}) {
+ my $line = "install ipv6 /bin/true\n";
+ substInFile { s/^install ipv6 .*//; $_ = $line if eof } "$::prefix/etc/modprobe.conf";
+ } else {
+ substInFile { s/^install ipv6 \/bin\/true// } "$::prefix/etc/modprobe.conf";
+ }
+ if ($u->{window_scaling}) {
+ my $line = "net.ipv4.tcp_window_scaling=0\n";
+ substInFile { s/^net\.ipv4\.tcp_window_scaling=.*//; $_ = $line if eof } "$::prefix/etc/sysctl.conf";
+ } else {
+ my $line = "net.ipv4.tcp_window_scaling=1\n";
+ substInFile { s/^net\.ipv4\.tcp_window_scaling=.*//; $_ = $line if eof } "$::prefix/etc/sysctl.conf";
+ }
+}
sub advanced_choose {
my ($in, $u) = @_;