[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/4] pc-bios/s390-ccw/net: Add support for px
From: |
Viktor VM Mihajlovski |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/4] pc-bios/s390-ccw/net: Add support for pxelinux-style config files |
Date: |
Tue, 24 Apr 2018 15:41:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 23.04.2018 09:58, Thomas Huth wrote:
[...]
> +
> +static int net_try_pxelinux_cfgs(filename_ip_t *fn_ip)
> +{
> + int rc, idx;
> + char basedir[256];
> + int has_basedir;
> +
> + cfgbuf[sizeof(cfgbuf) - 1] = 0; /* Make sure that it is NUL-terminated
> */
> +
> + /* Did we get a usable base directory via DHCP? */
> + idx = strlen((char *)fn_ip->filename);
> + if (idx > 0 && idx < sizeof(basedir) - 40 &&
> + fn_ip->filename[idx - 1] == '/') {
> + has_basedir = true;
> + strcpy(basedir, (char *)fn_ip->filename);
> + } else {
> + has_basedir = false;
> + strcpy(basedir, "pxelinux.cfg/");
> + }
> +
> + printf("Trying pxelinux.cfg files...\n");
> +
> + /* Look for config file with MAC address in its name */
> + sprintf((char *)fn_ip->filename, "%s%02x-%02x-%02x-%02x-%02x-%02x",
> + basedir, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
Just noticed that the filename has to be <basedir>/pxelinux.cfg/01-<mac>
per [1].
> + rc = tftp_load(fn_ip, cfgbuf, sizeof(cfgbuf) - 1);
> + if (rc > 0) {
> + return handle_pxelinux_cfg(fn_ip, cfgbuf, sizeof(cfgbuf));
> + }
> +
> + /* Look for config file with IP address in its name */
> + if (ip_version == 4) {
> + for (idx = 0; (has_basedir && idx <= 7) || idx < 1; idx++) {
> + sprintf((char *)fn_ip->filename, "%s%02X%02X%02X%02X", basedir,
> + (fn_ip->own_ip >> 24) & 0xff, (fn_ip->own_ip >> 16) &
> 0xff,
> + (fn_ip->own_ip >> 8) & 0xff, fn_ip->own_ip & 0xff);
> + fn_ip->filename[strlen((char *)fn_ip->filename) - idx] = 0;
> + rc = tftp_load(fn_ip, cfgbuf, sizeof(cfgbuf) - 1);
> + if (rc > 0) {
> + return handle_pxelinux_cfg(fn_ip, cfgbuf, sizeof(cfgbuf));
> + }
> + }
> + }
> +
> + /* Try "default" config file */
> + if (has_basedir) {
> + sprintf((char *)fn_ip->filename, "%sdefault", basedir);
> + rc = tftp_load(fn_ip, cfgbuf, sizeof(cfgbuf) - 1);
> + if (rc > 0) {
> + return handle_pxelinux_cfg(fn_ip, cfgbuf, sizeof(cfgbuf));
> + }
> + }
> +
> + return -1;
> +}
> +
[...]
[1
]https://www.syslinux.org/wiki/index.php?title=PXELINUX#Configuration_filename
--
Regards,
Viktor Mihajlovski
- [Qemu-devel] [PATCH v2 0/4] pc-bios/s390-ccw: Network boot improvements, Thomas Huth, 2018/04/23
- [Qemu-devel] [PATCH v2 3/4] pc-bios/s390-ccw/net: Add support for .INS config files, Thomas Huth, 2018/04/23
- [Qemu-devel] [PATCH v2 1/4] pc-bios/s390-ccw/net: Split up net_load() into init, load and uninit parts, Thomas Huth, 2018/04/23
- [Qemu-devel] [PATCH v2 4/4] pc-bios/s390-ccw/net: Use diag308 to reset machine before jumping to the OS, Thomas Huth, 2018/04/23
- [Qemu-devel] [PATCH v2 2/4] pc-bios/s390-ccw/net: Add support for pxelinux-style config files, Thomas Huth, 2018/04/23
- Re: [Qemu-devel] [PATCH v2 2/4] pc-bios/s390-ccw/net: Add support for pxelinux-style config files,
Viktor VM Mihajlovski <=
- [Qemu-devel] [PATCH v2 5/4] pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUID, Thomas Huth, 2018/04/23