Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] r58793 - /trunk/network/src/lan/YaPI/NETWORK.pm
  • From: mzugec@xxxxxxxxxxxxxxxx
  • Date: Fri, 25 Sep 2009 18:19:06 -0000
  • Message-id: <E1MrFNq-0003RR-Ut@xxxxxxxxxxxxxxxx>
Author: mzugec
Date: Fri Sep 25 20:19:06 2009
New Revision: 58793

URL: http://svn.opensuse.org/viewcvs/yast?rev=58793&view=rev
Log:
YaPI: convert NETMASK to PREFIXLEN

Modified:
trunk/network/src/lan/YaPI/NETWORK.pm

Modified: trunk/network/src/lan/YaPI/NETWORK.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/YaPI/NETWORK.pm?rev=58793&r1=58792&r2=58793&view=diff
==============================================================================
--- trunk/network/src/lan/YaPI/NETWORK.pm (original)
+++ trunk/network/src/lan/YaPI/NETWORK.pm Fri Sep 25 20:19:06 2009
@@ -107,20 +107,23 @@
if (exists($args->{'interface'})){
y2milestone("interface", Dumper(\$args->{'interface'}));
foreach my $dev (keys %{$args->{'interface'}}){
-# YaST::YCP::Import ("LanItems");
-# LanItems->Read();
-# foreach my $iface (keys %{LanItems->Items}){
-# LanItems->current($iface);
-# LanItems->DeleteItem();
-# }
-# LanItems->Write();
YaST::YCP::Import ("NetworkInterfaces");
NetworkInterfaces->Read();
NetworkInterfaces->Add() unless NetworkInterfaces->Edit($dev);
NetworkInterfaces->Name($dev);
+ my $ip = $args->{'interface'}->{$dev}->{'ipaddr'};
+ my $prefix="32";
+ YaST::YCP::Import ("Netmask");
+ my @ip_row = split(/\//, $ip);
+ my $prefix = $ip_row[$#ip_row];
+ if (Netmask->Check4($prefix)){
+ y2milestone("Valid netmask: ", $prefix, " will change to
prefixlen");
+ $prefix = Netmask->ToBits($prefix);
+ }
+ $ip = $ip_row[0]."/".$prefix;
my %config=("STARTMODE" => "auto",
"BOOTPROTO" =>
$args->{'interface'}->{$dev}->{'bootproto'},
- "IPADDR" => $args->{'interface'}->{$dev}->{'ipaddr'}
+ "IPADDR" => $ip
);
NetworkInterfaces->Current(\%config);
NetworkInterfaces->Commit();

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages