Need to support CIDR prefix at Add iSCSI target setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

After I sent you the netconfig_dialog.py.diff yesterday,
I think that it is better that anaconda supports
CIDR prefix at Add iSCSI target setup.
(I'm sorry for bothering you.)

Would you review my additional patch, please ?

thanks,

diff -u -r1.10 netconfig_dialog.py
--- iw/netconfig_dialog.py      22 Jun 2007 12:55:01 -0000      1.10
+++ iw/netconfig_dialog.py      22 Jun 2007 14:02:50 -0000
@@ -194,15 +194,29 @@
                 self._handleIPError(_("IP Address"), msg)
                 return

-            try:
-                network.sanityCheckIPString(ipv4nm)
-                netdev.set(('netmask', ipv4nm))
-            except network.IPMissing, msg:
-                self._handleIPMissing(_("Netmask"), msg)
-                return
-            except network.IPError, msg:
-                self._handleIPError(_("Netmask"), msg)
-                return
+            if ipv4nm.find('.') == -1:
+                # user provided a CIDR prefix
+                try:
+                    if int(ipv4nm) > 32 or int(ipv4nm) < 0:
+                        msg = _("IPv4 prefix must be between 0 and 32.")
+                        self._handleIPError(_("Netmask"), msg)
+                        return
+                    else:
+                        ipv4nm = isys.prefix2netmask(int(ipv4nm))
+                except:
+                    self._handleIPMissing(_("Netmask"), msg)
+                    return
+            else:
+                # user provided a dotted-quad netmask
+                try:
+                    network.sanityCheckIPString(ipv4nm)
+                    netdev.set(('netmask', ipv4nm))
+                except network.IPMissing, msg:
+                    self._handleIPMissing(_("Netmask"), msg)
+                    return
+                except network.IPError, msg:
+                    self._handleIPError(_("Netmask"), msg)
+                    return

             try:
                 network.sanityCheckIPString(gateway)


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux