[master 1/2] Re-enable all IPv6 support in loader.

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

 



This includes support in command line parameter parsing, GUI and network config
file generation.

At the moment the NetworkManager is missing support for IPv6 thus the change can
not be reasonably tested. It however needs to make it into RHEL6 rebase.
---
 loader/loader.c |   16 ------------
 loader/loader.h |   12 +--------
 loader/net.c    |   74 +------------------------------------------------------
 loader/net.h    |    6 ----
 4 files changed, 2 insertions(+), 106 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index cd3e178..449d5e0 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -835,7 +835,6 @@ static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv)
         flags |= LOADER_FLAGS_IP_PARAM;
 }
 
-#ifdef ENABLE_IPV6
 /*
  * parse anaconda ipv6= arguments
  */
@@ -860,7 +859,6 @@ static void parseCmdLineIpv6(struct loaderData_s * loaderData, char *argv)
 
     return;
 }
-#endif
 
 static long argToLong(char *arg, int offset) {
     long retval;
@@ -967,10 +965,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             flags |= LOADER_FLAGS_SERIAL;
         else if (!strcasecmp(argv[i], "noipv4"))
             flags |= LOADER_FLAGS_NOIPV4;
-#ifdef ENABLE_IPV6
         else if (!strcasecmp(argv[i], "noipv6"))
             flags |= LOADER_FLAGS_NOIPV6;
-#endif
         else if (!strcasecmp(argv[i], "kssendmac"))
             flags |= LOADER_FLAGS_KICKSTART_SEND_MAC;
         else if (!strcasecmp(argv[i], "kssendsn"))
@@ -1057,10 +1053,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             loaderData->hostname = strdup(argv[i] + 9);
         else if (!strncasecmp(argv[i], "ip=", 3))
             parseCmdLineIp(loaderData, argv[i]);
-#ifdef ENABLE_IPV6
         else if (!strncasecmp(argv[i], "ipv6=", 5))
             parseCmdLineIpv6(loaderData, argv[i]);
-#endif
         else if (!strncasecmp(argv[i], "netmask=", 8))
             loaderData->netmask = strdup(argv[i] + 8);
         else if (!strncasecmp(argv[i], "gateway=", 8))
@@ -1464,9 +1458,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
 
                 if (FL_HAVE_CMSCONF(flags)) {
                     loaderData->ipinfo_set = 1;
-#ifdef ENABLE_IPV6
                     loaderData->ipv6info_set = 1;
-#endif
                 }
 
                 rc = chooseNetworkInterface(loaderData);
@@ -1506,9 +1498,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
                 /* s390 provides all config info by way of the CMS conf file */
                 if (FL_HAVE_CMSCONF(flags)) {
                     loaderData->ipinfo_set = 1;
-#ifdef ENABLE_IPV6
                     loaderData->ipv6info_set = 1;
-#endif
                 }
 
                 /* populate netDev based on any kickstart data */
@@ -1559,9 +1549,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
                 if (!url) {
                     step = STEP_IP;
                     loaderData->ipinfo_set = 0;
-#ifdef ENABLE_IPV6
                     loaderData->ipv6info_set = 0;
-#endif
                     loaderData->method = -1;
                     skipMethodDialog = 0;
                     dir = -1;
@@ -1928,10 +1916,8 @@ int main(int argc, char ** argv) {
     mlLoadModuleSet("floppy:edd:pcspkr:iscsi_ibft");
 #endif
 
-#ifdef ENABLE_IPV6
     if (!FL_NOIPV6(flags))
         mlLoadModule("ipv6", NULL);
-#endif
 
     /* now let's do some initial hardware-type setup */
     dasdSetup();
@@ -2142,10 +2128,8 @@ int main(int argc, char ** argv) {
     if (FL_NOIPV4(flags))
         *argptr++ = "--noipv4";
 
-#ifdef ENABLE_IPV6
     if (FL_NOIPV6(flags))
         *argptr++ = "--noipv6";
-#endif
 
     if (FL_KICKSTART(flags)) {
         *argptr++ = "--kickstart";
diff --git a/loader/loader.h b/loader/loader.h
index ebf3766..91f581e 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -58,13 +58,9 @@
 #define LOADER_FLAGS_CMDLINE            (((uint64_t) 1) << 28)
 #define LOADER_FLAGS_GRAPHICAL          (((uint64_t) 1) << 29)
 #define LOADER_FLAGS_NOIPV4             (((uint64_t) 1) << 31)
-#ifdef ENABLE_IPV6
 #define LOADER_FLAGS_NOIPV6             (((uint64_t) 1) << 32)
-#endif
 #define LOADER_FLAGS_IP_PARAM           (((uint64_t) 1) << 33)
-#ifdef ENABLE_IPV6
 #define LOADER_FLAGS_IPV6_PARAM         (((uint64_t) 1) << 34)
-#endif
 #define LOADER_FLAGS_IS_KICKSTART       (((uint64_t) 1) << 35)
 #define LOADER_FLAGS_ALLOW_WIRELESS     (((uint64_t) 1) << 36)
 #define LOADER_FLAGS_HAVE_CMSCONF       (((uint64_t) 1) << 37)
@@ -95,13 +91,9 @@
 #define FL_VIRTPCONSOLE(a)       ((a) & LOADER_FLAGS_VIRTPCONSOLE)
 #define FL_ASKNETWORK(a)         ((a) & LOADER_FLAGS_ASKNETWORK)
 #define FL_NOIPV4(a)             ((a) & LOADER_FLAGS_NOIPV4)
-#ifdef ENABLE_IPV6
 #define FL_NOIPV6(a)             ((a) & LOADER_FLAGS_NOIPV6)
-#endif
 #define FL_IP_PARAM(a)           ((a) & LOADER_FLAGS_IP_PARAM)
-#ifdef ENABLE_IPV6
 #define FL_IPV6_PARAM(a)         ((a) & LOADER_FLAGS_IPV6_PARAM)
-#endif
 #define FL_IS_KICKSTART(a)       ((a) & LOADER_FLAGS_IS_KICKSTART)
 #define FL_ALLOW_WIRELESS(a)     ((a) & LOADER_FLAGS_ALLOW_WIRELESS)
 #define FL_HAVE_CMSCONF(a)       ((a) & LOADER_FLAGS_HAVE_CMSCONF)
@@ -131,10 +123,8 @@ struct loaderData_s {
     char * netCls;
     int netCls_set;
     char *ipv4, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot, *layer2, *portno, *macaddr;
-#ifdef ENABLE_IPV6
-    char *ipv6;
+    char *ipv6, *gateway6;
     int ipv6info_set;
-#endif
     int mtu;
     int noDns;
     int dhcpTimeout;
diff --git a/loader/net.c b/loader/net.c
index 43de50f..c3a6a75 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -87,7 +87,6 @@ static void cidrCallback(newtComponent co, void * dptr) {
 
         if (strcmp(data->ipv4, ""))
             upper = 32;
-#ifdef ENABLE_IPV6
     } else if (co == data->cidr6Entry) {
         if (data->cidr6 == NULL && data->ipv6 == NULL)
             return;
@@ -102,7 +101,6 @@ static void cidrCallback(newtComponent co, void * dptr) {
 
         if (strcmp(data->ipv6, ""))
             upper = 128;
-#endif
     }
 
     if (upper != 0) {
@@ -146,11 +144,9 @@ static void ipCallback(newtComponent co, void * dptr) {
         }
 
         return;
-#ifdef ENABLE_IPV6
     } else if (co == data->ipv6Entry) {
         /* users must provide a mask, we can't guess for ipv6 */
         return;
-#endif
     }
 }
 
@@ -171,12 +167,10 @@ static void v4MethodCallback(newtComponent co, void *dptr) {
     return;
 }
 
-#ifdef ENABLE_IPV6
 static void v6MethodCallback(newtComponent co, void *dptr) {
     setMethodSensitivity(dptr, 3);
     return;
 }
-#endif
 
 static void parseEthtoolSettings(struct loaderData_s * loaderData) {
     char * option, * buf;
@@ -287,11 +281,10 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) {
         }
     }
 
-#ifdef ENABLE_IPV6
     if (loaderData->ipv6info_set && loaderData->ipv6 != NULL) {
         if (!strncmp(loaderData->ipv6, "dhcp", 4)) {
             iface->ipv6method = IPV6_DHCP_METHOD;
-        } else if (!strcmp(loaderData->ipv6, "auto", 4)) {
+        } else if (!strncmp(loaderData->ipv6, "auto", 4)) {
             iface->ipv6method = IPV6_AUTO_METHOD;
         } else if (inet_pton(AF_INET6, loaderData->ipv6, &addr6) >= 1) {
             memcpy(&iface->ip6addr, &addr6, sizeof(struct in6_addr));
@@ -309,7 +302,6 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) {
                        strerror(errno));
         }
     }
-#endif
 
     /* iBFT configured DNS */
     if(iface->ipv4method == IPV4_IBFT_METHOD){
@@ -429,18 +421,14 @@ int readNetConfig(char * device, iface_t * iface,
     ipcomps.ipv4 = NULL;
     ipcomps.cidr4 = NULL;
     ipcomps.gw = NULL;
-#ifdef ENABLE_IPV6
     ipcomps.ipv6 = NULL;
     ipcomps.cidr6 = NULL;
     ipcomps.gw6 = NULL;
-#endif
     ipcomps.ns = NULL;
 
     /* init opts */
     opts.ipv4Choice = 0;
-#ifdef ENABLE_IPV6
     opts.ipv6Choice = 0;
-#endif
 
     /* JKFIXME: we really need a way to override this and be able to change
      * our network config */
@@ -541,9 +529,7 @@ int configureTCPIP(char * device, iface_t * iface,
     int i = 0, z = 0, skipForm = 0, ret;
     newtComponent f, okay, back, answer;
     newtComponent ipv4Checkbox, v4Method[2];
-#ifdef ENABLE_IPV6
     newtComponent ipv6Checkbox, v6Method[3];
-#endif
     newtGrid grid, checkgrid, buttons;
 
     /* UI WINDOW 1: ask for ipv4 choice, ipv6 choice, and conf methods */
@@ -561,7 +547,6 @@ int configureTCPIP(char * device, iface_t * iface,
     v4Method[0] = newtRadiobutton(-1, -1, DHCP_METHOD_STR, 1, NULL);
     v4Method[1] = newtRadiobutton(-1, -1, MANUAL_METHOD_STR, 0, v4Method[0]);
 
-#ifdef ENABLE_IPV6
     /* IPv6 checkbox */
     if (!opts->ipv6Choice) {
         if (FL_NOIPV6(flags) && !FL_IPV6_PARAM(flags))
@@ -575,17 +560,12 @@ int configureTCPIP(char * device, iface_t * iface,
     v6Method[0] = newtRadiobutton(-1, -1, AUTO_METHOD_STR, 1, NULL);
     v6Method[1] = newtRadiobutton(-1, -1, DHCPV6_METHOD_STR, 0, v6Method[0]);
     v6Method[2] = newtRadiobutton(-1, -1, MANUAL_METHOD_STR, 0, v6Method[1]);
-#endif
 
     /* button bar at the bottom of the window */
     buttons = newtButtonBar(_("OK"), &okay, _("Back"), &back, NULL);
 
     /* checkgrid contains the toggle options for net configuration */
-#ifdef ENABLE_IPV6
     checkgrid = newtCreateGrid(1, 8);
-#else
-    checkgrid = newtCreateGrid(1, 3);
-#endif
 
     newtGridSetField(checkgrid, 0, 0, NEWT_GRID_COMPONENT, ipv4Checkbox,
                      0, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
@@ -593,13 +573,11 @@ int configureTCPIP(char * device, iface_t * iface,
         newtGridSetField(checkgrid, 0, i, NEWT_GRID_COMPONENT, v4Method[i-1],
                          7, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
 
-#ifdef ENABLE_IPV6
     newtGridSetField(checkgrid, 0, 4, NEWT_GRID_COMPONENT, ipv6Checkbox,
                      0, 1, 0, 0, NEWT_ANCHOR_LEFT, 0);
     for (i = 5; i < 8; i++)
         newtGridSetField(checkgrid, 0, i, NEWT_GRID_COMPONENT, v6Method[i-5],
                          7, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
-#endif
 
     /* main window layout */
     grid = newtCreateGrid(1, 2);
@@ -615,20 +593,15 @@ int configureTCPIP(char * device, iface_t * iface,
 
     /* callbacks */
     newtComponentAddCallback(ipv4Checkbox, v4MethodCallback, &v4Method);
-#ifdef ENABLE_IPV6
     newtComponentAddCallback(ipv6Checkbox, v6MethodCallback, &v6Method);
-#endif
 
     /* match radio button sensitivity to initial checkbox choices */
     if (opts->ipv4Choice == ' ')
         setMethodSensitivity(&v4Method, 2);
 
-#ifdef ENABLE_IPV6
     if (opts->ipv6Choice == ' ')
         setMethodSensitivity(&v6Method, 3);
-#endif
 
-#ifdef ENABLE_IPV6
     /* If the user provided any of the following boot paramters, skip
      * prompting for network configuration information:
      *     ip=<val> ipv6=<val>
@@ -643,12 +616,6 @@ int configureTCPIP(char * device, iface_t * iface,
         skipForm = 1;
         newtPopWindow();
     }
-#else
-    if (FL_IP_PARAM(flags) || FL_NOIPV4(flags)) {
-        skipForm = 1;
-        newtPopWindow();
-    }
-#endif
 
     /* run the form */
     do {
@@ -662,11 +629,7 @@ int configureTCPIP(char * device, iface_t * iface,
             }
 
             /* need at least one stack */
-#ifdef ENABLE_IPV6
             if (opts->ipv4Choice == ' ' && opts->ipv6Choice == ' ') {
-#else
-            if (opts->ipv4Choice == ' ') {
-#endif
                 newtWinMessage(_("Missing Protocol"), _("Retry"),
                                _("You must select at least one protocol (IPv4 "
                                  "or IPv6)."));
@@ -691,7 +654,6 @@ int configureTCPIP(char * device, iface_t * iface,
             flags |= LOADER_FLAGS_NOIPV4;
         }
 
-#ifdef ENABLE_IPV6
         if (opts->ipv6Choice == '*') {
             flags &= ~LOADER_FLAGS_NOIPV6;
             for (z = IPV6_FIRST_METHOD; z <= IPV6_LAST_METHOD; z++)
@@ -700,26 +662,16 @@ int configureTCPIP(char * device, iface_t * iface,
         } else {
             flags |= LOADER_FLAGS_NOIPV6;
         }
-#endif
 
         /* do interface configuration (call DHCP here, or return for manual) */
-#ifdef ENABLE_IPV6
         if ((!FL_NOIPV4(flags) && iface->ipv4method == IPV4_DHCP_METHOD) ||
             (!FL_NOIPV6(flags) && (iface->ipv6method == IPV6_AUTO_METHOD ||
                                    iface->ipv6method == IPV6_DHCP_METHOD))) {
-#else
-        if (!FL_NOIPV4(flags) && iface->ipv4method == IPV4_DHCP_METHOD) {
-#endif
             /* DHCP selected, exit the loop */
             ret = LOADER_NOOP;
             i = 1;
-#ifdef ENABLE_IPV6
         } else if ((!FL_NOIPV4(flags) && iface->ipv4method == IPV4_MANUAL_METHOD) ||
                    (!FL_NOIPV6(flags) && iface->ipv6method == IPV6_MANUAL_METHOD)) {
-#else
-        } else if (!FL_NOIPV4(flags) && iface->ipv4method == IPV4_MANUAL_METHOD) {
-#endif
-
             /* manual IP configuration selected */
             ret = LOADER_OK;
             i = 1;
@@ -737,17 +689,13 @@ int manualNetConfig(char * device, iface_t * iface,
     char *buf = NULL;
     char ret[48];
     struct in_addr addr;
-#ifdef ENABLE_IPV6
     struct in6_addr addr6;
     int prefix;
-#endif
     struct in_addr *tmpaddr = NULL;
     newtComponent f, okay, back, answer;
     newtGrid egrid = NULL;
     newtGrid qgrid = NULL;
-#ifdef ENABLE_IPV6
     newtGrid rgrid = NULL;
-#endif
     newtGrid buttons, grid;
     newtComponent text = NULL;
 
@@ -756,10 +704,8 @@ int manualNetConfig(char * device, iface_t * iface,
     /* so we don't perform this test over and over */
     stack[IPV4] = opts->ipv4Choice == '*' &&
                   iface->ipv4method == IPV4_MANUAL_METHOD;
-#ifdef ENABLE_IPV6
     stack[IPV6] = opts->ipv6Choice == '*' &&
                   iface->ipv6method == IPV6_MANUAL_METHOD;
-#endif
 
     /* UI WINDOW 2 (optional): manual IP config for non-DHCP installs */
     rows = 2;
@@ -838,7 +784,6 @@ int manualNetConfig(char * device, iface_t * iface,
         pos++;
     }
 
-#ifdef ENABLE_IPV6
     /* IPv6 entry items */
     if (stack[IPV6]) {
         newtGridSetField(egrid, 0, pos, NEWT_GRID_COMPONENT,
@@ -901,7 +846,6 @@ int manualNetConfig(char * device, iface_t * iface,
 
         pos++;
     }
-#endif
 
     /* common entry items */
     ipcomps->gwEntry = newtEntry(-1, -1, NULL, 41, &ipcomps->gw, 0);
@@ -1027,7 +971,6 @@ int manualNetConfig(char * device, iface_t * iface,
             }
         }
 
-#ifdef ENABLE_IPV6
         /* collect IPv6 data */
         if (stack[IPV6]) {
             if (ipcomps->ipv6) {
@@ -1056,7 +999,6 @@ int manualNetConfig(char * device, iface_t * iface,
                 }
             }
         }
-#endif
 
         /* collect common network settings */
         if (ipcomps->gw) {
@@ -1073,12 +1015,8 @@ int manualNetConfig(char * device, iface_t * iface,
 
         /* gather nameservers */
         if (ipcomps->ns) {
-#ifdef ENABLE_IPV6
             if ((inet_pton(AF_INET, ipcomps->ns, &addr) >= 1) ||
                 (inet_pton(AF_INET6, ipcomps->ns, &addr6) >= 1)) {
-#else
-            if (inet_pton(AF_INET, ipcomps->ns, &addr) >= 1) {
-#endif
                 iface->dns[0] = strdup(ipcomps->ns);
                 if (iface->numdns < 1)
                     iface->numdns = 1;
@@ -1100,13 +1038,11 @@ int manualNetConfig(char * device, iface_t * iface,
                              "network mask or CIDR prefix."));
         }
 
-#ifdef ENABLE_IPV6
         if (stack[IPV6] && have[IPV6] != 2) {
             newtWinMessage(_("Missing Information"), _("Retry"),
                            _("You must enter both a valid IPv6 address and a "
                              "CIDR prefix."));
         }
-#endif
 
         strcpy(iface->device, device);
     }
@@ -1331,7 +1267,6 @@ int writeEnabledNetInfo(iface_t *iface) {
         }
     }
 
-#ifdef ENABLE_IPV6
     if (!FL_NOIPV6(flags)) {
         if (iface->ipv6method == IPV6_AUTO_METHOD ||
             iface->ipv6method == IPV6_DHCP_METHOD ||
@@ -1371,7 +1306,6 @@ int writeEnabledNetInfo(iface_t *iface) {
             }
         }
     }
-#endif
 
     if (iface->numdns > 0) {
         for (i = 0; i < iface->numdns; i++) {
@@ -1470,11 +1404,9 @@ int writeEnabledNetInfo(iface_t *iface) {
         fprintf(fp, "NETWORKING=yes\n");
     }
 
-#ifdef ENABLE_IPV6
     if (!FL_NOIPV6(flags)) {
         fprintf(fp, "NETWORKING_IPV6=yes\n");
     }
-#endif
 
     if (iface->hostname != NULL) {
         fprintf(fp, "HOSTNAME=%s\n", iface->hostname);
@@ -1490,7 +1422,6 @@ int writeEnabledNetInfo(iface_t *iface) {
         fprintf(fp, "GATEWAY=%s\n", buf);
     }
 
-#ifdef ENABLE_IPV6
     if (iface_have_in6_addr(&iface->gateway6)) {
         if (inet_ntop(AF_INET6, &iface->gateway6, buf,
                       INET6_ADDRSTRLEN) == NULL) {
@@ -1500,7 +1431,6 @@ int writeEnabledNetInfo(iface_t *iface) {
 
         fprintf(fp, "IPV6_DEFAULTGW=%s\n", buf);
     }
-#endif
 
     if (fclose(fp) == EOF) {
         return 12;
@@ -1625,10 +1555,8 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
         if (noipv4)
             flags |= LOADER_FLAGS_NOIPV4;
 
-#ifdef ENABLE_IPV6
         if (noipv6)
             flags |= LOADER_FLAGS_NOIPV6;
-#endif
     }
 
     if (noDns) {
diff --git a/loader/net.h b/loader/net.h
index 8245084..d70fe79 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -26,10 +26,8 @@
 
 #define DHCP_METHOD_STR   _("Dynamic IP configuration (DHCP)")
 #define MANUAL_METHOD_STR _("Manual configuration")
-#ifdef ENABLE_IPV6
 #define DHCPV6_METHOD_STR _("Dynamic IP configuration (DHCPv6)")
 #define AUTO_METHOD_STR   _("Automatic neighbor discovery")
-#endif
 
 #define SYSCONFIG_PATH       "/etc/sysconfig"
 #define NETWORK_SCRIPTS_PATH "/etc/sysconfig/network-scripts"
@@ -38,19 +36,15 @@ struct intfconfig_s {
     newtComponent ipv4Entry, cidr4Entry;
     newtComponent gwEntry, nsEntry;
     const char *ipv4, *cidr4;
-#ifdef ENABLE_IPV6
     newtComponent ipv6Entry, cidr6Entry;
     const char *ipv6, *cidr6;
     const char *gw6;
-#endif
     const char *gw, *ns;
 };
 
 struct netconfopts {
     char ipv4Choice;
-#ifdef ENABLE_IPV6
     char ipv6Choice;
-#endif
 };
 
 typedef int int32;
-- 
1.6.2.5

_______________________________________________
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