From owner-svn-src-user@FreeBSD.ORG Mon Jan 28 12:50:17 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8B64431F; Mon, 28 Jan 2013 12:50:17 +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 64B23839; Mon, 28 Jan 2013 12:50:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0SCoH0u069796; Mon, 28 Jan 2013 12:50:17 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0SCoHd7069739; Mon, 28 Jan 2013 12:50:17 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301281250.r0SCoHd7069739@svn.freebsd.org> From: Sean Bruno Date: Mon, 28 Jan 2013 12:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246031 - 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: Mon, 28 Jan 2013 12:50:17 -0000 Author: sbruno Date: Mon Jan 28 12:50:16 2013 New Revision: 246031 URL: http://svnweb.freebsd.org/changeset/base/246031 Log: Construct URL such that there is no // at the beginning of the request but still respect the contents of libstand::rootpath[] Update PXE_IP_WWW if we are using libstand code for bootp (at least that's what I think its doing here). Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dhcp.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 Mon Jan 28 12:20:20 2013 (r246030) +++ user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_core.c Mon Jan 28 12:50:16 2013 (r246031) @@ -142,6 +142,17 @@ pxe_core_update_bootp() setenv("boot.nfsroot.server", inet_ntoa(tmp_in), 1); setenv("boot.nfsroot.path", rootpath, 1); #endif + /* 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 + */ + if (pxe_get_ip(PXE_IP_WWW)->ip == 0) { + pxe_set_ip(PXE_IP_WWW, pxe_get_ip(PXE_IP_ROOT)); + } } /* pxe_core_init() - performs initialization of all PXE related code Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dhcp.c ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dhcp.c Mon Jan 28 12:20:20 2013 (r246030) +++ user/sbruno/head_146698/sys/boot/i386/pxe_http/pxe_dhcp.c Mon Jan 28 12:50:16 2013 (r246031) @@ -441,6 +441,7 @@ pxe_dhcp_query(uint32_t xid) addr.ip = rootip.s_addr; pxe_set_ip(PXE_IP_ROOT, &addr); + pxe_set_ip(PXE_IP_WWW, &addr); /* "network route". direct connect for those addresses */ pxe_ip_route_add(pxe_get_ip(PXE_IP_MY), netmask, NULL); From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 03:39:46 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 223CE56C; Tue, 29 Jan 2013 03:39:46 +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 13CAD285; Tue, 29 Jan 2013 03:39:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0T3djUp036904; Tue, 29 Jan 2013 03:39:45 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0T3djIZ036903; Tue, 29 Jan 2013 03:39:45 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301290339.r0T3djIZ036903@svn.freebsd.org> From: Sean Bruno Date: Tue, 29 Jan 2013 03:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246053 - 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: Tue, 29 Jan 2013 03:39:46 -0000 Author: sbruno Date: Tue Jan 29 03:39:45 2013 New Revision: 246053 URL: http://svnweb.freebsd.org/changeset/base/246053 Log: Add a newline here at EOF Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/README Modified: user/sbruno/head_146698/sys/boot/i386/pxe_http/README ============================================================================== --- user/sbruno/head_146698/sys/boot/i386/pxe_http/README Tue Jan 29 03:38:25 2013 (r246052) +++ user/sbruno/head_146698/sys/boot/i386/pxe_http/README Tue Jan 29 03:39:45 2013 (r246053) @@ -1250,4 +1250,4 @@ PXE_MORE - adds functions, used to out pxe_http/pxe_dhcp.h: PXE_BOOTP_USE_LIBSTAND libi386/Makefile: PXEHTTP_UDP_FOR_LIBSTAND - After that - NFS loader must work, as well as TFTP. \ No newline at end of file + After that - NFS loader must work, as well as TFTP. From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 10:46:48 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 B7340533; Tue, 29 Jan 2013 10:46:48 +0000 (UTC) (envelope-from ae@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 9E006EE0; Tue, 29 Jan 2013 10:46:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TAkmBd064548; Tue, 29 Jan 2013 10:46:48 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TAklAF064544; Tue, 29 Jan 2013 10:46:47 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301291046.r0TAklAF064544@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 29 Jan 2013 10:46:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246067 - user/ae/inet6/sys/netinet6 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: Tue, 29 Jan 2013 10:46:48 -0000 Author: ae Date: Tue Jan 29 10:46:47 2013 New Revision: 246067 URL: http://svnweb.freebsd.org/changeset/base/246067 Log: Rename in6_getlinkzone into in6_getscopezone. Now it returns zone id for the scpecified interface and scope. For loopback address return link-local scope, this is also required by RFC 6724. Change sa6_checkzone to reflect this. Modified: user/ae/inet6/sys/netinet6/in6.h user/ae/inet6/sys/netinet6/in6_ifattach.c user/ae/inet6/sys/netinet6/scope6.c user/ae/inet6/sys/netinet6/scope6_var.h Modified: user/ae/inet6/sys/netinet6/in6.h ============================================================================== --- user/ae/inet6/sys/netinet6/in6.h Tue Jan 29 07:46:22 2013 (r246066) +++ user/ae/inet6/sys/netinet6/in6.h Tue Jan 29 10:46:47 2013 (r246067) @@ -638,7 +638,7 @@ int in6_cksum_pseudo(struct ip6_hdr *, u int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); int in6_localaddr(struct in6_addr *); int in6_localip(struct in6_addr *); -int in6_addrscope(struct in6_addr *); +int in6_addrscope(const struct in6_addr *); struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *); extern void in6_if_up(struct ifnet *); struct sockaddr; Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_ifattach.c Tue Jan 29 07:46:22 2013 (r246066) +++ user/ae/inet6/sys/netinet6/in6_ifattach.c Tue Jan 29 10:46:47 2013 (r246067) @@ -478,7 +478,8 @@ in6_ifattach_linklocal(struct ifnet *ifp return (-1); } } - ifra.ifra_addr.sin6_scope_id = in6_getlinkzone(ifp); + ifra.ifra_addr.sin6_scope_id = in6_getscopezone(ifp, + IPV6_ADDR_SCOPE_LINKLOCAL); ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); ifra.ifra_prefixmask.sin6_family = AF_INET6; Modified: user/ae/inet6/sys/netinet6/scope6.c ============================================================================== --- user/ae/inet6/sys/netinet6/scope6.c Tue Jan 29 07:46:22 2013 (r246066) +++ user/ae/inet6/sys/netinet6/scope6.c Tue Jan 29 10:46:47 2013 (r246067) @@ -200,29 +200,14 @@ scope6_get(struct ifnet *ifp, struct sco * Get a scope of the address. Node-local, link-local, site-local or global. */ int -in6_addrscope(struct in6_addr *addr) +in6_addrscope(const struct in6_addr *addr) { if (IN6_IS_ADDR_MULTICAST(addr)) return (IPV6_ADDR_MC_SCOPE(addr)); - if (IN6_IS_ADDR_LINKLOCAL(addr)) + if (IN6_IS_ADDR_LINKLOCAL(addr) || + IN6_IS_ADDR_LOOPBACK(addr)) return (IPV6_ADDR_SCOPE_LINKLOCAL); -#if 0 - if (bcmp(&in6addr_loopback, addr, sizeof(*addr) - 1) == 0) { - /* - * XXX: RFC 4007 says that ::1 should treated as having - * link-local scope. But we don't allow configure it on - * several loopback interfaces. So, actually it has the - * global scope. - */ - if (addr->s6_addr[15] == 1) /* loopback */ - return (IPV6_ADDR_SCOPE_LINKLOCAL); - /* - * Regard unspecified address as global, since - * it has no ambiguity. - */ - } -#endif return (IPV6_ADDR_SCOPE_GLOBAL); } @@ -440,13 +425,18 @@ in6_getscope(struct in6_addr *in6) } /* - * Return zone id for the link-local scope. + * Return zone id for the specified scope. */ uint32_t -in6_getlinkzone(const struct ifnet *ifp) +in6_getscopezone(const struct ifnet *ifp, int scope) { - return (ifp->if_index); + if (scope == IPV6_ADDR_SCOPE_INTFACELOCAL || + scope == IPV6_ADDR_SCOPE_LINKLOCAL) + return (ifp->if_index); + if (scope >= 0 && scope < IPV6_ADDR_SCOPES_COUNT) + return (SID(ifp)->s6id_list[scope]); + return (0); } /* @@ -466,27 +456,27 @@ sa6_checkzone(struct sockaddr_in6 *sa6) scope = in6_addrscope(&sa6->sin6_addr); if (scope == IPV6_ADDR_SCOPE_GLOBAL) { - /* - * Since ::1 address always configured on the lo0, we can - * automagically set its zone id, when it is not specified. - * Return error, when specified zone id doesn't match with - * actual value. - */ - if (IN6_IS_ADDR_LOOPBACK(&sa6->sin6_addr)) { - if (sa6->sin6_sin6_scope_id == 0) { - sa6->sin6_scope_id = in6_getlinkzone(V_loif); - return (0); - } - if (sa6->sin6_scope_id == in6_getlinkzone(V_loif)) - return (0); - } /* We don't want zone id for global scope */ return (sa6->sin6_scope_id ? EINVAL: 0); } + /* + * Since ::1 address always configured on the lo0, we can + * automatically set its zone id, when it is not specified. + * Return error, when specified zone id doesn't match with + * actual value. + */ + if (IN6_IS_ADDR_LOOPBACK(&sa6->sin6_addr)) { + if (sa6->sin6_scope_id == 0) + sa6->sin6_scope_id = in6_getscopezone(V_loif, + IPV6_ADDR_SCOPE_LINKLOCAL); + if (sa6->sin6_scope_id != in6_getscopezone(V_loif, + IPV6_ADDR_SCOPE_LINKLOCAL)) + return (EADDRNOTAVAIL); + } if (sa6->sin6_scope_id != 0) return (0); if (V_ip6_use_defzone != 0) sa6->sin6_scope_id = V_sid_default.s6id_list[scope]; /* Return error if we can't determine zone id */ - return (sa6->sin6_scope_id ? 0: EINVAL); + return (sa6->sin6_scope_id ? 0: EADDRNOTAVAIL); } Modified: user/ae/inet6/sys/netinet6/scope6_var.h ============================================================================== --- user/ae/inet6/sys/netinet6/scope6_var.h Tue Jan 29 07:46:22 2013 (r246066) +++ user/ae/inet6/sys/netinet6/scope6_var.h Tue Jan 29 10:46:47 2013 (r246067) @@ -36,12 +36,13 @@ #ifdef _KERNEL #include +#define IPV6_ADDR_SCOPES_COUNT 16 struct scope6_id { /* * 16 is correspondent to 4bit multicast scope field. * i.e. from node-local to global with some reserved/unassigned types. */ - u_int32_t s6id_list[16]; + u_int32_t s6id_list[IPV6_ADDR_SCOPES_COUNT]; }; VNET_DECLARE(int, deembed_scopeid); @@ -57,10 +58,11 @@ int scope6_get_default(struct scope6_id u_int32_t scope6_addr2default(struct in6_addr *); int sa6_embedscope(struct sockaddr_in6 *, int); int sa6_recoverscope(struct sockaddr_in6 *); +int sa6_checkzone(struct sockaddr_in6 *); int in6_setscope(struct in6_addr *, struct ifnet *, u_int32_t *); int in6_clearscope(struct in6_addr *); uint16_t in6_getscope(struct in6_addr *); -uint32_t in6_getlinkzone(const struct ifnet *); +uint32_t in6_getscopezone(const struct ifnet *, int); #endif /* _KERNEL */ #endif /* _NETINET6_SCOPE6_VAR_H_ */ From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 10:54:50 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B7D9D972; Tue, 29 Jan 2013 10:54:50 +0000 (UTC) (envelope-from ae@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 AAB56F69; Tue, 29 Jan 2013 10:54:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TAsoHD067156; Tue, 29 Jan 2013 10:54:50 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TAsoLP067155; Tue, 29 Jan 2013 10:54:50 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301291054.r0TAsoLP067155@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 29 Jan 2013 10:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246068 - user/ae/inet6/sys/netinet6 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: Tue, 29 Jan 2013 10:54:50 -0000 Author: ae Date: Tue Jan 29 10:54:50 2013 New Revision: 246068 URL: http://svnweb.freebsd.org/changeset/base/246068 Log: Add in6_srcaddrscope function. It returns scope of specified address and will be used in the source address selection algorithm. Modified: user/ae/inet6/sys/netinet6/in6_src.c Modified: user/ae/inet6/sys/netinet6/in6_src.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_src.c Tue Jan 29 10:46:47 2013 (r246067) +++ user/ae/inet6/sys/netinet6/in6_src.c Tue Jan 29 10:54:50 2013 (r246068) @@ -143,6 +143,7 @@ static int walk_addrsel_policy(int (*)(s void *); static int dump_addrsel_policyent(struct in6_addrpolicy *, void *); static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *); +static int in6_srcaddrscope(const struct in6_addr *); /* * Return an IPv6 address, which is the most appropriate for a given @@ -1175,3 +1176,20 @@ match_addrsel_policy(struct sockaddr_in6 return (bestpol); } + +/* + * This function is similar to in6_addrscope, but has some difference, + * specific for the source address selection algorithm (RFC 6724). + */ +static int +in6_srcaddrscope(const struct in6_addr *addr) +{ + + /* 169.254/16 and 127/8 have link-local scope */ + if (IN6_IS_ADDR_V4MAPPED(addr)) { + if (addr->s6_addr[12] == 127 || ( + addr->s6_addr[12] == 169 && addr->s6_addr[13] == 254)) + return (IPV6_ADDR_SCOPE_LINKLOCAL); + } + return (in6_addrscope(addr)); +} From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 19:02:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9DA04E92; Tue, 29 Jan 2013 19:02:44 +0000 (UTC) (envelope-from delphij@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 77FC69C; Tue, 29 Jan 2013 19:02:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TJ2isq015109; Tue, 29 Jan 2013 19:02:44 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TJ2iOA015108; Tue, 29 Jan 2013 19:02:44 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201301291902.r0TJ2iOA015108@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jan 2013 19:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246086 - user/delphij/patch 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: Tue, 29 Jan 2013 19:02:44 -0000 Author: delphij Date: Tue Jan 29 19:02:43 2013 New Revision: 246086 URL: http://svnweb.freebsd.org/changeset/base/246086 Log: Conclude this branch as bsdpatch is in HEAD now. Deleted: user/delphij/patch/ From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 19:55:54 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 9EE47FD; Tue, 29 Jan 2013 19:55:54 +0000 (UTC) (envelope-from ae@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 61C132CE; Tue, 29 Jan 2013 19:55:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TJtsLl031225; Tue, 29 Jan 2013 19:55:54 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TJtrCv031222; Tue, 29 Jan 2013 19:55:53 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301291955.r0TJtrCv031222@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 29 Jan 2013 19:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246088 - user/ae/inet6/sys/netinet6 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: Tue, 29 Jan 2013 19:55:54 -0000 Author: ae Date: Tue Jan 29 19:55:53 2013 New Revision: 246088 URL: http://svnweb.freebsd.org/changeset/base/246088 Log: The in6ifa_ifwithaddr function now takes as arguments to lookup a pointer to the struct in6_addr and zone id. This allows use it without need of fill sockaddr_in6 structure, when we operate with a in6_addr. Modified: user/ae/inet6/sys/netinet6/in6.c user/ae/inet6/sys/netinet6/in6_pcb.c user/ae/inet6/sys/netinet6/in6_var.h Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Tue Jan 29 19:06:16 2013 (r246087) +++ user/ae/inet6/sys/netinet6/in6.c Tue Jan 29 19:55:53 2013 (r246088) @@ -1908,19 +1908,15 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, st * ifaddr is returned referenced. */ struct in6_ifaddr * -in6ifa_ifwithaddr(const struct sockaddr_in6 *sa6) +in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) { struct in6_ifaddr *ia; IN6_IFADDR_RLOCK(); - LIST_FOREACH(ia, IN6ADDR_HASH(&sa6->sin6_addr), ia6_hash) { - if (IN6_ARE_ADDR_EQUAL(IA6_IN6(ia), &sa6->sin6_addr)) { - /* - * XXX: should we determine the scope and compare - * sin6_scope_id with corresponding zone id? - */ - if (sa6->sin6_scope_id != 0 && - sa6->sin6_scope_id != in6_getlinkzone(ia->ia_ifp)) + LIST_FOREACH(ia, IN6ADDR_HASH(addr), ia6_hash) { + if (IN6_ARE_ADDR_EQUAL(IA6_IN6(ia), addr)) { + if (zoneid != 0 && + zoneid != ia->ia_addr.sin6_scope_id) continue; ifa_ref(ia); break; Modified: user/ae/inet6/sys/netinet6/in6_pcb.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_pcb.c Tue Jan 29 19:06:16 2013 (r246087) +++ user/ae/inet6/sys/netinet6/in6_pcb.c Tue Jan 29 19:55:53 2013 (r246088) @@ -164,7 +164,9 @@ in6_pcbbind(register struct inpcb *inp, struct in6_ifaddr *ifa; sin6->sin6_port = 0; /* yech... */ - if ((ifa = in6ifa_ifwithaddr(sin6)) == NULL && + ifa = in6ifa_ifwithaddr(&sin6->sin6_addr, + sin6->sin6_scope_id); + if (ifa == NULL && (inp->inp_flags & INP_BINDANY) == 0) { return (EADDRNOTAVAIL); } Modified: user/ae/inet6/sys/netinet6/in6_var.h ============================================================================== --- user/ae/inet6/sys/netinet6/in6_var.h Tue Jan 29 19:06:16 2013 (r246087) +++ user/ae/inet6/sys/netinet6/in6_var.h Tue Jan 29 19:55:53 2013 (r246088) @@ -801,7 +801,7 @@ void in6_setmaxmtu(void); int in6_if2idlen(struct ifnet *); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, struct in6_addr *); -struct in6_ifaddr *in6ifa_ifwithaddr(const struct sockaddr_in6 *); +struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t); char *ip6_sprintf(char *, const struct in6_addr *); int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *); int in6_matchlen(struct in6_addr *, struct in6_addr *); From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 19:59:57 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 531A6251; Tue, 29 Jan 2013 19:59:57 +0000 (UTC) (envelope-from ae@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 2404C2ED; Tue, 29 Jan 2013 19:59:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TJxvpl031754; Tue, 29 Jan 2013 19:59:57 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TJxvV8031752; Tue, 29 Jan 2013 19:59:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201301291959.r0TJxvV8031752@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 29 Jan 2013 19:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246089 - user/ae/inet6/sys/netinet6 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: Tue, 29 Jan 2013 19:59:57 -0000 Author: ae Date: Tue Jan 29 19:59:56 2013 New Revision: 246089 URL: http://svnweb.freebsd.org/changeset/base/246089 Log: Change the first part of in6_selectsrc to not use in6_setscope. Modified: user/ae/inet6/sys/netinet6/in6_src.c Modified: user/ae/inet6/sys/netinet6/in6_src.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_src.c Tue Jan 29 19:55:53 2013 (r246088) +++ user/ae/inet6/sys/netinet6/in6_src.c Tue Jan 29 19:59:56 2013 (r246089) @@ -225,7 +225,6 @@ in6_selectsrc(struct sockaddr_in6 *dstso */ if (opts && (pi = opts->ip6po_pktinfo) && !IN6_IS_ADDR_UNSPECIFIED(&pi->ipi6_addr)) { - struct sockaddr_in6 srcsock; struct in6_ifaddr *ia6; /* get the outgoing interface */ @@ -233,37 +232,27 @@ in6_selectsrc(struct sockaddr_in6 *dstso (inp != NULL) ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB)) != 0) return (error); - + KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); /* - * determine the appropriate zone id of the source based on + * Determine the appropriate zone id of the source based on * the zone of the destination and the outgoing interface. - * If the specified address is ambiguous wrt the scope zone, - * the interface must be specified; otherwise, ifa_ifwithaddr() - * will fail matching the address. - */ - bzero(&srcsock, sizeof(srcsock)); - srcsock.sin6_family = AF_INET6; - srcsock.sin6_len = sizeof(srcsock); - srcsock.sin6_addr = pi->ipi6_addr; - if (ifp) { - error = in6_setscope(&srcsock.sin6_addr, ifp, NULL); - if (error) - return (error); - } + */ + odstzone = in6_getscopezone(ifp, + in6_addrscope(&pi->ipi6_addr)); + + /* XXX: prison_local_ip6 can override pi->ipi6_addr */ if (cred != NULL && (error = prison_local_ip6(cred, - &srcsock.sin6_addr, (inp != NULL && + &pi->ipi6_addr, (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) return (error); - ia6 = (struct in6_ifaddr *)ifa_ifwithaddr( - (struct sockaddr *)&srcsock); + ia6 = in6ifa_ifwithaddr(&pi->ipi6_addr, odstzone); if (ia6 == NULL || (ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) { if (ia6 != NULL) ifa_free(&ia6->ia_ifa); return (EADDRNOTAVAIL); } - pi->ipi6_addr = srcsock.sin6_addr; /* XXX: this overrides pi */ if (ifpp) *ifpp = ifp; bcopy(&ia6->ia_addr.sin6_addr, srcp, sizeof(*srcp)); From owner-svn-src-user@FreeBSD.ORG Tue Jan 29 23:57:52 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 D04B13B7; Tue, 29 Jan 2013 23:57:52 +0000 (UTC) (envelope-from adrian@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 BD3B47A; Tue, 29 Jan 2013 23:57:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0TNvqPV003351; Tue, 29 Jan 2013 23:57:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0TNvqnm003349; Tue, 29 Jan 2013 23:57:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301292357.r0TNvqnm003349@svn.freebsd.org> From: Adrian Chadd Date: Tue, 29 Jan 2013 23:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246099 - user/adrian/ath_radar_stuff/lib/libradarpkt 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: Tue, 29 Jan 2013 23:57:52 -0000 Author: adrian Date: Tue Jan 29 23:57:51 2013 New Revision: 246099 URL: http://svnweb.freebsd.org/changeset/base/246099 Log: Implement HT40 spectral frame format support. HT40 spectral / radar frames report both the lower and upper 20MHz worth of samples (128 in total.) The two 20MHz halves have different RSSI values, so use the primary / extension values to calculate two sets of channel power, rather than doing it over the full 128 samples. The two 20MHz halves have different noise floor and RSSI values, so the right NF/RSSI values need to be lined up with the right half of the 40MHz channel. For HT40D (ie, extension channel below primary channel), swap the RSSI/NF values when calculating the power level. So: * remove the pri/ext FFT results - they're kind of pointless now; * calculate channel power separately for each 20MHz half; * Figure out which RSSI/NF to use based on the current channel flags; * Use chain 0 ctl/ext RSSI and NF (when the per-chain and per-half NF cal data is eventually used) in the signal level calculations. Tested: * AR9280, HT20 and HT40 spectral scan report modes Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Tue Jan 29 23:26:35 2013 (r246098) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Tue Jan 29 23:57:51 2013 (r246099) @@ -64,6 +64,11 @@ #define AR9280_SPECTRAL_SAMPLE_SIZE_HT40 135 #define NUM_SPECTRAL_ENTRIES_HT20 56 +#define NUM_SPECTRAL_ENTRIES_HT40 128 + +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif /* * GPLed snippet from Zefir on the linux-wireless list; rewrite this @@ -87,23 +92,40 @@ int convert_data_ht20(struct radar_entry *re, struct radar_fft_entry *fe) { - int dc_pwr_idx = NUM_SPECTRAL_ENTRIES_HT20 / 2; - int pwr_count = NUM_SPECTRAL_ENTRIES_HT20; +// int dc_pwr_idx = NUM_SPECTRAL_ENTRIES_HT20 / 2; + int pwr_count = fe->num_bins; int i; - int nf0 = -96; /* XXX populate re with this first! */ - float bsum = 0.0; + float bsum_lower = 0.0, bsum_upper = 0.0; +#if 0 + /* + * Commented out here - DC is different for HT20/HT40, so this + * logic won't work for HT40. + */ /* DC value is invalid -> interpolate */ - fe->pri.bins[dc_pwr_idx].raw_mag = - (fe->pri.bins[dc_pwr_idx - 1].raw_mag + fe->pri.bins[dc_pwr_idx + 1].raw_mag) / 2; + fe->bins[dc_pwr_idx].raw_mag = + (fe->bins[dc_pwr_idx - 1].raw_mag + fe->bins[dc_pwr_idx + 1].raw_mag) / 2; /* XXX adj mag? */ - fe->pri.bins[dc_pwr_idx].adj_mag = - fe->pri.bins[dc_pwr_idx].raw_mag << fe->max_exp; + fe->bins[dc_pwr_idx].adj_mag = + fe->bins[dc_pwr_idx].raw_mag << fe->max_exp; +#endif + + /* Calculate the total power for both lower and upper halves */ + if (! fe->is_ht40) { + for (i = 0; i < 56; i++) + bsum_lower += (float) (fe->bins[i].adj_mag) * (float) (fe->bins[i].adj_mag); + bsum_lower = log10f(bsum_lower) * 10.0; + } - /* Calculate the total power - use pre-adjusted magnitudes */ - for (i = 0; i < pwr_count; i++) - bsum += (float) (fe->pri.bins[i].adj_mag) * (float) (fe->pri.bins[i].adj_mag); - bsum = log10f(bsum) * 10.0; + if (fe->is_ht40) { + for (i = 0; i < 64; i++) + bsum_lower += (float) (fe->bins[i].adj_mag) * (float) (fe->bins[i].adj_mag); + bsum_lower = log10f(bsum_lower) * 10.0; + + for (i = 64; i < 128; i++) + bsum_upper += (float) (fe->bins[i].adj_mag) * (float) (fe->bins[i].adj_mag); + bsum_upper = log10f(bsum_upper) * 10.0; + } /* * Given the current NF/RSSI value, calculate an absolute dBm, then @@ -111,18 +133,24 @@ convert_data_ht20(struct radar_entry *re */ for (i = 0; i < pwr_count; i++) { float pwr_val; - int16_t val = fe->pri.bins[i].adj_mag; + int16_t val = fe->bins[i].adj_mag; if (val == 0) val = 1; pwr_val = 20.0 * log10f((float) val); - pwr_val += (float) nf0 + (float) re->re_rssi - bsum; - fe->pri.bins[i].dBm = pwr_val; + /* Use upper if i >= bin 64; captures both HT20 and HT40 modes */ + if (i < 64) { + pwr_val += (float) fe->lower.nf + (float) fe->lower.rssi - bsum_lower; + } else { + pwr_val += (float) fe->upper.nf + (float) fe->upper.rssi - bsum_upper; + } + + fe->bins[i].dBm = pwr_val; #if 0 - printf(" [%d] %d -> %d, ", i, fe->pri.bins[i].adj_mag, - fe->pri.bins[i].dBm); + printf(" [%d] %d -> %d, ", i, fe->bins[i].adj_mag, + fe->bins[i].dBm); #endif } // printf("\n"); @@ -134,16 +162,25 @@ static int ar9280_radar_spectral_print(struct radar_fft_entry *fe) { int i; - printf("PRI: max index=%d, magnitude=%d, bitmap weight=%d, max_exp=%d\n", - fe->pri.max_index, - fe->pri.max_magnitude, - fe->pri.bitmap_weight, - fe->max_exp); + printf("LOWER: max index=%d, magnitude=%d, bitmap weight=%d, max_exp=%d, is_ht40=%d, num_bins=%d\n", + fe->lower.max_index, + fe->lower.max_magnitude, + fe->lower.bitmap_weight, + fe->max_exp, + fe->is_ht40, + fe->num_bins); + if (fe->is_ht40) { + printf("UPPER: max index=%d, magnitude=%d, bitmap weight=%d\n", + fe->upper.max_index, + fe->upper.max_magnitude, + fe->upper.bitmap_weight); - for (i = 0; i < 56; i++) { + } + + for (i = 0; i < fe->num_bins; i++) { if (i % 8 == 0) printf("PRI: %d:", i); - printf("%02x ", fe->pri.bins[i].raw_mag); + printf("%02x ", fe->bins[i].raw_mag); if (i % 8 == 7) printf("\n"); } @@ -176,25 +213,123 @@ ar9280_radar_spectral_decode_ht20(struct } fe = &re->re_spectral_entries[cur_sample]; + fe->num_bins = 56; + fe->is_ht40 = 0; /* Decode the bitmap weight, magnitude, max index */ - - fe->pri.max_magnitude = + fe->lower.max_magnitude = (pkt[57] << 2) | ((pkt[56] & 0xc0) >> 6) | ((pkt[58] & 0x03) << 10); - fe->pri.bitmap_weight = pkt[56] & 0x3f; - fe->pri.max_index = (pkt[58] & 0x3f); + fe->lower.bitmap_weight = pkt[56] & 0x3f; + fe->lower.max_index = (pkt[58] & 0x3f); fe->max_exp = pkt[59] & 0x0f; /* Decode each bin - the dBm calculation will come later */ for (i = 0; i < 56; i++) { - fe->pri.bins[i].raw_mag = pkt[i]; - fe->pri.bins[i].adj_mag = fe->pri.bins[i].raw_mag << fe->max_exp; + fe->bins[i].raw_mag = pkt[i]; + fe->bins[i].adj_mag = fe->bins[i].raw_mag << fe->max_exp; + } + + /* + * Chain 0 ctl RSSI is used here. + */ + fe->lower.rssi = re->re_pri_rssi; + fe->lower.nf = re->re_nf; + + /* Convert to dBm */ + (void) convert_data_ht20(re, fe); + + /* Return OK */ + return (0); +} + +/* + * Decode the HT40 spectral data. + * + * The HT40 spectral data is lower and upper, rather than primary and + * extension channel. Pri/Ext is needed to map the relevant RSSI and NF + * values to the right side, for dBm calculations. That's it. + */ +static int +ar9280_radar_spectral_decode_ht40(struct ieee80211_radiotap_header *rh, + const unsigned char *pkt, int len, struct radar_entry *re, + int cur_sample) +{ + int i; + struct radar_fft_entry *fe; + + if (len < AR9280_SPECTRAL_SAMPLE_SIZE_HT40) { + printf("%s: got %d bytes, wanted %d bytes\n", __func__, len, AR9280_SPECTRAL_SAMPLE_SIZE_HT40); + return (-1); } + fe = &re->re_spectral_entries[cur_sample]; + + /* max_exp is shared among lower and upper samples */ + fe->max_exp = pkt[134] & 0x0f; + fe->is_ht40 = 1; + fe->num_bins = 128; + + /* + * Decode the bitmap weight, magnitude, max index for the + * lower bin. + */ + fe->lower.max_magnitude = + (pkt[129] << 2) | + ((pkt[128] & 0xc0) >> 6) | + ((pkt[130] & 0x03) << 10); + fe->lower.bitmap_weight = pkt[128] & 0x3f; + fe->lower.max_index = (pkt[130] & 0x3f); + + /* + * Decode the bitmap weight, magnitude, max index for + * the upper bin. + */ + fe->upper.max_magnitude = + (pkt[132] << 2) | + ((pkt[131] & 0xc0) >> 6) | + ((pkt[133] & 0x03) << 10); + fe->upper.bitmap_weight = pkt[131] & 0x3f; + fe->upper.max_index = (pkt[133] & 0x3f); + + /* Decode each bin - the dBm calculation will come later */ + for (i = 0; i < 128; i++) { + fe->bins[i].raw_mag = pkt[i]; + fe->bins[i].adj_mag = fe->bins[i].raw_mag << fe->max_exp; + } + + /* + * Populate the lower/upper NF and RSSI based on whether the + * configured channel is HT40U or HT40D. + * + * The PRI/EXT RSSI needs swapping to match the lower/upper + * organisation of the FFT here. + */ + if (re->re_flags & IEEE80211_CHAN_HT40D) { + /* + * The primary channel is 'upper'; the extension channel + * is 'lower'. + */ + fe->lower.rssi = re->re_ext_rssi; + fe->upper.rssi = re->re_pri_rssi; + fe->lower.nf = re->re_nf; + fe->upper.nf = re->re_nf; + } else { + /* + * The primary channel is 'lower'; the extension channel + * is 'upper'. + */ + fe->lower.rssi = re->re_pri_rssi; + fe->upper.rssi = re->re_ext_rssi; + fe->lower.nf = re->re_nf; + fe->upper.nf = re->re_nf; + } + +#if 1 /* Convert to dBm */ (void) convert_data_ht20(re, fe); +#endif /* Return OK */ return (0); @@ -222,16 +357,23 @@ ar9280_radar_spectral_decode(struct ieee const unsigned char *fr = pkt; int fr_len = len; - for (i = 0; i < MAX_SPECTRAL_SCAN_SAMPLES_PER_PKT; i++) { /* HT20 or HT40? */ - /* XXX hard-code HT20 */ - if (ar9280_radar_spectral_decode_ht20(rh, fr, fr_len, re, i) != 0) { - break; + if (re->re_flags & (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)) { + if (ar9280_radar_spectral_decode_ht40(rh, fr, fr_len, re, i) != 0) { + break; + } + ar9280_radar_spectral_print(&re->re_spectral_entries[i]); + fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT40; + fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT40; + } else { + if (ar9280_radar_spectral_decode_ht20(rh, fr, fr_len, re, i) != 0) { + break; + } + ar9280_radar_spectral_print(&re->re_spectral_entries[i]); + fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT20; + fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT20; } -// ar9280_radar_spectral_print(&re->re_spectral_entries[i]); - fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT20; - fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT20; if (fr_len < 0) break; } @@ -319,42 +461,65 @@ ar9280_radar_decode(struct ieee80211_rad * things) whether the pulse duration is based on 40MHz or 44MHz. */ re->re_timestamp = tsf; + //re->re_rssi = pri_rssi; /* XXX extension rssi? */ - re->re_rssi = comb_rssi; /* XXX comb for spectral scan? or not? */ + re->re_rssi = (int) comb_rssi; /* XXX comb for spectral scan? or not? */ re->re_dur = pkt[len - 3]; /* XXX extension duration? */ re->re_num_spectral_entries = 0; + re->re_nf = nf; /* XXX flags? */ + /* Spectral scan on Merlin uses chain 0 only */ + re->re_pri_rssi = (int) rx->wr_v.rssi_ctl[0]; + re->re_ext_rssi = (int) rx->wr_v.rssi_ext[0]; + + /* + * XXX hack if the driver is giving us unsigned rssi values, sigh. + */ + if (re->re_pri_rssi > 127) + re->re_pri_rssi = 254 - re->re_pri_rssi; + if (re->re_ext_rssi > 127) + re->re_ext_rssi = 254 - re->re_ext_rssi; + /* * Update the channel frequency information before we decode * the spectral or radar FFT payload. */ re->re_freq = 0; + re->re_freq_centre = 0; + re->re_flags = 0; + /* XXX endian convert len */ if (pkt_lookup_chan((char *) rh, rh->it_len, &x) == 0) { /* Update the channel/frequency information */ re->re_freq = x.freq; + re->re_flags = x.flags; if (x.flags & IEEE80211_CHAN_QUARTER) { re->re_freq_sec = 0; re->re_freqwidth = 5; + re->re_freq_centre = re->re_freq; } else if (x.flags & IEEE80211_CHAN_HALF) { re->re_freq_sec = 0; re->re_freqwidth = 10; + re->re_freq_centre = re->re_freq; } else if (x.flags & IEEE80211_CHAN_HT40U) { re->re_freq_sec = re->re_freq + 20; re->re_freqwidth = 40; + re->re_freq_centre = re->re_freq + 10; } else if (x.flags & IEEE80211_CHAN_HT40D) { re->re_freq_sec = re->re_freq - 20; re->re_freqwidth = 40; + re->re_freq_centre = re->re_freq - 10; } else { re->re_freq_sec = 0; re->re_freqwidth = 20; + re->re_freq_centre = re->re_freq; } } if (pkt[len - 1] & CH_SPECTRAL_EVENT) { - (void) ar9280_radar_spectral_decode(rh, pkt, len - 3, re); + (void) ar9280_radar_spectral_decode(rh, pkt, len - 3, re); } return(1); Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h Tue Jan 29 23:26:35 2013 (r246098) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/pkt.h Tue Jan 29 23:57:51 2013 (r246099) @@ -35,9 +35,9 @@ extern "C" { #endif -#define PKT_NUM_BINS 64 +#define PKT_NUM_BINS 128 -#define MAX_SPECTRAL_SCAN_SAMPLES_PER_PKT 64 +#define MAX_SPECTRAL_SCAN_SAMPLES_PER_PKT 128 struct radar_fft_bin { int32_t dBm; @@ -51,13 +51,16 @@ struct radar_fft_entry { int is_ht40; /* 1=HT40, 0=HT20 */ struct { - struct radar_fft_bin bins[PKT_NUM_BINS]; + int nf, rssi; uint8_t max_index; uint8_t bitmap_weight; uint16_t max_magnitude; - } pri, ext; + } lower, upper; + + struct radar_fft_bin bins[PKT_NUM_BINS]; uint8_t max_exp; + uint8_t num_bins; /* 56 or 128 */ }; struct radar_entry { @@ -66,6 +69,9 @@ struct radar_entry { /* Primary frequency */ uint32_t re_freq; + /* Flags */ + uint32_t re_flags; + /* Secondary channel frequency, if applicable */ uint32_t re_freq_sec; @@ -73,12 +79,27 @@ struct radar_entry { uint32_t re_freqwidth; /* + * True event frequency centre - for spectral scan and + * radar FFTs. + */ + uint32_t re_freq_centre; + + /* * The hardware may give it to us as a negative number; * eg CCK decode which can use self-correlation to decode * a very very weak signal. */ int32_t re_rssi; uint32_t re_dur; + int32_t re_nf; + + /* + * Store the spectral scan primary/extension channel + * RSSI here, which will be used by the spectral scan + * FFT code to calculate dBm values. + */ + int32_t re_pri_rssi; + int32_t re_ext_rssi; /* XXX make these optional at some point */ int re_num_spectral_entries; From owner-svn-src-user@FreeBSD.ORG Wed Jan 30 23:57:20 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 F33E3B21; Wed, 30 Jan 2013 23:57:19 +0000 (UTC) (envelope-from adrian@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 C35E8DF4; Wed, 30 Jan 2013 23:57:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0UNvJeu040868; Wed, 30 Jan 2013 23:57:19 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0UNvJHd040867; Wed, 30 Jan 2013 23:57:19 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301302357.r0UNvJHd040867@svn.freebsd.org> From: Adrian Chadd Date: Wed, 30 Jan 2013 23:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246136 - user/adrian/ath_radar_stuff/lib/libradarpkt 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: Wed, 30 Jan 2013 23:57:20 -0000 Author: adrian Date: Wed Jan 30 23:57:19 2013 New Revision: 246136 URL: http://svnweb.freebsd.org/changeset/base/246136 Log: Fixes! * the RSSI from the hardware is in units of dB*2, so we need to divide it by 2 to get an actual dB value; * Do the frame length check at the beginning of the loop, in case we get frames that are 0 bytes in length. * Don't print out the full spectral data here. This doesn't fix the MAC/BB issues surrounding corrupted HT20/HT40 frame lengths; that'll come later. Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Modified: user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c ============================================================================== --- user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Wed Jan 30 23:49:36 2013 (r246135) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/ar9280_radar.c Wed Jan 30 23:57:19 2013 (r246136) @@ -142,9 +142,9 @@ convert_data_ht20(struct radar_entry *re /* Use upper if i >= bin 64; captures both HT20 and HT40 modes */ if (i < 64) { - pwr_val += (float) fe->lower.nf + (float) fe->lower.rssi - bsum_lower; + pwr_val += (float) fe->lower.nf + ((float) fe->lower.rssi / 2.0) - bsum_lower; } else { - pwr_val += (float) fe->upper.nf + (float) fe->upper.rssi - bsum_upper; + pwr_val += (float) fe->upper.nf + ((float) fe->upper.rssi / 2.0) - bsum_upper; } fe->bins[i].dBm = pwr_val; @@ -260,7 +260,10 @@ ar9280_radar_spectral_decode_ht40(struct struct radar_fft_entry *fe; if (len < AR9280_SPECTRAL_SAMPLE_SIZE_HT40) { - printf("%s: got %d bytes, wanted %d bytes\n", __func__, len, AR9280_SPECTRAL_SAMPLE_SIZE_HT40); + printf("%s: got %d bytes, wanted %d bytes\n", + __func__, + len, + AR9280_SPECTRAL_SAMPLE_SIZE_HT40); return (-1); } @@ -358,24 +361,25 @@ ar9280_radar_spectral_decode(struct ieee int fr_len = len; for (i = 0; i < MAX_SPECTRAL_SCAN_SAMPLES_PER_PKT; i++) { + if (fr_len <= 0) + break; + /* HT20 or HT40? */ if (re->re_flags & (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)) { if (ar9280_radar_spectral_decode_ht40(rh, fr, fr_len, re, i) != 0) { break; } - ar9280_radar_spectral_print(&re->re_spectral_entries[i]); + //ar9280_radar_spectral_print(&re->re_spectral_entries[i]); fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT40; fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT40; } else { if (ar9280_radar_spectral_decode_ht20(rh, fr, fr_len, re, i) != 0) { break; } - ar9280_radar_spectral_print(&re->re_spectral_entries[i]); + //ar9280_radar_spectral_print(&re->re_spectral_entries[i]); fr_len -= AR9280_SPECTRAL_SAMPLE_SIZE_HT20; fr += AR9280_SPECTRAL_SAMPLE_SIZE_HT20; } - if (fr_len < 0) - break; } // printf(" Spectral: %d samples\n", i); From owner-svn-src-user@FreeBSD.ORG Wed Jan 30 23:59:05 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4D9B8C4E; Wed, 30 Jan 2013 23:59:05 +0000 (UTC) (envelope-from adrian@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 117F8DFD; Wed, 30 Jan 2013 23:59:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0UNx4YW041111; Wed, 30 Jan 2013 23:59:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0UNx4Sa041110; Wed, 30 Jan 2013 23:59:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301302359.r0UNx4Sa041110@svn.freebsd.org> From: Adrian Chadd Date: Wed, 30 Jan 2013 23:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246137 - user/adrian/ath_radar_stuff/src/spectral_fft 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: Wed, 30 Jan 2013 23:59:05 -0000 Author: adrian Date: Wed Jan 30 23:59:04 2013 New Revision: 246137 URL: http://svnweb.freebsd.org/changeset/base/246137 Log: Display separate lines delineating the centre frequency of channels. Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c Wed Jan 30 23:57:19 2013 (r246136) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c Wed Jan 30 23:59:04 2013 (r246137) @@ -226,6 +226,23 @@ fft_display_draw_picture(struct fft_disp char text[1024]; struct scanresult *result; SDL_Surface *surface; + static int chans[] = { + 2412, 2417, 2422, 2427, + 2432, 2437, 2442, 2447, + 2452, 2457, 2462, 2467, + 2472, 2484, + + 5180, 5200, 5220, 5240, + 5260, 5280, 5300, 5320, + 5500, 5520, 5540, 5560, + 5580, 5600, 4950, 5620, + 4955, 5640, 4960, 5660, + 4965, 5680, 4970, 5700, + 4975, 5745, 4980, 5765, + 5120, 5785, 5140, 5805, + 5160, 5825 + }; + static int nchans = 48; surface = SDL_CreateRGBSurface(SDL_SWSURFACE, WIDTH, HEIGHT, BPP, RMASK, GMASK, BMASK, AMASK); pixels = (Uint32 *) surface->pixels; @@ -234,7 +251,7 @@ fft_display_draw_picture(struct fft_disp pixels[x + y * WIDTH] = AMASK; /* vertical lines (frequency) */ - for (i = 2300; i < 6000; i += 20) { + for (i = 2300; i < 6000; i += 10) { x = (X_SCALE * (i - startfreq)); if (x < 0 || x > WIDTH) @@ -243,8 +260,21 @@ fft_display_draw_picture(struct fft_disp for (y = 0; y < HEIGHT - 20; y++) pixels[x + y * WIDTH] = 0x40404040 | AMASK; - snprintf(text, sizeof(text), "%d MHz", i); - render_text(fdisp, surface, text, x - 30, HEIGHT - 20); + if (i % 20 == 0) { + snprintf(text, sizeof(text), "%d MHz", i); + render_text(fdisp, surface, text, x - 30, HEIGHT - 20); + } + } + + /* and now, the channel lines, at least for channels 1-14 */ + for (i = 0; i < nchans; i++) { + x = (X_SCALE * (chans[i] - startfreq)); + if (x < 0 || x > WIDTH) + + continue; + + for (y = 0; y < HEIGHT - 20; y++) + pixels[x + y * WIDTH] = 0x808080FF | AMASK; } /* horizontal lines (dBm) */ @@ -287,7 +317,6 @@ fft_display_draw_picture(struct fft_disp continue; } - /* .. and the max */ signal = (float) fft_fetch_freq_max(fdisp->fh, freqKhz); color = RMASK | AMASK; From owner-svn-src-user@FreeBSD.ORG Wed Jan 30 23:59:28 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 75C6FD6E; Wed, 30 Jan 2013 23:59:28 +0000 (UTC) (envelope-from adrian@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 59B3BE05; Wed, 30 Jan 2013 23:59:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0UNxSDs041197; Wed, 30 Jan 2013 23:59:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0UNxRID041194; Wed, 30 Jan 2013 23:59:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301302359.r0UNxRID041194@svn.freebsd.org> From: Adrian Chadd Date: Wed, 30 Jan 2013 23:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246138 - user/adrian/ath_radar_stuff/src/spectral_fft 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: Wed, 30 Jan 2013 23:59:28 -0000 Author: adrian Date: Wed Jan 30 23:59:27 2013 New Revision: 246138 URL: http://svnweb.freebsd.org/changeset/base/246138 Log: Update the FFT code to support the HT40 operating mode and the slight change in FFT format from libradarpkt. Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c user/adrian/ath_radar_stuff/src/spectral_fft/fft_histogram.c Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c Wed Jan 30 23:59:04 2013 (r246137) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c Wed Jan 30 23:59:27 2013 (r246138) @@ -49,8 +49,8 @@ #include "fft_histogram.h" #include "fft_display.h" -/* 10 a second for now, the rendering is too inefficient otherwise? */ -#define RENDER_PERIOD_MSEC 100 +/* 5 a second for now, the rendering is too inefficient otherwise? */ +#define RENDER_PERIOD_MSEC 200 #define LCL_EVENT_RENDER 69 @@ -200,6 +200,7 @@ void graphics_main(struct fft_app *fap) break; case SDL_QUIT: quit = 1; + printf("quit!\n"); break; case SDL_KEYDOWN: switch (event.key.keysym.sym) { Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c Wed Jan 30 23:59:04 2013 (r246137) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c Wed Jan 30 23:59:27 2013 (r246138) @@ -67,7 +67,7 @@ pkt_print(struct radar_entry *re) { printf("ts: %llu, freq=%u, rssi=%d, dur=%d, nsamples=%d\n", re->re_timestamp, - re->re_freq, + re->re_freq_centre, re->re_rssi, re->re_dur, re->re_num_spectral_entries); Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_histogram.c ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_histogram.c Wed Jan 30 23:59:04 2013 (r246137) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_histogram.c Wed Jan 30 23:59:27 2013 (r246138) @@ -19,9 +19,6 @@ #include "fft_histogram.h" -/* XXX ew */ -#define SPECTRAL_HT20_NUM_BINS 56 - struct fft_histogram * fft_histogram_init(void) { @@ -62,39 +59,57 @@ void fft_add_sample(struct fft_histogram *fh, struct radar_entry *re, struct radar_fft_entry *fe) { - float ffreq; + float ffreq_khz; int i; int fidx; int cur; + float fwidth_khz; + + if (fe->num_bins == 0) { + fprintf(stderr, "%s: invalid num_bins (0)\n", __func__); + return; + } + //fprintf(stderr, "%s: yay, bins=%d, centre freq=%d\n", __func__, fe->num_bins, re->re_freq_centre); - for (i = 0; i < SPECTRAL_HT20_NUM_BINS; i++) { + /* + * We know the bins are 315KHz (or 312.5KHz for non-fast mode, + * but whatever) wide, so let's calculate the true total bin + * width. + */ + fwidth_khz = (float) (fe->num_bins) * 312.5; + + for (i = 0; i < fe->num_bins; i++) { /* Calculate frequency of the given event */ - ffreq = (float) re->re_freq - 10.0 + - ((20.0 * i) / SPECTRAL_HT20_NUM_BINS); + ffreq_khz = (((float) re->re_freq_centre) * 1000.0) - (fwidth_khz / 2.0) + + ((fwidth_khz * i) / (float) fe->num_bins); /* If it doesn't fit in the array, toss */ - fidx = freq2fidx((int) (ffreq * 1000.0)); - if (fidx < 0) + fidx = freq2fidx((int) ffreq_khz); + if (fidx < 0) { + fprintf(stderr, "%s: tossed, ffreq_khz=%d\n", __func__, (int) ffreq_khz); continue; + } /* XXX until i figure out what's going on */ - if (fe->pri.bins[i].dBm == 0 || fe->pri.bins[i].dBm < -185) // || fe->pri.bins[i].dBm > -10) + if (fe->bins[i].dBm == 0 || fe->bins[i].dBm < -185) { // || fe->bins[i].dBm > -10) { +// fprintf(stderr, "%s: tossed; dbm=%d\n", __func__, fe->bins[i].dBm); continue; + } /* Rolling/decaying average */ cur = fh->d.avg_pts_cur[fidx]; if (fh->d.avg_pts[fidx][cur] == 0) { - fh->d.avg_pts[fidx][cur] = fe->pri.bins[i].dBm; + fh->d.avg_pts[fidx][cur] = fe->bins[i].dBm; } else { - fh->d.avg_pts[fidx][cur] = (((fh->d.avg_pts[fidx][cur] * 100) / 90) + fe->pri.bins[i].dBm) / 2; + fh->d.avg_pts[fidx][cur] = (((fh->d.avg_pts[fidx][cur] * 100) / 90) + fe->bins[i].dBm) / 2; } fh->d.avg_pts_cur[fidx] = (fh->d.avg_pts_cur[fidx] + 1) % FFT_HISTOGRAM_HISTORY_DEPTH; /* Max */ - if (fh->d.max_pts[fidx] == 0 || fe->pri.bins[i].dBm > fh->d.max_pts[fidx]) { - fh->d.max_pts[fidx] = fe->pri.bins[i].dBm; + if (fh->d.max_pts[fidx] == 0 || fe->bins[i].dBm > fh->d.max_pts[fidx]) { + fh->d.max_pts[fidx] = fe->bins[i].dBm; } else { - fh->d.max_pts[fidx] = ((fh->d.max_pts[fidx] * 975) + (fe->pri.bins[i].dBm * 25)) / 1000; + fh->d.max_pts[fidx] = ((fh->d.max_pts[fidx] * 990) + (fe->bins[i].dBm * 10)) / 1000; } } } From owner-svn-src-user@FreeBSD.ORG Thu Jan 31 00:02:50 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 617B5B9; Thu, 31 Jan 2013 00:02:50 +0000 (UTC) (envelope-from adrian@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 46649E29; Thu, 31 Jan 2013 00:02:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0V02oHO043459; Thu, 31 Jan 2013 00:02:50 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0V02n1k043456; Thu, 31 Jan 2013 00:02:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301310002.r0V02n1k043456@svn.freebsd.org> From: Adrian Chadd Date: Thu, 31 Jan 2013 00:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246140 - user/adrian/ath_radar_stuff/src/spectral_fft 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: Thu, 31 Jan 2013 00:02:50 -0000 Author: adrian Date: Thu Jan 31 00:02:49 2013 New Revision: 246140 URL: http://svnweb.freebsd.org/changeset/base/246140 Log: stop hard-coding the operating mode and interface type. Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.h Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c Thu Jan 31 00:02:36 2013 (r246139) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c Thu Jan 31 00:02:49 2013 (r246140) @@ -236,19 +236,8 @@ void graphics_main(struct fft_app *fap) void usage(int argc, char *argv[]) { - fprintf(stderr, "Usage: %s [scanfile]\n", argv[0]); - fprintf(stderr, "\n"); - fprintf(stderr, "scanfile is generated by the spectral analyzer feature\n"); - fprintf(stderr, "of your wifi card. If you have a AR92xx or AR93xx based\n"); - fprintf(stderr, "card, try:\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "ifconfig wlan0 up\n"); - fprintf(stderr, "iw dev wlan0 scan spec-scan\n"); - fprintf(stderr, "cat /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan > /tmp/fft_results\n"); - fprintf(stderr, "%s /tmp/fft_results\n", argv[0]); - fprintf(stderr, "\n"); - fprintf(stderr, "(NOTE: maybe debugfs must be mounted first: mount -t debugfs none /sys/kernel/debug/ )\n"); - fprintf(stderr, "\n"); + fprintf(stderr, "Usage: %s \n", + argv[0]); } @@ -273,7 +262,7 @@ int main(int argc, char *argv[]) int ret; struct fft_app *fap; - if (argc < 2) { + if (argc < 4) { usage(argc, argv); return -1; } @@ -312,7 +301,7 @@ int main(int argc, char *argv[]) exit(127); /* Fetch data */ - ret = read_scandata_freebsd(argv[1], NULL); + ret = read_scandata_freebsd(argv[1], argv[2], argv[3]); if (ret < 0) { fprintf(stderr, "Couldn't read scanfile ...\n"); usage(argc, argv); Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c Thu Jan 31 00:02:36 2013 (r246139) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.c Thu Jan 31 00:02:49 2013 (r246140) @@ -260,9 +260,9 @@ open_device(const char *dev_str, const c } int -read_scandata_freebsd(char *fname, struct scanresult **result) +read_scandata_freebsd(char *chip, char *mode, char *fname) { - (void) open_device("wlan0", "ar9280", "if"); + (void) open_device(fname, chip, mode); return (0); } Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.h ============================================================================== --- user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.h Thu Jan 31 00:02:36 2013 (r246139) +++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_freebsd.h Thu Jan 31 00:02:49 2013 (r246140) @@ -4,6 +4,6 @@ typedef void (* scandata_cb)(struct radar_entry *re, void *cbdata); extern void set_scandata_callback(scandata_cb cb, void *cbdata); -extern int read_scandata_freebsd(char *fname, struct scanresult **result); +extern int read_scandata_freebsd(char *chip, char *mode, char *fname); #endif From owner-svn-src-user@FreeBSD.ORG Thu Jan 31 18:56:58 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 BEA9A44A; Thu, 31 Jan 2013 18:56:58 +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 97CDFAB3; Thu, 31 Jan 2013 18:56:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0VIuwV4085374; Thu, 31 Jan 2013 18:56:58 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0VIuw4a085373; Thu, 31 Jan 2013 18:56:58 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301311856.r0VIuw4a085373@svn.freebsd.org> From: Sean Bruno Date: Thu, 31 Jan 2013 18:56:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246151 - user/sbruno/head_177038 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: Thu, 31 Jan 2013 18:56:58 -0000 Author: sbruno Date: Thu Jan 31 18:56:58 2013 New Revision: 246151 URL: http://svnweb.freebsd.org/changeset/base/246151 Log: branch head @177038 because attempting to merge my old user branch causes 30MB of data to hit the repo in a single commit. BTW, that's stupid. Added: user/sbruno/head_177038/ - copied from r177038, head/ From owner-svn-src-user@FreeBSD.ORG Thu Jan 31 22:43:40 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 01FC5AB5; Thu, 31 Jan 2013 22:43:40 +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 D9F928D9; Thu, 31 Jan 2013 22:43:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0VMhdic057301; Thu, 31 Jan 2013 22:43:39 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0VMhcOo057294; Thu, 31 Jan 2013 22:43:38 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201301312243.r0VMhcOo057294@svn.freebsd.org> From: Sean Bruno Date: Thu, 31 Jan 2013 22:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246186 - in user/sbruno/head_177038: lib/libstand sys/boot/i386 sys/boot/i386/libi386 sys/boot/i386/loader 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: Thu, 31 Jan 2013 22:43:40 -0000 Author: sbruno Date: Thu Jan 31 22:43:38 2013 New Revision: 246186 URL: http://svnweb.freebsd.org/changeset/base/246186 Log: Bring pxe_http into head@177038 in a functional state Added: user/sbruno/head_177038/sys/boot/i386/pxe_http/ user/sbruno/head_177038/sys/boot/i386/pxe_http/Makefile user/sbruno/head_177038/sys/boot/i386/pxe_http/README user/sbruno/head_177038/sys/boot/i386/pxe_http/httpfs.c user/sbruno/head_177038/sys/boot/i386/pxe_http/httpfs.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_arp.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_arp.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_await.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_await.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_buffer.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_buffer.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_connection.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_connection.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_core.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_core.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_dhcp.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_dhcp.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_dns.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_dns.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_filter.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_filter.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_http.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_http.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_icmp.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_icmp.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_ip.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_ip.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_isr.S user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_isr.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_mem.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_mem.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_segment.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_segment.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_sock.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_sock.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_tcp.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_tcp.h user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_udp.c user/sbruno/head_177038/sys/boot/i386/pxe_http/pxe_udp.h Modified: user/sbruno/head_177038/lib/libstand/printf.c user/sbruno/head_177038/lib/libstand/stand.h user/sbruno/head_177038/sys/boot/i386/Makefile user/sbruno/head_177038/sys/boot/i386/libi386/Makefile user/sbruno/head_177038/sys/boot/i386/libi386/pxe.c user/sbruno/head_177038/sys/boot/i386/libi386/pxe.h user/sbruno/head_177038/sys/boot/i386/loader/Makefile user/sbruno/head_177038/sys/boot/i386/loader/conf.c user/sbruno/head_177038/sys/boot/i386/loader/main.c Modified: user/sbruno/head_177038/lib/libstand/printf.c ============================================================================== --- user/sbruno/head_177038/lib/libstand/printf.c Thu Jan 31 22:31:25 2013 (r246185) +++ user/sbruno/head_177038/lib/libstand/printf.c Thu Jan 31 22:43:38 2013 (r246186) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1) static char *ksprintn (char *buf, uintmax_t num, int base, int *len, int upper); -static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap); +static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, size_t size, va_list ap); int printf(const char *fmt, ...) @@ -66,7 +66,7 @@ printf(const char *fmt, ...) int retval; va_start(ap, fmt); - retval = kvprintf(fmt, putchar, NULL, 10, ap); + retval = kvprintf(fmt, putchar, NULL, 10, 0, ap); va_end(ap); return retval; } @@ -75,7 +75,7 @@ void vprintf(const char *fmt, va_list ap) { - kvprintf(fmt, putchar, NULL, 10, ap); + kvprintf(fmt, putchar, NULL, 10, 0, ap); } int @@ -85,18 +85,42 @@ sprintf(char *buf, const char *cfmt, ... va_list ap; va_start(ap, cfmt); - retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap); + retval = kvprintf(cfmt, NULL, (void *)buf, 10, 0, ap); buf[retval] = '\0'; va_end(ap); return retval; } +int +snprintf(char *buf, size_t size, const char *cfmt, ...) +{ + int retval; + va_list ap; + size_t maxsize = (size > 1) ? size - 1 : 0; + + if (maxsize == 0) { + buf[0] = '\0'; + return (0); + } + + va_start(ap, cfmt); + retval = kvprintf(cfmt, NULL, (void *)buf, 10, maxsize, ap); + + if (retval < maxsize) + buf[retval] = '\0'; + else + buf[maxsize] = '\0'; + + va_end(ap); + return retval; +} + void vsprintf(char *buf, const char *cfmt, va_list ap) { int retval; - retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap); + retval = kvprintf(cfmt, NULL, (void *)buf, 10, 0, ap); buf[retval] = '\0'; } @@ -149,9 +173,11 @@ ksprintn(char *nbuf, uintmax_t num, int * ("%*D", len, ptr, " " -> XX XX XX XX ... */ static int -kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap) +kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, size_t maxsize, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; } +#define PCHAR(c) { int cc=(c); if (func) (*func)(cc); else *d++ = cc; retval++; \ + if (maxsize && (retval == maxsize)) return (retval); \ + } char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; Modified: user/sbruno/head_177038/lib/libstand/stand.h ============================================================================== --- user/sbruno/head_177038/lib/libstand/stand.h Thu Jan 31 22:31:25 2013 (r246185) +++ user/sbruno/head_177038/lib/libstand/stand.h Thu Jan 31 22:43:38 2013 (r246186) @@ -246,6 +246,7 @@ extern char *getdisklabel(const char *, extern int printf(const char *fmt, ...) __printflike(1, 2); extern void vprintf(const char *fmt, __va_list); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); +extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); extern void vsprintf(char *buf, const char *cfmt, __va_list); extern void twiddle(void); Modified: user/sbruno/head_177038/sys/boot/i386/Makefile ============================================================================== --- user/sbruno/head_177038/sys/boot/i386/Makefile Thu Jan 31 22:31:25 2013 (r246185) +++ user/sbruno/head_177038/sys/boot/i386/Makefile Thu Jan 31 22:43:38 2013 (r246186) @@ -1,7 +1,7 @@ # $FreeBSD$ -SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot kgzldr \ - libi386 libfirewire loader +SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot kgzldr libi386 \ + libfirewire pxe_http loader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr Modified: user/sbruno/head_177038/sys/boot/i386/libi386/Makefile ============================================================================== --- user/sbruno/head_177038/sys/boot/i386/libi386/Makefile Thu Jan 31 22:31:25 2013 (r246185) +++ user/sbruno/head_177038/sys/boot/i386/libi386/Makefile Thu Jan 31 22:43:38 2013 (r246186) @@ -7,15 +7,17 @@ SRCS= biosacpi.c bioscd.c biosdisk.c bio biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ comconsole.c devicename.c elf32_freebsd.c \ elf64_freebsd.c \ - i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ + i386_copy.c i386_module.c nullconsole.c pxe.c \ smbios.c time.c vidconsole.c amd64_tramp.S -# Enable PXE TFTP or NFS support, not both. +# Enable PXE to fetch things via HTTP, TFTP or NFS. +.if !defined(LOADER_HTTP_SUPPORT) .if defined(LOADER_TFTP_SUPPORT) CFLAGS+= -DLOADER_TFTP_SUPPORT .else CFLAGS+= -DLOADER_NFS_SUPPORT .endif +.endif BOOT_COMCONSOLE_PORT?= 0x3f8 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} @@ -35,13 +37,17 @@ CFLAGS+= -DSMBIOS_SERIAL_NUMBERS # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU +CDLAGS+= -DPXE_DEBUG + +# allow pxe_http perform udpread/udpwrite +CFLAGS+= -DPXEHTTP_UDP_FOR_LIBSTAND # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica \ - -I${.CURDIR}/../../.. -I. + -I${.CURDIR}/../../.. -I. -I${.CURDIR}/../pxe_http/ # the location of libstand CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ Modified: user/sbruno/head_177038/sys/boot/i386/libi386/pxe.c ============================================================================== --- user/sbruno/head_177038/sys/boot/i386/libi386/pxe.c Thu Jan 31 22:31:25 2013 (r246185) +++ user/sbruno/head_177038/sys/boot/i386/libi386/pxe.c Thu Jan 31 22:43:38 2013 (r246186) @@ -39,67 +39,65 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef LOADER_NFS_SUPPORT #include +#endif #include #include #include #include "btxv86.h" #include "pxe.h" +#include "pxe_core.h" +#include "pxe_dhcp.h" +#include "pxe_isr.h" +#include "pxe_ip.h" +#include "pxe_udp.h" -/* - * Allocate the PXE buffers statically instead of sticking grimy fingers into - * BTX's private data area. The scratch buffer is used to send information to - * the PXE BIOS, and the data buffer is used to receive data from the PXE BIOS. - */ -#define PXE_BUFFER_SIZE 0x2000 #define PXE_TFTP_BUFFER_SIZE 512 -static char scratch_buffer[PXE_BUFFER_SIZE]; -static char data_buffer[PXE_BUFFER_SIZE]; +#ifndef PXEHTTP_UDP_FOR_LIBSTAND +extern uint8_t *scratch_buffer; +extern uint8_t *data_buffer; +#endif + +extern char servername[256]; static pxenv_t *pxenv_p = NULL; /* PXENV+ */ static pxe_t *pxe_p = NULL; /* !PXE */ -static BOOTPLAYER bootplayer; /* PXE Cached information. */ -static int pxe_debug = 0; -static int pxe_sock = -1; +int pxe_sock = -1; static int pxe_opens = 0; void pxe_enable(void *pxeinfo); -static void (*pxe_call)(int func); -static void pxenv_call(int func); -static void bangpxe_call(int func); static int pxe_init(void); static int pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize); + static int pxe_open(struct open_file *f, ...); static int pxe_close(struct open_file *f); -static void pxe_print(int verbose); static void pxe_cleanup(void); -static void pxe_setnfshandle(char *rootpath); +static void pxe_print(int verbose); -static void pxe_perror(int error); static int pxe_netif_match(struct netif *nif, void *machdep_hint); static int pxe_netif_probe(struct netif *nif, void *machdep_hint); static void pxe_netif_init(struct iodesc *desc, void *machdep_hint); static int pxe_netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout); + static int pxe_netif_put(struct iodesc *desc, void *pkt, size_t len); static void pxe_netif_end(struct netif *nif); -extern struct netif_stats pxe_st[]; -extern u_int16_t __bangpxeseg; -extern u_int16_t __bangpxeoff; -extern void __bangpxeentry(void); -extern u_int16_t __pxenvseg; -extern u_int16_t __pxenvoff; -extern void __pxenventry(void); - -struct netif_dif pxe_ifs[] = { -/* dif_unit dif_nsel dif_stats dif_private */ - {0, 1, &pxe_st[0], 0} -}; +#ifdef LOADER_NFS_SUPPORT +static void pxe_setnfshandle(char *rootpath); +#endif + +extern struct netif_stats pxe_st[]; + +struct netif_dif pxe_ifs[] = { + /* dif_unit dif_nsel dif_stats dif_private */ + {0, 1, &pxe_st[0], 0} + }; struct netif_stats pxe_st[NENTS(pxe_ifs)]; @@ -132,279 +130,234 @@ struct devsw pxedisk = { pxe_cleanup }; -/* - * This function is called by the loader to enable PXE support if we - * are booted by PXE. The passed in pointer is a pointer to the - * PXENV+ structure. +/* pxe_enable() - This function is called by the loader to enable PXE support + * if we are booted by PXE. + * in: + * pxeinfo - pointer is a pointer to the PXENV+ structure. + * out: + * none */ void pxe_enable(void *pxeinfo) { + pxenv_p = (pxenv_t *)pxeinfo; pxe_p = (pxe_t *)PTOV(pxenv_p->PXEPtr.segment * 16 + pxenv_p->PXEPtr.offset); - pxe_call = NULL; } -/* - * return true if pxe structures are found/initialized, - * also figures out our IP information via the pxe cached info struct +/* pxe_init() - inits pxe_core structs + * in: + * none + * out: + * 2 - already initialized + * 1 - if pxe structures are found & initialized + * 0 - failed */ static int pxe_init(void) { - t_PXENV_GET_CACHED_INFO *gci_p; - int counter; - uint8_t checksum; - uint8_t *checkptr; - - if(pxenv_p == NULL) - return (0); - - /* look for "PXENV+" */ - if (bcmp((void *)pxenv_p->Signature, S_SIZE("PXENV+"))) { - pxenv_p = NULL; - return (0); - } - - /* make sure the size is something we can handle */ - if (pxenv_p->Length > sizeof(*pxenv_p)) { - printf("PXENV+ structure too large, ignoring\n"); - pxenv_p = NULL; - return (0); - } - - /* - * do byte checksum: - * add up each byte in the structure, the total should be 0 - */ - checksum = 0; - checkptr = (uint8_t *) pxenv_p; - for (counter = 0; counter < pxenv_p->Length; counter++) - checksum += *checkptr++; - if (checksum != 0) { - printf("PXENV+ structure failed checksum, ignoring\n"); - pxenv_p = NULL; - return (0); - } - - /* - * PXENV+ passed, so use that if !PXE is not available or - * the checksum fails. - */ - pxe_call = pxenv_call; - if (pxenv_p->Version >= 0x0200) { - for (;;) { - if (bcmp((void *)pxe_p->Signature, S_SIZE("!PXE"))) { - pxe_p = NULL; - break; - } - checksum = 0; - checkptr = (uint8_t *)pxe_p; - for (counter = 0; counter < pxe_p->StructLength; - counter++) - checksum += *checkptr++; - if (checksum != 0) { - pxe_p = NULL; - break; - } - pxe_call = bangpxe_call; - break; - } - } - - printf("\nPXE version %d.%d, real mode entry point ", - (uint8_t) (pxenv_p->Version >> 8), - (uint8_t) (pxenv_p->Version & 0xFF)); - if (pxe_call == bangpxe_call) - printf("@%04x:%04x\n", - pxe_p->EntryPointSP.segment, - pxe_p->EntryPointSP.offset); - else - printf("@%04x:%04x\n", - pxenv_p->RMEntry.segment, pxenv_p->RMEntry.offset); - - gci_p = (t_PXENV_GET_CACHED_INFO *) scratch_buffer; - bzero(gci_p, sizeof(*gci_p)); - 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); - } - bcopy(PTOV((gci_p->Buffer.segment << 4) + gci_p->Buffer.offset), - &bootplayer, gci_p->BufferSize); - return (1); + if (__pxe_nic_irq != 0) + return (2); + + return pxe_core_init(pxenv_p, pxe_p); } - +/* block device strategy function */ static int pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize) { + return (EIO); } +static void +pxe_print(int verbose) +{ + printf(" pxenet0: MAC %6D\n", pxe_get_mymac(), ":"); + printf(" ISR: at %x:%x (chained at: %x:%x)\n", + __pxe_entry_seg, __pxe_entry_off, + __chained_irq_seg, __chained_irq_off); + + return; +} + static int pxe_open(struct open_file *f, ...) { - va_list args; - char *devname; /* Device part of file name (or NULL). */ - char temp[FNAME_SIZE]; - int error = 0; - int i; - - va_start(args, f); - devname = va_arg(args, char*); - va_end(args); - - /* On first open, do netif open, mount, etc. */ - if (pxe_opens == 0) { - /* Find network interface. */ - if (pxe_sock < 0) { - pxe_sock = netif_open(devname); - if (pxe_sock < 0) { - printf("pxe_open: netif_open() failed\n"); - return (ENXIO); - } - if (pxe_debug) - printf("pxe_open: netif_open() succeeded\n"); - } - if (rootip.s_addr == 0) { - /* - * Do a bootp/dhcp request to find out where our - * NFS/TFTP server is. Even if we dont get back - * the proper information, fall back to the server - * which brought us to life and a default rootpath. - */ - bootp(pxe_sock, BOOTP_PXE); - if (rootip.s_addr == 0) - rootip.s_addr = bootplayer.sip; - if (!rootpath[1]) - strcpy(rootpath, PXENFSROOTPATH); - - for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) - if (rootpath[i] == ':') - break; - if (i && i != FNAME_SIZE && rootpath[i] == ':') { - rootpath[i++] = '\0'; - if (inet_addr(&rootpath[0]) != INADDR_NONE) - rootip.s_addr = inet_addr(&rootpath[0]); - bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1); - bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1); - } - printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); - printf("pxe_open: server path: %s\n", rootpath); - printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - - setenv("boot.netif.ip", inet_ntoa(myip), 1); - setenv("boot.netif.netmask", intoa(netmask), 1); - setenv("boot.netif.gateway", inet_ntoa(gateip), 1); - if (bootplayer.Hardware == ETHER_TYPE) { - sprintf(temp, "%6D", bootplayer.CAddr, ":"); - setenv("boot.netif.hwaddr", temp, 1); + va_list args; + char *devname = NULL; + int i = 0; + + va_start(args, f); + devname = va_arg(args, char*); + va_end(args); + + if (pxe_opens == 0) { + /* Find network interface. */ + if (pxe_sock < 0) { + pxe_sock = netif_open(devname); + + if (pxe_sock < 0) { + printf("pxe_open: netif_open() failed\n"); + return (ENXIO); + } + } - setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); - setenv("boot.nfsroot.path", rootpath, 1); - setenv("dhcp.host-name", hostname, 1); + +#ifdef PXE_BOOTP_USE_LIBSTAND + const PXE_IPADDR *addr = pxe_get_ip(PXE_IP_ROOT); + + if ( (addr->ip == 0)) { + pxe_dhcp_query(0); + pxe_core_update_bootp(); + +#ifdef PXEHTTP_UDP_FOR_LIBSTAND + gateip.s_addr = pxe_get_ip(PXE_IP_GATEWAY)->ip; + rootip.s_addr = pxe_get_ip(PXE_IP_ROOT)->ip; + netmask = pxe_get_ip(PXE_IP_NETMASK)->ip; + myip.s_addr = pxe_get_ip(PXE_IP_MY)->ip; + nameip.s_addr = pxe_get_ip(PXE_IP_NAMESERVER)->ip; +#endif + } +#endif /* PXE_BOOTP_USE_LIBSTAND */ } - } - pxe_opens++; - f->f_devdata = &pxe_sock; - return (error); + ++pxe_opens; + f->f_devdata = &pxe_sock; + + return (0); } static int pxe_close(struct open_file *f) { - -#ifdef PXE_DEBUG - if (pxe_debug) - printf("pxe_close: opens=%d\n", pxe_opens); -#endif - - /* On last close, do netif close, etc. */ - f->f_devdata = NULL; - /* Extra close call? */ - if (pxe_opens <= 0) - return (0); - pxe_opens--; - /* Not last close? */ - if (pxe_opens > 0) - return(0); + /* On last close, do netif close, etc. */ + f->f_devdata = NULL; + + if (pxe_opens) + --pxe_opens; + + /* Not last close? */ + if (pxe_opens > 0) + return (0); #ifdef LOADER_NFS_SUPPORT /* get an NFS filehandle for our root filesystem */ pxe_setnfshandle(rootpath); #endif - if (pxe_sock >= 0) { - + if (pxe_sock >= 0) { #ifdef PXE_DEBUG - if (pxe_debug) - printf("pxe_close: calling netif_close()\n"); + printf("pxe_close: calling netif_close()\n"); #endif - netif_close(pxe_sock); - pxe_sock = -1; - } - return (0); + netif_close(pxe_sock); + pxe_sock = -1; + } + + return (0); } static void -pxe_print(int verbose) +pxe_cleanup(void) { - if (pxe_call != NULL) { - if (*bootplayer.Sname == '\0') { - printf(" "IP_STR":%s\n", - IP_ARGS(htonl(bootplayer.sip)), - bootplayer.bootfile); - } else { - printf(" %s:%s\n", bootplayer.Sname, - bootplayer.bootfile); - } - } + pxe_core_shutdown(); +} - return; +static int +pxe_netif_match(struct netif *nif, void *machdep_hint) +{ +#ifdef PXE_DEBUG + printf("pxe_netif_match() called."); +#endif + return (1); +} + + +static int +pxe_netif_probe(struct netif *nif, void *machdep_hint) +{ +#ifdef PXE_DEBUG + printf("pxe_netif_probe() called."); +#endif + +#ifdef PXEHTTP_UDP_FOR_LIBSTAND + if (__pxe_nic_irq == 0) + return (-1); +#else + t_PXENV_UDP_OPEN *udpopen_p = (t_PXENV_UDP_OPEN *)scratch_buffer; + + bzero(udpopen_p, sizeof(*udpopen_p)); + + const PXE_IPADDR *my = pxe_get_ip(PXE_IP_MY); + udpopen_p->src_ip = my->ip; + + pxe_core_call(PXENV_UDP_OPEN); + + if (udpopen_p->status != 0) { + printf("pxe_netif_probe: failed %x\n", udpopen_p->status); + return (-1); + } +#endif + return (0); } static void -pxe_cleanup(void) +pxe_netif_end(struct netif *nif) { #ifdef PXE_DEBUG - t_PXENV_UNLOAD_STACK *unload_stack_p = - (t_PXENV_UNLOAD_STACK *)scratch_buffer; - t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p = - (t_PXENV_UNDI_SHUTDOWN *)scratch_buffer; + printf("pxe_netif_end() called."); #endif - if (pxe_call == NULL) - return; +#ifndef PXEHTTP_UDP_FOR_LIBSTAND + t_PXENV_UDP_CLOSE *udpclose_p = (t_PXENV_UDP_CLOSE *)scratch_buffer; + + bzero(udpclose_p, sizeof(*udpclose_p)); - pxe_call(PXENV_UNDI_SHUTDOWN); + pxe_core_call(PXENV_UDP_CLOSE); + + if (udpclose_p->status != 0) + printf("pxe_end failed %x\n", udpclose_p->status); +#endif +} +static void +pxe_netif_init(struct iodesc *desc, void *machdep_hint) +{ + #ifdef PXE_DEBUG - if (pxe_debug && undi_shutdown_p->Status != 0) - printf("pxe_cleanup: UNDI_SHUTDOWN failed %x\n", - undi_shutdown_p->Status); + printf("pxe_netif_init(): called.\n"); #endif + uint8_t *mac = (uint8_t *)pxe_get_mymac(); + + int i; + for (i = 0; i < 6; ++i) + desc->myea[i] = mac[i]; - pxe_call(PXENV_UNLOAD_STACK); + const PXE_IPADDR *my = pxe_get_ip(PXE_IP_MY); + desc->xid = my->ip; +} -#ifdef PXE_DEBUG - if (pxe_debug && unload_stack_p->Status != 0) - printf("pxe_cleanup: UNLOAD_STACK failed %x\n", - unload_stack_p->Status); +static int +pxe_netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) +{ +#ifdef PXE_DEBUG + printf("pxe_netif_get(): called.\n"); #endif + return (len); } -void -pxe_perror(int err) +static int +pxe_netif_put(struct iodesc *desc, void *pkt, size_t len) { - return; +#ifdef PXE_DEBUG + printf("pxe_netif_put(): called.\n"); +#endif + return (len); } +#ifdef LOADER_NFS_SUPPORT /* * Reach inside the libstand NFS code and dig out an NFS handle * for the root filesystem. @@ -415,6 +368,7 @@ struct nfs_iodesc { u_char fh[NFS_FHSIZE]; /* structure truncated here */ }; + extern struct nfs_iodesc nfs_root_node; extern int rpc_port; @@ -456,181 +410,127 @@ pxe_setnfshandle(char *rootpath) sprintf(cp, "X"); setenv("boot.nfsroot.nfshandle", buf, 1); } - -void -pxenv_call(int func) -{ -#ifdef PXE_DEBUG - if (pxe_debug) - printf("pxenv_call %x\n", func); #endif - - bzero(&v86, sizeof(v86)); - bzero(data_buffer, sizeof(data_buffer)); - - __pxenvseg = pxenv_p->RMEntry.segment; - __pxenvoff = pxenv_p->RMEntry.offset; - - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.es = VTOPSEG(scratch_buffer); - v86.edi = VTOPOFF(scratch_buffer); - v86.addr = (VTOPSEG(__pxenventry) << 16) | VTOPOFF(__pxenventry); - v86.ebx = func; - v86int(); - v86.ctl = V86_FLAGS; -} -void -bangpxe_call(int func) +#ifdef PXEHTTP_UDP_FOR_LIBSTAND +/* new versions of udp send/recv functions */ +ssize_t +sendudp(struct iodesc *h, void *pkt, size_t len) { -#ifdef PXE_DEBUG - if (pxe_debug) - printf("bangpxe_call %x\n", func); +#ifdef PXE_DEBUG_HELL + printf("sendudp(): sending %u bytes from me:%u -> %s:%u\n", + len, ntohs(h->myport), + inet_ntoa(h->destip), ntohs(h->destport)); #endif + void *ipdata = pkt - sizeof(PXE_UDP_PACKET); - bzero(&v86, sizeof(v86)); - bzero(data_buffer, sizeof(data_buffer)); - - __bangpxeseg = pxe_p->EntryPointSP.segment; - __bangpxeoff = pxe_p->EntryPointSP.offset; - - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.edx = VTOPSEG(scratch_buffer); - v86.eax = VTOPOFF(scratch_buffer); - v86.addr = (VTOPSEG(__bangpxeentry) << 16) | VTOPOFF(__bangpxeentry); - v86.ebx = func; - v86int(); - v86.ctl = V86_FLAGS; -} - - -time_t -getsecs() -{ - time_t n = 0; - time(&n); - return n; -} - -static int -pxe_netif_match(struct netif *nif, void *machdep_hint) -{ - return 1; -} - - -static int -pxe_netif_probe(struct netif *nif, void *machdep_hint) -{ - t_PXENV_UDP_OPEN *udpopen_p = (t_PXENV_UDP_OPEN *)scratch_buffer; - - if (pxe_call == NULL) - return -1; - - bzero(udpopen_p, sizeof(*udpopen_p)); - udpopen_p->src_ip = bootplayer.yip; - pxe_call(PXENV_UDP_OPEN); + PXE_IPADDR dst; + dst.ip = h->destip.s_addr; - if (udpopen_p->status != 0) { - printf("pxe_netif_probe: failed %x\n", udpopen_p->status); - return -1; + if (!pxe_udp_send(ipdata, &dst, ntohs(h->destport), + ntohs(h->myport), len + sizeof(PXE_UDP_PACKET))) + { + printf("sendudp(): failed\n"); + return (-1); } - return 0; -} - -static void -pxe_netif_end(struct netif *nif) -{ - t_PXENV_UDP_CLOSE *udpclose_p = (t_PXENV_UDP_CLOSE *)scratch_buffer; - bzero(udpclose_p, sizeof(*udpclose_p)); - - pxe_call(PXENV_UDP_CLOSE); - if (udpclose_p->status != 0) - printf("pxe_end failed %x\n", udpclose_p->status); -} - -static void -pxe_netif_init(struct iodesc *desc, void *machdep_hint) -{ - int i; - for (i = 0; i < 6; ++i) - desc->myea[i] = bootplayer.CAddr[i]; - desc->xid = bootplayer.ident; + + return (len); } -static int -pxe_netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) +ssize_t +readudp(struct iodesc *h, void *pkt, size_t len, time_t timeout) { - return len; -} + PXE_UDP_DGRAM dgram; + struct udphdr *uh = (struct udphdr *) pkt - 1; + + /* process any queued incoming packets */ + pxe_core_recv_packets(); -static int -pxe_netif_put(struct iodesc *desc, void *pkt, size_t len) -{ - return len; + /* reading from default socket */ + int recv = pxe_udp_read(NULL, pkt, len, &dgram); + + if (recv == -1) { + printf("readudp(): failed\n"); + return (-1); + } +#ifdef PXE_DEBUG_HELL + printf("readudp(): received %d(%u/%u) bytes from %u port\n", + recv, len, dgram.size, dgram.src_port); +#endif + uh->uh_sport = htons(dgram.src_port); + + return (recv); } +#else /* !defined(PXEHTTP_UDP_FOR_LIBSTAND) */ +/* old variants of udp send/recv functions */ ssize_t sendudp(struct iodesc *h, void *pkt, size_t len) { - t_PXENV_UDP_WRITE *udpwrite_p = (t_PXENV_UDP_WRITE *)scratch_buffer; - bzero(udpwrite_p, sizeof(*udpwrite_p)); - - udpwrite_p->ip = h->destip.s_addr; - udpwrite_p->dst_port = h->destport; - udpwrite_p->src_port = h->myport; - udpwrite_p->buffer_size = len; - udpwrite_p->buffer.segment = VTOPSEG(pkt); - udpwrite_p->buffer.offset = VTOPOFF(pkt); - - if (netmask == 0 || SAMENET(myip, h->destip, netmask)) - udpwrite_p->gw = 0; - else - udpwrite_p->gw = gateip.s_addr; - - pxe_call(PXENV_UDP_WRITE); + t_PXENV_UDP_WRITE *udpwrite_p = (t_PXENV_UDP_WRITE *)scratch_buffer; + bzero(udpwrite_p, sizeof(*udpwrite_p)); + + udpwrite_p->ip = h->destip.s_addr; + udpwrite_p->dst_port = h->destport; + udpwrite_p->src_port = h->myport; + udpwrite_p->buffer_size = len; + udpwrite_p->buffer.segment = VTOPSEG(pkt); + udpwrite_p->buffer.offset = VTOPOFF(pkt); + + if (netmask == 0 || SAMENET(myip, h->destip, netmask)) + udpwrite_p->gw = 0; + else + udpwrite_p->gw = gateip.s_addr; + pxe_core_call(PXENV_UDP_WRITE); #if 0 - /* XXX - I dont know why we need this. */ - delay(1000); + /* XXX - I dont know why we need this. */ + delay(1000); #endif - if (udpwrite_p->status != 0) { - /* XXX: This happens a lot. It shouldn't. */ - if (udpwrite_p->status != 1) - printf("sendudp failed %x\n", udpwrite_p->status); - return -1; + if (udpwrite_p->status != 0) { + /* XXX: This happens a lot. It shouldn't. */ + if (udpwrite_p->status != 1) + printf("sendudp failed %x\n", udpwrite_p->status); + + return (-1); } - return len; + + return (len); } ssize_t readudp(struct iodesc *h, void *pkt, size_t len, time_t timeout) { - t_PXENV_UDP_READ *udpread_p = (t_PXENV_UDP_READ *)scratch_buffer; - struct udphdr *uh = NULL; - - uh = (struct udphdr *) pkt - 1; - bzero(udpread_p, sizeof(*udpread_p)); - - udpread_p->dest_ip = h->myip.s_addr; - udpread_p->d_port = h->myport; - udpread_p->buffer_size = len; - udpread_p->buffer.segment = VTOPSEG(data_buffer); - udpread_p->buffer.offset = VTOPOFF(data_buffer); - - pxe_call(PXENV_UDP_READ); - + t_PXENV_UDP_READ *udpread_p = (t_PXENV_UDP_READ *)scratch_buffer; + struct udphdr *uh = NULL; + + uh = (struct udphdr *) pkt - 1; + bzero(udpread_p, sizeof(*udpread_p)); + + udpread_p->dest_ip = h->myip.s_addr; + udpread_p->d_port = h->myport; + udpread_p->buffer_size = len; + udpread_p->buffer.segment = VTOPSEG(data_buffer); + udpread_p->buffer.offset = VTOPOFF(data_buffer); + + pxe_core_call(PXENV_UDP_READ); + #if 0 - /* XXX - I dont know why we need this. */ - delay(1000); + /* XXX - I dont know why we need this. */ + delay(1000); #endif - if (udpread_p->status != 0) { - /* XXX: This happens a lot. It shouldn't. */ - if (udpread_p->status != 1) - printf("readudp failed %x\n", udpread_p->status); - return -1; + if (udpread_p->status != 0) { + /* XXX: This happens a lot. It shouldn't. */ + if (udpread_p->status != 1) + printf("readudp failed %x\n", udpread_p->status); + + return (-1); } - bcopy(data_buffer, pkt, udpread_p->buffer_size); - uh->uh_sport = udpread_p->s_port; - return udpread_p->buffer_size; + + bcopy(data_buffer, pkt, udpread_p->buffer_size); + uh->uh_sport = udpread_p->s_port; + + return (udpread_p->buffer_size); } + +#endif /* PXEHTTP_UDP_FOR_LIBSTAND */ Modified: user/sbruno/head_177038/sys/boot/i386/libi386/pxe.h ============================================================================== --- user/sbruno/head_177038/sys/boot/i386/libi386/pxe.h Thu Jan 31 22:31:25 2013 (r246185) +++ user/sbruno/head_177038/sys/boot/i386/libi386/pxe.h Thu Jan 31 22:43:38 2013 (r246186) @@ -48,6 +48,9 @@ * structures passed into PXE * Question: does this really work for PXE's expected ABI? */ +#ifndef __PXE__H__ +#define __PXE__H__ + #define PACKED __packed #define S_SIZE(s) s, sizeof(s) - 1 @@ -156,7 +159,7 @@ typedef struct { PXENV_STATUS_t Status; ADDR32_t ProtocolIni; /* Phys addr of a copy of the driver module */ uint8_t reserved[8]; -} PACKED t_PXENV_UNDI_INITALIZE; +} PACKED t_PXENV_UNDI_INITIALIZE; #define MAXNUM_MCADDR 8 @@ -334,6 +337,15 @@ typedef struct { uint32_t Reserved[4]; /* must be 0 */ } PACKED t_PXENV_UNDI_GET_NDIS_INFO; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Feb 1 01:35:00 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B866DCC3; Fri, 1 Feb 2013 01:35:00 +0000 (UTC) (envelope-from adrian@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 A9E67C1; Fri, 1 Feb 2013 01:35:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r111Z0k1009087; Fri, 1 Feb 2013 01:35:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r111Z0ci009086; Fri, 1 Feb 2013 01:35:00 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302010135.r111Z0ci009086@svn.freebsd.org> From: Adrian Chadd Date: Fri, 1 Feb 2013 01:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246189 - user/adrian/ath_radar_stuff/lib/libradarpkt 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, 01 Feb 2013 01:35:00 -0000 Author: adrian Date: Fri Feb 1 01:34:59 2013 New Revision: 246189 URL: http://svnweb.freebsd.org/changeset/base/246189 Log: Oops, add missing file. Added: user/adrian/ath_radar_stuff/lib/libradarpkt/platform.h Added: user/adrian/ath_radar_stuff/lib/libradarpkt/platform.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/adrian/ath_radar_stuff/lib/libradarpkt/platform.h Fri Feb 1 01:34:59 2013 (r246189) @@ -0,0 +1,19 @@ +#include +#include +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#include + +#define le16_to_cpu le16toh +#define le32_to_cpu le32toh +#define get_unaligned(p) \ +({ \ + struct packed_dummy_struct { \ + typeof(*(p)) __val; \ + } __attribute__((packed)) *__ptr = (void *) (p); \ + \ + __ptr->__val; \ +}) +#define get_unaligned_le16(p) le16_to_cpu(get_unaligned((uint16_t *)(p))) +#define get_unaligned_le32(p) le32_to_cpu(get_unaligned((uint32_t *)(p))) From owner-svn-src-user@FreeBSD.ORG Fri Feb 1 18:59:16 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0973676; Fri, 1 Feb 2013 18:59:16 +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 CED7E965; Fri, 1 Feb 2013 18:59:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r11IxFSO025810; Fri, 1 Feb 2013 18:59:15 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r11IxFU0025809; Fri, 1 Feb 2013 18:59:15 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201302011859.r11IxFU0025809@svn.freebsd.org> From: Sean Bruno Date: Fri, 1 Feb 2013 18:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r246220 - user/sbruno/pxe_http_head 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, 01 Feb 2013 18:59:16 -0000 Author: sbruno Date: Fri Feb 1 18:59:14 2013 New Revision: 246220 URL: http://svnweb.freebsd.org/changeset/base/246220 Log: Branch head for final pass at resurrection of pxe_http Added: - copied from r246219, head/ Directory Properties: user/sbruno/pxe_http_head/ (props changed) From owner-svn-src-user@FreeBSD.ORG Fri Feb 1 19:32:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F0C3A9A6 for ; Fri, 1 Feb 2013 19:32:44 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 84A50ACB for ; Fri, 1 Feb 2013 19:32:44 +0000 (UTC) Received: (qmail 45440 invoked from network); 1 Feb 2013 20:52:20 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 1 Feb 2013 20:52:20 -0000 Message-ID: <510C1855.40701@freebsd.org> Date: Fri, 01 Feb 2013 20:32:37 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Sean Bruno Subject: Re: svn commit: r246220 - user/sbruno/pxe_http_head References: <201302011859.r11IxFU0025809@svn.freebsd.org> In-Reply-To: <201302011859.r11IxFU0025809@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org 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, 01 Feb 2013 19:32:45 -0000 On 01.02.2013 19:59, Sean Bruno wrote: > Author: sbruno > Date: Fri Feb 1 18:59:14 2013 > New Revision: 246220 > URL: http://svnweb.freebsd.org/changeset/base/246220 > > Log: > Branch head for final pass at resurrection of pxe_http While I don't want to discourage from this work the IPXE package (formerly etherboot) already provides HTTP as well as iSCSI, FCoE and AoE to load the kernel. It also provides a nice scripting language where the scrips can even be loaded through HTTP. IPXE is GPLv2 licensed though. -- Andre From owner-svn-src-user@FreeBSD.ORG Fri Feb 1 23:09:52 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 23AE278C; Fri, 1 Feb 2013 23:09:52 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by mx1.freebsd.org (Postfix) with ESMTP id 1F43532B; Fri, 1 Feb 2013 23:09:50 +0000 (UTC) Received: by mail-lb0-f172.google.com with SMTP id n8so5085580lbj.31 for ; Fri, 01 Feb 2013 15:09:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=PRJwfkOT3UrOwTU4HOb0FSZR4buD1f7PdE5d91wgWjc=; b=ICeQNySPiX/+AoWSQNcRPfB+bR+xNv7LMI9YT6rqr/0u/B2+fM7AJk2QfjePStCfhV s0xdptS01ssR+lhOr0TtlE+b7lBqIqaPC4jUZlAjHWP7rVHDW1YlAvxZ1EqTAgrjIeRG 2pYbQay0KII7/PBBFoT542wtZBEIMYQv5btFgdU0kD4yHul04tm5RESpkQc0ztMblUWm Y2e9kC98xtzchD6iL9sgdFwER9isvHdPT8dD62PhqITOjG3qWEZQmZeruwBq7rHATzoH SSv4MVL/tpG7WqA6dYIfAf8Ms7VghECml8KVX1CuVWtvVaNKc0eCsK/hYOQgL+E0B6kR l1dQ== MIME-Version: 1.0 X-Received: by 10.112.82.202 with SMTP id k10mr5464142lby.22.1359760189577; Fri, 01 Feb 2013 15:09:49 -0800 (PST) Sender: crodr001@gmail.com Received: by 10.112.30.39 with HTTP; Fri, 1 Feb 2013 15:09:49 -0800 (PST) In-Reply-To: <510C1855.40701@freebsd.org> References: <201302011859.r11IxFU0025809@svn.freebsd.org> <510C1855.40701@freebsd.org> Date: Fri, 1 Feb 2013 15:09:49 -0800 X-Google-Sender-Auth: KRL_w7w8SODiehmdFLgLV6DNHOs Message-ID: Subject: Re: svn commit: r246220 - user/sbruno/pxe_http_head From: Craig Rodrigues To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Sean Bruno , src-committers@freebsd.org, svn-src-user@freebsd.org 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, 01 Feb 2013 23:09:52 -0000 On Fri, Feb 1, 2013 at 11:32 AM, Andre Oppermann wrOn > > > While I don't want to discourage from this work the IPXE package > (formerly etherboot) already provides HTTP as well as iSCSI, FCoE > and AoE to load the kernel. It also provides a nice scripting > language where the scrips can even be loaded through HTTP. IPXE > is GPLv2 licensed though. > > -- > Andre > > Does iPXE work with FreeBSD? It would be good to see newer alternatives to PXE/TFTP, especially things that work over HTTP. Based on this thread: http://lists.freebsd.org/pipermail/freebsd-current/2013-January/039334.html I am wondering if there are areas of the NFS root mount code that we can clean up so it works better with things like iPXE. Right now there are a lot of preprocessor macros that can be enabled in the kernel (NFS_ROOT, BOOTP*, etc.). If this stuff could be cleaned up so that instead of compile time macros, these features get converted to run-time behaviors that can be triggered by kernel environment varialbes that are documented, that would be nicer IMHO. -- Craig Rodrigues rodrigc@crodrigues.org From owner-svn-src-user@FreeBSD.ORG Fri Feb 1 23:17:51 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6B014909 for ; Fri, 1 Feb 2013 23:17:51 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id D156235C for ; Fri, 1 Feb 2013 23:17:50 +0000 (UTC) Received: (qmail 49878 invoked from network); 2 Feb 2013 00:37:24 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 2 Feb 2013 00:37:24 -0000 Message-ID: <510C4D17.90407@freebsd.org> Date: Sat, 02 Feb 2013 00:17:43 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Craig Rodrigues Subject: Re: svn commit: r246220 - user/sbruno/pxe_http_head References: <201302011859.r11IxFU0025809@svn.freebsd.org> <510C1855.40701@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sean Bruno , src-committers@freebsd.org, svn-src-user@freebsd.org 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, 01 Feb 2013 23:17:51 -0000 On 02.02.2013 00:09, Craig Rodrigues wrote: > On Fri, Feb 1, 2013 at 11:32 AM, Andre Oppermann > wrOn > > > While I don't want to discourage from this work the IPXE package > (formerly etherboot) already provides HTTP as well as iSCSI, FCoE > and AoE to load the kernel. It also provides a nice scripting > language where the scrips can even be loaded through HTTP. IPXE > is GPLv2 licensed though. > > -- > Andre > > > Does iPXE work with FreeBSD? It would be good to see newer alternatives > to PXE/TFTP, especially things that work over HTTP. > > Based on this thread: http://lists.freebsd.org/pipermail/freebsd-current/2013-January/039334.html > I am wondering if there are areas of the NFS root mount code that > we can clean up so it works better with things like iPXE. > > Right now there are a lot of preprocessor macros that can be enabled > in the kernel (NFS_ROOT, BOOTP*, etc.). > If this stuff could be cleaned up so that instead of compile time macros, > these features get converted to run-time behaviors that can be triggered > by kernel environment varialbes that are documented, that would be nicer IMHO. Based on the recent discussions I've started a local branch two days ago to do exactly that and chop/merge bootp_subr.c and nfs_diskless.c into the network interface, bootp/dhcp and nfs parts. All of which gets tied into vfs_mountroot.c to work the same as ufs, zfs or md root mounting. Downloading a md root image via HTTP as another option is the goal. :) -- Andre