Bug 1231931
| Summary: | gPXE 'Host' header being transferred without port | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Robert McSwain <rmcswain> |
| Component: | gpxe | Assignee: | Alex Williamson <alex.williamson> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.5 | CC: | alex.williamson, chayang, juzhang, michen, qzhang, saga, virt-maint |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | gpxe-0.9.7-6.15.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-05-10 20:56:33 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1172231 | ||
|
Description
Robert McSwain
2015-06-15 16:01:43 UTC
A comment in the case file indicates customer has already identified the necessary change: http://lists.ipxe.org/pipermail/ipxe-devel/2011-July/000791.html v2 of the patch is simplified and it was committed to ipxe as: commit 69b7d57265679d76e26581d034e8f8ab5168bb27 Author: Malte Starostik <lists.net> Date: Fri Jul 15 16:31:56 2011 +0200 [http] Include port in HTTP Host header as needed According to section 14.23 of RFC2616, an HTTP Host header without port implies the default port is used. Thus, when fetching from anywhere but port 80 for HTTP or 443 for HTTPS, the port ought to be explicitly given in that header. Otherwise, some servers might fail to associate the request with the correct virtual host or generate incorrect self-referencing URLs. Signed-off-by: Michael Brown <mcb30> diff --git a/src/net/tcp/http.c b/src/net/tcp/http.c index 012b226..cee7513 100644 --- a/src/net/tcp/http.c +++ b/src/net/tcp/http.c @@ -662,13 +662,17 @@ static void http_step ( struct http_request *http ) { if ( ( rc = xfer_printf ( &http->socket, "%s %s%s HTTP/1.1\r\n" "User-Agent: iPXE/" VERSION "\r\n" - "Host: %s\r\n" + "Host: %s%s%s\r\n" "%s%s%s%s%s%s%s" "\r\n", ( ( http->flags & HTTP_HEAD_ONLY ) ? "HEAD" : "GET" ), ( http->uri->path ? "" : "/" ), request, host, + ( http->uri->port ? + ":" : "" ), + ( http->uri->port ? + http->uri->port : "" ), ( ( http->flags & HTTP_KEEPALIVE ) ? "Connection: Keep-Alive\r\n" : "" ), ( partial ? "Range: bytes=" : "" ), The backport to gpxe looks relatively straightforward. Patch backported and tested with the following configuration:
# virsh net-dumpxml default
<network>
<name>default</name>
<uuid>d010e06a-1259-41dd-92a6-689d064d8c86</uuid>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0' />
<mac address='52:54:00:09:F3:2A'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<tftp root='/var/tftp' />
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
<bootp file='init.gpxe' />
</dhcp>
</ip>
</network>
# cat /var/tftp/init.gpxe
#!gpxe
# Test non-standard port
##kernel http://192.168.1.120:8888/rhel65/x86_64/os/images/pxeboot/vmlinuz nofb nomodeset vga=normal console=ttyS0,9600 hda=noprobe edd=on
##initrd http://192.168.1.120:8888/rhel65/x86_64/os/images/pxeboot/initrd.img
# Test standard port, specified
#kernel http://192.168.1.120:80/install/RHEL65/images/pxeboot/vmlinuz nofb nomodeset vga=normal console=ttyS0,9600 hda=noprobe edd=on
#initrd http://192.168.1.120:80/install/RHEL65/images/pxeboot/initrd.img
# Test standard port, not-specified
kernel http://192.168.1.120/install/RHEL65/images/pxeboot/vmlinuz nofb nomodeset vga=normal console=ttyS0,9600 hda=noprobe edd=on
initrd http://192.168.1.120/install/RHEL65/images/pxeboot/initrd.img
boot
VM started with:
virt-install --name pxe --ram 2048 --vcpus 2 --network bridge=virbr0,model=virtio,mac=52:54:00:08:ae:d5 --pxe --graphics none --nodisks
Each of the cases tested separately and verified with wireshark trace on virbr0. In the cases where a port is specified, the HTTP GET request includes the information and it matches the active specification in gpxe script. When unspecified, the port is not present in the GET request and there is no change from previous behavior.
With my http server configuration, all cases successfully transfer the files regardless of the Host port specification. This may not be true of a virtual server configuration which parses the Host tag within the GET request for path context.
Light general testing shows no adverse affects from this patch in my environment. Suggest QE repeat the above as well as perform general PXE boot regression testing for VMs.
Fix included in gpxe-0.9.7-6.15.el6 Additional info: QE also have a basic test, try to install via pxe with the fixed build, the RHEL6 guest is installed well, and boot successfully w/o any error, no regression issue found. If the result of not specifying port as comment 7 is expected, this bug is verified, will wait for Alex reply. Thanks, Qian Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2016-0814.html |