Re: [PATCH] Allow loader to re-prompt for networking when network activation fails

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

 



Looks good to me. It is a fragile part of code, but you
gave it a lot of testing, so ack from me.

On 11/02/2010 09:42 PM, James Laska wrote:
---
  loader/loader.c |   29 +++++++++++++++++++++++++++--
  loader/net.c    |   20 ++++++++++++++------
  2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index f9d5483..4675bb8 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1482,6 +1482,8 @@ static void doLoaderMain(struct loaderData_s *loaderData,
                  if (rc == LOADER_BACK || rc == LOADER_ERROR || (dir == -1&&  rc == LOADER_NOOP)) {
                      step = STEP_METHOD;
                      dir = -1;
+                    /* Clear current device selection so we prompt on re-entry to STEP_IFACE */
+                    loaderData->netDev_set = 0;
                      break;
                  }

@@ -1505,7 +1507,6 @@ static void doLoaderMain(struct loaderData_s *loaderData,
                      doExit(EXIT_FAILURE);
                  }

-                logMessage(INFO, "going to do getNetConfig");

                  /* s390 provides all config info by way of linuxrc.s390 */
                  if (FL_HAVE_CMSCONF(flags)) {
@@ -1516,7 +1517,9 @@ static void doLoaderMain(struct loaderData_s *loaderData,
                  }

                  /* populate netDev based on any kickstart data */
+                logMessage(DEBUGLVL, "in doLoaderMain, calling setupIfaceStruct()");
                  setupIfaceStruct(&iface, loaderData);
+                logMessage(DEBUGLVL, "in doLoaderMain, calling readNetConfig()");
                  rc = readNetConfig(devName,&iface, loaderData->netCls, loaderData->method);

                  /* set the hostname if we have that */
@@ -1531,15 +1534,37 @@ static void doLoaderMain(struct loaderData_s *loaderData,
                  free(ret);
                  ret = NULL;

+                /* Go to STEP_IFACE */
                  if (rc == LOADER_BACK || (dir == -1&&  rc == LOADER_NOOP)) {
                      needsNetwork = 1;
                      step = STEP_IFACE;
                      dir = -1;
+
+                   /* Clear out netDev_set so we prompt the user in
+                    * STEP_IFACE */
+                   loaderData->netDev_set = 0;
+                   /* Clear ipinfo_set so we prompt the user in when they
+                    * return to STEP_IP */
+                   loaderData->ipinfo_set = 0;
+#ifdef ENABLE_IPV6
+                   loaderData->ipv6info_set = 0;
+#endif
+                   logMessage(DEBUGLVL, "in STEP_IP, going to STEP_IFACE (LOADER_BACK)");
+
                      break;
                  }
-                /* retry */
+                /* Retry STEP_IP */
                  if (rc == LOADER_ERROR) {
                      needsNetwork = 1;
+
+                   /* Don't retry the same failed settings.  Clear ipinfo-set
+                    * so the user can enter new data */
+                   loaderData->ipinfo_set = 0;
+#ifdef ENABLE_IPV6
+                   loaderData->ipv6info_set = 0;
+#endif
+                   logMessage(DEBUGLVL, "in STEP_IP, retry (LOADER_ERROR)");
+
                      break;
                  }

diff --git a/loader/net.c b/loader/net.c
index 1f0c2a9..b0d6f46 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -513,7 +513,10 @@ int readNetConfig(char * device, iface_t * iface,
              newtWinMessage(_("Network Error"), _("Retry"),
                             _("There was an error configuring your network "
                               "interface."));
-            return LOADER_BACK;
+            /* Clear out ip selections to allow for re-entry */
+            iface->ipv4method = IPV4_UNUSED_METHOD;
+            iface->ipv6method = IPV6_UNUSED_METHOD;
+            return LOADER_ERROR;
          }

          return LOADER_NOOP;
@@ -568,6 +571,7 @@ int readNetConfig(char * device, iface_t * iface,
          newtWinMessage(_("Network Error"), _("Retry"),
                         _("There was an error configuring your network "
                           "interface."));
+        /* Clear out selections to allow for re-entry */
          iface->ipv4method = IPV4_UNUSED_METHOD;
          iface->ipv6method = IPV6_UNUSED_METHOD;
          return LOADER_ERROR;
@@ -676,17 +680,19 @@ int configureTCPIP(char * device, iface_t * iface,
       *     ip=<val>  noipv6
       *     ipv6=<val>  noipv4
       */
-    if ((FL_IP_PARAM(flags)&&  FL_IPV6_PARAM(flags)) ||
-        (FL_IP_PARAM(flags)&&  FL_NOIPV6(flags)) ||
-        (FL_IPV6_PARAM(flags)&&  FL_NOIPV4(flags)) ||
-        (FL_NOIPV4(flags)&&  FL_NOIPV6(flags))) {
+    if ((iface->ipv4method>  IPV4_UNUSED_METHOD&&  iface->ipv6method>  IPV6_UNUSED_METHOD) || /* both */
+        (iface->ipv4method>  IPV4_UNUSED_METHOD&&  FL_NOIPV6(flags)) || /* only ipv4 */
+        (FL_NOIPV4(flags)&&  iface->ipv6method>  IPV6_UNUSED_METHOD) || /* only ipv6 */
+        (FL_NOIPV4(flags)&&  FL_NOIPV6(flags))) { /* neither ipv4 or ipv6 -- what else? */
          skipForm = 1;
          newtPopWindow();
+        logMessage(DEBUGLVL, "in configureTCPIP(), detected network boot args, skipping form");
      }
  #else
-    if (FL_IP_PARAM(flags) || FL_NOIPV4(flags)) {
+    if (iface->ipv4method>  IPV4_UNUSED_METHOD || FL_NOIPV4(flags)) {
          skipForm = 1;
          newtPopWindow();
+        logMessage(DEBUGLVL, "in configureTCPIP(), detected network boot args, skipping form");
      }
  #endif

@@ -2101,7 +2107,9 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
                             __func__, rc);
              }

+            /* Forget network device so we prompt the user */
              loaderData->netDev_set = 0;
+            /* Forget IP information so we prompt the user */
              loaderData->ipinfo_set = 0;
              free(loaderData->ipv4);
              loaderData->ipv4 = NULL;

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[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