From owner-svn-src-user@FreeBSD.ORG Fri Jan 25 19:34:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8EBFFE1D; Fri, 25 Jan 2013 19:34:55 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 81298315; Fri, 25 Jan 2013 19:34:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0PJYtxO094135; Fri, 25 Jan 2013 19:34:55 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0PJYtqM094134; Fri, 25 Jan 2013 19:34:55 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301251934.r0PJYtqM094134@svn.freebsd.org> From: Sean Bruno Date: Fri, 25 Jan 2013 19:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245913 - user/sbruno/head_146698/sys/boot/i386/pxe_http X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 19:34:55 -0000 Author: sbruno Date: Fri Jan 25 19:34:54 2013 New Revision: 245913 URL: http://svnweb.freebsd.org/changeset/base/245913 Log: Make the WWW IP work if PXE_BOOTP_USE_LIBSTAND defined. Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Fri Jan 25 18:47:16 2013 (r245912) +++ user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Fri Jan 25 19:34:54 2013 (r245913) @@ -86,62 +86,61 @@ static int pxe_state = PXE_DOWN; void pxe_core_update_bootp() { - const PXE_IPADDR *paddr = pxe_get_ip(PXE_IP_ROOT); - int i = 0; - char temp[20]; + const PXE_IPADDR *paddr = pxe_get_ip(PXE_IP_ROOT); + int i = 0; + char temp[20]; - if (paddr->ip == 0) - pxe_set_ip(PXE_IP_ROOT, pxe_get_ip(PXE_IP_SERVER)); + if (paddr->ip == 0) + pxe_set_ip(PXE_IP_ROOT, pxe_get_ip(PXE_IP_SERVER)); - struct in_addr tmp_in; + struct in_addr tmp_in; - tmp_in.s_addr = pxe_get_ip(PXE_IP_GATEWAY)->ip; - setenv("boot.netif.gateway", inet_ntoa(tmp_in), 1); + tmp_in.s_addr = pxe_get_ip(PXE_IP_GATEWAY)->ip; + setenv("boot.netif.gateway", inet_ntoa(tmp_in), 1); /* initing route tables, using DHCP reply data */ - pxe_ip_route_init(pxe_get_ip(PXE_IP_GATEWAY)); + pxe_ip_route_init(pxe_get_ip(PXE_IP_GATEWAY)); #ifdef PXE_DEBUG - printf("pxe_open: gateway ip: %s\n", inet_ntoa(tmp_in)); + printf("pxe_open: gateway ip: %s\n", inet_ntoa(tmp_in)); #endif - tmp_in.s_addr = pxe_get_ip(PXE_IP_MY)->ip; - setenv("boot.netif.ip", inet_ntoa(tmp_in), 1); + tmp_in.s_addr = pxe_get_ip(PXE_IP_MY)->ip; + setenv("boot.netif.ip", inet_ntoa(tmp_in), 1); - tmp_in.s_addr = pxe_get_ip(PXE_IP_NETMASK)->ip; - setenv("boot.netif.netmask", inet_ntoa(tmp_in), 1); + tmp_in.s_addr = pxe_get_ip(PXE_IP_NETMASK)->ip; + setenv("boot.netif.netmask", inet_ntoa(tmp_in), 1); - sprintf(temp, "%6D", pxe_get_mymac(), ":"); - setenv("boot.netif.hwaddr", temp, 1); + sprintf(temp, "%6D", pxe_get_mymac(), ":"); + setenv("boot.netif.hwaddr", temp, 1); - if (!rootpath[1]) - strcpy(rootpath, PXENFSROOTPATH); + if (!rootpath[1]) + strcpy(rootpath, PXENFSROOTPATH); - for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) + printf("rootpath: %s\n", rootpath); + for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') - break; + break; - if (i && i != FNAME_SIZE && rootpath[i] == ':') { - - rootpath[i++] = '\0'; - - const PXE_IPADDR *root_addr = pxe_gethostbyname(rootpath); - pxe_set_ip(PXE_IP_ROOT, root_addr); - - pxe_memcpy(rootpath, servername, i); - pxe_memcpy(&rootpath[i], &rootpath[0], - strlen(&rootpath[i]) + 1); - } + if (i && i != FNAME_SIZE && rootpath[i] == ':') { + rootpath[i++] = '\0'; + const PXE_IPADDR *root_addr = pxe_gethostbyname(rootpath); + pxe_set_ip(PXE_IP_ROOT, root_addr); + + pxe_memcpy(rootpath, servername, i); + pxe_memcpy(&rootpath[i], &rootpath[0], + strlen(&rootpath[i]) + 1); + } - tmp_in.s_addr = pxe_get_ip(PXE_IP_ROOT)->ip; + tmp_in.s_addr = pxe_get_ip(PXE_IP_ROOT)->ip; #ifdef PXE_DEBUG - printf("pxe_open: server addr: %s\n", inet_ntoa(tmp_in)); - printf("pxe_open: server path: %s\n", rootpath); + printf("pxe_open: server addr: %s\n", inet_ntoa(tmp_in)); + printf("pxe_open: server path: %s\n", rootpath); #endif #ifdef LOADER_NFS_SUPPORT - setenv("boot.nfsroot.server", inet_ntoa(tmp_in), 1); - setenv("boot.nfsroot.path", rootpath, 1); + setenv("boot.nfsroot.server", inet_ntoa(tmp_in), 1); + setenv("boot.nfsroot.path", rootpath, 1); #endif } @@ -368,6 +367,9 @@ pxe_core_init(pxenv_t *pxenv_p, pxe_t* p /* trying to get gateway/nameserver info from DHCP server */ pxe_dhcp_query(bootplayer->ident); pxe_core_update_bootp(); +#else + pxe_set_ip(PXE_IP_WWW, pxe_get_ip(PXE_IP_SERVER)); + pxe_set_ip(PXE_IP_ROOT, pxe_get_ip(PXE_IP_SERVER)); #endif #ifdef PXE_CORE_DEBUG