Correctly pass netdev name from linuxrc.s390 to loader (#595382) Fix readNetInfo and writeEnabledNetInfo for s390 (#595388) Fix most of what is necessary for install over IPv6 on s390 (#594090)
booty/bootloaderInfo.py | 15 --------- isys/iface.c | 3 +- isys/iface.h | 3 +- loader/linuxrc.s390 | 66 +++++++++++++++-------------------------- loader/loader.c | 74 ++++++++++++++++++++++++++++++++++++++-------- loader/loader.h | 3 +- loader/net.c | 64 ++++++++++++++++++++-------------------- 7 files changed, 121 insertions(+), 107 deletions(-)
Loader has 3 ways to configure the network: 1) interactive user input 2) boot parameters 3) readNetInfo Option 3 is used to transfer the configuration of the already configured network of linuxrc.s390. Linuxrc.s390 has to configure the network early since the default terminals on s390 provide line mode but no full screen. The user then logs in over ssh to provide a full screen terminal in which loader can be executed. Since linuxrc already did the network config, we want to skip interactive user input in loader. Hence, 3 replaces 1 and 2 on s390. Before 0d5f432a39178f78754698e33a89905440584e4c, loader's readNetinfo iterated over all existing ifcfg files, which is only fine for s390 where linuxrc currently only ever configures at most one network device. Since readNetInfo is called for all platforms there could maybe exist more than one ifcfg file so we need a way for linuxrc to tell loader the name of the specific configured device. Linuxrc.s390 has 3 ways to activate loader: 1) ssh login as user install, which has /sbin/loader as login shell 2) ssh login as user root (/bin/bash) and executing loader manually 3) boot option RUNKS=1 Passing exported environment variables only works for 3 where loader is a child of linuxrc. 2 only worked by accident since linuxrc wrote the content of /tmp/install.cfg into /etc/profile so root could see it. However, in the general and often used case 1 there is neither an ancestor relationship between linuxrc and loader nor a shell involved. Therefore, introduce a new file /tmp/s390net to pass the name to loader. This works the same for all three cases. Since QETHPARM and CHANDEV are no longer used, we can get rid of the old /tmp/install.cfg entirely. --- booty/bootloaderInfo.py | 15 --------------- loader/linuxrc.s390 | 45 +++++++-------------------------------------- loader/loader.c | 40 ++++++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 59 deletions(-)
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index d019edf..a0a7b4d 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -172,26 +172,11 @@ class KernelArguments:
def __init__(self, anaconda): newArgs = [] - cfgFilename = "/tmp/install.cfg"
self.anaconda = anaconda
if iutil.isS390(): self.cargs = [] - f = open(cfgFilename) - for line in f: - try: - (vname,vparm) = line.split('=', 1) - vname = vname.strip() - vparm = vparm.replace('"','') - vparm = vparm.strip() - if vname == "CHANDEV": - self.cargs.append(vparm) - if vname == "QETHPARM": - self.cargs.append(vparm) - except Exception, e: - pass - f.close()
# look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht", diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 99e5192..b421062 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2971,49 +2971,18 @@ done # [ "$ipv6" ] && echo "IPV6=yes"
# transfer options into install environment -cat > /tmp/install.cfg << EOF -LANG="$LANG" -S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" -PORTNAME="$PORTNAME" -HOSTNAME="$HOSTNAME" -DEVICE="$DEVICE" -NETTYPE="$NETTYPE" -IPADDR="$IPADDR" -GATEWAY="$GATEWAY" -MTU="$MTU" -NETWORK="$NETWORK" -NETMASK="$NETMASK" -BROADCAST="$BROADCAST" -SEARCHDNS="$SEARCHDNS" -PEERID="$PEERID" -SUBCHANNELS="$SUBCHANNELS" -ONBOOT="yes" -CTCPROT="$CTCPROT" -EOF +# loader now uses ifcfg instead of install.cfg to receive our network config + +# additionally, loader's readNetInfo needs to know our DEVICE name +echo $DEVICE > /tmp/s390net + if [ "$ipv6" ]; then DNS1=$(echo $DNS | cut -d ',' -f 1) - echo DNS="$DNS1" >> /tmp/install.cfg - echo DNS1="$DNS1" >> /tmp/install.cfg - echo DNS2="$(echo $DNS | cut -d ',' -f 2)" >> /tmp/install.cfg + DNS2=$(echo $DNS | cut -d ',' -f 2) else DNS1=$(echo $DNS | cut -d ':' -f 1) - echo DNS="$DNS1" >> /tmp/install.cfg - echo DNS1="$DNS1" >> /tmp/install.cfg - echo DNS2="$(echo $DNS | cut -d ':' -f 2)" >> /tmp/install.cfg + DNS2=$(echo $DNS | cut -d ':' -f 2) fi -cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR -export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS -export PEERID ONBOOT SUBCHANNELS CTCPROT -EOF -# immediately read it in again to export these into the shell below -. /tmp/install.cfg -if [ -z "$testing" ]; then - cat /tmp/install.cfg >> /etc/profile -fi # testing
NETSCRIPTS="/etc/sysconfig/network-scripts" IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" diff --git a/loader/loader.c b/loader/loader.c index fbbd13b..5f49cc0 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -633,20 +633,48 @@ static void writeVNCPasswordFile(char *pfile, char *password) { */ static void readNetInfo(struct loaderData_s ** ld) { struct loaderData_s * loaderData = *ld; - char *cfgfile = NULL; - gchar *contents = NULL; + char *cfgfile = NULL, *devfile = "/tmp/s390net"; + gchar *contents = NULL, *device = NULL; gchar **lines = NULL, **line = NULL; GError *e = NULL;
- /* when this function is called, the DEVICE environment variable + /* when this function is called, /tmp/s390net * contains the device name whose ifcfg file we want to read */ - if (!getenv("DEVICE")) { + if (!g_file_test(devfile, G_FILE_TEST_EXISTS)) { + logMessage(DEBUGLVL, "readNetInfo %s not found, early return", devfile); + return; + } + if (!g_file_get_contents(devfile, &contents, NULL, &e)) { + logMessage(ERROR, "error reading %s: %s", devfile, e->message); + g_error_free(e); + abort(); + } + line = lines = g_strsplit(contents, "\n", 0); + g_free(contents); + while (*line != NULL) { + gchar *tmp = g_strdup(*line); + tmp = g_strstrip(tmp); + logMessage(DEBUGLVL, "readNetInfo stripped line: %s", tmp); + if (strlen(tmp) > 0) { + device = strdup(tmp); + g_free(tmp); + logMessage(DEBUGLVL, "readNetInfo found device: %s", device); + break; + } + g_free(tmp); + line++; + } + free(cfgfile); + g_strfreev(lines); + if (strlen(device) == 0) { return; + logMessage(DEBUGLVL, "readNetInfo no device found"); }
checked_asprintf(&cfgfile, "/etc/sysconfig/network-scripts/ifcfg-%s", - getenv("DEVICE")); + device); + logMessage(INFO, "readNetInfo cfgfile: %s", cfgfile);
/* make sure everything is NULL before we begin copying info */ loaderData->ipv4 = NULL; @@ -1485,7 +1513,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
logMessage(INFO, "going to do getNetConfig");
- /* s390 provides all config info by way of the CMS conf file */ + /* s390 provides all config info by way of linuxrc.s390 */ if (FL_HAVE_CMSCONF(flags)) { loaderData->ipinfo_set = 1; #ifdef ENABLE_IPV6
Looks good to me, just one nitpick below. The whole 3/3 set looks good to me, but I'd prefer second look of David Cantrell.
Radek
Steffen Maier wrote:
Loader has 3 ways to configure the network:
- interactive user input
- boot parameters
- readNetInfo
Option 3 is used to transfer the configuration of the already configured network of linuxrc.s390. Linuxrc.s390 has to configure the network early since the default terminals on s390 provide line mode but no full screen. The user then logs in over ssh to provide a full screen terminal in which loader can be executed. Since linuxrc already did the network config, we want to skip interactive user input in loader. Hence, 3 replaces 1 and 2 on s390. Before 0d5f432a39178f78754698e33a89905440584e4c, loader's readNetinfo iterated over all existing ifcfg files, which is only fine for s390 where linuxrc currently only ever configures at most one network device. Since readNetInfo is called for all platforms there could maybe exist more than one ifcfg file so we need a way for linuxrc to tell loader the name of the specific configured device. Linuxrc.s390 has 3 ways to activate loader:
- ssh login as user install, which has /sbin/loader as login shell
- ssh login as user root (/bin/bash) and executing loader manually
- boot option RUNKS=1
Passing exported environment variables only works for 3 where loader is a child of linuxrc. 2 only worked by accident since linuxrc wrote the content of /tmp/install.cfg into /etc/profile so root could see it. However, in the general and often used case 1 there is neither an ancestor relationship between linuxrc and loader nor a shell involved. Therefore, introduce a new file /tmp/s390net to pass the name to loader. This works the same for all three cases. Since QETHPARM and CHANDEV are no longer used, we can get rid of the old /tmp/install.cfg entirely.
booty/bootloaderInfo.py | 15 --------------- loader/linuxrc.s390 | 45 +++++++-------------------------------------- loader/loader.c | 40 ++++++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 59 deletions(-)
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index d019edf..a0a7b4d 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -172,26 +172,11 @@ class KernelArguments:
def __init__(self, anaconda): newArgs = []
cfgFilename = "/tmp/install.cfg" self.anaconda = anaconda if iutil.isS390(): self.cargs = []f = open(cfgFilename)for line in f:try:(vname,vparm) = line.split('=', 1)vname = vname.strip()vparm = vparm.replace('"','')vparm = vparm.strip()if vname == "CHANDEV":self.cargs.append(vparm)if vname == "QETHPARM":self.cargs.append(vparm)except Exception, e:passf.close() # look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht",diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 99e5192..b421062 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2971,49 +2971,18 @@ done # [ "$ipv6" ] && echo "IPV6=yes"
# transfer options into install environment -cat > /tmp/install.cfg << EOF -LANG="$LANG" -S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" -PORTNAME="$PORTNAME" -HOSTNAME="$HOSTNAME" -DEVICE="$DEVICE" -NETTYPE="$NETTYPE" -IPADDR="$IPADDR" -GATEWAY="$GATEWAY" -MTU="$MTU" -NETWORK="$NETWORK" -NETMASK="$NETMASK" -BROADCAST="$BROADCAST" -SEARCHDNS="$SEARCHDNS" -PEERID="$PEERID" -SUBCHANNELS="$SUBCHANNELS" -ONBOOT="yes" -CTCPROT="$CTCPROT" -EOF +# loader now uses ifcfg instead of install.cfg to receive our network config
+# additionally, loader's readNetInfo needs to know our DEVICE name +echo $DEVICE > /tmp/s390net
if [ "$ipv6" ]; then DNS1=$(echo $DNS | cut -d ',' -f 1)
- echo DNS="$DNS1" >> /tmp/install.cfg
- echo DNS1="$DNS1" >> /tmp/install.cfg
- echo DNS2="$(echo $DNS | cut -d ',' -f 2)" >> /tmp/install.cfg
- DNS2=$(echo $DNS | cut -d ',' -f 2)
else DNS1=$(echo $DNS | cut -d ':' -f 1)
- echo DNS="$DNS1" >> /tmp/install.cfg
- echo DNS1="$DNS1" >> /tmp/install.cfg
- echo DNS2="$(echo $DNS | cut -d ':' -f 2)" >> /tmp/install.cfg
- DNS2=$(echo $DNS | cut -d ':' -f 2)
fi -cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR -export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS -export PEERID ONBOOT SUBCHANNELS CTCPROT -EOF -# immediately read it in again to export these into the shell below -. /tmp/install.cfg -if [ -z "$testing" ]; then
- cat /tmp/install.cfg >> /etc/profile
-fi # testing
NETSCRIPTS="/etc/sysconfig/network-scripts" IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" diff --git a/loader/loader.c b/loader/loader.c index fbbd13b..5f49cc0 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -633,20 +633,48 @@ static void writeVNCPasswordFile(char *pfile, char *password) { */ static void readNetInfo(struct loaderData_s ** ld) { struct loaderData_s * loaderData = *ld;
- char *cfgfile = NULL;
- gchar *contents = NULL;
- char *cfgfile = NULL, *devfile = "/tmp/s390net";
- gchar *contents = NULL, *device = NULL; gchar **lines = NULL, **line = NULL; GError *e = NULL;
- /* when this function is called, the DEVICE environment variable
- /* when this function is called, /tmp/s390net
*/
- contains the device name whose ifcfg file we want to read
- if (!getenv("DEVICE")) {
- if (!g_file_test(devfile, G_FILE_TEST_EXISTS)) {
logMessage(DEBUGLVL, "readNetInfo %s not found, early return", devfile);return;- }
- if (!g_file_get_contents(devfile, &contents, NULL, &e)) {
logMessage(ERROR, "error reading %s: %s", devfile, e->message);g_error_free(e);abort();- }
- line = lines = g_strsplit(contents, "\n", 0);
- g_free(contents);
- while (*line != NULL) {
gchar *tmp = g_strdup(*line);tmp = g_strstrip(tmp);logMessage(DEBUGLVL, "readNetInfo stripped line: %s", tmp);if (strlen(tmp) > 0) {device = strdup(tmp);g_free(tmp);logMessage(DEBUGLVL, "readNetInfo found device: %s", device);break;}g_free(tmp);line++;- }
- free(cfgfile);
This free seems redundant.
g_strfreev(lines);
if (strlen(device) == 0) { return;
logMessage(DEBUGLVL, "readNetInfo no device found");}
checked_asprintf(&cfgfile, "/etc/sysconfig/network-scripts/ifcfg-%s",
getenv("DEVICE"));
device);logMessage(INFO, "readNetInfo cfgfile: %s", cfgfile);
/* make sure everything is NULL before we begin copying info */ loaderData->ipv4 = NULL;
@@ -1485,7 +1513,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
logMessage(INFO, "going to do getNetConfig");
/* s390 provides all config info by way of the CMS conf file */
/* s390 provides all config info by way of linuxrc.s390 */ if (FL_HAVE_CMSCONF(flags)) { loaderData->ipinfo_set = 1;#ifdef ENABLE_IPV6
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ack. The commit message could be a bit less verbose, but I will apply this patch to master and rhel6-branch.
On Mon, 31 May 2010, Steffen Maier wrote:
Loader has 3 ways to configure the network:
- interactive user input
- boot parameters
- readNetInfo
Option 3 is used to transfer the configuration of the already configured network of linuxrc.s390. Linuxrc.s390 has to configure the network early since the default terminals on s390 provide line mode but no full screen. The user then logs in over ssh to provide a full screen terminal in which loader can be executed. Since linuxrc already did the network config, we want to skip interactive user input in loader. Hence, 3 replaces 1 and 2 on s390. Before 0d5f432a39178f78754698e33a89905440584e4c, loader's readNetinfo iterated over all existing ifcfg files, which is only fine for s390 where linuxrc currently only ever configures at most one network device. Since readNetInfo is called for all platforms there could maybe exist more than one ifcfg file so we need a way for linuxrc to tell loader the name of the specific configured device. Linuxrc.s390 has 3 ways to activate loader:
- ssh login as user install, which has /sbin/loader as login shell
- ssh login as user root (/bin/bash) and executing loader manually
- boot option RUNKS=1
Passing exported environment variables only works for 3 where loader is a child of linuxrc. 2 only worked by accident since linuxrc wrote the content of /tmp/install.cfg into /etc/profile so root could see it. However, in the general and often used case 1 there is neither an ancestor relationship between linuxrc and loader nor a shell involved. Therefore, introduce a new file /tmp/s390net to pass the name to loader. This works the same for all three cases. Since QETHPARM and CHANDEV are no longer used, we can get rid of the old /tmp/install.cfg entirely.
booty/bootloaderInfo.py | 15 --------------- loader/linuxrc.s390 | 45 +++++++-------------------------------------- loader/loader.c | 40 ++++++++++++++++++++++++++++++++++------ 3 files changed, 41 insertions(+), 59 deletions(-)
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index d019edf..a0a7b4d 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -172,26 +172,11 @@ class KernelArguments:
def __init__(self, anaconda): newArgs = []
cfgFilename = "/tmp/install.cfg" self.anaconda = anaconda if iutil.isS390(): self.cargs = []f = open(cfgFilename)for line in f:try:(vname,vparm) = line.split('=', 1)vname = vname.strip()vparm = vparm.replace('"','')vparm = vparm.strip()if vname == "CHANDEV":self.cargs.append(vparm)if vname == "QETHPARM":self.cargs.append(vparm)except Exception, e:passf.close() # look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht",diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 99e5192..b421062 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2971,49 +2971,18 @@ done # [ "$ipv6" ] && echo "IPV6=yes"
# transfer options into install environment -cat > /tmp/install.cfg << EOF -LANG="$LANG" -S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" -PORTNAME="$PORTNAME" -HOSTNAME="$HOSTNAME" -DEVICE="$DEVICE" -NETTYPE="$NETTYPE" -IPADDR="$IPADDR" -GATEWAY="$GATEWAY" -MTU="$MTU" -NETWORK="$NETWORK" -NETMASK="$NETMASK" -BROADCAST="$BROADCAST" -SEARCHDNS="$SEARCHDNS" -PEERID="$PEERID" -SUBCHANNELS="$SUBCHANNELS" -ONBOOT="yes" -CTCPROT="$CTCPROT" -EOF +# loader now uses ifcfg instead of install.cfg to receive our network config
+# additionally, loader's readNetInfo needs to know our DEVICE name +echo $DEVICE > /tmp/s390net
if [ "$ipv6" ]; then DNS1=$(echo $DNS | cut -d ',' -f 1)
- echo DNS="$DNS1" >> /tmp/install.cfg
- echo DNS1="$DNS1" >> /tmp/install.cfg
- echo DNS2="$(echo $DNS | cut -d ',' -f 2)" >> /tmp/install.cfg
- DNS2=$(echo $DNS | cut -d ',' -f 2)
else DNS1=$(echo $DNS | cut -d ':' -f 1)
- echo DNS="$DNS1" >> /tmp/install.cfg
- echo DNS1="$DNS1" >> /tmp/install.cfg
- echo DNS2="$(echo $DNS | cut -d ':' -f 2)" >> /tmp/install.cfg
- DNS2=$(echo $DNS | cut -d ':' -f 2)
fi -cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR -export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS -export PEERID ONBOOT SUBCHANNELS CTCPROT -EOF -# immediately read it in again to export these into the shell below -. /tmp/install.cfg -if [ -z "$testing" ]; then
- cat /tmp/install.cfg >> /etc/profile
-fi # testing
NETSCRIPTS="/etc/sysconfig/network-scripts" IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" diff --git a/loader/loader.c b/loader/loader.c index fbbd13b..5f49cc0 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -633,20 +633,48 @@ static void writeVNCPasswordFile(char *pfile, char *password) { */ static void readNetInfo(struct loaderData_s ** ld) { struct loaderData_s * loaderData = *ld;
- char *cfgfile = NULL;
- gchar *contents = NULL;
- char *cfgfile = NULL, *devfile = "/tmp/s390net";
- gchar *contents = NULL, *device = NULL; gchar **lines = NULL, **line = NULL; GError *e = NULL;
- /* when this function is called, the DEVICE environment variable
- /* when this function is called, /tmp/s390net
*/
- contains the device name whose ifcfg file we want to read
- if (!getenv("DEVICE")) {
if (!g_file_test(devfile, G_FILE_TEST_EXISTS)) {
logMessage(DEBUGLVL, "readNetInfo %s not found, early return", devfile);return;}
if (!g_file_get_contents(devfile, &contents, NULL, &e)) {
logMessage(ERROR, "error reading %s: %s", devfile, e->message);g_error_free(e);abort();}
line = lines = g_strsplit(contents, "\n", 0);
g_free(contents);
while (*line != NULL) {
gchar *tmp = g_strdup(*line);tmp = g_strstrip(tmp);logMessage(DEBUGLVL, "readNetInfo stripped line: %s", tmp);if (strlen(tmp) > 0) {device = strdup(tmp);g_free(tmp);logMessage(DEBUGLVL, "readNetInfo found device: %s", device);break;}g_free(tmp);line++;}
free(cfgfile);
g_strfreev(lines);
if (strlen(device) == 0) { return;
logMessage(DEBUGLVL, "readNetInfo no device found");}
checked_asprintf(&cfgfile, "/etc/sysconfig/network-scripts/ifcfg-%s",
getenv("DEVICE"));
device);logMessage(INFO, "readNetInfo cfgfile: %s", cfgfile);
/* make sure everything is NULL before we begin copying info */ loaderData->ipv4 = NULL;
@@ -1485,7 +1513,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
logMessage(INFO, "going to do getNetConfig");
/* s390 provides all config info by way of the CMS conf file */
/* s390 provides all config info by way of linuxrc.s390 */ if (FL_HAVE_CMSCONF(flags)) { loaderData->ipinfo_set = 1;#ifdef ENABLE_IPV6
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
Loader has 3 ways to configure the network:
- interactive user input
- boot parameters
- readNetInfo
Option 3 is used to transfer the configuration of the already configured network of linuxrc.s390. Linuxrc.s390 has to configure the network early since the default terminals on s390 provide line mode but no full screen. The user then logs in over ssh to provide a full screen terminal in which loader can be executed. Since linuxrc already did the network config, we want to skip interactive user input in loader. Hence, 3 replaces 1 and 2 on s390. Before 0d5f432a39178f78754698e33a89905440584e4c, loader's readNetinfo iterated over all existing ifcfg files, which is only fine for s390 where linuxrc currently only ever configures at most one network device. Since readNetInfo is called for all platforms there could maybe exist more than one ifcfg file so we need a way for linuxrc to tell loader the name of the specific configured device. Linuxrc.s390 has 3 ways to activate loader:
- ssh login as user install, which has /sbin/loader as login shell
- ssh login as user root (/bin/bash) and executing loader manually
- boot option RUNKS=1
Passing exported environment variables only works for 3 where loader is a child of linuxrc. 2 only worked by accident since linuxrc wrote the content of /tmp/install.cfg into /etc/profile so root could see it. However, in the general and often used case 1 there is neither an ancestor relationship between linuxrc and loader nor a shell involved. Therefore, introduce a new file /tmp/s390net to pass the name to loader. This works the same for all three cases. Since QETHPARM and CHANDEV are no longer used, we can get rid of the old /tmp/install.cfg entirely.
This commit message is ridiculous. Please describe the problem *concisely* and *directly*. A page full of text is not concise. No one's going to sit down and read all this.
- Chris
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 2 Jun 2010, Chris Lumens wrote:
Loader has 3 ways to configure the network:
- interactive user input
- boot parameters
- readNetInfo
Option 3 is used to transfer the configuration of the already configured network of linuxrc.s390. Linuxrc.s390 has to configure the network early since the default terminals on s390 provide line mode but no full screen. The user then logs in over ssh to provide a full screen terminal in which loader can be executed. Since linuxrc already did the network config, we want to skip interactive user input in loader. Hence, 3 replaces 1 and 2 on s390. Before 0d5f432a39178f78754698e33a89905440584e4c, loader's readNetinfo iterated over all existing ifcfg files, which is only fine for s390 where linuxrc currently only ever configures at most one network device. Since readNetInfo is called for all platforms there could maybe exist more than one ifcfg file so we need a way for linuxrc to tell loader the name of the specific configured device. Linuxrc.s390 has 3 ways to activate loader:
- ssh login as user install, which has /sbin/loader as login shell
- ssh login as user root (/bin/bash) and executing loader manually
- boot option RUNKS=1
Passing exported environment variables only works for 3 where loader is a child of linuxrc. 2 only worked by accident since linuxrc wrote the content of /tmp/install.cfg into /etc/profile so root could see it. However, in the general and often used case 1 there is neither an ancestor relationship between linuxrc and loader nor a shell involved. Therefore, introduce a new file /tmp/s390net to pass the name to loader. This works the same for all three cases. Since QETHPARM and CHANDEV are no longer used, we can get rid of the old /tmp/install.cfg entirely.
This commit message is ridiculous. Please describe the problem *concisely* and *directly*. A page full of text is not concise. No one's going to sit down and read all this.
Holding off on applying this patch until we get a better commit message. Steffen, something like this would get your point across:
Pass configured network device on s390 to loader via /tmp/s390net rather than the DEVICE environment variable. Using the environment variable only works when loader is the child process of /sbin/init, which only happens for ks installs. Interactive installs on s390 invoke loader as the ssh login shell, so they never see the DEVICE environment variable.
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
Pass configured network device on s390 to loader via /tmp/s390net rather than the DEVICE environment variable. Using the environment variable only works when loader is the child process of /sbin/init, which only happens with RUNKS=1. Other installs on s390 invoke loader as the ssh login shell, so they never see the DEVICE environment variable. --- booty/bootloaderInfo.py | 15 --------------- loader/linuxrc.s390 | 45 +++++++-------------------------------------- loader/loader.c | 39 +++++++++++++++++++++++++++++++++------ 3 files changed, 40 insertions(+), 59 deletions(-)
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index d019edf..a0a7b4d 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -172,26 +172,11 @@ class KernelArguments:
def __init__(self, anaconda): newArgs = [] - cfgFilename = "/tmp/install.cfg"
self.anaconda = anaconda
if iutil.isS390(): self.cargs = [] - f = open(cfgFilename) - for line in f: - try: - (vname,vparm) = line.split('=', 1) - vname = vname.strip() - vparm = vparm.replace('"','') - vparm = vparm.strip() - if vname == "CHANDEV": - self.cargs.append(vparm) - if vname == "QETHPARM": - self.cargs.append(vparm) - except Exception, e: - pass - f.close()
# look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht", diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 614f7ff..356426e 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2973,49 +2973,18 @@ done # [ "$ipv6" ] && echo "IPV6=yes"
# transfer options into install environment -cat > /tmp/install.cfg << EOF -LANG="$LANG" -S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" -PORTNAME="$PORTNAME" -HOSTNAME="$HOSTNAME" -DEVICE="$DEVICE" -NETTYPE="$NETTYPE" -IPADDR="$IPADDR" -GATEWAY="$GATEWAY" -MTU="$MTU" -NETWORK="$NETWORK" -NETMASK="$NETMASK" -BROADCAST="$BROADCAST" -SEARCHDNS="$SEARCHDNS" -PEERID="$PEERID" -SUBCHANNELS="$SUBCHANNELS" -ONBOOT="yes" -CTCPROT="$CTCPROT" -EOF +# loader now uses ifcfg instead of install.cfg to receive our network config + +# additionally, loader's readNetInfo needs to know our DEVICE name +echo $DEVICE > /tmp/s390net + if [ "$ipv6" ]; then DNS1=$(echo $DNS | cut -d ',' -f 1) - echo DNS="$DNS1" >> /tmp/install.cfg - echo DNS1="$DNS1" >> /tmp/install.cfg - echo DNS2="$(echo $DNS | cut -d ',' -f 2)" >> /tmp/install.cfg + DNS2=$(echo $DNS | cut -d ',' -f 2) else DNS1=$(echo $DNS | cut -d ':' -f 1) - echo DNS="$DNS1" >> /tmp/install.cfg - echo DNS1="$DNS1" >> /tmp/install.cfg - echo DNS2="$(echo $DNS | cut -d ':' -f 2)" >> /tmp/install.cfg + DNS2=$(echo $DNS | cut -d ':' -f 2) fi -cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR -export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS -export PEERID ONBOOT SUBCHANNELS CTCPROT -EOF -# immediately read it in again to export these into the shell below -. /tmp/install.cfg -if [ -z "$testing" ]; then - cat /tmp/install.cfg >> /etc/profile -fi # testing
NETSCRIPTS="/etc/sysconfig/network-scripts" IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" diff --git a/loader/loader.c b/loader/loader.c index 14c7be6..a154ecc 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -633,20 +633,47 @@ static void writeVNCPasswordFile(char *pfile, char *password) { */ static void readNetInfo(struct loaderData_s ** ld) { struct loaderData_s * loaderData = *ld; - char *cfgfile = NULL; - gchar *contents = NULL; + char *cfgfile = NULL, *devfile = "/tmp/s390net"; + gchar *contents = NULL, *device = NULL; gchar **lines = NULL, **line = NULL; GError *e = NULL;
- /* when this function is called, the DEVICE environment variable + /* when this function is called, /tmp/s390net * contains the device name whose ifcfg file we want to read */ - if (!getenv("DEVICE")) { + if (!g_file_test(devfile, G_FILE_TEST_EXISTS)) { + logMessage(DEBUGLVL, "readNetInfo %s not found, early return", devfile); + return; + } + if (!g_file_get_contents(devfile, &contents, NULL, &e)) { + logMessage(ERROR, "error reading %s: %s", devfile, e->message); + g_error_free(e); + abort(); + } + line = lines = g_strsplit(contents, "\n", 0); + g_free(contents); + while (*line != NULL) { + gchar *tmp = g_strdup(*line); + tmp = g_strstrip(tmp); + logMessage(DEBUGLVL, "readNetInfo stripped line: %s", tmp); + if (strlen(tmp) > 0) { + device = strdup(tmp); + g_free(tmp); + logMessage(DEBUGLVL, "readNetInfo found device: %s", device); + break; + } + g_free(tmp); + line++; + } + g_strfreev(lines); + if (strlen(device) == 0) { return; + logMessage(DEBUGLVL, "readNetInfo no device found"); }
checked_asprintf(&cfgfile, "/etc/sysconfig/network-scripts/ifcfg-%s", - getenv("DEVICE")); + device); + logMessage(INFO, "readNetInfo cfgfile: %s", cfgfile);
/* make sure everything is NULL before we begin copying info */ loaderData->ipv4 = NULL; @@ -1495,7 +1522,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
logMessage(INFO, "going to do getNetConfig");
- /* s390 provides all config info by way of the CMS conf file */ + /* s390 provides all config info by way of linuxrc.s390 */ if (FL_HAVE_CMSCONF(flags)) { loaderData->ipinfo_set = 1; #ifdef ENABLE_IPV6
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ack and applied.
On Wed, 2 Jun 2010, Steffen Maier wrote:
Pass configured network device on s390 to loader via /tmp/s390net rather than the DEVICE environment variable. Using the environment variable only works when loader is the child process of /sbin/init, which only happens with RUNKS=1. Other installs on s390 invoke loader as the ssh login shell, so they never see the DEVICE environment variable.
booty/bootloaderInfo.py | 15 --------------- loader/linuxrc.s390 | 45 +++++++-------------------------------------- loader/loader.c | 39 +++++++++++++++++++++++++++++++++------ 3 files changed, 40 insertions(+), 59 deletions(-)
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index d019edf..a0a7b4d 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -172,26 +172,11 @@ class KernelArguments:
def __init__(self, anaconda): newArgs = []
cfgFilename = "/tmp/install.cfg" self.anaconda = anaconda if iutil.isS390(): self.cargs = []f = open(cfgFilename)for line in f:try:(vname,vparm) = line.split('=', 1)vname = vname.strip()vparm = vparm.replace('"','')vparm = vparm.strip()if vname == "CHANDEV":self.cargs.append(vparm)if vname == "QETHPARM":self.cargs.append(vparm)except Exception, e:passf.close() # look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht",diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 614f7ff..356426e 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2973,49 +2973,18 @@ done # [ "$ipv6" ] && echo "IPV6=yes"
# transfer options into install environment -cat > /tmp/install.cfg << EOF -LANG="$LANG" -S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" -PORTNAME="$PORTNAME" -HOSTNAME="$HOSTNAME" -DEVICE="$DEVICE" -NETTYPE="$NETTYPE" -IPADDR="$IPADDR" -GATEWAY="$GATEWAY" -MTU="$MTU" -NETWORK="$NETWORK" -NETMASK="$NETMASK" -BROADCAST="$BROADCAST" -SEARCHDNS="$SEARCHDNS" -PEERID="$PEERID" -SUBCHANNELS="$SUBCHANNELS" -ONBOOT="yes" -CTCPROT="$CTCPROT" -EOF +# loader now uses ifcfg instead of install.cfg to receive our network config
+# additionally, loader's readNetInfo needs to know our DEVICE name +echo $DEVICE > /tmp/s390net
if [ "$ipv6" ]; then DNS1=$(echo $DNS | cut -d ',' -f 1)
- echo DNS="$DNS1" >> /tmp/install.cfg
- echo DNS1="$DNS1" >> /tmp/install.cfg
- echo DNS2="$(echo $DNS | cut -d ',' -f 2)" >> /tmp/install.cfg
- DNS2=$(echo $DNS | cut -d ',' -f 2)
else DNS1=$(echo $DNS | cut -d ':' -f 1)
- echo DNS="$DNS1" >> /tmp/install.cfg
- echo DNS1="$DNS1" >> /tmp/install.cfg
- echo DNS2="$(echo $DNS | cut -d ':' -f 2)" >> /tmp/install.cfg
- DNS2=$(echo $DNS | cut -d ':' -f 2)
fi -cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR -export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS -export PEERID ONBOOT SUBCHANNELS CTCPROT -EOF -# immediately read it in again to export these into the shell below -. /tmp/install.cfg -if [ -z "$testing" ]; then
- cat /tmp/install.cfg >> /etc/profile
-fi # testing
NETSCRIPTS="/etc/sysconfig/network-scripts" IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" diff --git a/loader/loader.c b/loader/loader.c index 14c7be6..a154ecc 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -633,20 +633,47 @@ static void writeVNCPasswordFile(char *pfile, char *password) { */ static void readNetInfo(struct loaderData_s ** ld) { struct loaderData_s * loaderData = *ld;
- char *cfgfile = NULL;
- gchar *contents = NULL;
- char *cfgfile = NULL, *devfile = "/tmp/s390net";
- gchar *contents = NULL, *device = NULL; gchar **lines = NULL, **line = NULL; GError *e = NULL;
- /* when this function is called, the DEVICE environment variable
- /* when this function is called, /tmp/s390net
*/
- contains the device name whose ifcfg file we want to read
- if (!getenv("DEVICE")) {
if (!g_file_test(devfile, G_FILE_TEST_EXISTS)) {
logMessage(DEBUGLVL, "readNetInfo %s not found, early return", devfile);return;}
if (!g_file_get_contents(devfile, &contents, NULL, &e)) {
logMessage(ERROR, "error reading %s: %s", devfile, e->message);g_error_free(e);abort();}
line = lines = g_strsplit(contents, "\n", 0);
g_free(contents);
while (*line != NULL) {
gchar *tmp = g_strdup(*line);tmp = g_strstrip(tmp);logMessage(DEBUGLVL, "readNetInfo stripped line: %s", tmp);if (strlen(tmp) > 0) {device = strdup(tmp);g_free(tmp);logMessage(DEBUGLVL, "readNetInfo found device: %s", device);break;}g_free(tmp);line++;}
g_strfreev(lines);
if (strlen(device) == 0) { return;
logMessage(DEBUGLVL, "readNetInfo no device found");}
checked_asprintf(&cfgfile, "/etc/sysconfig/network-scripts/ifcfg-%s",
getenv("DEVICE"));
device);logMessage(INFO, "readNetInfo cfgfile: %s", cfgfile);
/* make sure everything is NULL before we begin copying info */ loaderData->ipv4 = NULL;
@@ -1495,7 +1522,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
logMessage(INFO, "going to do getNetConfig");
/* s390 provides all config info by way of the CMS conf file */
/* s390 provides all config info by way of linuxrc.s390 */ if (FL_HAVE_CMSCONF(flags)) { loaderData->ipinfo_set = 1;#ifdef ENABLE_IPV6
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
Before f17d989bc2cb50ffaedcf97a332095180511a272, writeEnabledNetInfo did not seem to be called on s390. Now that it is, it turned out that readNetInfo and writeEnabledNetInfo are not complete.
Loader does not need to handle or understand layer2 and portno so consolidate that into opaque options. This will prevent issues such as ef100b6baa5324fb5f5060b21f804bddc16ebead or 9caaca40bcaffb502dc58659e828f97d78a2d0f8 and is also transparent to future extensions in linuxrc.
Really ignore parm/conf file options that are deprecated, otherwise fixed loader would leave them in the ifcfg file.
Tell which stacks to configure in /etc/sysconfig/network
GATEWAY in ifcfg is really IPv4 only.
Please fixed loader to parse DNS and write DNS1,DNS2,... itself (again).
Correctly parse OPTIONS whose value includes equal signs because the values are attribute value pairs. See also bug 597205 and 8549a36d4b22171992951a272b82f0aa14234dc4.
Do parse DOMAIN for DNS search suffixes which are very hand on s390 where it's sometimes hard to write more than 80 chars for repo/stage2/updates etc. Also write out quoted since it is a whitespace separated list.
Don't write HWADDR on s390. See also 3411cda88be7ec7fe57ec5c9c73d15148354a414 and 2c1aab43a1010ec0e113fa86e4daea9cd99de7f6 (bug 546005) or bug 591533. --- isys/iface.c | 3 +-- isys/iface.h | 3 +-- loader/linuxrc.s390 | 17 ++++++++++++++++- loader/loader.c | 15 ++++++++------- loader/loader.h | 2 +- loader/net.c | 45 +++++++++++++-------------------------------- 6 files changed, 40 insertions(+), 45 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/linuxrc.s390 b/loader/linuxrc.s390 index b421062..3716979 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -1992,6 +1992,7 @@ function do_network() { echo $"The NETWORK parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo + unset NETWORK }
### BROADCAST @@ -2001,6 +2002,7 @@ function do_broadcast() { echo $"The BROADCAST parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo + unset BROADCAST }
### NETMASK (IPv6) @@ -2994,12 +2996,16 @@ fi cat > /etc/sysconfig/network << EOF HOSTNAME=$HOSTNAME EOF +if [ "$ipv6" ]; then + echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network +else + echo "NETWORKING=yes" >> /etc/sysconfig/network +fi
cat > $IFCFGFILE << EOF DEVICE=$DEVICE ONBOOT=yes BOOTPROTO=static -GATEWAY=$GATEWAY BROADCAST=$BROADCAST MTU=$MTU SUBCHANNELS=$SUBCHANNELS @@ -3017,10 +3023,19 @@ else cat >> $IFCFGFILE << EOF IPADDR=$IPADDR NETMASK=$NETMASK +GATEWAY=$GATEWAY EOF fi +# real DNS config for NetworkManager to generate /etc/resolv.conf [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE [ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE +# just to please loader's readNetInfo && writeEnabledNetInfo +# which eats DNS1,DNS2,... and generates it themselves based on DNS +if [ "$ipv6" ]; then + [ "$DNS" != "" ] && echo "DNS="$DNS"" >> $IFCFGFILE +else + [ "$DNS" != "" ] && echo "DNS="$(echo $DNS|sed -e 's/:/,/g')"" >> $IFCFGFILE +fi # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf [ "$SEARCHDNS" != "" ] && echo "DOMAIN="$SEARCHDNS"" >> $IFCFGFILE [ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE diff --git a/loader/loader.c b/loader/loader.c index 5f49cc0..049c26f 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -686,8 +686,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; @@ -722,7 +721,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); @@ -735,12 +734,16 @@ static void readNetInfo(struct loaderData_s ** ld) { } else { if (!g_strcmp0(pair[0], "IPADDR")) { loaderData->ipv4 = strdup(val); + loaderData->ipinfo_set = 1; + flags |= LOADER_FLAGS_IP_PARAM; } else if (!g_strcmp0(pair[0], "NETMASK")) { loaderData->netmask = strdup(val); } else if (!g_strcmp0(pair[0], "GATEWAY")) { loaderData->gateway = strdup(val); } else if (!g_strcmp0(pair[0], "DNS")) { loaderData->dns = strdup(val); + } else if (!g_strcmp0(pair[0], "DOMAIN")) { + loaderData->domain = strdup(val); } else if (!g_strcmp0(pair[0], "MTU")) { errno = 0; loaderData->mtu = strtol(val, NULL, 10); @@ -761,10 +764,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..f35e3ff 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, *domain, *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..769c1d4 100644 --- a/loader/net.c +++ b/loader/net.c @@ -366,6 +366,11 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) { logMessage(INFO, "dnsservers is %s", loaderData->dns); }
+ if (loaderData->domain) { + logMessage(INFO, "dnsdomains is %s", loaderData->domain); + iface->domain = strdup(loaderData->domain); + } + if (loaderData->hostname) { logMessage(INFO, "setting specified hostname of %s", loaderData->hostname); @@ -400,12 +405,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 +1219,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]; @@ -1283,7 +1284,9 @@ int writeEnabledNetInfo(iface_t *iface) { }
fprintf(fp, "DEVICE=%s\n", iface->device); +#if !defined(__s390__) && !defined(__s390x__) fprintf(fp, "HWADDR=%s\n", iface_mac2str(iface->device)); +#endif fprintf(fp, "ONBOOT=yes\n");
if (!FL_NOIPV4(flags)) { @@ -1401,7 +1404,7 @@ int writeEnabledNetInfo(iface_t *iface) { }
if (iface->domain) { - fprintf(fp, "DOMAIN=%s\n", iface->domain); + fprintf(fp, "DOMAIN="%s"\n", iface->domain); }
if (iface->mtu) { @@ -1428,30 +1431,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) {
Before f17d989bc2cb50ffaedcf97a332095180511a272, writeEnabledNetInfo did not seem to be called on s390. Now that it is, it turned out that readNetInfo and writeEnabledNetInfo are not complete.
Loader does not need to handle or understand layer2 and portno so consolidate that into opaque options. This will prevent issues such as ef100b6baa5324fb5f5060b21f804bddc16ebead or 9caaca40bcaffb502dc58659e828f97d78a2d0f8 and is also transparent to future extensions in linuxrc.
Really ignore parm/conf file options that are deprecated, otherwise fixed loader would leave them in the ifcfg file.
Tell which stacks to configure in /etc/sysconfig/network
GATEWAY in ifcfg is really IPv4 only.
Please fixed loader to parse DNS and write DNS1,DNS2,... itself (again).
Correctly parse OPTIONS whose value includes equal signs because the values are attribute value pairs. See also bug 597205 and 8549a36d4b22171992951a272b82f0aa14234dc4.
Do parse DOMAIN for DNS search suffixes which are very hand on s390 where it's sometimes hard to write more than 80 chars for repo/stage2/updates etc. Also write out quoted since it is a whitespace separated list.
Don't write HWADDR on s390. See also 3411cda88be7ec7fe57ec5c9c73d15148354a414 and 2c1aab43a1010ec0e113fa86e4daea9cd99de7f6 (bug 546005) or bug 591533.
Please fix one issue per commit. Having giant catch-all commits like this makes it more difficult to see what's going on in the history.
- Chris
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
These changes look fine from a technical standpoint, but in an effort to keep git commits to a single functional change, could you break these changes in to multiple commits? Chris already requested this, but I'm requesting it as well. Even though they are for the same BZ, the actual changes included here are for different issues. The BZ filed is really a catch-all BZ, which is fine, but we would prefer separate git commits. Make sure you reference the BZ number in each patch per the docs/commit-log.txt file.
Also, could you stop referencing many git commits via their full hash? It makes the commit log message difficult to read.
On Mon, 31 May 2010, Steffen Maier wrote:
Before f17d989bc2cb50ffaedcf97a332095180511a272, writeEnabledNetInfo did not seem to be called on s390. Now that it is, it turned out that readNetInfo and writeEnabledNetInfo are not complete.
Loader does not need to handle or understand layer2 and portno so consolidate that into opaque options. This will prevent issues such as ef100b6baa5324fb5f5060b21f804bddc16ebead or 9caaca40bcaffb502dc58659e828f97d78a2d0f8 and is also transparent to future extensions in linuxrc.
This change should be a single commit. Referencing ef100b6baa5324fb5f5060b21f804bddc16ebead and 9caaca40bcaffb502dc58659e828f97d78a2d0f8 is less desirable than referencing the other bugs in a "Related: rhbz#XXXXXX" format. Also, it's best to not make promises we can't guarantee ("...and is also transparent to future extensions in linuxrc").
Really ignore parm/conf file options that are deprecated, otherwise fixed loader would leave them in the ifcfg file.
I don't know what change this sentence refers to in the patch.
Tell which stacks to configure in /etc/sysconfig/network
This should be a single commit.
GATEWAY in ifcfg is really IPv4 only.
This should be a single commit.
Please fixed loader to parse DNS and write DNS1,DNS2,... itself (again).
This should be a single commit.
Correctly parse OPTIONS whose value includes equal signs because the values are attribute value pairs. See also bug 597205 and 8549a36d4b22171992951a272b82f0aa14234dc4.
My guess is this change should be part of the commit above to fix the handling of layer2 and portno, but I could be wrong.
Do parse DOMAIN for DNS search suffixes which are very hand on s390 where it's sometimes hard to write more than 80 chars for repo/stage2/updates etc. Also write out quoted since it is a whitespace separated list.
This should be a single commit.
Don't write HWADDR on s390. See also 3411cda88be7ec7fe57ec5c9c73d15148354a414 and 2c1aab43a1010ec0e113fa86e4daea9cd99de7f6 (bug 546005) or bug 591533.
This should be a single commit.
isys/iface.c | 3 +-- isys/iface.h | 3 +-- loader/linuxrc.s390 | 17 ++++++++++++++++- loader/loader.c | 15 ++++++++------- loader/loader.h | 2 +- loader/net.c | 45 +++++++++++++-------------------------------- 6 files changed, 40 insertions(+), 45 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/linuxrc.s390 b/loader/linuxrc.s390 index b421062..3716979 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -1992,6 +1992,7 @@ function do_network() { echo $"The NETWORK parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo
- unset NETWORK
}
### BROADCAST @@ -2001,6 +2002,7 @@ function do_broadcast() { echo $"The BROADCAST parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo
- unset BROADCAST
}
### NETMASK (IPv6) @@ -2994,12 +2996,16 @@ fi cat > /etc/sysconfig/network << EOF HOSTNAME=$HOSTNAME EOF +if [ "$ipv6" ]; then
- echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
+else
- echo "NETWORKING=yes" >> /etc/sysconfig/network
+fi
cat > $IFCFGFILE << EOF DEVICE=$DEVICE ONBOOT=yes BOOTPROTO=static -GATEWAY=$GATEWAY BROADCAST=$BROADCAST MTU=$MTU SUBCHANNELS=$SUBCHANNELS @@ -3017,10 +3023,19 @@ else cat >> $IFCFGFILE << EOF IPADDR=$IPADDR NETMASK=$NETMASK +GATEWAY=$GATEWAY EOF fi +# real DNS config for NetworkManager to generate /etc/resolv.conf [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE [ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE +# just to please loader's readNetInfo && writeEnabledNetInfo +# which eats DNS1,DNS2,... and generates it themselves based on DNS +if [ "$ipv6" ]; then
- [ "$DNS" != "" ] && echo "DNS="$DNS"" >> $IFCFGFILE
+else
- [ "$DNS" != "" ] && echo "DNS="$(echo $DNS|sed -e 's/:/,/g')"" >> $IFCFGFILE
+fi # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf [ "$SEARCHDNS" != "" ] && echo "DOMAIN="$SEARCHDNS"" >> $IFCFGFILE [ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE diff --git a/loader/loader.c b/loader/loader.c index 5f49cc0..049c26f 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -686,8 +686,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; @@ -722,7 +721,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);@@ -735,12 +734,16 @@ static void readNetInfo(struct loaderData_s ** ld) { } else { if (!g_strcmp0(pair[0], "IPADDR")) { loaderData->ipv4 = strdup(val);
loaderData->ipinfo_set = 1;flags |= LOADER_FLAGS_IP_PARAM; } else if (!g_strcmp0(pair[0], "NETMASK")) { loaderData->netmask = strdup(val); } else if (!g_strcmp0(pair[0], "GATEWAY")) { loaderData->gateway = strdup(val); } else if (!g_strcmp0(pair[0], "DNS")) { loaderData->dns = strdup(val);} else if (!g_strcmp0(pair[0], "DOMAIN")) {loaderData->domain = strdup(val); } else if (!g_strcmp0(pair[0], "MTU")) { errno = 0; loaderData->mtu = strtol(val, NULL, 10);@@ -761,10 +764,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..f35e3ff 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, *domain, *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..769c1d4 100644 --- a/loader/net.c +++ b/loader/net.c @@ -366,6 +366,11 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) { logMessage(INFO, "dnsservers is %s", loaderData->dns); }
- if (loaderData->domain) {
logMessage(INFO, "dnsdomains is %s", loaderData->domain);iface->domain = strdup(loaderData->domain);- }
- if (loaderData->hostname) { logMessage(INFO, "setting specified hostname of %s", loaderData->hostname);
@@ -400,12 +405,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 +1219,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];
@@ -1283,7 +1284,9 @@ int writeEnabledNetInfo(iface_t *iface) { }
fprintf(fp, "DEVICE=%s\n", iface->device);+#if !defined(__s390__) && !defined(__s390x__) fprintf(fp, "HWADDR=%s\n", iface_mac2str(iface->device)); +#endif fprintf(fp, "ONBOOT=yes\n");
if (!FL_NOIPV4(flags)) {@@ -1401,7 +1404,7 @@ int writeEnabledNetInfo(iface_t *iface) { }
if (iface->domain) {
fprintf(fp, "DOMAIN=%s\n", iface->domain);
fprintf(fp, "DOMAIN=\"%s\"\n", iface->domain);}
if (iface->mtu) {
@@ -1428,30 +1431,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) {
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
Steffen Maier (8): Handle OPTIONS in ifcfg files transparently in loader (#595388) Really ignore deprecated parm/conf file options in linuxrc.s390 (#595388) Tell which stacks to configure in /etc/sysconfig/network on s390 (#595388) GATEWAY in linuxrc.s390's ifcfg is really IPv4 only (#595388) Allow loader to parse DNS and write DNS1,DNS2,... itself (again). (#595388) Do parse DOMAIN for DNS search suffixes in loader (#595388) Don't let loader write HWADDR to ifcfg file on s390. (#595388) Remember when IPv4 IPADDR has been read from ifcfg file in loader (#595388)
isys/iface.c | 3 +-- isys/iface.h | 3 +-- loader/linuxrc.s390 | 17 ++++++++++++++++- loader/loader.c | 15 ++++++++------- loader/loader.h | 2 +- loader/net.c | 45 +++++++++++++-------------------------------- 6 files changed, 40 insertions(+), 45 deletions(-)
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) {
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
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) {
Otherwise the fixed loader would leave them in the ifcfg file. --- loader/linuxrc.s390 | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 356426e..fc7f325 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -1994,6 +1994,7 @@ function do_network() { echo $"The NETWORK parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo + unset NETWORK }
### BROADCAST @@ -2003,6 +2004,7 @@ function do_broadcast() { echo $"The BROADCAST parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo + unset BROADCAST }
### NETMASK (IPv6)
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
Otherwise the fixed loader would leave them in the ifcfg file.
loader/linuxrc.s390 | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 356426e..fc7f325 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -1994,6 +1994,7 @@ function do_network() { echo $"The NETWORK parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo
- unset NETWORK
}
### BROADCAST @@ -2003,6 +2004,7 @@ function do_broadcast() { echo $"The BROADCAST parameter isn't used anymore and will be ignored." echo $" It is sufficient to specify IPADDR and NETMASK." echo
- unset BROADCAST
}
### NETMASK (IPv6)
--- loader/linuxrc.s390 | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index fc7f325..c83f54b 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2998,6 +2998,11 @@ fi cat > /etc/sysconfig/network << EOF HOSTNAME=$HOSTNAME EOF +if [ "$ipv6" ]; then + echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network +else + echo "NETWORKING=yes" >> /etc/sysconfig/network +fi
cat > $IFCFGFILE << EOF DEVICE=$DEVICE
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
loader/linuxrc.s390 | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index fc7f325..c83f54b 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2998,6 +2998,11 @@ fi cat > /etc/sysconfig/network << EOF HOSTNAME=$HOSTNAME EOF +if [ "$ipv6" ]; then
- echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
+else
- echo "NETWORKING=yes" >> /etc/sysconfig/network
+fi
cat > $IFCFGFILE << EOF DEVICE=$DEVICE
--- loader/linuxrc.s390 | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index c83f54b..11d97a6 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -3008,7 +3008,6 @@ cat > $IFCFGFILE << EOF DEVICE=$DEVICE ONBOOT=yes BOOTPROTO=static -GATEWAY=$GATEWAY BROADCAST=$BROADCAST MTU=$MTU SUBCHANNELS=$SUBCHANNELS @@ -3026,6 +3025,7 @@ else cat >> $IFCFGFILE << EOF IPADDR=$IPADDR NETMASK=$NETMASK +GATEWAY=$GATEWAY EOF fi [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
loader/linuxrc.s390 | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index c83f54b..11d97a6 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -3008,7 +3008,6 @@ cat > $IFCFGFILE << EOF DEVICE=$DEVICE ONBOOT=yes BOOTPROTO=static -GATEWAY=$GATEWAY BROADCAST=$BROADCAST MTU=$MTU SUBCHANNELS=$SUBCHANNELS @@ -3026,6 +3025,7 @@ else cat >> $IFCFGFILE << EOF IPADDR=$IPADDR NETMASK=$NETMASK +GATEWAY=$GATEWAY EOF fi [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE
--- loader/linuxrc.s390 | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 11d97a6..7badbe5 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -3028,8 +3028,16 @@ NETMASK=$NETMASK GATEWAY=$GATEWAY EOF fi +# real DNS config for NetworkManager to generate /etc/resolv.conf [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE [ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE +# just to please loader's readNetInfo && writeEnabledNetInfo +# which eats DNS1,DNS2,... and generates it themselves based on DNS +if [ "$ipv6" ]; then + [ "$DNS" != "" ] && echo "DNS="$DNS"" >> $IFCFGFILE +else + [ "$DNS" != "" ] && echo "DNS="$(echo $DNS|sed -e 's/:/,/g')"" >> $IFCFGFILE +fi # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf [ "$SEARCHDNS" != "" ] && echo "DOMAIN="$SEARCHDNS"" >> $IFCFGFILE [ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
loader/linuxrc.s390 | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 11d97a6..7badbe5 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -3028,8 +3028,16 @@ NETMASK=$NETMASK GATEWAY=$GATEWAY EOF fi +# real DNS config for NetworkManager to generate /etc/resolv.conf [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE [ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE +# just to please loader's readNetInfo && writeEnabledNetInfo +# which eats DNS1,DNS2,... and generates it themselves based on DNS +if [ "$ipv6" ]; then
- [ "$DNS" != "" ] && echo "DNS="$DNS"" >> $IFCFGFILE
+else
- [ "$DNS" != "" ] && echo "DNS="$(echo $DNS|sed -e 's/:/,/g')"" >> $IFCFGFILE
+fi # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf [ "$SEARCHDNS" != "" ] && echo "DOMAIN="$SEARCHDNS"" >> $IFCFGFILE [ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE
This is very handy on s390, where it's sometimes hard to write more than 80 chars for repo/stage2/updates etc.
Also write out quoted since it is a whitespace separated list. --- loader/loader.c | 2 ++ loader/loader.h | 2 +- loader/net.c | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/loader/loader.c b/loader/loader.c index 10ac12b..381f19b 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -739,6 +739,8 @@ static void readNetInfo(struct loaderData_s ** ld) { loaderData->gateway = strdup(val); } else if (!g_strcmp0(pair[0], "DNS")) { loaderData->dns = strdup(val); + } else if (!g_strcmp0(pair[0], "DOMAIN")) { + loaderData->domain = strdup(val); } else if (!g_strcmp0(pair[0], "MTU")) { errno = 0; loaderData->mtu = strtol(val, NULL, 10); diff --git a/loader/loader.h b/loader/loader.h index 0b910f7..f35e3ff 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, *options, *macaddr; + char *ipv4, *netmask, *gateway, *dns, *domain, *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 153e6f9..8e37a66 100644 --- a/loader/net.c +++ b/loader/net.c @@ -366,6 +366,11 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) { logMessage(INFO, "dnsservers is %s", loaderData->dns); }
+ if (loaderData->domain) { + logMessage(INFO, "dnsdomains is %s", loaderData->domain); + iface->domain = strdup(loaderData->domain); + } + if (loaderData->hostname) { logMessage(INFO, "setting specified hostname of %s", loaderData->hostname); @@ -1397,7 +1402,7 @@ int writeEnabledNetInfo(iface_t *iface) { }
if (iface->domain) { - fprintf(fp, "DOMAIN=%s\n", iface->domain); + fprintf(fp, "DOMAIN="%s"\n", iface->domain); }
if (iface->mtu) {
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
This is very handy on s390, where it's sometimes hard to write more than 80 chars for repo/stage2/updates etc.
Also write out quoted since it is a whitespace separated list.
loader/loader.c | 2 ++ loader/loader.h | 2 +- loader/net.c | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/loader/loader.c b/loader/loader.c index 10ac12b..381f19b 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -739,6 +739,8 @@ static void readNetInfo(struct loaderData_s ** ld) { loaderData->gateway = strdup(val); } else if (!g_strcmp0(pair[0], "DNS")) { loaderData->dns = strdup(val);
} else if (!g_strcmp0(pair[0], "DOMAIN")) {loaderData->domain = strdup(val); } else if (!g_strcmp0(pair[0], "MTU")) { errno = 0; loaderData->mtu = strtol(val, NULL, 10);diff --git a/loader/loader.h b/loader/loader.h index 0b910f7..f35e3ff 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, *options, *macaddr;
- char *ipv4, *netmask, *gateway, *dns, *domain, *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 153e6f9..8e37a66 100644 --- a/loader/net.c +++ b/loader/net.c @@ -366,6 +366,11 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData) { logMessage(INFO, "dnsservers is %s", loaderData->dns); }
- if (loaderData->domain) {
logMessage(INFO, "dnsdomains is %s", loaderData->domain);iface->domain = strdup(loaderData->domain);- }
- if (loaderData->hostname) { logMessage(INFO, "setting specified hostname of %s", loaderData->hostname);
@@ -1397,7 +1402,7 @@ int writeEnabledNetInfo(iface_t *iface) { }
if (iface->domain) {
fprintf(fp, "DOMAIN=%s\n", iface->domain);
fprintf(fp, "DOMAIN=\"%s\"\n", iface->domain);}
if (iface->mtu) {
See also bug 546005 and bug 546005 or bug 591533. --- loader/net.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/loader/net.c b/loader/net.c index 8e37a66..769c1d4 100644 --- a/loader/net.c +++ b/loader/net.c @@ -1284,7 +1284,9 @@ int writeEnabledNetInfo(iface_t *iface) { }
fprintf(fp, "DEVICE=%s\n", iface->device); +#if !defined(__s390__) && !defined(__s390x__) fprintf(fp, "HWADDR=%s\n", iface_mac2str(iface->device)); +#endif fprintf(fp, "ONBOOT=yes\n");
if (!FL_NOIPV4(flags)) {
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
See also bug 546005 and bug 546005 or bug 591533.
loader/net.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/loader/net.c b/loader/net.c index 8e37a66..769c1d4 100644 --- a/loader/net.c +++ b/loader/net.c @@ -1284,7 +1284,9 @@ int writeEnabledNetInfo(iface_t *iface) { }
fprintf(fp, "DEVICE=%s\n", iface->device);+#if !defined(__s390__) && !defined(__s390x__) fprintf(fp, "HWADDR=%s\n", iface_mac2str(iface->device)); +#endif fprintf(fp, "ONBOOT=yes\n");
if (!FL_NOIPV4(flags)) {
--- loader/loader.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/loader/loader.c b/loader/loader.c index 381f19b..cca5273 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -733,6 +733,8 @@ static void readNetInfo(struct loaderData_s ** ld) { } else { if (!g_strcmp0(pair[0], "IPADDR")) { loaderData->ipv4 = strdup(val); + loaderData->ipinfo_set = 1; + flags |= LOADER_FLAGS_IP_PARAM; } else if (!g_strcmp0(pair[0], "NETMASK")) { loaderData->netmask = strdup(val); } else if (!g_strcmp0(pair[0], "GATEWAY")) {
Ack, applying.
On Wed, 2 Jun 2010, Steffen Maier wrote:
loader/loader.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/loader/loader.c b/loader/loader.c index 381f19b..cca5273 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -733,6 +733,8 @@ static void readNetInfo(struct loaderData_s ** ld) { } else { if (!g_strcmp0(pair[0], "IPADDR")) { loaderData->ipv4 = strdup(val);
loaderData->ipinfo_set = 1;flags |= LOADER_FLAGS_IP_PARAM; } else if (!g_strcmp0(pair[0], "NETMASK")) { loaderData->netmask = strdup(val); } else if (!g_strcmp0(pair[0], "GATEWAY")) {
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 2 Jun 2010, Steffen Maier wrote:
Steffen Maier (8): Handle OPTIONS in ifcfg files transparently in loader (#595388) Really ignore deprecated parm/conf file options in linuxrc.s390 (#595388) Tell which stacks to configure in /etc/sysconfig/network on s390 (#595388) GATEWAY in linuxrc.s390's ifcfg is really IPv4 only (#595388) Allow loader to parse DNS and write DNS1,DNS2,... itself (again). (#595388) Do parse DOMAIN for DNS search suffixes in loader (#595388) Don't let loader write HWADDR to ifcfg file on s390. (#595388) Remember when IPv4 IPADDR has been read from ifcfg file in loader (#595388)
Better, but patches 1, 4, 5, and 6 do not apply.
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
On Wed, 2 Jun 2010, David Cantrell wrote:
On Wed, 2 Jun 2010, Steffen Maier wrote:
Steffen Maier (8): Handle OPTIONS in ifcfg files transparently in loader (#595388) Really ignore deprecated parm/conf file options in linuxrc.s390 (#595388) Tell which stacks to configure in /etc/sysconfig/network on s390 (#595388) GATEWAY in linuxrc.s390's ifcfg is really IPv4 only (#595388) Allow loader to parse DNS and write DNS1,DNS2,... itself (again). (#595388) Do parse DOMAIN for DNS search suffixes in loader (#595388) Don't let loader write HWADDR to ifcfg file on s390. (#595388) Remember when IPv4 IPADDR has been read from ifcfg file in loader (#595388)
Better, but patches 1, 4, 5, and 6 do not apply.
Everything has been applied now.
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) {
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ack for master and rhel6-branch.
On Mon, 31 May 2010, Steffen Maier wrote:
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) {
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
anaconda-devel@lists.fedoraproject.org