summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-10-24 12:09:45 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-10-24 12:09:45 -1000
commit8807d1cfc446bd23404e150e31eb0cf7fe4c98e1 (patch)
treef110377fd2b75d87efe5cb7641a4d700d59508c9 /loader
parent351f18092f98f319d2203377ab141c070cc00a72 (diff)
downloadanaconda-8807d1cfc446bd23404e150e31eb0cf7fe4c98e1.tar.gz
anaconda-8807d1cfc446bd23404e150e31eb0cf7fe4c98e1.tar.xz
anaconda-8807d1cfc446bd23404e150e31eb0cf7fe4c98e1.zip
Write dhcpclass to the dhclient conf file for the device (#468436)
If the user passes dhcpclass= at the boot prompt, write the value to /etc/dhclient-DEVICE.conf as 'send vendor-class-identifier %s' so that NM will use those settings when sending the DHCP request.
Diffstat (limited to 'loader')
-rw-r--r--loader/net.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/loader/net.c b/loader/net.c
index 6f660bb77..b29d40c9a 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1075,6 +1075,23 @@ int writeDisabledNetInfo(void) {
}
for (i = 0; devs[i]; i++) {
+ /* remove dhclient-DEVICE.conf if we have it */
+ if (asprintf(&ofile, "/etc/dhclient-%s.conf", devs[i]->device) == -1) {
+ return 5;
+ }
+
+ if (!access(ofile, R_OK|W_OK)) {
+ if (unlink(ofile)) {
+ logMessage(ERROR, "error removing %s", ofile);
+ }
+ }
+
+ if (ofile) {
+ free(ofile);
+ ofile = NULL;
+ }
+
+ /* write disabled ifcfg-DEVICE file */
if (asprintf(&ofile, "%s/.ifcfg-%s",
NETWORK_SCRIPTS_PATH,
devs[i]->device) == -1) {
@@ -1142,6 +1159,32 @@ int writeEnabledNetInfo(iface_t *iface) {
return 16;
}
+ /* write vendor class if we have that */
+ if (iface->vendorclass != NULL) {
+ if (asprintf(&ofile, "/etc/dhclient-%s.conf", iface->device) == -1) {
+ return 17;
+ }
+
+ if ((fp = fopen(ofile, "w")) == NULL) {
+ free(ofile);
+ return 18;
+ }
+
+ fprintf(fp, "send vendor-class-identifier \"%s\";\n",
+ iface->vendorclass);
+
+ if (fclose(fp) == EOF) {
+ free(ofile);
+ return 19;
+ }
+
+ if (ofile) {
+ free(ofile);
+ ofile = NULL;
+ }
+ }
+
+ /* write out new ifcfg-DEVICE file */
if (asprintf(&ofile, "%s/.ifcfg-%s",
NETWORK_SCRIPTS_PATH, iface->device) == -1) {
return 1;