ref: refs/heads/network
commit 409cd7667168c6d03628ef0cc3b78f1fb280a54f
Author: Michal Zugec
Date: Mon Sep 28 21:56:38 2009 +0200
correctly handle netmask/prefixlen (bnc#539889)
---
.../network/app/controllers/network_controller.rb | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/plugins/network/app/controllers/network_controller.rb b/plugins/network/app/controllers/network_controller.rb
index 65c8f46..8c82060 100644
--- a/plugins/network/app/controllers/network_controller.rb
+++ b/plugins/network/app/controllers/network_controller.rb
@@ -50,26 +50,20 @@ class NetworkController < ApplicationController
ipaddr = "-/-"
end
@ip, @netmask = ipaddr.split "/"
-
+ # when detect PREFIXLEN with leading "/"
+ @netmask = "/"+@netmask if ifc.bootproto == "static" && @netmask.to_i >= 0 && @netmask.to_i <= 32
+
@name = hn.name
@domain = hn.domain
@nameservers = dns.nameservers
@searchdomains = dns.searches
@default_route = rt.via
- #FIXME: this is ugly and keys are duplicated, but otherwise seems it doesn't work
- @conf_modes = [["",""], ["static","static"], ["dhcp", "dhcp"]]
- # if unknown item, just add it into list
- found = false
- @conf_modes.each {|a| found=true if a[0] == @conf_mode}
- @conf_modes << [@conf_mode, @conf_mode] if !found
+ @conf_modes = {""=>"", _("static")=>"static", _("dhcp")=>"dhcp"}
+ @conf_modes[@conf_mode] ||=@conf_mode
end
- # GET /users/1/edit
- def edit
- end
-
# PUT /users/1
# PUT /users/1.xml
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org