diff options
author | David Cantrell <dcantrell@redhat.com> | 2008-12-03 18:19:28 -1000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2008-12-05 10:42:17 -1000 |
commit | 059ff58dcf85d703ef938c8203658b923f86e77f (patch) | |
tree | 00be36ce00002db8104c0b00eaece457780892a5 /loader/net.c | |
parent | a77a618e2e1ed5a5432fcca7ad21646f764ec17d (diff) | |
download | anaconda-059ff58dcf85d703ef938c8203658b923f86e77f.tar.gz anaconda-059ff58dcf85d703ef938c8203658b923f86e77f.tar.xz anaconda-059ff58dcf85d703ef938c8203658b923f86e77f.zip |
Send unique vendor class identifier unless user specifies one.
Restores functionality we had before the NM changeover. This was
originally requested by gurulabs.com. Instead of sending just
'anaconda' as the vendor class identifier, send something like:
anaconda-Linux 2.6.27.5-117.fc10.i686 i686
Of course, if we fail to collect that information, fall back on
'anaconda'. Guru Labs wanted this functionality for PXE booting
as it allowed them to more easily control per-client/per-release
settings from the DHCP server. My fault for not adding this back
when the NM changeover happened.
Diffstat (limited to 'loader/net.c')
-rw-r--r-- | loader/net.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/loader/net.c b/loader/net.c index 62dc236c1..9c6c2f59f 100644 --- a/loader/net.c +++ b/loader/net.c @@ -1156,6 +1156,7 @@ int writeEnabledNetInfo(iface_t *iface) { char buf[INET6_ADDRSTRLEN+1]; char *ofile = NULL; char *nfile = NULL; + struct utsname kv; memset(&buf, '\0', sizeof(buf)); @@ -1163,29 +1164,38 @@ 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; + /* write vendor class */ + if (iface->vendorclass == NULL) { + if (uname(&kv) == -1) { + iface->vendorclass = "anaconda"; + } else { + if (asprintf(&iface->vendorclass, "anaconda-%s %s %s", + kv.sysname, kv.release, kv.machine)) { + return 20; + } } + } - if ((fp = fopen(ofile, "w")) == NULL) { - free(ofile); - return 18; - } + if (asprintf(&ofile, "/etc/dhclient-%s.conf", iface->device) == -1) { + return 17; + } - fprintf(fp, "send vendor-class-identifier \"%s\";\n", - iface->vendorclass); + if ((fp = fopen(ofile, "w")) == NULL) { + free(ofile); + return 18; + } - if (fclose(fp) == EOF) { - free(ofile); - return 19; - } + fprintf(fp, "send vendor-class-identifier \"%s\";\n", + iface->vendorclass); - if (ofile) { - free(ofile); - ofile = NULL; - } + if (fclose(fp) == EOF) { + free(ofile); + return 19; + } + + if (ofile) { + free(ofile); + ofile = NULL; } /* write out new ifcfg-DEVICE file */ |