[master&rhel6-branch 3/3] Fix most of what is necessary for install over IPv6 on s390 (#594090)

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

 



We need loader support to parse and write out an IPv6 prefix.
Write out IPV6_AUTOCONF=no in writeEnabledNetInfo for manual IPv6 method.
---
 loader/linuxrc.s390 |    4 +---
 loader/loader.c     |   19 +++++++++++++++++++
 loader/loader.h     |    1 +
 loader/net.c        |   19 +++++++++++++++++++
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 3716979..f799db9 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -3006,7 +3006,6 @@ cat > $IFCFGFILE << EOF
 DEVICE=$DEVICE
 ONBOOT=yes
 BOOTPROTO=static
-BROADCAST=$BROADCAST
 MTU=$MTU
 SUBCHANNELS=$SUBCHANNELS
 EOF
@@ -3017,12 +3016,11 @@ IPV6_AUTOCONF=no
 IPV6ADDR=$IPADDR/$NETMASK
 IPV6_DEFAULTGW=$GATEWAY
 EOF
-    # FIXME: /etc/sysconfig/network:IPV6_DEFAULTGW=$GATEWAY
-    #        /etc/sysconfig/network:NETWORKING_IPV6=yes
 else
     cat >> $IFCFGFILE << EOF
 IPADDR=$IPADDR
 NETMASK=$NETMASK
+BROADCAST=$BROADCAST
 GATEWAY=$GATEWAY
 EOF
 fi
diff --git a/loader/loader.c b/loader/loader.c
index 049c26f..ebc80e6 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -690,6 +690,7 @@ static void readNetInfo(struct loaderData_s ** ld) {
     loaderData->macaddr = NULL;
 #ifdef ENABLE_IPV6
     loaderData->ipv6 = NULL;
+    loaderData->ipv6prefix = NULL;
     loaderData->gateway6 = NULL;
 #endif
 
@@ -740,6 +741,24 @@ static void readNetInfo(struct loaderData_s ** ld) {
                     loaderData->netmask = strdup(val);
                 } else if (!g_strcmp0(pair[0], "GATEWAY")) {
                     loaderData->gateway = strdup(val);
+#ifdef ENABLE_IPV6
+                } else if (!g_strcmp0(pair[0], "IPV6ADDR")) {
+                    gchar **elements = g_strsplit(val, "/", 2);
+
+                    if (elements[0]) {
+                        loaderData->ipv6 = strdup(elements[0]);
+                        loaderData->ipv6info_set = 1;
+                        flags |= LOADER_FLAGS_IPV6_PARAM;
+                        if (elements[1]) {
+                            loaderData->ipv6prefix = strdup(elements[1]);
+                        }
+                    } else {
+                      logMessage(WARNING, "readNetInfo could not parse IPV6ADDR: %s", val);
+                    }
+                    g_strfreev(elements);
+                } else if (!g_strcmp0(pair[0], "IPV6_DEFAULTGW")) {
+                    loaderData->gateway6 = strdup(val);
+#endif
                 } else if (!g_strcmp0(pair[0], "DNS")) {
                     loaderData->dns = strdup(val);
                 } else if (!g_strcmp0(pair[0], "DOMAIN")) {
diff --git a/loader/loader.h b/loader/loader.h
index f35e3ff..bb38098 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -135,6 +135,7 @@ struct loaderData_s {
     char *ipv4, *netmask, *gateway, *dns, *domain, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot, *options, *macaddr;
 #ifdef ENABLE_IPV6
     char *ipv6;
+    char *ipv6prefix;
     int ipv6info_set;
     char *gateway6;
 #endif
diff --git a/loader/net.c b/loader/net.c
index 769c1d4..9b89f55 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -297,6 +297,24 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) {
         } else if (inet_pton(AF_INET6, loaderData->ipv6, &addr6) >= 1) {
             memcpy(&iface->ip6addr, &addr6, sizeof(struct in6_addr));
             iface->ipv6method = IPV6_MANUAL_METHOD;
+
+            iface->ip6prefix = 0;
+            if (loaderData->ipv6prefix) {
+                int prefix;
+
+                errno = 0;
+                prefix = strtol(loaderData->ipv6prefix, NULL, 10);
+                if ((errno == ERANGE && (prefix == LONG_MIN ||
+                                         prefix == LONG_MAX)) ||
+                    (errno != 0 && prefix == 0)) {
+                    logMessage(ERROR, "%s: %d: %m", __func__, __LINE__);
+                    abort();
+                }
+
+                if (prefix > 0 || prefix <= 128) {
+                    iface->ip6prefix = prefix;
+                }
+            }
         } else {
             iface->ipv6method = 0;
             loaderData->ipv6info_set = 0;
@@ -1363,6 +1381,7 @@ int writeEnabledNetInfo(iface_t *iface) {
             } else if (iface->ipv6method == IPV6_DHCP_METHOD) {
                 fprintf(fp, "DHCPV6C=yes\n");
             } else if (iface->ipv6method == IPV6_MANUAL_METHOD) {
+                fprintf(fp, "IPV6_AUTOCONF=no\n");
                 if (iface_have_in6_addr(&iface->ip6addr)) {
                     if (inet_ntop(AF_INET6, &iface->ip6addr, buf,
                                   INET6_ADDRSTRLEN) == NULL) {
-- 
1.7.0.4


_______________________________________________
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