David Cantrell wrote:
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.
---
loader/net.c | 46 ++++++++++++++++++++++++++++------------------
1 files changed, 28 insertions(+), 18 deletions(-)
Looks good,
Regards,
Hans
diff --git a/loader/net.c b/loader/net.c
index 62dc236..9c6c2f5 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 */
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list