Loader does not need to handle or understand layer2 and portno so consolidate that into opaque options. This will prevent issues such as bug 577005 or commit 9caaca4 or bug 468755 and should be also transparent to future extensions in linuxrc. Correctly parse OPTIONS whose value includes equal signs because the values are attribute value pairs. See also bug 597205 and commit 8549a36. --- isys/iface.c | 3 +-- isys/iface.h | 3 +-- loader/loader.c | 11 ++++------- loader/loader.h | 2 +- loader/net.c | 36 +++++------------------------------- 5 files changed, 12 insertions(+), 43 deletions(-) diff --git a/isys/iface.c b/isys/iface.c index 0369104..afdc59f 100644 --- a/isys/iface.c +++ b/isys/iface.c @@ -383,8 +383,7 @@ void iface_init_iface_t(iface_t *iface) { iface->peerid = NULL; iface->nettype = NULL; iface->ctcprot = NULL; - iface->layer2 = NULL; - iface->portno = NULL; + iface->options = 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 d7ecc56..b7eaa6f 100644 --- a/isys/iface.h +++ b/isys/iface.h @@ -95,8 +95,7 @@ typedef struct _iface_t { char *peerid; char *nettype; char *ctcprot; - char *layer2; - char *portno; + char *options; /* flags */ uint64_t flags; diff --git a/loader/loader.c b/loader/loader.c index a154ecc..10ac12b 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -685,8 +685,7 @@ static void readNetInfo(struct loaderData_s ** ld) { loaderData->portname = NULL; loaderData->nettype = NULL; loaderData->ctcprot = NULL; - loaderData->layer2 = NULL; - loaderData->portno = NULL; + loaderData->options = NULL; loaderData->macaddr = NULL; #ifdef ENABLE_IPV6 loaderData->ipv6 = NULL; @@ -721,7 +720,7 @@ static void readNetInfo(struct loaderData_s ** ld) { } tmp = g_strstrip(tmp); - pair = g_strsplit(tmp, "=", 0); + pair = g_strsplit(tmp, "=", 2); if (g_strv_length(pair) == 2) { gchar *val = g_shell_unquote(pair[1], &e); @@ -760,10 +759,8 @@ static void readNetInfo(struct loaderData_s ** ld) { loaderData->nettype = strdup(val); } else if (!g_strcmp0(pair[0], "CTCPROT")) { loaderData->ctcprot = strdup(val); - } else if (!g_strcmp0(pair[0], "LAYER2")) { - loaderData->layer2 = strdup(val); - } else if (!g_strcmp0(pair[0], "PORTNO")) { - loaderData->portno = strdup(val); + } else if (!g_strcmp0(pair[0], "OPTIONS")) { + loaderData->options = strdup(val); } else if (!g_strcmp0(pair[0], "MACADDR")) { loaderData->macaddr = strdup(val); } else if (!g_strcmp0(pair[0], "HOSTNAME")) { diff --git a/loader/loader.h b/loader/loader.h index c64c475..0b910f7 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -132,7 +132,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, *portno, *macaddr; + char *ipv4, *netmask, *gateway, *dns, *hostname, *peerid, *ethtool, *subchannels, *portname, *essid, *wepkey, *nettype, *ctcprot, *options, *macaddr; #ifdef ENABLE_IPV6 char *ipv6; int ipv6info_set; diff --git a/loader/net.c b/loader/net.c index 5a832de..153e6f9 100644 --- a/loader/net.c +++ b/loader/net.c @@ -400,12 +400,8 @@ 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->options) { + iface->options = strdup(loaderData->options); } if (loaderData->wepkey) { @@ -1218,7 +1214,7 @@ int writeDisabledNetInfo(void) { * /etc/sysconfig/network */ int writeEnabledNetInfo(iface_t *iface) { - int i = 0, osa_layer2 = 0, osa_portno = 0; + int i = 0; mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; FILE *fp = NULL; char buf[INET6_ADDRSTRLEN+1]; @@ -1428,30 +1424,8 @@ int writeEnabledNetInfo(iface_t *iface) { fprintf(fp, "CTCPROT=%s\n", iface->ctcprot); } - if (iface->layer2 && !strcmp(iface->layer2, "1")) { - osa_layer2 = 1; - } - - 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->options) { + fprintf(fp, "OPTIONS=\'%s\'\n", iface->options); } if (iface->macaddr) { -- 1.7.0.4 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list