diff options
author | Jeremy Katz <katzj@redhat.com> | 2004-01-06 23:37:50 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2004-01-06 23:37:50 +0000 |
commit | c2705387272baa56829b9236ee095390119eb36a (patch) | |
tree | 93648fda09f6f1976bfbd1d7cb8a9440af4647ae | |
parent | a417b6e2edac5605f284697460be59bc587b5b0d (diff) | |
download | anaconda-c2705387272baa56829b9236ee095390119eb36a.tar.gz anaconda-c2705387272baa56829b9236ee095390119eb36a.tar.xz anaconda-c2705387272baa56829b9236ee095390119eb36a.zip |
add dhcp class id support (#107946). requires pump >= 0.8.20
-rw-r--r-- | anaconda.spec.in | 2 | ||||
-rw-r--r-- | docs/command-line.txt | 3 | ||||
-rw-r--r-- | installclass.py | 3 | ||||
-rw-r--r-- | isys/isys.c | 5 | ||||
-rw-r--r-- | kickstart.py | 8 | ||||
-rw-r--r-- | loader2/loader.c | 5 | ||||
-rw-r--r-- | loader2/loader.h | 2 | ||||
-rw-r--r-- | loader2/net.c | 20 | ||||
-rw-r--r-- | loader2/net.h | 2 | ||||
-rw-r--r-- | network.py | 6 |
10 files changed, 42 insertions, 14 deletions
diff --git a/anaconda.spec.in b/anaconda.spec.in index 32e144e03..f95c5be86 100644 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -6,7 +6,7 @@ License: GPL Summary: The Red Hat Linux installation program. Group: Applications/System Source: anaconda-%{PACKAGE_VERSION}.tar.bz2 -BuildPreReq: pump-devel >= 0.8.15, kudzu-devel >= 1.1.0, pciutils-devel, bzip2-devel, e2fsprogs-devel, python-devel gtk2-devel rpm-python >= 4.2-0.61, newt-devel, rpm-devel, gettext >= 0.11, rhpl, booty, libxml2-python, zlib-devel, bogl-devel >= 0:0.1.9-17, bogl-bterm >= 0:0.1.9-17, elfutils-devel, beecrypt-devel +BuildPreReq: pump-devel >= 0.8.20, kudzu-devel >= 1.1.0, pciutils-devel, bzip2-devel, e2fsprogs-devel, python-devel gtk2-devel rpm-python >= 4.2-0.61, newt-devel, rpm-devel, gettext >= 0.11, rhpl, booty, libxml2-python, zlib-devel, bogl-devel >= 0:0.1.9-17, bogl-bterm >= 0:0.1.9-17, elfutils-devel, beecrypt-devel %ifarch i386 BuildRequires: dietlibc %endif diff --git a/docs/command-line.txt b/docs/command-line.txt index 97a1d787a..06582c2f5 100644 --- a/docs/command-line.txt +++ b/docs/command-line.txt @@ -102,6 +102,9 @@ kssendmac Adds HTTP headers to ks=http:// request that can be helpful HTTP_X_RHN_PROVISIONING_0, HTTP_X_RHN_PROVISIONING_1, etc, for all nics. +dhcpclass=<class> Sends a custom DHCP vendor class identifier. ISC's dhcpcd can + inspect this value using "option vendor-class-identifier". + upgradeany Don't require an /etc/redhat-release that matches the expected syntax to upgrade. diff --git a/installclass.py b/installclass.py index d44ff9021..c78fdc15a 100644 --- a/installclass.py +++ b/installclass.py @@ -292,7 +292,7 @@ class BaseInstallClass: id.auth.enableCache = enableCache - def setNetwork(self, id, bootProto, ip, netmask, ethtool, device = None, onboot = 1): + def setNetwork(self, id, bootProto, ip, netmask, ethtool, device = None, onboot = 1, dhcpclass = None): if bootProto: devices = id.network.available () if (devices and bootProto): @@ -302,6 +302,7 @@ class BaseInstallClass: device = list[0] dev = devices[device] dev.set (("bootproto", bootProto)) + dev.set (("dhcpclass", dhcpclass)) if onboot: dev.set (("onboot", "yes")) else: diff --git a/isys/isys.c b/isys/isys.c index 45657e720..323419d83 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -606,14 +606,15 @@ static PyObject * doConfigNetDevice(PyObject * s, PyObject * args) { static PyObject * doPumpNetDevice(PyObject * s, PyObject * args) { char * device; + char * dhcpclass; char * chptr; struct pumpNetIntf cfg; PyObject * rc; - if (!PyArg_ParseTuple(args, "s", &device)) + if (!PyArg_ParseTuple(args, "ss", &device, &dhcpclass)) return NULL; - chptr = pumpDhcpRun(device, 0, 0, NULL, &cfg, NULL); + chptr = pumpDhcpClassRun(device, 0, 0, NULL, dhcpclass, &cfg, NULL); if (chptr) { Py_INCREF(Py_None); return Py_None; diff --git a/kickstart.py b/kickstart.py index b3bad114f..468e676e6 100644 --- a/kickstart.py +++ b/kickstart.py @@ -447,7 +447,8 @@ class KickstartBase(BaseInstallClass): # nodns is only used by the loader (args, extra) = isys.getopt(args, '', [ 'bootproto=', 'ip=', 'netmask=', 'gateway=', 'nameserver=', - 'nodns', 'device=', 'hostname=', 'ethtool=', 'onboot=']) + 'nodns', 'device=', 'hostname=', 'ethtool=', 'onboot=', + 'dhcpclass=']) bootProto = "dhcp" ip = None netmask = "" @@ -457,6 +458,7 @@ class KickstartBase(BaseInstallClass): ethtool = "" onboot = 1 device = None + dhcpclass = None for n in args: (str, arg) = n if str == "--bootproto": @@ -480,8 +482,10 @@ class KickstartBase(BaseInstallClass): onboot = 0 else: onboot = 1 + elif str == "--class": + dhcpclass = arg - self.setNetwork(id, bootProto, ip, netmask, ethtool, device=device, onboot=onboot) + self.setNetwork(id, bootProto, ip, netmask, ethtool, device=device, onboot=onboot, dhcpclass=dhcpclass) if hostname != "": self.setHostname(id, hostname, override = 1) if nameserver != "": diff --git a/loader2/loader.c b/loader2/loader.c index 6f952679b..3e63cf455 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -527,6 +527,9 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData, else if (!strncasecmp(argv[i], "ksdevice=", 9)) { loaderData->netDev = strdup(argv[i] + 9); loaderData->netDev_set = 1; + } else if (!strncasecmp(argv[i], "dhcpclass=", 8)) { + loaderData->netCls = strdup(argv[i] + 8); + loaderData->netCls_set = 1; } else if (!strcasecmp(argv[i], "ks") || !strncasecmp(argv[i], "ks=", 3)) loaderData->ksFile = strdup(argv[i]); @@ -897,7 +900,7 @@ static char *doLoaderMain(char * location, /* populate netDev based on any kickstart data */ setupNetworkDeviceConfig(&netDev, loaderData, flags); - rc = readNetConfig(devName, &netDev, flags); + rc = readNetConfig(devName, &netDev, loaderData->netCls, flags); if ((rc == LOADER_BACK) || (rc == LOADER_ERROR) || ((dir == -1) && (rc == LOADER_NOOP))) { step = STEP_IFACE; diff --git a/loader2/loader.h b/loader2/loader.h index f18705759..db005ab83 100644 --- a/loader2/loader.h +++ b/loader2/loader.h @@ -83,6 +83,8 @@ struct loaderData_s { int kbd_set; char * netDev; int netDev_set; + char * netCls; + int netCls_set; char * ip, * netmask, *gateway, *dns, *hostname, *ptpaddr, *ethtool; int mtu; int noDns; diff --git a/loader2/net.c b/loader2/net.c index 3691cb81c..299010ab2 100644 --- a/loader2/net.c +++ b/loader2/net.c @@ -199,6 +199,8 @@ void printLoaderDataIPINFO(struct loaderData_s *loaderData) { logMessage("loaderData->noDns = %d", loaderData->noDns); logMessage("loaderData->netDev_set = %d", loaderData->netDev_set); logMessage("loaderData->netDev = %s", loaderData->netDev); + logMessage("loaderData->netCls_set = %d", loaderData->netCls_set); + logMessage("loaderData->netCls = %s", loaderData->netCls); } /* given loader data from kickstart, populate network configuration struct */ @@ -234,7 +236,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, if (!FL_TESTING(flags)) { waitForLink(loaderData->netDev); - chptr = pumpDhcpRun(loaderData->netDev, 0, 0, NULL, &cfg->dev, NULL); + chptr = pumpDhcpClassRun(loaderData->netDev, 0, 0, NULL, loaderData->netCls ? loaderData->netCls : "anaconda", &cfg->dev, NULL); } else { chptr = NULL; } @@ -346,7 +348,8 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, cfg->noDns = loaderData->noDns; } -int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) { +int readNetConfig(char * device, struct networkDeviceConfig * cfg, + char * dhcpclass, int flags) { newtComponent text, f, okay, back, answer, dhcpCheckbox; newtGrid grid, subgrid, buttons; struct networkDeviceConfig newCfg; @@ -485,7 +488,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) { _("Sending request for IP information for %s..."), device, 0); waitForLink(device); - chptr = pumpDhcpRun(device, 0, 0, NULL, &newCfg.dev, NULL); + chptr = pumpDhcpClassRun(device, 0, 0, NULL, dhcpclass ? dhcpclass : "anaconda", &newCfg.dev, NULL); newtPopWindow(); } else { chptr = NULL; @@ -678,13 +681,14 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) { void setKickstartNetwork(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { - char * arg, * bootProto = NULL, * device = NULL, *ethtool = NULL; + char * arg, * bootProto = NULL, * device = NULL, *ethtool = NULL, * class = NULL; int noDns = 0, rc; poptContext optCon; struct poptOption ksOptions[] = { { "bootproto", '\0', POPT_ARG_STRING, &bootProto, 0 }, { "device", '\0', POPT_ARG_STRING, &device, 0 }, + { "dhcpclass", '\0', POPT_ARG_STRING, &class, 0 }, { "gateway", '\0', POPT_ARG_STRING, NULL, 'g' }, { "ip", '\0', POPT_ARG_STRING, NULL, 'i' }, { "nameserver", '\0', POPT_ARG_STRING, NULL, 'n' }, @@ -755,6 +759,11 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc, loaderData->netDev_set = 1; } + if (class) { + loaderData->netCls = strdup(class); + loaderData->netCls_set = 1; + } + if (ethtool) { if (loaderData->ethtool) free(loaderData->ethtool); @@ -918,7 +927,8 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, setupNetworkDeviceConfig(netCfgPtr, loaderData, flags); - rc = readNetConfig(loaderData->netDev, netCfgPtr, flags); + rc = readNetConfig(loaderData->netDev, netCfgPtr, loaderData->netCls, + flags); if ((rc == LOADER_BACK) || (rc == LOADER_ERROR)) { logMessage("unable to setup networking"); return -1; diff --git a/loader2/net.h b/loader2/net.h index c79bcf33b..f79fec223 100644 --- a/loader2/net.h +++ b/loader2/net.h @@ -12,7 +12,7 @@ struct networkDeviceConfig { }; int readNetConfig(char * device, struct networkDeviceConfig * dev, - int flags); + char * dhcpclass, int flags); int configureNetwork(struct networkDeviceConfig * dev); int writeNetInfo(const char * fn, struct networkDeviceConfig * dev); int findHostAndDomain(struct networkDeviceConfig * dev, int flags); diff --git a/network.py b/network.py index 28b3dada9..f861db9d1 100644 --- a/network.py +++ b/network.py @@ -282,7 +282,7 @@ class Network: for dev in self.netdevices.values(): if (dev.get('bootproto') == "dhcp" and dev.get('onboot') == "yes"): - ret = isys.pumpNetDevice(dev.get('device')) + ret = isys.pumpNetDevice(dev.get('device'), dev.get('dhcpclass')) if ret is None: continue myns = ret @@ -348,6 +348,8 @@ class Network: f.write(" --onboot no") if dev.get('bootproto') == 'dhcp': f.write(" --bootproto dhcp") + if dev.get('dhcpclass'): + f.write(" --class %s" % dev.get('dhcpclass')) if self.overrideDHCPhostname: if (self.hostname and self.hostname != "localhost.localdomain"): @@ -389,6 +391,8 @@ class Network: if (dev.get('bootproto') == 'dhcp' and self.hostname and self.overrideDHCPhostname): f.write("DHCP_HOSTNAME=%s\n" %(self.hostname,)) + if dev.get('dhcpclass'): + f.write("DHCP_CLASSID=%s\n" % dev.get('dhcpclass')) f.close() |