On 05/25/2017 04:30 PM, Andriy Gapon wrote:
First, the initial PXE client must be instructed to load and run FreeBSD
pxeboot.  pxeboot is a special loader, an intermediate stage that loads the
actual FreeBSD kernel.  pxeboot is itself a DHCP and PXE client.


I am pretty sure it didn't send any additional DHCP packets itself in the past.

And code seems to reflect that.
It copies the cached packet from the initial PXE client to a variable bootp_response here:

https://github.com/freebsd/freebsd/blob/master/sys/boot/i386/libi386/pxe.c#L231

==
    gci_p->PacketType = PXENV_PACKET_TYPE_BINL_REPLY;
    pxe_call(PXENV_GET_CACHED_INFO);
    if (gci_p->Status != 0) {
        pxe_perror(gci_p->Status);
        pxe_p = NULL;
        return (0);
    }
    free(bootp_response);
    if ((bootp_response = malloc(gci_p->BufferSize)) != NULL) {
        bootp_response_size = gci_p->BufferSize;
        bcopy(PTOV((gci_p->Buffer.segment << 4) + gci_p->Buffer.offset),
            bootp_response, bootp_response_size);
    }
==


And skips doing DHCP itself if that is set and it parses:

https://github.com/freebsd/freebsd/blob/master/sys/boot/common/dev_net.c#L261

==
    /*
     * Try to get boot info using BOOTP.  If we succeed, then
     * the server IP address, gateway, and root path will all
     * be initialized.  If any remain uninitialized, we will
     * use RARP and RPC/bootparam (the Sun way) to get them.
     */
    if (try_bootp) {
        int rc = -1;
        if (bootp_response != NULL) {
            rc = dhcp_try_rfc1048(bootp_response->bp_vend,
                bootp_response_size -
                offsetof(struct bootp, bp_vend));

            if (servip.s_addr == 0)
                servip = bootp_response->bp_siaddr;
            if (rootip.s_addr == 0)
                rootip = bootp_response->bp_siaddr;
            if (gateip.s_addr == 0)
                gateip = bootp_response->bp_giaddr;
            if (myip.s_addr == 0)
                myip = bootp_response->bp_yiaddr;
            d->myip = myip;
        }
        if (rc < 0)
            bootp(sock, BOOTP_NONE);
    }
==

dhcp_try_rfc1048() calls vend_rfc1048() which gets the root-path out of the DHCP packet.


So yes, I do think it should be able to get the root-path out of the proxy DHCP packet. It may have problems getting its IP/netmask/gateway though, as that is not in the proxy DHCP packet, but in the other packet, and it does not currently seem to fetch that.
Not sure how well the RARP fallback works.


Yours sincerely,

Floris Bos



_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to