[PATCH 5/5] Add missing LAYER2 and PORTNO handling for s390x.

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

 



libisys and loader lacked handling for the LAYER2 and PORTNO settings
present on s390x systems.

Also include the fix for #468755 to write layer2=1 rather than layer=2
to the ifcfg-DEVICE file.

Also include the fix for #471101 to include ARP=no when the device type
is qeth and there are subchannels.
---
 isys/iface.c    |    2 ++
 isys/iface.h    |    2 ++
 loader/loader.c |    4 ++++
 loader/loader.h |    2 +-
 loader/net.c    |   42 +++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/isys/iface.c b/isys/iface.c
index e139e74..c1251be 100644
--- a/isys/iface.c
+++ b/isys/iface.c
@@ -381,6 +381,8 @@ void iface_init_iface_t(iface_t *iface) {
     iface->peerid = NULL;
     iface->nettype = NULL;
     iface->ctcprot = NULL;
+    iface->layer2 = NULL;
+    iface->portno = NULL;
     iface->flags = 0;
     iface->ipv4method = IPV4_UNUSED_METHOD;
     iface->ipv6method = IPV6_UNUSED_METHOD;
diff --git a/isys/iface.h b/isys/iface.h
index f678932..3f97935 100644
--- a/isys/iface.h
+++ b/isys/iface.h
@@ -95,6 +95,8 @@ typedef struct _iface_t {
     char *peerid;
     char *nettype;
     char *ctcprot;
+    char *layer2;
+    char *portno;
 
     /* flags */
     uint64_t flags;
diff --git a/loader/loader.c b/loader/loader.c
index 1de7019..71829e6 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -684,6 +684,7 @@ static void readNetInfo(struct loaderData_s ** ld) {
     loaderData->nettype = NULL;
     loaderData->ctcprot = NULL;
     loaderData->layer2 = NULL;
+    loaderData->portno = NULL;
     loaderData->macaddr = NULL;
 
     /*
@@ -753,6 +754,9 @@ static void readNetInfo(struct loaderData_s ** ld) {
             if (!strncmp(vname, "LAYER2", 6))
                 loaderData->layer2 = strdup(vparm);
 
+            if (!strncmp(vname, "PORTNO", 6))
+                loaderData->portno = strdup(vparm);
+
             if (!strncmp(vname, "MACADDR", 7))
                 loaderData->macaddr = strdup(vparm);
 
diff --git a/loader/loader.h b/loader/loader.h
index a6e2d05..a38bd49 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -126,7 +126,7 @@ struct loaderData_s {
     int bootIf_set;
     char * netCls;
     int netCls_set;
-    char *ipv4, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot, *layer2, *macaddr;
+    char *ipv4, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot, *layer2, *portno, *macaddr;
 #ifdef ENABLE_IPV6
     char *ipv6;
     int ipv6info_set;
diff --git a/loader/net.c b/loader/net.c
index 5b9593a..d56a040 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -400,6 +400,14 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) {
         parseEthtoolSettings(loaderData);
     }
 
+    if (loaderData->layer2) {
+        iface->layer2 = strdup(loaderData->layer2);
+    }
+
+    if (loaderData->portno) {
+        iface->portno = strdup(loaderData->portno);
+    }
+
     if (loaderData->noDns) {
         iface->flags |= IFACE_FLAGS_NO_WRITE_RESOLV_CONF;
     }
@@ -1193,7 +1201,7 @@ int writeDisabledNetInfo(void) {
  *     /etc/sysconfig/network
  */
 int writeEnabledNetInfo(iface_t *iface) {
-    int i = 0;
+    int i = 0, osa_layer2 = 1, osa_portno = 0;
     mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
     FILE *fp = NULL;
     char buf[INET6_ADDRSTRLEN+1];
@@ -1403,6 +1411,38 @@ int writeEnabledNetInfo(iface_t *iface) {
         fprintf(fp, "CTCPROT=%s\n", iface->ctcprot);
     }
 
+    if (iface->layer2 && !strcmp(iface->layer2, "1")) {
+        osa_layer2 = 1;
+    } else if (iface->subchannels && !strcmp(iface->nettype, "qeth")) {
+        fprintf(fp, "ARP=no\n");
+    }
+
+    if (iface->portno && !strcmp(iface->portno, "1")) {
+        osa_portno = 1;
+    }
+
+    if (osa_layer2 || osa_portno) {
+        fprintf(fp, "OPTIONS=\"");
+
+        if (osa_layer2) {
+            fprintf(fp, "layer2=1");
+        }
+
+        if (osa_layer2 && osa_portno) {
+            fprintf(fp, " ");
+        }
+
+        if (osa_portno) {
+            fprintf(fp, "portno=1");
+        }
+
+        fprintf(fp, "\"\n");
+    }
+
+    if (iface->macaddr) {
+        fprintf(fp, "MACADDR=%s\n", iface->macaddr);
+    }
+
     if (fclose(fp) == EOF) {
         free(ofile);
         free(nfile);
-- 
1.6.3.3

_______________________________________________
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