From owner-p4-projects@FreeBSD.ORG Thu Nov 8 09:45:27 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 48A0516A41A; Thu, 8 Nov 2007 09:45:27 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B62AA16A417 for ; Thu, 8 Nov 2007 09:45:26 +0000 (UTC) (envelope-from taleks@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8D29913C48E for ; Thu, 8 Nov 2007 09:45:26 +0000 (UTC) (envelope-from taleks@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lA89jQFO019073 for ; Thu, 8 Nov 2007 09:45:26 GMT (envelope-from taleks@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lA89jQiE019070 for perforce@freebsd.org; Thu, 8 Nov 2007 09:45:26 GMT (envelope-from taleks@FreeBSD.org) Date: Thu, 8 Nov 2007 09:45:26 GMT Message-Id: <200711080945.lA89jQiE019070@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to taleks@FreeBSD.org using -f From: Alexey Tarasov To: Perforce Change Reviews Cc: Subject: PERFORCE change 128811 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Nov 2007 09:45:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=128811 Change 128811 by taleks@taleks_th on 2007/11/08 09:44:50 Added function for simple parsing of direcory index, provided by Apache. Fixed error (probably finally fixed) with '/' at tail of rootpath. servername now is correctly strdup()'ed from PXE_IP_WWW. Affected files ... .. //depot/projects/soc2007/taleks-pxe_http/Makefile#17 edit .. //depot/projects/soc2007/taleks-pxe_http/README#4 edit .. //depot/projects/soc2007/taleks-pxe_http/httpfs.c#10 edit .. //depot/projects/soc2007/taleks-pxe_http/httpfs.h#4 edit .. //depot/projects/soc2007/taleks-pxe_http/libi386_mod/pxe.c#7 edit .. //depot/projects/soc2007/taleks-pxe_http/loader_mod/main.c#5 edit .. //depot/projects/soc2007/taleks-pxe_http/pxe_core.c#28 edit .. //depot/projects/soc2007/taleks-pxe_http/pxe_httpls.c#1 add .. //depot/projects/soc2007/taleks-pxe_http/pxe_httpls.h#1 add Differences ... ==== //depot/projects/soc2007/taleks-pxe_http/Makefile#17 (text+ko) ==== @@ -6,7 +6,7 @@ SRCS= pxe_isr.S pxe_mem.c pxe_buffer.c pxe_await.c pxe_arp.c pxe_ip.c \ pxe_core.c pxe_icmp.c pxe_udp.c pxe_filter.c pxe_dns.c \ pxe_dhcp.c pxe_segment.c pxe_tcp.c pxe_sock.c \ - pxe_connection.c pxe_http.c httpfs.c + pxe_connection.c pxe_http.c pxe_httpls.c httpfs.c CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica \ ==== //depot/projects/soc2007/taleks-pxe_http/README#4 (text+ko) ==== @@ -164,6 +164,10 @@ # server KeepAliveTimeout 15 # more then 2 seconds # is good enough + + 1.1 Non keep-alive connections supported if macro + PXE_HTTP_AUTO_KEEPALIVE defined. In this case, non keep-alive + connections will be used if keep-alive are unavailable. 2. loader checks gzipped versions of files first, it's good idea to compress every needed file. e.g. @@ -366,7 +370,7 @@ int result = pxe_connect(socket, &hh->addr, 80, PXE_TCP_PROTOCOL); /* This call creates filter, associates it with socket and establishes * communication if needed. - * Parameters are socket, remote ip address (PXE_IPADDR)m remote port + * Parameters are socket, remote ip address (PXE_IPADDR), remote port * and one of PXE_UDP_PROTOCOL and PXE_TCP_PROTOCOL protocols. */ @@ -676,8 +680,7 @@ was performed PXE_IP_WWW - IP address of http-server PXE_IP_ROOT - IP adddress of server, where root - file system is situated. Currently - it's synonym for PXE_IP_WWW + file system is situated. void pxe_set_ip(uint8_t id, const PXE_IPADDR *ip) - sets value by it's id. @@ -1149,7 +1152,7 @@ command 'route': - works with routing table and used for ip based protocols. IP packet routed to first found route, routes are searched - sequentially from start of table to end.. + sequentially from start of table to end. Example: pxe route print - shows current routing table. @@ -1220,7 +1223,7 @@ some hints that may be usefull. In LAN usually packet loss is small and speed is fast, so - it may be good idea to define PXE_TCP_AGRRESIVE macro (see 3.3.15). + it may be good idea to define PXE_TCP_AGRESSIVE macro (see 3.3.15). PXE_TCP_MSS may me set to 1460 without any doubts. Buffer sizes may be set higher (3.3.3). 16K for incoming traffic is good enough for WAN connections, but for LAN it may be set ==== //depot/projects/soc2007/taleks-pxe_http/httpfs.c#10 (text+ko) ==== @@ -101,14 +101,14 @@ return (ENOMEM); } + pxe_memcpy(pxe_get_ip(PXE_IP_WWW), &httpfile->addr, sizeof(PXE_IPADDR)); + if (servername[0]) { httpfile->servername = servername; } else { httpfile->servername = strdup(inet_ntoa(httpfile->addr.ip)); } - pxe_memcpy(pxe_get_ip(PXE_IP_WWW), &httpfile->addr, sizeof(PXE_IPADDR)); - #ifdef PXE_DEBUG_HELL printf("servername: %s\n", httpfile->servername); #endif ==== //depot/projects/soc2007/taleks-pxe_http/httpfs.h#4 (text+ko) ==== ==== //depot/projects/soc2007/taleks-pxe_http/libi386_mod/pxe.c#7 (text+ko) ==== @@ -29,7 +29,6 @@ #include __FBSDID("$FreeBSD: src/sys/boot/i386/libi386/pxe.c,v 1.23 2007/10/12 17:09:43 ps Exp $"); -/* #include #include #include @@ -43,6 +42,7 @@ #ifdef LOADER_NFS_SUPPORT #include #endif + #include #include ==== //depot/projects/soc2007/taleks-pxe_http/loader_mod/main.c#5 (text+ko) ==== @@ -46,6 +46,7 @@ #include "pxe_dns.h" #include "pxe_filter.h" #include "pxe_http.h" +#include "pxe_httpld.h" #include "pxe_icmp.h" #include "pxe_ip.h" #include "pxe_sock.h" @@ -516,6 +517,27 @@ return (CMD_OK); } +static int +command_ls(int argc, char *argv[]) +{ + + if (argc == 1) { + printf("usage: ls /path/to/dir\n"); + return (CMD_OK); + } + + int fd = open(argv[1], O_RDONLY); + + if (fd == -1) + return (CMD_OK); + + http_parse_index(fd); + + close(fd); + + return (CMD_OK); +} + COMMAND_SET(pxe, "pxe", "pxe test module", command_pxe); static int @@ -563,6 +585,10 @@ if (!strcmp(argv[1], "fetch")) { return command_fetch(argc - 1, &argv[1]); } + + if (!strcmp(argv[1], "ls")) { + return command_ls(argc - 1, &argv[1]); + } printf("unknown pxe command '%s'\n", argv[1]); ==== //depot/projects/soc2007/taleks-pxe_http/pxe_core.c#28 (text+ko) ==== @@ -144,9 +144,11 @@ setenv("boot.nfsroot.path", rootpath, 1); #endif - /* if it's just '/' then make rootpath empty */ - if (rootpath[1] == '\0') - rootpath[0] = '\0'; + /* removing '/' at tail of rootpath */ + size_t rlen = strlen(rootpath); + + if ( (rlen > 0) && (rootpath[rlen - 1] == '/')) + rootpath[rlen - 1] = '\0'; /* check if Web server option specified, * if not, make it equal to root ip