Mailinglist Archive: yast-devel (45 mails)

< Previous Next >
[yast-devel] [PATCH] Fix setting the IP address and PREFIXLEN via YaPI
Hey everyone :)

I noticed that the ipaddr wasn't decomposed into IP and prefix in
writeInterfaces so the IPADDR field contained both the IP and the
prefix and the PREFIXLEN was left empty.

This seems to cause little problems in practice since most of the time
both variables are concatenated again, but if you set the IP address
using YaPI and read it out again (also using YaPI) you ended up with a
string containing an extra trailing /. I think this is why the yast web
client code contains lots of .delete("/") in network_controller.rb.

The attached patch fixes this problem.

Cheers,
Justus
--
Justus Winter winter@xxxxxxxxxxxx

PRESENSE Technologies GmbH Sachsenstr. 5, D-20097 HH
USt-IdNr.: DE263765024
Geschäftsführer/Managing Directors AG Hamburg, HRB 107844
Till Dörges Jürgen Sander Axel Theilmann

# HG changeset patch
# Parent 2f83742a71af18becb7a83d7eee8fb8f33fca222

diff -r 2f83742a71af network/src/lan/YaPI/NETWORK.pm
--- a/network/src/lan/YaPI/NETWORK.pm Mon Jul 18 13:25:42 2011 +0000
+++ b/network/src/lan/YaPI/NETWORK.pm Mon Jul 25 17:13:30 2011 +0200
@@ -146,10 +146,10 @@
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" => $ip
+ "IPADDR" => $ip_row[0],
+ "PREFIXLEN" => $prefix
);
NetworkInterfaces->Current(\%config);
NetworkInterfaces->Commit();
< Previous Next >
Follow Ups