From owner-svn-soc-all@freebsd.org Sun Aug 14 04:08:05 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CB0FBB926F for ; Sun, 14 Aug 2016 04:08:05 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F39C1B61 for ; Sun, 14 Aug 2016 04:08:05 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7E485C1028092 for ; Sun, 14 Aug 2016 04:08:05 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7E484LL027754 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 04:08:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 04:08:04 GMT Message-Id: <201608140408.u7E484LL027754@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307556 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 04:08:05 -0000 Author: yuanxunzhang Date: Sun Aug 14 04:08:04 2016 New Revision: 307556 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307556 Log: EAPS: check eaps domian name Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 03:49:37 2016 (r307555) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:08:04 2016 (r307556) @@ -66,7 +66,7 @@ int keyword(const char *); static void create_domain(int, char **, int); -static void delete_domain(int, char **); +static void delete_domain(int, char **, int); static void display(int, char **); static void usage(const char *); void load_module(const char *); @@ -103,7 +103,7 @@ struct module_stat mstat; int fileid, modid; const char *cp; - + mstat.version = sizeof(struct module_stat); for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) { /* scan modules in file */ @@ -135,13 +135,17 @@ printf("Create eaps %s!\n", domain_name); + if (domain_name == null) { + err(1, "EAPS domain name is NULL!"); + } + // Create EAPS interface /* check and maybe load support for this interface */ load_module(eaps_ifname); - struct ifreq ifr; - + struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); + (void) strlcpy(ifr.ifr_name, eaps_ifname, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) @@ -151,7 +155,7 @@ } static void -delete_domain(int argc, char **argv) +delete_domain(int argc, char **argv, int s) { int error = 0; printf("Delete eaps domain %s!\n", *(++argv)); From owner-svn-soc-all@freebsd.org Sun Aug 14 04:12:24 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88A39BB9556 for ; Sun, 14 Aug 2016 04:12:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BFC4122B for ; Sun, 14 Aug 2016 04:12:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7E4COmK032823 for ; Sun, 14 Aug 2016 04:12:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7E4CNWi032204 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 04:12:23 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 04:12:23 GMT Message-Id: <201608140412.u7E4CNWi032204@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307557 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 04:12:24 -0000 Author: yuanxunzhang Date: Sun Aug 14 04:12:22 2016 New Revision: 307557 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307557 Log: EAPS: check eaps domian name Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:08:04 2016 (r307556) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:12:22 2016 (r307557) @@ -135,10 +135,11 @@ printf("Create eaps %s!\n", domain_name); - if (domain_name == null) { + // Check eaps domain name + if (domain_name == NULL) { err(1, "EAPS domain name is NULL!"); } - + // Create EAPS interface /* check and maybe load support for this interface */ load_module(eaps_ifname); From owner-svn-soc-all@freebsd.org Sun Aug 14 04:13:10 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47274BB957F for ; Sun, 14 Aug 2016 04:13:10 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A89D125B for ; Sun, 14 Aug 2016 04:13:10 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7E4DADL052730 for ; Sun, 14 Aug 2016 04:13:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7E4D9xj052119 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 04:13:09 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 04:13:09 GMT Message-Id: <201608140413.u7E4D9xj052119@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307558 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 04:13:10 -0000 Author: yuanxunzhang Date: Sun Aug 14 04:13:08 2016 New Revision: 307558 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307558 Log: EAPS: check eaps domian name Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:12:22 2016 (r307557) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:13:08 2016 (r307558) @@ -88,7 +88,7 @@ create_domain(argc, argv, s); case K_DELETE: - delete_domain(argc, argv); + delete_domain(argc, argv, s); case K_DISPLAY: display(argc, argv); From owner-svn-soc-all@freebsd.org Sun Aug 14 04:25:55 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A863EBB9745 for ; Sun, 14 Aug 2016 04:25:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B4E6155B for ; Sun, 14 Aug 2016 04:25:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7E4Pt0a043430 for ; Sun, 14 Aug 2016 04:25:55 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7E4PswZ043138 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 04:25:54 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 04:25:54 GMT Message-Id: <201608140425.u7E4PswZ043138@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307559 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 04:25:55 -0000 Author: yuanxunzhang Date: Sun Aug 14 04:25:54 2016 New Revision: 307559 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307559 Log: EAPS: check eaps domian name Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:13:08 2016 (r307558) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:25:54 2016 (r307559) @@ -130,7 +130,6 @@ static void create_domain(int argc, char **argv, int s) { - int error = 0; char *domain_name = *(++argv); printf("Create eaps %s!\n", domain_name); @@ -151,8 +150,6 @@ if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) err(1, "SIOCIFCREATE2"); - - exit(error); } static void From owner-svn-soc-all@freebsd.org Sun Aug 14 05:46:12 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 164D3BB9438 for ; Sun, 14 Aug 2016 05:46:12 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 091A315BA for ; Sun, 14 Aug 2016 05:46:12 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7E5kBBq062615 for ; Sun, 14 Aug 2016 05:46:11 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7E5kBMv062599 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 05:46:11 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 05:46:11 GMT Message-Id: <201608140546.u7E5kBMv062599@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307562 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 05:46:12 -0000 Author: yuanxunzhang Date: Sun Aug 14 05:46:10 2016 New Revision: 307562 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307562 Log: EAPS: check eaps domian name Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 04:35:04 2016 (r307561) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 05:46:10 2016 (r307562) @@ -132,7 +132,7 @@ { char *domain_name = *(++argv); - printf("Create eaps %s!\n", domain_name); + printf("Debug print: Create eaps %s!\n", domain_name); // Check eaps domain name if (domain_name == NULL) { @@ -146,7 +146,7 @@ struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); - (void) strlcpy(ifr.ifr_name, eaps_ifname, sizeof(ifr.ifr_name)); + (void) strlcpy(ifr.ifr_name, domain_name, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) err(1, "SIOCIFCREATE2"); From owner-svn-soc-all@freebsd.org Sun Aug 14 05:53:05 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3690BBB9672 for ; Sun, 14 Aug 2016 05:53:05 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29CA81B49 for ; Sun, 14 Aug 2016 05:53:05 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7E5r5CW077997 for ; Sun, 14 Aug 2016 05:53:05 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7E5r4Op077995 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 05:53:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 05:53:04 GMT Message-Id: <201608140553.u7E5r4Op077995@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307563 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 05:53:05 -0000 Author: yuanxunzhang Date: Sun Aug 14 05:53:04 2016 New Revision: 307563 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307563 Log: EAPS: check eaps domian name Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 05:46:10 2016 (r307562) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 05:53:04 2016 (r307563) @@ -130,6 +130,7 @@ static void create_domain(int argc, char **argv, int s) { + int error = 0; char *domain_name = *(++argv); printf("Debug print: Create eaps %s!\n", domain_name); @@ -150,6 +151,8 @@ if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) err(1, "SIOCIFCREATE2"); + + exit(error); } static void From owner-svn-soc-all@freebsd.org Sun Aug 14 16:52:48 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8858FBBA0B2 for ; Sun, 14 Aug 2016 16:52:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B98916FB for ; Sun, 14 Aug 2016 16:52:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7EGqmRP015112 for ; Sun, 14 Aug 2016 16:52:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7EGqlmx015055 for svn-soc-all@FreeBSD.org; Sun, 14 Aug 2016 16:52:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 14 Aug 2016 16:52:47 GMT Message-Id: <201608141652.u7EGqlmx015055@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307577 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2016 16:52:48 -0000 Author: yuanxunzhang Date: Sun Aug 14 16:52:47 2016 New Revision: 307577 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307577 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 15:52:00 2016 (r307576) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 16:52:47 2016 (r307577) @@ -159,7 +159,7 @@ delete_domain(int argc, char **argv, int s) { int error = 0; - printf("Delete eaps domain %s!\n", *(++argv)); + printf("Debug print: Delete eaps domain %s!\n", *(++argv)); exit(error); } @@ -179,6 +179,13 @@ errx(EX_USAGE, "usage: eaps command [args]"); } +static void +eaps_status(int s) +{ + printf("Debug print: -------.\n"); + return; +} + int keyword(const char *cp) { @@ -187,4 +194,16 @@ while (kt->kt_cp != NULL && strcmp(kt->kt_cp, cp) != 0) kt++; return (kt->kt_i); +} + +static struct afswtch af_eaps = { + .af_name = "af_eaps", + .af_af = AF_UNSPEC, + .af_other_status = eaps_status, +}; + +static __constructor void +eaps_ctor(void) +{ + af_register(&af_eaps); } \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon Aug 15 02:31:56 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAC23BBA19B for ; Mon, 15 Aug 2016 02:31:56 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE08C1384 for ; Mon, 15 Aug 2016 02:31:56 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F2Vulw071337 for ; Mon, 15 Aug 2016 02:31:56 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F2VuXa071029 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 02:31:56 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 02:31:56 GMT Message-Id: <201608150231.u7F2VuXa071029@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307601 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 02:31:56 -0000 Author: yuanxunzhang Date: Mon Aug 15 02:31:55 2016 New Revision: 307601 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307601 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun Aug 14 23:38:50 2016 (r307600) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 02:31:55 2016 (r307601) @@ -49,7 +49,7 @@ #include #include #include - +#include "eaps.h" /* * EAPS Command Line Module - configure, and display eaps */ @@ -186,6 +186,13 @@ return; } +void +af_register(struct afswtch *p) +{ + p->af_next = afs; + afs = p; +} + int keyword(const char *cp) { From owner-svn-soc-all@freebsd.org Mon Aug 15 02:32:52 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCF6DBBA1BF for ; Mon, 15 Aug 2016 02:32:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3973152D for ; Mon, 15 Aug 2016 02:32:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F2WqBq091080 for ; Mon, 15 Aug 2016 02:32:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F2Wqi7090805 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 02:32:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 02:32:52 GMT Message-Id: <201608150232.u7F2Wqi7090805@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307602 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 02:32:52 -0000 Author: yuanxunzhang Date: Mon Aug 15 02:32:51 2016 New Revision: 307602 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307602 Log: EAPS: add header file Added: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Added: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 02:32:51 2016 (r307602) @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Yuanxun Zhang. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the FreeBSD Project + * by Peter Wemm. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * so there! + * + * $FreeBSD$ + */ + +#define __constructor __attribute__((constructor)) + +struct afswtch; + +struct afswtch { + const char *af_name; /* as given on cmd line, e.g. "inet" */ + short af_af; /* AF_* */ + /* + * Status is handled one of two ways; if there is an + * address associated with the interface then the + * associated address family af_status method is invoked + * with the appropriate addressin info. Otherwise, if + * all possible info is to be displayed and af_other_status + * is defined then it is invoked after all address status + * is presented. + */ + void (*af_status)(int, const struct ifaddrs *); + void (*af_other_status)(int); + struct afswtch *af_next; +}; + +void af_register(struct afswtch *); \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon Aug 15 02:40:02 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6CF5BBA244 for ; Mon, 15 Aug 2016 02:40:02 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D983C15F9 for ; Mon, 15 Aug 2016 02:40:02 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F2e2ke060512 for ; Mon, 15 Aug 2016 02:40:02 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F2e2xO060110 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 02:40:02 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 02:40:02 GMT Message-Id: <201608150240.u7F2e2xO060110@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307603 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 02:40:03 -0000 Author: yuanxunzhang Date: Mon Aug 15 02:40:01 2016 New Revision: 307603 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307603 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 02:32:51 2016 (r307602) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 02:40:01 2016 (r307603) @@ -186,6 +186,8 @@ return; } +static struct afswtch *afs = NULL; + void af_register(struct afswtch *p) { From owner-svn-soc-all@freebsd.org Mon Aug 15 02:41:27 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 753C5BBA25E for ; Mon, 15 Aug 2016 02:41:27 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6878616A3 for ; Mon, 15 Aug 2016 02:41:27 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F2fRrM098653 for ; Mon, 15 Aug 2016 02:41:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F2fQ3n098219 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 02:41:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 02:41:26 GMT Message-Id: <201608150241.u7F2fQ3n098219@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307604 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 02:41:27 -0000 Author: yuanxunzhang Date: Mon Aug 15 02:41:26 2016 New Revision: 307604 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307604 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 02:40:01 2016 (r307603) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 02:41:26 2016 (r307604) @@ -37,6 +37,7 @@ #define __constructor __attribute__((constructor)) struct afswtch; +struct ifaddrs; struct afswtch { const char *af_name; /* as given on cmd line, e.g. "inet" */ @@ -52,7 +53,6 @@ */ void (*af_status)(int, const struct ifaddrs *); void (*af_other_status)(int); - struct afswtch *af_next; }; void af_register(struct afswtch *); \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon Aug 15 02:42:17 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47B70BBA335 for ; Mon, 15 Aug 2016 02:42:17 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B3E01809 for ; Mon, 15 Aug 2016 02:42:17 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F2gH2F022707 for ; Mon, 15 Aug 2016 02:42:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F2gGGg022355 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 02:42:16 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 02:42:16 GMT Message-Id: <201608150242.u7F2gGGg022355@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307605 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 02:42:17 -0000 Author: yuanxunzhang Date: Mon Aug 15 02:42:16 2016 New Revision: 307605 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307605 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 02:41:26 2016 (r307604) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 02:42:16 2016 (r307605) @@ -53,6 +53,7 @@ */ void (*af_status)(int, const struct ifaddrs *); void (*af_other_status)(int); + struct afswtch *af_next; }; void af_register(struct afswtch *); \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon Aug 15 03:39:01 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 812A8BBAD0C for ; Mon, 15 Aug 2016 03:39:01 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65BE41195 for ; Mon, 15 Aug 2016 03:39:01 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F3d18u016965 for ; Mon, 15 Aug 2016 03:39:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F3d0DO016345 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 03:39:00 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 03:39:00 GMT Message-Id: <201608150339.u7F3d0DO016345@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307606 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 03:39:01 -0000 Author: yuanxunzhang Date: Mon Aug 15 03:38:59 2016 New Revision: 307606 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307606 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 02:42:16 2016 (r307605) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 03:38:59 2016 (r307606) @@ -67,7 +67,7 @@ int keyword(const char *); static void create_domain(int, char **, int); static void delete_domain(int, char **, int); -static void display(int, char **); +static void display(int, char **, int); static void usage(const char *); void load_module(const char *); @@ -91,7 +91,7 @@ delete_domain(argc, argv, s); case K_DISPLAY: - display(argc, argv); + eaps_status(argc, argv, s); } usage(*argv); return retval; @@ -164,11 +164,10 @@ } static void -display(int argc, char **argv) +eaps_status(int argc, char **argv) { - int error = 0; - - exit(error); + printf("Debug print: -------.\n"); + return; } static void @@ -179,22 +178,6 @@ errx(EX_USAGE, "usage: eaps command [args]"); } -static void -eaps_status(int s) -{ - printf("Debug print: -------.\n"); - return; -} - -static struct afswtch *afs = NULL; - -void -af_register(struct afswtch *p) -{ - p->af_next = afs; - afs = p; -} - int keyword(const char *cp) { @@ -203,16 +186,4 @@ while (kt->kt_cp != NULL && strcmp(kt->kt_cp, cp) != 0) kt++; return (kt->kt_i); -} - -static struct afswtch af_eaps = { - .af_name = "af_eaps", - .af_af = AF_UNSPEC, - .af_other_status = eaps_status, -}; - -static __constructor void -eaps_ctor(void) -{ - af_register(&af_eaps); } \ No newline at end of file Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 02:42:16 2016 (r307605) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 15 03:38:59 2016 (r307606) @@ -33,27 +33,3 @@ * * $FreeBSD$ */ - -#define __constructor __attribute__((constructor)) - -struct afswtch; -struct ifaddrs; - -struct afswtch { - const char *af_name; /* as given on cmd line, e.g. "inet" */ - short af_af; /* AF_* */ - /* - * Status is handled one of two ways; if there is an - * address associated with the interface then the - * associated address family af_status method is invoked - * with the appropriate addressin info. Otherwise, if - * all possible info is to be displayed and af_other_status - * is defined then it is invoked after all address status - * is presented. - */ - void (*af_status)(int, const struct ifaddrs *); - void (*af_other_status)(int); - struct afswtch *af_next; -}; - -void af_register(struct afswtch *); \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon Aug 15 03:39:42 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B85D7BBAD2D for ; Mon, 15 Aug 2016 03:39:42 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB9CE11BD for ; Mon, 15 Aug 2016 03:39:42 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F3dgra033435 for ; Mon, 15 Aug 2016 03:39:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F3dgog033157 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 03:39:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 03:39:42 GMT Message-Id: <201608150339.u7F3dgog033157@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307607 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 03:39:42 -0000 Author: yuanxunzhang Date: Mon Aug 15 03:39:41 2016 New Revision: 307607 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307607 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 03:38:59 2016 (r307606) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 03:39:41 2016 (r307607) @@ -164,7 +164,7 @@ } static void -eaps_status(int argc, char **argv) +eaps_status(int argc, char **argv, int s) { printf("Debug print: -------.\n"); return; From owner-svn-soc-all@freebsd.org Mon Aug 15 03:40:52 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39EFCBBAD6F for ; Mon, 15 Aug 2016 03:40:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D3921213 for ; Mon, 15 Aug 2016 03:40:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F3eqwU060271 for ; Mon, 15 Aug 2016 03:40:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7F3epeM060049 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 03:40:51 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 03:40:51 GMT Message-Id: <201608150340.u7F3epeM060049@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307608 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 03:40:52 -0000 Author: yuanxunzhang Date: Mon Aug 15 03:40:51 2016 New Revision: 307608 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307608 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 03:39:41 2016 (r307607) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 03:40:51 2016 (r307608) @@ -67,7 +67,7 @@ int keyword(const char *); static void create_domain(int, char **, int); static void delete_domain(int, char **, int); -static void display(int, char **, int); +static void eaps_status(int, char **, int); static void usage(const char *); void load_module(const char *); From owner-svn-soc-all@freebsd.org Mon Aug 15 15:47:53 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C2D2BBAB40 for ; Mon, 15 Aug 2016 15:47:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06EC81313 for ; Mon, 15 Aug 2016 15:47:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7FFlq9Z093095 for ; Mon, 15 Aug 2016 15:47:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7FFlpVU093076 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 15:47:51 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 15:47:51 GMT Message-Id: <201608151547.u7FFlpVU093076@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307665 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 15:47:53 -0000 Author: yuanxunzhang Date: Mon Aug 15 15:47:50 2016 New Revision: 307665 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307665 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 15 14:58:25 2016 (r307664) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 15 15:47:50 2016 (r307665) @@ -198,7 +198,7 @@ int error = 0; switch (cmd) { - + break; default: error = ether_ioctl(ifp, cmd, data); Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 15 14:58:25 2016 (r307664) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 15 15:47:50 2016 (r307665) @@ -44,6 +44,15 @@ u_char sc_defaddr[6]; /* Default MAC address */ }; +/* eaps ring information */ +struct eaps_reqall { + char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ + uint8_t eaps_state; /* state of eaps * / + uint8_t enable_state; /* enable or disable eaps ring */ +}; + +#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) + /* * Extreme Active Protection System (EAPS) definitions. * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 14:58:25 2016 (r307664) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 15:47:50 2016 (r307665) @@ -166,8 +166,15 @@ static void eaps_status(int argc, char **argv, int s) { - printf("Debug print: -------.\n"); - return; + int error = 0; + + // check eaps domain name + if (domain_name == NULL) { + err(1, "EAPS domain name is NULL!"); + } + + + exit(error); } static void From owner-svn-soc-all@freebsd.org Mon Aug 15 19:20:22 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B205BBAD72 for ; Mon, 15 Aug 2016 19:20:22 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E15816A8 for ; Mon, 15 Aug 2016 19:20:22 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7FJKMlj071003 for ; Mon, 15 Aug 2016 19:20:22 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7FJKKQ8070966 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 19:20:20 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 19:20:20 GMT Message-Id: <201608151920.u7FJKKQ8070966@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307678 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 19:20:22 -0000 Author: yuanxunzhang Date: Mon Aug 15 19:20:20 2016 New Revision: 307678 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307678 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 15 18:55:33 2016 (r307677) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 15 19:20:20 2016 (r307678) @@ -198,7 +198,8 @@ int error = 0; switch (cmd) { - + case SIOCSEAPSDOMAIN: + printf("Debug print: Delete eaps domain!\n"); break; default: error = ether_ioctl(ifp, cmd, data); Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 15 18:55:33 2016 (r307677) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 15 19:20:20 2016 (r307678) @@ -44,10 +44,12 @@ u_char sc_defaddr[6]; /* Default MAC address */ }; -/* eaps ring information */ +/* +* eaps ring information +*/ struct eaps_reqall { char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ - uint8_t eaps_state; /* state of eaps * / + uint8_t eaps_state; /* state of eaps */ uint8_t enable_state; /* enable or disable eaps ring */ }; Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 18:55:33 2016 (r307677) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 19:20:20 2016 (r307678) @@ -67,7 +67,7 @@ int keyword(const char *); static void create_domain(int, char **, int); static void delete_domain(int, char **, int); -static void eaps_status(int, char **, int); +static void show_eaps_status(int, char **, int); static void usage(const char *); void load_module(const char *); @@ -86,12 +86,13 @@ switch (keyword(*argv)) { case K_CREATE: create_domain(argc, argv, s); - + break; case K_DELETE: delete_domain(argc, argv, s); - + break; case K_DISPLAY: - eaps_status(argc, argv, s); + show_eaps_status(argc, argv, s); + break; } usage(*argv); return retval; @@ -164,17 +165,21 @@ } static void -eaps_status(int argc, char **argv, int s) +show_eaps_status(int argc, char **argv, int s) { - int error = 0; - + struct eaps_reqall er; + bzero(&ro, sizeof(ro)); + + char *domain_name = *(++argv); + // check eaps domain name if (domain_name == NULL) { err(1, "EAPS domain name is NULL!"); } - - exit(error); + strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); + if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) + err(1, "SIOCSEAPSDOMAIN"); } static void Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Mon Aug 15 18:55:33 2016 (r307677) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Mon Aug 15 19:20:20 2016 (r307678) @@ -3,4 +3,4 @@ create delete -display +show From owner-svn-soc-all@freebsd.org Mon Aug 15 19:27:57 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEA89BBAF9F for ; Mon, 15 Aug 2016 19:27:57 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1D2B1BAF for ; Mon, 15 Aug 2016 19:27:57 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7FJRvps087580 for ; Mon, 15 Aug 2016 19:27:57 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7FJRv9v087545 for svn-soc-all@FreeBSD.org; Mon, 15 Aug 2016 19:27:57 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 15 Aug 2016 19:27:57 GMT Message-Id: <201608151927.u7FJRv9v087545@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307679 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 19:27:57 -0000 Author: yuanxunzhang Date: Mon Aug 15 19:27:56 2016 New Revision: 307679 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307679 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 19:20:20 2016 (r307678) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 15 19:27:56 2016 (r307679) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,7 @@ case K_DELETE: delete_domain(argc, argv, s); break; - case K_DISPLAY: + case K_SHOW: show_eaps_status(argc, argv, s); break; } @@ -168,7 +169,7 @@ show_eaps_status(int argc, char **argv, int s) { struct eaps_reqall er; - bzero(&ro, sizeof(ro)); + bzero(&er, sizeof(er)); char *domain_name = *(++argv); From owner-svn-soc-all@freebsd.org Tue Aug 16 03:14:14 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEB83BBAFAA for ; Tue, 16 Aug 2016 03:14:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1C571D9C for ; Tue, 16 Aug 2016 03:14:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G3EEsn033456 for ; Tue, 16 Aug 2016 03:14:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G3EEtu032530 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 03:14:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 03:14:14 GMT Message-Id: <201608160314.u7G3EEtu032530@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307707 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 03:14:14 -0000 Author: yuanxunzhang Date: Tue Aug 16 03:14:13 2016 New Revision: 307707 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307707 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 02:34:25 2016 (r307706) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 03:14:13 2016 (r307707) @@ -50,7 +50,7 @@ #include #include #include -#include "eaps.h" +// #include "eaps.h" /* * EAPS Command Line Module - configure, and display eaps */ From owner-svn-soc-all@freebsd.org Tue Aug 16 03:32:48 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF1E7BBB2EC for ; Tue, 16 Aug 2016 03:32:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E256714A6 for ; Tue, 16 Aug 2016 03:32:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G3WmG2071441 for ; Tue, 16 Aug 2016 03:32:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G3WmRd071001 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 03:32:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 03:32:48 GMT Message-Id: <201608160332.u7G3WmRd071001@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307708 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 03:32:49 -0000 Author: yuanxunzhang Date: Tue Aug 16 03:32:47 2016 New Revision: 307708 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307708 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 03:14:13 2016 (r307707) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 03:32:47 2016 (r307708) @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -50,7 +50,7 @@ #include #include #include -// #include "eaps.h" +#include "eaps.h" /* * EAPS Command Line Module - configure, and display eaps */ @@ -168,19 +168,19 @@ static void show_eaps_status(int argc, char **argv, int s) { - struct eaps_reqall er; - bzero(&er, sizeof(er)); + // struct eaps_reqall er; + // bzero(&er, sizeof(er)); - char *domain_name = *(++argv); - - // check eaps domain name - if (domain_name == NULL) { - err(1, "EAPS domain name is NULL!"); - } + // char *domain_name = *(++argv); - strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); - if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) - err(1, "SIOCSEAPSDOMAIN"); + // // check eaps domain name + // if (domain_name == NULL) { + // err(1, "EAPS domain name is NULL!"); + // } + + // strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); + // if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) + // err(1, "SIOCSEAPSDOMAIN"); } static void From owner-svn-soc-all@freebsd.org Tue Aug 16 03:44:10 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AC7EBBB60E for ; Tue, 16 Aug 2016 03:44:10 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F21B419D1 for ; Tue, 16 Aug 2016 03:44:09 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G3i91D038122 for ; Tue, 16 Aug 2016 03:44:09 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G3i9Y3037706 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 03:44:09 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 03:44:09 GMT Message-Id: <201608160344.u7G3i9Y3037706@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307709 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 03:44:10 -0000 Author: yuanxunzhang Date: Tue Aug 16 03:44:08 2016 New Revision: 307709 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307709 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 03:32:47 2016 (r307708) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 03:44:08 2016 (r307709) @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -168,19 +168,19 @@ static void show_eaps_status(int argc, char **argv, int s) { - // struct eaps_reqall er; - // bzero(&er, sizeof(er)); + struct eaps_reqall er; + bzero(&er, sizeof(er)); - // char *domain_name = *(++argv); + char *domain_name = *(++argv); + + // check eaps domain name + if (domain_name == NULL) { + err(1, "EAPS domain name is NULL!"); + } - // // check eaps domain name - // if (domain_name == NULL) { - // err(1, "EAPS domain name is NULL!"); - // } - - // strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); - // if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) - // err(1, "SIOCSEAPSDOMAIN"); + strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); + if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) + err(1, "SIOCSEAPSDOMAIN"); } static void From owner-svn-soc-all@freebsd.org Tue Aug 16 06:50:33 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEDE3BBBEBA for ; Tue, 16 Aug 2016 06:50:33 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E22141DBC for ; Tue, 16 Aug 2016 06:50:33 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G6oXG7067645 for ; Tue, 16 Aug 2016 06:50:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G6oX4I067587 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 06:50:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 06:50:33 GMT Message-Id: <201608160650.u7G6oX4I067587@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307710 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 06:50:34 -0000 Author: yuanxunzhang Date: Tue Aug 16 06:50:32 2016 New Revision: 307710 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307710 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 03:44:08 2016 (r307709) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 06:50:32 2016 (r307710) @@ -36,8 +36,8 @@ #include #include #include -#include #include +#include #include #include #include From owner-svn-soc-all@freebsd.org Tue Aug 16 07:07:34 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70A96BBB486 for ; Tue, 16 Aug 2016 07:07:34 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63E4916F1 for ; Tue, 16 Aug 2016 07:07:34 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G77Y3i051977 for ; Tue, 16 Aug 2016 07:07:34 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G77XqA051941 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 07:07:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 07:07:33 GMT Message-Id: <201608160707.u7G77XqA051941@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307712 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 07:07:34 -0000 Author: yuanxunzhang Date: Tue Aug 16 07:07:33 2016 New Revision: 307712 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307712 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Tue Aug 16 06:40:27 2016 (r307711) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Tue Aug 16 07:07:33 2016 (r307712) @@ -28,8 +28,8 @@ * $FreeBSD$ */ -#ifndef _NET_EAPS_H_ -#define _NET_EAPS_H_ +#ifndef _NET_EAPS_H +#define _NET_EAPS_H #ifdef _KERNEL @@ -163,4 +163,4 @@ #endif /* _KERNEL */ -#endif /* _NET_EAPS_H_ */ +#endif /* _NET_EAPS_H */ From owner-svn-soc-all@freebsd.org Tue Aug 16 08:42:31 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9BBFBBA088 for ; Tue, 16 Aug 2016 08:42:31 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B58B41377 for ; Tue, 16 Aug 2016 08:42:31 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G8gVhU087809 for ; Tue, 16 Aug 2016 08:42:31 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G8gT6M087747 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 08:42:29 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 08:42:29 GMT Message-Id: <201608160842.u7G8gT6M087747@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307718 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 08:42:31 -0000 Author: yuanxunzhang Date: Tue Aug 16 08:42:29 2016 New Revision: 307718 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307718 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/if.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 16 07:51:05 2016 (r307717) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 16 08:42:29 2016 (r307718) @@ -59,7 +59,7 @@ #include #include -#include +#include /* * EAPS Protocol Module Modified: soc2016/yuanxunzhang/head/sys/net/if.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if.h Tue Aug 16 07:51:05 2016 (r307717) +++ soc2016/yuanxunzhang/head/sys/net/if.h Tue Aug 16 08:42:29 2016 (r307718) @@ -545,4 +545,138 @@ unsigned int if_nametoindex(const char *); __END_DECLS #endif + + +#ifndef _KERNEL + +/* !!!!!!!!!Temporarily move eaps header file content to here!!!!!!!!!!! */ + +/* + * Software state for each EAPS Domain + */ +struct eaps_softc { + struct ifnet *sc_ifp; /* make this an interface */ + struct rmlock sc_mtx; + LIST_ENTRY(eaps_softc) sc_list; + u_char sc_defaddr[6]; /* Default MAC address */ +}; + +/* +* eaps ring information +*/ +struct eaps_reqall { + char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ + uint8_t eaps_state; /* state of eaps */ + uint8_t enable_state; /* enable or disable eaps ring */ +}; + +#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) + +/* + * Extreme Active Protection System (EAPS) definitions. + * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] + */ + +/* TODO: */ +/* EDP/EAPS packets are SNAP encapsulated on Ethernet. */ +/* dsap/ssap are LLV_SNAP_LSAP, llc_control is LLC_UI, oui is EXTREME_OUI, PID is EDP.*/ + +/* + * Extreme Networks proprietary MAC addresses. + */ +#define EXTREME_OUI_INIT { 0x00, 0xE0, 0x2B } +#define EDP_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x00 } +#define EAPS_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x04 } + +/* +const uint8_t eaps_etheraddr[] = EAPS_ETHERADDR_INIT; +const uint8_t edp_etheraddr[] = EDP_ETHERADDR_INIT; +*/ + +/* + * Extreme Discovery Protocol (EDP) header. + */ +struct edp_hdr { + uint8_t edp_version; /* EDP_VERSION_1 */ + uint8_t edp_reserved00; /* must be zero */ + uint16_t edp_len; /* Payload length including edp_hdr */ + uint16_t edp_cksum; /* RFC 1071-like */ + uint16_t edp_seq; /* simple monotonic */ + uint16_t edp_devid; /* 0 for MAC address */ + struct ether_addr edp_dev_mac; /* 48 bits */ + /* followed by 0..N TLVs. */ +} __packed; +#define EDP_VERSION_1 0x01 + +/* + * EDP Tag-Length-Value (TLV) header. + * Minimum length: 32 bits (length: 0x0004). + */ +struct edp_tlv_hdr { + uint8_t etv_marker; /* always set to EDP_MARKER 0x99 */ + uint8_t etv_tag; /* Tag: see below. */ + uint16_t etv_len; /* network-endian; includes this header */ + /* followed by [0..etv_len] octets */ +} __packed; + +#define EDP_MARKER 0x99 /* etv_marker constant */ +#define EDP_TAG_NULL 0x00 /* No-op, length must be 0x04. */ +#define EDP_TAG_ESRP 0x08 /* Extreme Standby Router Protocol (undocumented) */ +#define EDP_TAG_EAPS 0x0B /* RFC 3619 Extreme Active Protection System */ + +/* + * EAPS TLV payload. + */ +struct eaps_pdu { + uint8_t eaps_version; /* Always EAPS_VERSION_1 (for now) */ + uint8_t eaps_type; /* PDU type */ + uint16_t eaps_cvlan; /* Control VLAN Tag ID */ + uint32_t eaps_rsvd0; /* Reserved; set to zero */ + struct ether_addr eaps_origin; /* Originating MAC address */ + uint16_t eaps_hello; /* HELLO interval (hardcoded) */ + uint16_t eaps_fail; /* FAIL interval (set by master) */ + uint8_t eaps_state; /* EAPS_S_xxx; see below */ + uint8_t eaps_rsvd1; /* Reserved; set to zero */ + uint16_t eaps_seq; /* Health PDU sequence number */ + uint16_t eaps_rsvd2[38]; /* Reserved; set to zero */ +} __packed; + + +#define EAPS_VERSION_1 0x01 /* EAPSv1; may support v2 in future */ +#define EAPS_HELLO_INTERVAL 0x04 /* hardcoded value of eaps_hello */ + +/* + * EAPS PDU Types + */ +#define EAPS_P_HEALTH 0x05 /* Polling for ring health */ +#define EAPS_P_RING_UP 0x06 /* Master indicates link is up */ +#define EAPS_P_RING_DOWN 0x07 /* Master indicates link is down */ +#define EAPS_P_LINK_DOWN 0x08 /* Peer indicates link is down */ +#define EAPS_P_FLUSH 0x0D /* Topology change: flush FDB for domain */ +#define EAPS_P_LINK_QUERY 0x0F /* Link status query from peer */ +#define EAPS_P_LINK_UP 0x10 /* Peer indicates link is up */ + +/* + * EAPS ring node states + */ +#define EAPS_S_IDLE 0x00 /* EAPS Domain (Master/Transit) not running */ +#define EAPS_S_COMPLETE 0x01 /* Master node in COMPLETE state */ +#define EAPS_S_FAILED 0x02 /* Master node in FAILED state */ +#define EAPS_S_LINKS_UP 0x03 /* Transit UP: Pri & Sec ring ports are up */ +#define EAPS_S_LINK_DOWN 0x04 /* Transit DOWN: Pri and/or Sec ports down */ +#define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ +#define EAPS_S_INIT 0x06 /* Master node in INIT state */ + + +#define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") +#define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) +#define EAPS_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p)) +#define EAPS_WLOCK(_sc) rm_wlock(&(_sc)->sc_mtx) +#define EAPS_RUNLOCK(_sc, _p) rm_runlock(&(_sc)->sc_mtx, (_p)) +#define EAPS_WUNLOCK(_sc) rm_wunlock(&(_sc)->sc_mtx) +#define EAPS_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) +#define EAPS_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) +#define EAPS_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) + +#endif #endif /* !_NET_IF_H_ */ Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 07:51:05 2016 (r307717) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 08:42:29 2016 (r307718) @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include From owner-svn-soc-all@freebsd.org Tue Aug 16 09:01:14 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98544BBA9BA for ; Tue, 16 Aug 2016 09:01:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B36A1C8E for ; Tue, 16 Aug 2016 09:01:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G91EXD054518 for ; Tue, 16 Aug 2016 09:01:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G91DYe053214 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 09:01:13 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 09:01:13 GMT Message-Id: <201608160901.u7G91DYe053214@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307723 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 09:01:14 -0000 Author: yuanxunzhang Date: Tue Aug 16 09:01:12 2016 New Revision: 307723 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307723 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/if.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 16 08:48:41 2016 (r307722) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 16 09:01:12 2016 (r307723) @@ -59,7 +59,7 @@ #include #include -#include +#include /* * EAPS Protocol Module Modified: soc2016/yuanxunzhang/head/sys/net/if.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if.h Tue Aug 16 08:48:41 2016 (r307722) +++ soc2016/yuanxunzhang/head/sys/net/if.h Tue Aug 16 09:01:12 2016 (r307723) @@ -546,137 +546,4 @@ __END_DECLS #endif - -#ifndef _KERNEL - -/* !!!!!!!!!Temporarily move eaps header file content to here!!!!!!!!!!! */ - -/* - * Software state for each EAPS Domain - */ -struct eaps_softc { - struct ifnet *sc_ifp; /* make this an interface */ - struct rmlock sc_mtx; - LIST_ENTRY(eaps_softc) sc_list; - u_char sc_defaddr[6]; /* Default MAC address */ -}; - -/* -* eaps ring information -*/ -struct eaps_reqall { - char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ - uint8_t eaps_state; /* state of eaps */ - uint8_t enable_state; /* enable or disable eaps ring */ -}; - -#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) - -/* - * Extreme Active Protection System (EAPS) definitions. - * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] - */ - -/* TODO: */ -/* EDP/EAPS packets are SNAP encapsulated on Ethernet. */ -/* dsap/ssap are LLV_SNAP_LSAP, llc_control is LLC_UI, oui is EXTREME_OUI, PID is EDP.*/ - -/* - * Extreme Networks proprietary MAC addresses. - */ -#define EXTREME_OUI_INIT { 0x00, 0xE0, 0x2B } -#define EDP_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x00 } -#define EAPS_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x04 } - -/* -const uint8_t eaps_etheraddr[] = EAPS_ETHERADDR_INIT; -const uint8_t edp_etheraddr[] = EDP_ETHERADDR_INIT; -*/ - -/* - * Extreme Discovery Protocol (EDP) header. - */ -struct edp_hdr { - uint8_t edp_version; /* EDP_VERSION_1 */ - uint8_t edp_reserved00; /* must be zero */ - uint16_t edp_len; /* Payload length including edp_hdr */ - uint16_t edp_cksum; /* RFC 1071-like */ - uint16_t edp_seq; /* simple monotonic */ - uint16_t edp_devid; /* 0 for MAC address */ - struct ether_addr edp_dev_mac; /* 48 bits */ - /* followed by 0..N TLVs. */ -} __packed; -#define EDP_VERSION_1 0x01 - -/* - * EDP Tag-Length-Value (TLV) header. - * Minimum length: 32 bits (length: 0x0004). - */ -struct edp_tlv_hdr { - uint8_t etv_marker; /* always set to EDP_MARKER 0x99 */ - uint8_t etv_tag; /* Tag: see below. */ - uint16_t etv_len; /* network-endian; includes this header */ - /* followed by [0..etv_len] octets */ -} __packed; - -#define EDP_MARKER 0x99 /* etv_marker constant */ -#define EDP_TAG_NULL 0x00 /* No-op, length must be 0x04. */ -#define EDP_TAG_ESRP 0x08 /* Extreme Standby Router Protocol (undocumented) */ -#define EDP_TAG_EAPS 0x0B /* RFC 3619 Extreme Active Protection System */ - -/* - * EAPS TLV payload. - */ -struct eaps_pdu { - uint8_t eaps_version; /* Always EAPS_VERSION_1 (for now) */ - uint8_t eaps_type; /* PDU type */ - uint16_t eaps_cvlan; /* Control VLAN Tag ID */ - uint32_t eaps_rsvd0; /* Reserved; set to zero */ - struct ether_addr eaps_origin; /* Originating MAC address */ - uint16_t eaps_hello; /* HELLO interval (hardcoded) */ - uint16_t eaps_fail; /* FAIL interval (set by master) */ - uint8_t eaps_state; /* EAPS_S_xxx; see below */ - uint8_t eaps_rsvd1; /* Reserved; set to zero */ - uint16_t eaps_seq; /* Health PDU sequence number */ - uint16_t eaps_rsvd2[38]; /* Reserved; set to zero */ -} __packed; - - -#define EAPS_VERSION_1 0x01 /* EAPSv1; may support v2 in future */ -#define EAPS_HELLO_INTERVAL 0x04 /* hardcoded value of eaps_hello */ - -/* - * EAPS PDU Types - */ -#define EAPS_P_HEALTH 0x05 /* Polling for ring health */ -#define EAPS_P_RING_UP 0x06 /* Master indicates link is up */ -#define EAPS_P_RING_DOWN 0x07 /* Master indicates link is down */ -#define EAPS_P_LINK_DOWN 0x08 /* Peer indicates link is down */ -#define EAPS_P_FLUSH 0x0D /* Topology change: flush FDB for domain */ -#define EAPS_P_LINK_QUERY 0x0F /* Link status query from peer */ -#define EAPS_P_LINK_UP 0x10 /* Peer indicates link is up */ - -/* - * EAPS ring node states - */ -#define EAPS_S_IDLE 0x00 /* EAPS Domain (Master/Transit) not running */ -#define EAPS_S_COMPLETE 0x01 /* Master node in COMPLETE state */ -#define EAPS_S_FAILED 0x02 /* Master node in FAILED state */ -#define EAPS_S_LINKS_UP 0x03 /* Transit UP: Pri & Sec ring ports are up */ -#define EAPS_S_LINK_DOWN 0x04 /* Transit DOWN: Pri and/or Sec ports down */ -#define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ -#define EAPS_S_INIT 0x06 /* Master node in INIT state */ - - -#define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") -#define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) -#define EAPS_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p)) -#define EAPS_WLOCK(_sc) rm_wlock(&(_sc)->sc_mtx) -#define EAPS_RUNLOCK(_sc, _p) rm_runlock(&(_sc)->sc_mtx, (_p)) -#define EAPS_WUNLOCK(_sc) rm_wunlock(&(_sc)->sc_mtx) -#define EAPS_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) -#define EAPS_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) -#define EAPS_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) - -#endif #endif /* !_NET_IF_H_ */ Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 08:48:41 2016 (r307722) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 09:01:12 2016 (r307723) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include From owner-svn-soc-all@freebsd.org Tue Aug 16 09:28:11 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2CB7BBB471 for ; Tue, 16 Aug 2016 09:28:11 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96444127A for ; Tue, 16 Aug 2016 09:28:11 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G9SBG6004402 for ; Tue, 16 Aug 2016 09:28:11 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7G9SAkg004317 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 09:28:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 09:28:10 GMT Message-Id: <201608160928.u7G9SAkg004317@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307724 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 09:28:11 -0000 Author: yuanxunzhang Date: Tue Aug 16 09:28:10 2016 New Revision: 307724 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307724 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Tue Aug 16 09:01:12 2016 (r307723) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Tue Aug 16 09:28:10 2016 (r307724) @@ -32,8 +32,6 @@ #define _NET_EAPS_H -#ifdef _KERNEL - /* * Software state for each EAPS Domain */ @@ -160,7 +158,5 @@ #define EAPS_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) #define EAPS_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) #define EAPS_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) - -#endif /* _KERNEL */ #endif /* _NET_EAPS_H */ From owner-svn-soc-all@freebsd.org Tue Aug 16 10:02:07 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ADBEBBC3B9 for ; Tue, 16 Aug 2016 10:02:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16EB9183D for ; Tue, 16 Aug 2016 10:02:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GA26ls006342 for ; Tue, 16 Aug 2016 10:02:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7GA26aM006195 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 10:02:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 10:02:06 GMT Message-Id: <201608161002.u7GA26aM006195@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307729 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 10:02:07 -0000 Author: yuanxunzhang Date: Tue Aug 16 10:02:05 2016 New Revision: 307729 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307729 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 09:12:45 2016 (r307728) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 10:02:05 2016 (r307729) @@ -50,7 +50,6 @@ #include #include #include -#include "eaps.h" /* * EAPS Command Line Module - configure, and display eaps */ From owner-svn-soc-all@freebsd.org Tue Aug 16 17:54:34 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 361A7BBC426 for ; Tue, 16 Aug 2016 17:54:34 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2926B1BBC for ; Tue, 16 Aug 2016 17:54:34 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GHsY9D014169 for ; Tue, 16 Aug 2016 17:54:34 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7GHsXml014167 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 17:54:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 17:54:33 GMT Message-Id: <201608161754.u7GHsXml014167@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307743 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 17:54:34 -0000 Author: yuanxunzhang Date: Tue Aug 16 17:54:33 2016 New Revision: 307743 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307743 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 16:50:48 2016 (r307742) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 17:54:33 2016 (r307743) @@ -37,7 +37,7 @@ #include #include #include -#include +// #include #include #include #include From owner-svn-soc-all@freebsd.org Tue Aug 16 18:03:14 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE8E0BBC5FB for ; Tue, 16 Aug 2016 18:03:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D17211F0B for ; Tue, 16 Aug 2016 18:03:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GI3EE2019466 for ; Tue, 16 Aug 2016 18:03:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7GI3EVD019195 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 18:03:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 18:03:14 GMT Message-Id: <201608161803.u7GI3EVD019195@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307748 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 18:03:15 -0000 Author: yuanxunzhang Date: Tue Aug 16 18:03:13 2016 New Revision: 307748 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307748 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 17:30:58 2016 (r307747) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 18:03:13 2016 (r307748) @@ -50,6 +50,17 @@ #include #include #include + +/* +* eaps ring information +*/ +struct eaps_reqall { + char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ + uint8_t eaps_state; /* state of eaps */ + uint8_t enable_state; /* enable or disable eaps ring */ +}; + + /* * EAPS Command Line Module - configure, and display eaps */ From owner-svn-soc-all@freebsd.org Tue Aug 16 18:05:28 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC5CBBBC657 for ; Tue, 16 Aug 2016 18:05:28 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF9BE1F54 for ; Tue, 16 Aug 2016 18:05:28 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GI5SuV060096 for ; Tue, 16 Aug 2016 18:05:28 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7GI5RCo059824 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 18:05:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 18:05:27 GMT Message-Id: <201608161805.u7GI5RCo059824@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307749 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 18:05:28 -0000 Author: yuanxunzhang Date: Tue Aug 16 18:05:27 2016 New Revision: 307749 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307749 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 18:03:13 2016 (r307748) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 18:05:27 2016 (r307749) @@ -51,15 +51,6 @@ #include #include -/* -* eaps ring information -*/ -struct eaps_reqall { - char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ - uint8_t eaps_state; /* state of eaps */ - uint8_t enable_state; /* enable or disable eaps ring */ -}; - /* * EAPS Command Line Module - configure, and display eaps Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Tue Aug 16 18:03:13 2016 (r307748) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Tue Aug 16 18:05:27 2016 (r307749) @@ -33,3 +33,14 @@ * * $FreeBSD$ */ + +/* +* eaps ring information +*/ +struct eaps_reqall { + char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ + uint8_t eaps_state; /* state of eaps */ + uint8_t enable_state; /* enable or disable eaps ring */ +}; + +#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) From owner-svn-soc-all@freebsd.org Tue Aug 16 18:05:42 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EBEBBBC673 for ; Tue, 16 Aug 2016 18:05:42 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 222171F71 for ; Tue, 16 Aug 2016 18:05:42 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GI5g5H063399 for ; Tue, 16 Aug 2016 18:05:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7GI5fjx063024 for svn-soc-all@FreeBSD.org; Tue, 16 Aug 2016 18:05:41 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 16 Aug 2016 18:05:41 GMT Message-Id: <201608161805.u7GI5fjx063024@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307750 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 18:05:42 -0000 Author: yuanxunzhang Date: Tue Aug 16 18:05:40 2016 New Revision: 307750 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307750 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 18:05:27 2016 (r307749) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 18:05:40 2016 (r307750) @@ -50,6 +50,7 @@ #include #include #include +#include "eaps.h" /* From owner-svn-soc-all@freebsd.org Wed Aug 17 04:49:59 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 532E7BBCF26 for ; Wed, 17 Aug 2016 04:49:59 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 466901646 for ; Wed, 17 Aug 2016 04:49:59 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7H4nxO0010598 for ; Wed, 17 Aug 2016 04:49:59 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7H4nwbk010593 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 04:49:58 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 04:49:58 GMT Message-Id: <201608170449.u7H4nwbk010593@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307768 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 04:49:59 -0000 Author: yuanxunzhang Date: Wed Aug 17 04:49:57 2016 New Revision: 307768 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307768 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Wed Aug 17 02:40:17 2016 (r307767) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Wed Aug 17 04:49:57 2016 (r307768) @@ -199,7 +199,7 @@ switch (cmd) { case SIOCSEAPSDOMAIN: - printf("Debug print: Delete eaps domain!\n"); + printf("Debug print: Query eaps domain!\n"); break; default: error = ether_ioctl(ifp, cmd, data); @@ -239,6 +239,7 @@ static void eaps_init(void *xsc) { + printf("Debug print: eaps_init!\n"); struct eaps_softc *sc = (struct eaps_softc *)xsc; struct ifnet *ifp = sc->sc_ifp; Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Wed Aug 17 02:40:17 2016 (r307767) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Wed Aug 17 04:49:57 2016 (r307768) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Bruce Simpson. + * Copyright (c) 2015 Bruce Simpson, Yuanuxn Zhang. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-soc-all@freebsd.org Wed Aug 17 05:06:52 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8162FBBC273 for ; Wed, 17 Aug 2016 05:06:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DA051E10 for ; Wed, 17 Aug 2016 05:06:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7H56q7v086125 for ; Wed, 17 Aug 2016 05:06:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7H56pG2086123 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 05:06:51 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 05:06:51 GMT Message-Id: <201608170506.u7H56pG2086123@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307770 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 05:06:52 -0000 Author: yuanxunzhang Date: Wed Aug 17 05:06:51 2016 New Revision: 307770 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307770 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Wed Aug 17 04:41:47 2016 (r307769) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Wed Aug 17 05:06:51 2016 (r307770) @@ -183,6 +183,8 @@ strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) err(1, "SIOCSEAPSDOMAIN"); + + exit(error); } static void From owner-svn-soc-all@freebsd.org Wed Aug 17 07:27:02 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23196BBB7F5 for ; Wed, 17 Aug 2016 07:27:02 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 163D617A2 for ; Wed, 17 Aug 2016 07:27:02 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7H7R138062982 for ; Wed, 17 Aug 2016 07:27:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7H7R1lF062978 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 07:27:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 07:27:01 GMT Message-Id: <201608170727.u7H7R1lF062978@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307780 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 07:27:02 -0000 Author: yuanxunzhang Date: Wed Aug 17 07:27:00 2016 New Revision: 307780 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307780 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Wed Aug 17 06:58:43 2016 (r307779) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Wed Aug 17 07:27:00 2016 (r307780) @@ -170,6 +170,8 @@ static void show_eaps_status(int argc, char **argv, int s) { + int error = 0; + struct eaps_reqall er; bzero(&er, sizeof(er)); From owner-svn-soc-all@freebsd.org Wed Aug 17 16:01:53 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0722BBD40E for ; Wed, 17 Aug 2016 16:01:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92F361EF6 for ; Wed, 17 Aug 2016 16:01:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7HG1rVx031448 for ; Wed, 17 Aug 2016 16:01:53 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7HG1quv031075 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 16:01:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 16:01:52 GMT Message-Id: <201608171601.u7HG1quv031075@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307816 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 16:01:53 -0000 Author: yuanxunzhang Date: Wed Aug 17 16:01:51 2016 New Revision: 307816 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307816 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Wed Aug 17 15:50:56 2016 (r307815) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Wed Aug 17 16:01:51 2016 (r307816) @@ -70,6 +70,7 @@ static int eaps_transmit(struct ifnet *, struct mbuf *); static void eaps_qflush(struct ifnet *); static void eaps_init(void *); +static void eaps_domain_init(struct eaps_softc *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) @@ -231,6 +232,13 @@ { } +static void +eaps_domain_init(struct eaps_softc *sc) +{ + //set eaps domain default state + sc->sc_eaps->state = EAPS_S_IDLE; + sc->sc_eaps->active = EAPS_ACTIVE_DISABLE; +} /* * eaps_init: * Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Wed Aug 17 15:50:56 2016 (r307815) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Wed Aug 17 16:01:51 2016 (r307816) @@ -31,6 +31,14 @@ #ifndef _NET_EAPS_H #define _NET_EAPS_H +/* +* eaps state information +*/ +struct eaps_state { + char ifname[IFNAMSIZ]; /* name of the eaps */ + uint8_t state; /* state of eaps */ + uint8_t active; /* enable or disable eaps */ +}; /* * Software state for each EAPS Domain @@ -38,18 +46,12 @@ struct eaps_softc { struct ifnet *sc_ifp; /* make this an interface */ struct rmlock sc_mtx; + struct eaps_state sc_eaps; /* state of eaps */ LIST_ENTRY(eaps_softc) sc_list; u_char sc_defaddr[6]; /* Default MAC address */ }; -/* -* eaps ring information -*/ -struct eaps_reqall { - char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ - uint8_t eaps_state; /* state of eaps */ - uint8_t enable_state; /* enable or disable eaps ring */ -}; + #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) @@ -148,6 +150,11 @@ #define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ #define EAPS_S_INIT 0x06 /* Master node in INIT state */ +/* + * EAPS ring active states + */ +#define EAPS_ACTIVE_DISABLE 0x00 /* Disable the eaps domain */ +#define EAPS_ACTIVE_ENABLE 0x01 /* Enable the eaps domain */ #define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") #define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Wed Aug 17 15:50:56 2016 (r307815) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Wed Aug 17 16:01:51 2016 (r307816) @@ -35,12 +35,12 @@ */ /* -* eaps ring information +* eaps state information */ -struct eaps_reqall { - char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ - uint8_t eaps_state; /* state of eaps */ - uint8_t enable_state; /* enable or disable eaps ring */ +struct eaps_state { + char ifname[IFNAMSIZ]; /* name of the eaps */ + uint8_t state; /* state of eaps */ + uint8_t active; /* enable or disable eaps */ }; #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) From owner-svn-soc-all@freebsd.org Wed Aug 17 16:08:32 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC539BBD595 for ; Wed, 17 Aug 2016 16:08:32 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF86814C9 for ; Wed, 17 Aug 2016 16:08:32 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7HG8WRk053970 for ; Wed, 17 Aug 2016 16:08:32 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7HG8WaN053968 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 16:08:32 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 16:08:32 GMT Message-Id: <201608171608.u7HG8WaN053968@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307817 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 16:08:33 -0000 Author: yuanxunzhang Date: Wed Aug 17 16:08:31 2016 New Revision: 307817 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307817 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Wed Aug 17 16:01:51 2016 (r307816) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Wed Aug 17 16:08:31 2016 (r307817) @@ -171,9 +171,9 @@ show_eaps_status(int argc, char **argv, int s) { int error = 0; - - struct eaps_reqall er; - bzero(&er, sizeof(er)); + + struct eaps_state es; + bzero(&es, sizeof(es)); char *domain_name = *(++argv); @@ -182,8 +182,8 @@ err(1, "EAPS domain name is NULL!"); } - strlcpy(er.eaps_ifname, domain_name, sizeof(er.eaps_ifname)); - if (ioctl(s, SIOCSEAPSDOMAIN, &er) < 0) + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + if (ioctl(s, SIOCSEAPSDOMAIN, &es) < 0) err(1, "SIOCSEAPSDOMAIN"); exit(error); From owner-svn-soc-all@freebsd.org Wed Aug 17 16:11:50 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4847BBD6BB for ; Wed, 17 Aug 2016 16:11:50 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7871174B for ; Wed, 17 Aug 2016 16:11:50 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7HGBoGJ062026 for ; Wed, 17 Aug 2016 16:11:50 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7HGBnQ6061973 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 16:11:49 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 16:11:49 GMT Message-Id: <201608171611.u7HGBnQ6061973@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307818 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 16:11:50 -0000 Author: yuanxunzhang Date: Wed Aug 17 16:11:49 2016 New Revision: 307818 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307818 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Wed Aug 17 16:08:31 2016 (r307817) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Wed Aug 17 16:11:49 2016 (r307818) @@ -53,7 +53,7 @@ -#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) +#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) /* * Extreme Active Protection System (EAPS) definitions. Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Wed Aug 17 16:08:31 2016 (r307817) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Wed Aug 17 16:11:49 2016 (r307818) @@ -43,4 +43,4 @@ uint8_t active; /* enable or disable eaps */ }; -#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) +#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) From owner-svn-soc-all@freebsd.org Wed Aug 17 16:15:13 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC855BBD72F for ; Wed, 17 Aug 2016 16:15:13 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFE8A18AB for ; Wed, 17 Aug 2016 16:15:13 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7HGFDoB069699 for ; Wed, 17 Aug 2016 16:15:13 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7HGFDYL069697 for svn-soc-all@FreeBSD.org; Wed, 17 Aug 2016 16:15:13 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Wed, 17 Aug 2016 16:15:13 GMT Message-Id: <201608171615.u7HGFDYL069697@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307819 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 16:15:14 -0000 Author: yuanxunzhang Date: Wed Aug 17 16:15:12 2016 New Revision: 307819 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307819 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Wed Aug 17 16:11:49 2016 (r307818) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Wed Aug 17 16:15:12 2016 (r307819) @@ -236,8 +236,8 @@ eaps_domain_init(struct eaps_softc *sc) { //set eaps domain default state - sc->sc_eaps->state = EAPS_S_IDLE; - sc->sc_eaps->active = EAPS_ACTIVE_DISABLE; + sc->sc_eaps.state = EAPS_S_IDLE; + sc->sc_eaps.active = EAPS_ACTIVE_DISABLE; } /* * eaps_init: From owner-svn-soc-all@freebsd.org Thu Aug 18 04:12:52 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03531BBDCF9 for ; Thu, 18 Aug 2016 04:12:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E05791176 for ; Thu, 18 Aug 2016 04:12:51 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7I4CpPt050585 for ; Thu, 18 Aug 2016 04:12:51 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7I4CoPm049719 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 04:12:50 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 04:12:50 GMT Message-Id: <201608180412.u7I4CoPm049719@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307850 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 04:12:52 -0000 Author: yuanxunzhang Date: Thu Aug 18 04:12:49 2016 New Revision: 307850 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307850 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 02:14:39 2016 (r307849) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 04:12:49 2016 (r307850) @@ -70,13 +70,15 @@ static int eaps_transmit(struct ifnet *, struct mbuf *); static void eaps_qflush(struct ifnet *); static void eaps_init(void *); -static void eaps_domain_init(struct eaps_softc *); - +void eaps_attach(struct eaps_state *); +void eaps_detach(struct eaps_state *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) static const char eaps_name[] = "eaps"; +static struct mtx es_list_mtx; + SYSCTL_DECL(_net_link); static SYSCTL_NODE(_net_link, IFT_EAPS, eaps, CTLFLAG_RW, 0, "EAPS"); @@ -168,6 +170,7 @@ ifp->if_init = eaps_init; ifp->if_type = IFT_EAPS; + eaps_attach(&sc->sc_eaps); ether_ifattach(ifp, sc->sc_defaddr); EAPS_LIST_LOCK(); @@ -232,13 +235,26 @@ { } -static void -eaps_domain_init(struct eaps_softc *sc) +void +eaps_attach(struct eaps_state *es) { - //set eaps domain default state - sc->sc_eaps.state = EAPS_S_IDLE; - sc->sc_eaps.active = EAPS_ACTIVE_DISABLE; + //set eaps domain protocol state to default value + es->state = EAPS_S_IDLE; + es->active = EAPS_ACTIVE_DISABLE; + + mtx_lock(&es_list_mtx); + LIST_INSERT_HEAD(&es_list_mtx, es, es_list); + mtx_unlock(&es_list_mtx); } + +void +eaps_detach(struct eaps_state *es) +{ + mtx_lock(&es_list_mtx); + LIST_REMOVE(es, es_list); + mtx_unlock(&es_list_mtx); +} + /* * eaps_init: * Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 02:14:39 2016 (r307849) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 04:12:49 2016 (r307850) @@ -36,6 +36,8 @@ */ struct eaps_state { char ifname[IFNAMSIZ]; /* name of the eaps */ + LIST_ENTRY(eaps_state) es_list; + struct mtx bs_mtx; /* mutex signal */ uint8_t state; /* state of eaps */ uint8_t active; /* enable or disable eaps */ }; @@ -165,5 +167,11 @@ #define EAPS_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) #define EAPS_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) #define EAPS_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) - + +#define EAPS_STATE_LOCK_INIT(_bs) mtx_init(&(_bs)->bs_mtx, "eaps state", NULL, MTX_DEF) +#define EAPS_STATE_LOCK_DESTROY(_bs) mtx_destroy(&(_bs)->bs_mtx) +#define EAPS_STATE_LOCK(_bs) mtx_lock(&(_bs)->bs_mtx) +#define EAPS_STATE_UNLOCK(_bs) mtx_unlock(&(_bs)->bs_mtx) +#define EAPS_STATE_LOCK_ASSERT(_bs) mtx_assert(&(_bs)->bs_mtx, MA_OWNED) + #endif /* _NET_EAPS_H */ Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 02:14:39 2016 (r307849) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 04:12:49 2016 (r307850) @@ -39,6 +39,8 @@ */ struct eaps_state { char ifname[IFNAMSIZ]; /* name of the eaps */ + LIST_ENTRY(eaps_state) es_list; + struct mtx bs_mtx; /* mutex signal */ uint8_t state; /* state of eaps */ uint8_t active; /* enable or disable eaps */ }; From owner-svn-soc-all@freebsd.org Thu Aug 18 04:45:25 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22C2CBBC5BD for ; Thu, 18 Aug 2016 04:45:25 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 161FF1F88 for ; Thu, 18 Aug 2016 04:45:25 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7I4jOa3023663 for ; Thu, 18 Aug 2016 04:45:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7I4jOmT023660 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 04:45:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 04:45:24 GMT Message-Id: <201608180445.u7I4jOmT023660@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307851 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 04:45:25 -0000 Author: yuanxunzhang Date: Thu Aug 18 04:45:23 2016 New Revision: 307851 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307851 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 04:12:49 2016 (r307850) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 04:45:23 2016 (r307851) @@ -76,7 +76,7 @@ #define V_eaps_cloner VNET(eaps_cloner) static const char eaps_name[] = "eaps"; - +LIST_HEAD(, eaps_state) es_list_head; static struct mtx es_list_mtx; SYSCTL_DECL(_net_link); @@ -243,7 +243,7 @@ es->active = EAPS_ACTIVE_DISABLE; mtx_lock(&es_list_mtx); - LIST_INSERT_HEAD(&es_list_mtx, es, es_list); + LIST_INSERT_HEAD(&es_list_head, es, es_list); mtx_unlock(&es_list_mtx); } From owner-svn-soc-all@freebsd.org Thu Aug 18 04:48:39 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8701FBBC66A for ; Thu, 18 Aug 2016 04:48:39 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A4A01143 for ; Thu, 18 Aug 2016 04:48:39 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7I4mdYq027458 for ; Thu, 18 Aug 2016 04:48:39 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7I4mc39027456 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 04:48:38 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 04:48:38 GMT Message-Id: <201608180448.u7I4mc39027456@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307852 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 04:48:39 -0000 Author: yuanxunzhang Date: Thu Aug 18 04:48:38 2016 New Revision: 307852 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307852 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 04:45:23 2016 (r307851) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 04:48:38 2016 (r307852) @@ -34,6 +34,8 @@ * $FreeBSD$ */ +#include + /* * eaps state information */ From owner-svn-soc-all@freebsd.org Thu Aug 18 07:09:46 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4755BBDB06 for ; Thu, 18 Aug 2016 07:09:46 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA9F01BD8 for ; Thu, 18 Aug 2016 07:09:46 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7I79k4s016026 for ; Thu, 18 Aug 2016 07:09:46 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7I79kAJ016024 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 07:09:46 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 07:09:46 GMT Message-Id: <201608180709.u7I79kAJ016024@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307864 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 07:09:46 -0000 Author: yuanxunzhang Date: Thu Aug 18 07:09:45 2016 New Revision: 307864 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307864 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 06:46:14 2016 (r307863) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 07:09:45 2016 (r307864) @@ -34,8 +34,9 @@ * $FreeBSD$ */ +#include #include - + /* * eaps state information */ From owner-svn-soc-all@freebsd.org Thu Aug 18 07:25:01 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 837E7BBDFA7 for ; Thu, 18 Aug 2016 07:25:01 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76C2D14A2 for ; Thu, 18 Aug 2016 07:25:01 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7I7P12c048232 for ; Thu, 18 Aug 2016 07:25:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7I7P0mM048228 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 07:25:00 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 07:25:00 GMT Message-Id: <201608180725.u7I7P0mM048228@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307865 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 07:25:01 -0000 Author: yuanxunzhang Date: Thu Aug 18 07:25:00 2016 New Revision: 307865 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307865 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 07:09:45 2016 (r307864) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 07:25:00 2016 (r307865) @@ -33,8 +33,7 @@ * * $FreeBSD$ */ - -#include +#include #include /* From owner-svn-soc-all@freebsd.org Thu Aug 18 07:37:37 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E46FBBE2CB for ; Thu, 18 Aug 2016 07:37:37 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 817FB1CC5 for ; Thu, 18 Aug 2016 07:37:37 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7I7bbHP072608 for ; Thu, 18 Aug 2016 07:37:37 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7I7baW8072511 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 07:37:36 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 07:37:36 GMT Message-Id: <201608180737.u7I7baW8072511@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307866 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 07:37:37 -0000 Author: yuanxunzhang Date: Thu Aug 18 07:37:36 2016 New Revision: 307866 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307866 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 07:25:00 2016 (r307865) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 07:37:36 2016 (r307866) @@ -33,7 +33,9 @@ * * $FreeBSD$ */ +#include #include +#include #include /* From owner-svn-soc-all@freebsd.org Thu Aug 18 14:27:25 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3350BBEC5D for ; Thu, 18 Aug 2016 14:27:25 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9828D1DA1 for ; Thu, 18 Aug 2016 14:27:25 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IERPM0082485 for ; Thu, 18 Aug 2016 14:27:25 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IERODD082425 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 14:27:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 14:27:24 GMT Message-Id: <201608181427.u7IERODD082425@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307960 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 14:27:25 -0000 Author: yuanxunzhang Date: Thu Aug 18 14:27:22 2016 New Revision: 307960 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307960 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 12:51:26 2016 (r307959) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 14:27:22 2016 (r307960) @@ -200,10 +200,13 @@ eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { int error = 0; + struct eaps_softc *sc = (struct eaps_softc *)ifp->if_softc; + struct eaps_state *es = (struct eaps_state *)data; switch (cmd) { case SIOCSEAPSDOMAIN: - printf("Debug print: Query eaps domain!\n"); + printf("Debug print: Query eaps domain status!\n"); + eaps_status(sc, es); break; default: error = ether_ioctl(ifp, cmd, data); @@ -233,26 +236,35 @@ static void eaps_qflush(struct ifnet *ifp __unused) { + +} + +void +eaps_status(struct eaps_softc *sc, struct eaps_state *es) +{ + struct rm_priotracker tracker; + EAPS_RLOCK(sc, &tracker); + es->state = sc->sc_eaps.state; + es->active = sc->sc_eaps.active; + + printf("EAPS status: interface: %s, state: %d\n.", sc->sc_ifp->if_xname, es->state); + EAPS_RUNLOCK(sc, &tracker); } void -eaps_attach(struct eaps_state *es) +eaps_attach(struct eaps_softc *es) { //set eaps domain protocol state to default value + EAPS_WLOCK(sc); es->state = EAPS_S_IDLE; es->active = EAPS_ACTIVE_DISABLE; - - mtx_lock(&es_list_mtx); - LIST_INSERT_HEAD(&es_list_head, es, es_list); - mtx_unlock(&es_list_mtx); + EAPS_WUNLOCK(sc); } void eaps_detach(struct eaps_state *es) { - mtx_lock(&es_list_mtx); - LIST_REMOVE(es, es_list); - mtx_unlock(&es_list_mtx); + } /* Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 12:51:26 2016 (r307959) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 14:27:22 2016 (r307960) @@ -36,8 +36,6 @@ */ struct eaps_state { char ifname[IFNAMSIZ]; /* name of the eaps */ - LIST_ENTRY(eaps_state) es_list; - struct mtx bs_mtx; /* mutex signal */ uint8_t state; /* state of eaps */ uint8_t active; /* enable or disable eaps */ }; Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 12:51:26 2016 (r307959) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 14:27:22 2016 (r307960) @@ -43,8 +43,6 @@ */ struct eaps_state { char ifname[IFNAMSIZ]; /* name of the eaps */ - LIST_ENTRY(eaps_state) es_list; - struct mtx bs_mtx; /* mutex signal */ uint8_t state; /* state of eaps */ uint8_t active; /* enable or disable eaps */ }; From owner-svn-soc-all@freebsd.org Thu Aug 18 15:51:51 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59BEEBBE82C for ; Thu, 18 Aug 2016 15:51:51 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FA8D131C for ; Thu, 18 Aug 2016 15:51:51 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IFppZi088373 for ; Thu, 18 Aug 2016 15:51:51 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IFpok8088371 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 15:51:50 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 15:51:50 GMT Message-Id: <201608181551.u7IFpok8088371@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307962 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 15:51:51 -0000 Author: yuanxunzhang Date: Thu Aug 18 15:51:50 2016 New Revision: 307962 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307962 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 14:10:36 2016 (r307961) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 15:51:50 2016 (r307962) @@ -72,6 +72,8 @@ static void eaps_init(void *); void eaps_attach(struct eaps_state *); void eaps_detach(struct eaps_state *); +voide eaps_status(struct eaps_softc *, struct eaps_state *); + static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) From owner-svn-soc-all@freebsd.org Thu Aug 18 16:02:41 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97572BBEC87 for ; Thu, 18 Aug 2016 16:02:41 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AB0E18A6 for ; Thu, 18 Aug 2016 16:02:41 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IG2fVB050015 for ; Thu, 18 Aug 2016 16:02:41 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IG2e98050005 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 16:02:40 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 16:02:40 GMT Message-Id: <201608181602.u7IG2e98050005@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307963 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 16:02:41 -0000 Author: yuanxunzhang Date: Thu Aug 18 16:02:40 2016 New Revision: 307963 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307963 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 15:51:50 2016 (r307962) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:02:40 2016 (r307963) @@ -72,7 +72,7 @@ static void eaps_init(void *); void eaps_attach(struct eaps_state *); void eaps_detach(struct eaps_state *); -voide eaps_status(struct eaps_softc *, struct eaps_state *); +void eaps_status(struct eaps_softc *, struct eaps_state *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) From owner-svn-soc-all@freebsd.org Thu Aug 18 16:32:40 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E9CCBBE470 for ; Thu, 18 Aug 2016 16:32:40 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71E88188F for ; Thu, 18 Aug 2016 16:32:40 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IGWetX013387 for ; Thu, 18 Aug 2016 16:32:40 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IGWdAU013385 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 16:32:39 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 16:32:39 GMT Message-Id: <201608181632.u7IGWdAU013385@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307964 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 16:32:40 -0000 Author: yuanxunzhang Date: Thu Aug 18 16:32:39 2016 New Revision: 307964 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307964 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:02:40 2016 (r307963) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:32:39 2016 (r307964) @@ -257,10 +257,10 @@ eaps_attach(struct eaps_softc *es) { //set eaps domain protocol state to default value - EAPS_WLOCK(sc); + EAPS_WLOCK(es); es->state = EAPS_S_IDLE; es->active = EAPS_ACTIVE_DISABLE; - EAPS_WUNLOCK(sc); + EAPS_WUNLOCK(es); } void From owner-svn-soc-all@freebsd.org Thu Aug 18 16:34:34 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D413BBE495 for ; Thu, 18 Aug 2016 16:34:34 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 309ED18CC for ; Thu, 18 Aug 2016 16:34:34 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IGYYgj015805 for ; Thu, 18 Aug 2016 16:34:34 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IGYX9j015789 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 16:34:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 16:34:33 GMT Message-Id: <201608181634.u7IGYX9j015789@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307965 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 16:34:34 -0000 Author: yuanxunzhang Date: Thu Aug 18 16:34:33 2016 New Revision: 307965 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307965 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:32:39 2016 (r307964) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:34:33 2016 (r307965) @@ -254,7 +254,7 @@ } void -eaps_attach(struct eaps_softc *es) +eaps_attach(struct eaps_state *es) { //set eaps domain protocol state to default value EAPS_WLOCK(es); From owner-svn-soc-all@freebsd.org Thu Aug 18 16:39:30 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7312ABBE5A1 for ; Thu, 18 Aug 2016 16:39:30 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6646519D1 for ; Thu, 18 Aug 2016 16:39:30 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IGdUKL021841 for ; Thu, 18 Aug 2016 16:39:30 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IGdTlO021837 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 16:39:29 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 16:39:29 GMT Message-Id: <201608181639.u7IGdTlO021837@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307966 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 16:39:30 -0000 Author: yuanxunzhang Date: Thu Aug 18 16:39:29 2016 New Revision: 307966 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307966 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:34:33 2016 (r307965) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:39:29 2016 (r307966) @@ -70,8 +70,8 @@ static int eaps_transmit(struct ifnet *, struct mbuf *); static void eaps_qflush(struct ifnet *); static void eaps_init(void *); -void eaps_attach(struct eaps_state *); -void eaps_detach(struct eaps_state *); +void eaps_attach(struct eaps_softc *); +void eaps_detach(struct eaps_softc *); void eaps_status(struct eaps_softc *, struct eaps_state *); static VNET_DEFINE(struct if_clone *, eaps_cloner); @@ -172,7 +172,7 @@ ifp->if_init = eaps_init; ifp->if_type = IFT_EAPS; - eaps_attach(&sc->sc_eaps); + eaps_attach(sc); ether_ifattach(ifp, sc->sc_defaddr); EAPS_LIST_LOCK(); @@ -254,17 +254,17 @@ } void -eaps_attach(struct eaps_state *es) +eaps_attach(struct eaps_softc *sc) { //set eaps domain protocol state to default value - EAPS_WLOCK(es); - es->state = EAPS_S_IDLE; - es->active = EAPS_ACTIVE_DISABLE; - EAPS_WUNLOCK(es); + EAPS_WLOCK(sc); + sc->sc_eaps.state = EAPS_S_IDLE; + sc->sc_eaps.active = EAPS_ACTIVE_DISABLE; + EAPS_WUNLOCK(sc); } void -eaps_detach(struct eaps_state *es) +eaps_detach(struct eaps_softc *es) { } From owner-svn-soc-all@freebsd.org Thu Aug 18 16:42:24 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB97BBBE6A7 for ; Thu, 18 Aug 2016 16:42:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF08B1CA9 for ; Thu, 18 Aug 2016 16:42:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IGgOPJ033302 for ; Thu, 18 Aug 2016 16:42:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IGgOSt033293 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 16:42:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 16:42:24 GMT Message-Id: <201608181642.u7IGgOSt033293@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307967 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 16:42:25 -0000 Author: yuanxunzhang Date: Thu Aug 18 16:42:23 2016 New Revision: 307967 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307967 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:39:29 2016 (r307966) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 16:42:23 2016 (r307967) @@ -78,8 +78,6 @@ #define V_eaps_cloner VNET(eaps_cloner) static const char eaps_name[] = "eaps"; -LIST_HEAD(, eaps_state) es_list_head; -static struct mtx es_list_mtx; SYSCTL_DECL(_net_link); static SYSCTL_NODE(_net_link, IFT_EAPS, eaps, CTLFLAG_RW, 0, "EAPS"); @@ -264,7 +262,7 @@ } void -eaps_detach(struct eaps_softc *es) +eaps_detach(struct eaps_softc *sc) { } From owner-svn-soc-all@freebsd.org Thu Aug 18 17:07:07 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B360FBBEDA1 for ; Thu, 18 Aug 2016 17:07:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6B651E05 for ; Thu, 18 Aug 2016 17:07:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IH77PU019539 for ; Thu, 18 Aug 2016 17:07:07 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IH77Pt019500 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 17:07:07 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 17:07:07 GMT Message-Id: <201608181707.u7IH77Pt019500@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307969 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 17:07:07 -0000 Author: yuanxunzhang Date: Thu Aug 18 17:07:06 2016 New Revision: 307969 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307969 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 16:22:40 2016 (r307968) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 17:07:06 2016 (r307969) @@ -47,4 +47,5 @@ uint8_t active; /* enable or disable eaps */ }; + #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) From owner-svn-soc-all@freebsd.org Thu Aug 18 17:57:55 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70877BBEB21 for ; Thu, 18 Aug 2016 17:57:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63A931986 for ; Thu, 18 Aug 2016 17:57:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7IHvtf8023135 for ; Thu, 18 Aug 2016 17:57:55 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7IHvs9J023133 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 17:57:54 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 17:57:54 GMT Message-Id: <201608181757.u7IHvs9J023133@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307970 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 17:57:55 -0000 Author: yuanxunzhang Date: Thu Aug 18 17:57:54 2016 New Revision: 307970 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307970 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 17:07:06 2016 (r307969) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 17:57:54 2016 (r307970) @@ -205,7 +205,6 @@ switch (cmd) { case SIOCSEAPSDOMAIN: - printf("Debug print: Query eaps domain status!\n"); eaps_status(sc, es); break; default: @@ -242,11 +241,11 @@ void eaps_status(struct eaps_softc *sc, struct eaps_state *es) { + printf("Debug print: Query eaps domain status!\n"); struct rm_priotracker tracker; EAPS_RLOCK(sc, &tracker); es->state = sc->sc_eaps.state; es->active = sc->sc_eaps.active; - printf("EAPS status: interface: %s, state: %d\n.", sc->sc_ifp->if_xname, es->state); EAPS_RUNLOCK(sc, &tracker); } From owner-svn-soc-all@freebsd.org Thu Aug 18 21:47:41 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5ADDBBFE95 for ; Thu, 18 Aug 2016 21:47:41 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8A241DD4 for ; Thu, 18 Aug 2016 21:47:41 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7ILlf17019794 for ; Thu, 18 Aug 2016 21:47:41 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7ILldTs019789 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 21:47:39 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 21:47:39 GMT Message-Id: <201608182147.u7ILldTs019789@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307973 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 21:47:42 -0000 Author: yuanxunzhang Date: Thu Aug 18 21:47:39 2016 New Revision: 307973 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307973 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 19:18:40 2016 (r307972) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Thu Aug 18 21:47:39 2016 (r307973) @@ -245,7 +245,8 @@ struct rm_priotracker tracker; EAPS_RLOCK(sc, &tracker); es->state = sc->sc_eaps.state; - es->active = sc->sc_eaps.active; + es->status = sc->sc_eaps.status; + es->ifname = sc->sc_ifp->if_xname; printf("EAPS status: interface: %s, state: %d\n.", sc->sc_ifp->if_xname, es->state); EAPS_RUNLOCK(sc, &tracker); } @@ -256,7 +257,7 @@ //set eaps domain protocol state to default value EAPS_WLOCK(sc); sc->sc_eaps.state = EAPS_S_IDLE; - sc->sc_eaps.active = EAPS_ACTIVE_DISABLE; + sc->sc_eaps.status = EAPS_ACTIVE_DISABLE; EAPS_WUNLOCK(sc); } Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 19:18:40 2016 (r307972) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 21:47:39 2016 (r307973) @@ -151,10 +151,10 @@ #define EAPS_S_INIT 0x06 /* Master node in INIT state */ /* - * EAPS ring active states + * EAPS ring status states (active or not active) */ -#define EAPS_ACTIVE_DISABLE 0x00 /* Disable the eaps domain */ -#define EAPS_ACTIVE_ENABLE 0x01 /* Enable the eaps domain */ +#define EAPS_STATUS_ACTIVE 0x00 /* Eaps is active */ +#define EAPS_STATUS_NOT_ACTIVE 0x01 /* Eaps is not active */ #define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") #define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Thu Aug 18 19:18:40 2016 (r307972) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Thu Aug 18 21:47:39 2016 (r307973) @@ -59,6 +59,22 @@ static const char eaps_ifname[] = "eaps"; +/* Must be same order with define */ +static const char *eaps_status_message[] = { + "active", /* EAPS_STATUS_ACTIVE */ + "not active", /* EAPS_STATUS_NOT_ACTIVE */ +}; + +static const char *eaps_state_message[] = { + "idle", /* EAPS_S_IDLE */ + "complete" /* EAPS_S_COMPLETE */ + "failed" /* EAPS_S_FAILED */ + "link up" /* EAPS_S_LINKS_UP */ + "link down" /* EAPS_S_LINK_DOWN */ + "preforward" /* EAPS_S_PREFORWARD */ + "init" /* EAPS_S_INIT */ +} + static struct keytab { const char *kt_cp; int kt_i; @@ -183,8 +199,14 @@ } strlcpy(es.ifname, domain_name, sizeof(es.ifname)); - if (ioctl(s, SIOCSEAPSDOMAIN, &es) < 0) + if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { + printf("%s: ", domain_name); + printf("status: %s, ", eaps_status_message[es->status]); + printf("state: %s, ", eaps_state_message[es->state]); + putchar('\n'); + } else { err(1, "SIOCSEAPSDOMAIN"); + } exit(error); } Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 19:18:40 2016 (r307972) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 21:47:39 2016 (r307973) @@ -47,5 +47,21 @@ uint8_t active; /* enable or disable eaps */ }; +/* + * EAPS ring node states + */ +#define EAPS_S_IDLE 0x00 /* EAPS Domain (Master/Transit) not running */ +#define EAPS_S_COMPLETE 0x01 /* Master node in COMPLETE state */ +#define EAPS_S_FAILED 0x02 /* Master node in FAILED state */ +#define EAPS_S_LINKS_UP 0x03 /* Transit UP: Pri & Sec ring ports are up */ +#define EAPS_S_LINK_DOWN 0x04 /* Transit DOWN: Pri and/or Sec ports down */ +#define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ +#define EAPS_S_INIT 0x06 /* Master node in INIT state */ + +/* + * EAPS ring status states (active or not active) + */ +#define EAPS_STATUS_ACTIVE 0x00 /* Eaps is active */ +#define EAPS_STATUS_NOT_ACTIVE 0x01 /* Eaps is not active */ #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) From owner-svn-soc-all@freebsd.org Thu Aug 18 21:49:49 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35DBCBBFF02 for ; Thu, 18 Aug 2016 21:49:49 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 290B41E46 for ; Thu, 18 Aug 2016 21:49:49 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7ILnnJH022401 for ; Thu, 18 Aug 2016 21:49:49 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7ILnm1Q022394 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 21:49:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 21:49:48 GMT Message-Id: <201608182149.u7ILnm1Q022394@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307974 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 21:49:49 -0000 Author: yuanxunzhang Date: Thu Aug 18 21:49:48 2016 New Revision: 307974 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307974 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Thu Aug 18 21:47:39 2016 (r307973) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Thu Aug 18 21:49:48 2016 (r307974) @@ -201,8 +201,8 @@ strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { printf("%s: ", domain_name); - printf("status: %s, ", eaps_status_message[es->status]); - printf("state: %s, ", eaps_state_message[es->state]); + printf("status: %s, ", eaps_status_message[es.status]); + printf("state: %s, ", eaps_state_message[es.state]); putchar('\n'); } else { err(1, "SIOCSEAPSDOMAIN"); From owner-svn-soc-all@freebsd.org Thu Aug 18 21:52:23 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCC4ABBFFE5 for ; Thu, 18 Aug 2016 21:52:23 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFF2D11E7 for ; Thu, 18 Aug 2016 21:52:23 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7ILqNgF031959 for ; Thu, 18 Aug 2016 21:52:23 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7ILqMoq031917 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 21:52:22 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 21:52:22 GMT Message-Id: <201608182152.u7ILqMoq031917@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307975 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 21:52:23 -0000 Author: yuanxunzhang Date: Thu Aug 18 21:52:22 2016 New Revision: 307975 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307975 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 21:49:48 2016 (r307974) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Thu Aug 18 21:52:22 2016 (r307975) @@ -37,7 +37,7 @@ struct eaps_state { char ifname[IFNAMSIZ]; /* name of the eaps */ uint8_t state; /* state of eaps */ - uint8_t active; /* enable or disable eaps */ + uint8_t status; /* enable or disable eaps */ }; /* Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 21:49:48 2016 (r307974) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Thu Aug 18 21:52:22 2016 (r307975) @@ -44,7 +44,7 @@ struct eaps_state { char ifname[IFNAMSIZ]; /* name of the eaps */ uint8_t state; /* state of eaps */ - uint8_t active; /* enable or disable eaps */ + uint8_t status; /* enable or disable eaps */ }; /* From owner-svn-soc-all@freebsd.org Thu Aug 18 21:53:05 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29306BC0000 for ; Thu, 18 Aug 2016 21:53:05 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C7671229 for ; Thu, 18 Aug 2016 21:53:05 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7ILr4sk035013 for ; Thu, 18 Aug 2016 21:53:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7ILr4sL034997 for svn-soc-all@FreeBSD.org; Thu, 18 Aug 2016 21:53:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Thu, 18 Aug 2016 21:53:04 GMT Message-Id: <201608182153.u7ILr4sL034997@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307976 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 21:53:05 -0000 Author: yuanxunzhang Date: Thu Aug 18 21:53:03 2016 New Revision: 307976 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307976 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Thu Aug 18 21:52:22 2016 (r307975) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Thu Aug 18 21:53:03 2016 (r307976) @@ -73,7 +73,7 @@ "link down" /* EAPS_S_LINK_DOWN */ "preforward" /* EAPS_S_PREFORWARD */ "init" /* EAPS_S_INIT */ -} +}; static struct keytab { const char *kt_cp; From owner-svn-soc-all@freebsd.org Fri Aug 19 04:38:01 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A75DCBBDA79 for ; Fri, 19 Aug 2016 04:38:01 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AB9C1E9B for ; Fri, 19 Aug 2016 04:38:01 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7J4c1N2096650 for ; Fri, 19 Aug 2016 04:38:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7J4c1Fs096647 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 04:38:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 04:38:01 GMT Message-Id: <201608190438.u7J4c1Fs096647@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307986 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 04:38:01 -0000 Author: yuanxunzhang Date: Fri Aug 19 04:38:00 2016 New Revision: 307986 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307986 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 03:32:04 2016 (r307985) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 04:38:00 2016 (r307986) @@ -257,7 +257,7 @@ //set eaps domain protocol state to default value EAPS_WLOCK(sc); sc->sc_eaps.state = EAPS_S_IDLE; - sc->sc_eaps.status = EAPS_ACTIVE_DISABLE; + sc->sc_eaps.status = EAPS_STATUS_NOT_ACTIVE; EAPS_WUNLOCK(sc); } From owner-svn-soc-all@freebsd.org Fri Aug 19 05:28:03 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12490BBE5E1 for ; Fri, 19 Aug 2016 05:28:03 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC08E14C9 for ; Fri, 19 Aug 2016 05:28:02 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7J5S28b034598 for ; Fri, 19 Aug 2016 05:28:02 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7J5S2Mh034565 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 05:28:02 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 05:28:02 GMT Message-Id: <201608190528.u7J5S2Mh034565@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307989 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 05:28:03 -0000 Author: yuanxunzhang Date: Fri Aug 19 05:28:01 2016 New Revision: 307989 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307989 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 04:30:29 2016 (r307988) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 05:28:01 2016 (r307989) @@ -246,7 +246,7 @@ EAPS_RLOCK(sc, &tracker); es->state = sc->sc_eaps.state; es->status = sc->sc_eaps.status; - es->ifname = sc->sc_ifp->if_xname; + (void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname)); printf("EAPS status: interface: %s, state: %d\n.", sc->sc_ifp->if_xname, es->state); EAPS_RUNLOCK(sc, &tracker); } From owner-svn-soc-all@freebsd.org Fri Aug 19 07:45:07 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C5B8BBF298 for ; Fri, 19 Aug 2016 07:45:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11CDE1B41 for ; Fri, 19 Aug 2016 07:45:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7J7j6vR077468 for ; Fri, 19 Aug 2016 07:45:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7J7j422077409 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 07:45:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 07:45:04 GMT Message-Id: <201608190745.u7J7j422077409@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307994 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 07:45:07 -0000 Author: yuanxunzhang Date: Fri Aug 19 07:45:04 2016 New Revision: 307994 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307994 Log: EAPS: get eaps mode priority interface Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 05:43:28 2016 (r307993) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 07:45:04 2016 (r307994) @@ -246,8 +246,9 @@ EAPS_RLOCK(sc, &tracker); es->state = sc->sc_eaps.state; es->status = sc->sc_eaps.status; + es->mode = sc->sc_eaps.mode; + es->priority = sc->sc_eaps.priority; (void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname)); - printf("EAPS status: interface: %s, state: %d\n.", sc->sc_ifp->if_xname, es->state); EAPS_RUNLOCK(sc, &tracker); } @@ -258,6 +259,8 @@ EAPS_WLOCK(sc); sc->sc_eaps.state = EAPS_S_IDLE; sc->sc_eaps.status = EAPS_STATUS_NOT_ACTIVE; + sc->sc_eaps.mode = EAPS_MODE_TRANSIT; + sc->sc_eaps.priority = EAPS_PRIORITY_NORMAL; EAPS_WUNLOCK(sc); } Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Aug 19 05:43:28 2016 (r307993) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Aug 19 07:45:04 2016 (r307994) @@ -38,6 +38,8 @@ char ifname[IFNAMSIZ]; /* name of the eaps */ uint8_t state; /* state of eaps */ uint8_t status; /* enable or disable eaps */ + uint8_t mode; /* switch mode for a node: transit or master, default transit */ + uint8_t priority; /* EAPS domain priority high or normal */ }; /* @@ -156,6 +158,12 @@ #define EAPS_STATUS_ACTIVE 0x00 /* Eaps is active */ #define EAPS_STATUS_NOT_ACTIVE 0x01 /* Eaps is not active */ +#define EAPS_MODE_TRANSIT 0x00 /* EAPS swith mode - transit (default) */ +#define EAPS_MODE_MASTER 0x01 /* EAPS swith mode - master */ + +#define EAPS_PRIORITY_NORMAL 0x00 /* EAPS domain priority - normal */ +#define EAPS_PRIORITY_HIGH 0x01 /* EAPS domain priority - high (default) */ + #define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") #define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) #define EAPS_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p)) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 05:43:28 2016 (r307993) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 07:45:04 2016 (r307994) @@ -67,12 +67,22 @@ static const char *eaps_state_message[] = { "idle", /* EAPS_S_IDLE */ - "complete" /* EAPS_S_COMPLETE */ - "failed" /* EAPS_S_FAILED */ - "link up" /* EAPS_S_LINKS_UP */ - "link down" /* EAPS_S_LINK_DOWN */ - "preforward" /* EAPS_S_PREFORWARD */ - "init" /* EAPS_S_INIT */ + "complete", /* EAPS_S_COMPLETE */ + "failed", /* EAPS_S_FAILED */ + "link up", /* EAPS_S_LINKS_UP */ + "link down", /* EAPS_S_LINK_DOWN */ + "preforward", /* EAPS_S_PREFORWARD */ + "init", /* EAPS_S_INIT */ +}; + +static const char *eaps_mode_message[] = { + "transit", /* EAPS_MODE_TRANSIT */ + "master", /* EAPS_MODE_MASTER */ +}; + +static const char *eaps_priority_message[] = { + "normal", /* EAPS_PRIORITY_NORMAL */ + "high", /* EAPS_PRIORITY_HIGH */ }; static struct keytab { @@ -202,8 +212,9 @@ if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { printf("%s: ", domain_name); printf("status: %s, ", eaps_status_message[es.status]); - printf("state: %s, ", eaps_state_message[es.state]); - putchar('\n'); + printf("state: %s\n", eaps_state_message[es.state]); + printf("\tswitch mode: %s\n", eaps_mode_message[es.mode]); + printf("\tpriority: %s\n", eaps_priority_message[es.priority]); } else { err(1, "SIOCSEAPSDOMAIN"); } Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 05:43:28 2016 (r307993) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 07:45:04 2016 (r307994) @@ -45,8 +45,9 @@ char ifname[IFNAMSIZ]; /* name of the eaps */ uint8_t state; /* state of eaps */ uint8_t status; /* enable or disable eaps */ + uint8_t mode; /* switch mode for a node: transit or master, default transit */ + uint8_t priority; /* EAPS domain priority high or normal */ }; - /* * EAPS ring node states */ From owner-svn-soc-all@freebsd.org Fri Aug 19 08:38:13 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70849BBE288 for ; Fri, 19 Aug 2016 08:38:13 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63D6E1D72 for ; Fri, 19 Aug 2016 08:38:13 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7J8cDeH019592 for ; Fri, 19 Aug 2016 08:38:13 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7J8cChm019588 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 08:38:12 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 08:38:12 GMT Message-Id: <201608190838.u7J8cChm019588@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308000 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 08:38:13 -0000 Author: yuanxunzhang Date: Fri Aug 19 08:38:12 2016 New Revision: 308000 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308000 Log: EAPS: get eaps mode priority interface Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 07:59:00 2016 (r307999) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 08:38:12 2016 (r308000) @@ -199,6 +199,7 @@ static int eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { + printf("Debug print: Receive message!\n"); int error = 0; struct eaps_softc *sc = (struct eaps_softc *)ifp->if_softc; struct eaps_state *es = (struct eaps_state *)data; From owner-svn-soc-all@freebsd.org Fri Aug 19 09:02:54 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57270BBEFAA for ; Fri, 19 Aug 2016 09:02:54 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49F3515EF for ; Fri, 19 Aug 2016 09:02:54 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7J92saL056297 for ; Fri, 19 Aug 2016 09:02:54 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7J92rVO055911 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 09:02:53 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 09:02:53 GMT Message-Id: <201608190902.u7J92rVO055911@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308005 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 09:02:54 -0000 Author: yuanxunzhang Date: Fri Aug 19 09:02:53 2016 New Revision: 308005 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308005 Log: EAPS: modify eaps socket interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 08:44:37 2016 (r308004) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 09:02:53 2016 (r308005) @@ -208,6 +208,13 @@ err(1, "EAPS domain name is NULL!"); } + struct ifreq ifr; + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, domain_name, sizeof(ifr.ifr_name)); + s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0); + if (s < 0) + err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { printf("%s: ", domain_name); From owner-svn-soc-all@freebsd.org Fri Aug 19 09:31:24 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34974BBF93A for ; Fri, 19 Aug 2016 09:31:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E3881961 for ; Fri, 19 Aug 2016 09:31:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7J9VNxO058755 for ; Fri, 19 Aug 2016 09:31:23 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7J9VNLg058698 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 09:31:23 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 09:31:23 GMT Message-Id: <201608190931.u7J9VNLg058698@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308006 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 09:31:24 -0000 Author: yuanxunzhang Date: Fri Aug 19 09:31:22 2016 New Revision: 308006 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308006 Log: EAPS: modify eaps socket interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 09:02:53 2016 (r308005) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 09:31:22 2016 (r308006) @@ -208,13 +208,6 @@ err(1, "EAPS domain name is NULL!"); } - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - strlcpy(ifr.ifr_name, domain_name, sizeof(ifr.ifr_name)); - s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0); - if (s < 0) - err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); - strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { printf("%s: ", domain_name); @@ -223,6 +216,7 @@ printf("\tswitch mode: %s\n", eaps_mode_message[es.mode]); printf("\tpriority: %s\n", eaps_priority_message[es.priority]); } else { + printf("Debug print: ioctl failed!\n"); err(1, "SIOCSEAPSDOMAIN"); } From owner-svn-soc-all@freebsd.org Fri Aug 19 10:49:15 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C576ABBFF52 for ; Fri, 19 Aug 2016 10:49:15 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B88CC1AB0 for ; Fri, 19 Aug 2016 10:49:15 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JAnFU7053285 for ; Fri, 19 Aug 2016 10:49:15 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JAnEBi053158 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 10:49:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 10:49:14 GMT Message-Id: <201608191049.u7JAnEBi053158@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308008 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 10:49:15 -0000 Author: yuanxunzhang Date: Fri Aug 19 10:49:13 2016 New Revision: 308008 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308008 Log: EAPS: modify eaps socket interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 09:11:50 2016 (r308007) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:49:13 2016 (r308008) @@ -97,6 +97,8 @@ static void create_domain(int, char **, int); static void delete_domain(int, char **, int); static void show_eaps_status(int, char **, int); +static void set_eaps_mode(int, char **, int); +static void set_eaps_priority(int, char **, int); static void usage(const char *); void load_module(const char *); @@ -122,6 +124,10 @@ case K_SHOW: show_eaps_status(argc, argv, s); break; + case K_MODE: + break; + case K_PRIORITY: + break; } usage(*argv); return retval; @@ -223,6 +229,34 @@ exit(error); } +static void +set_eaps_mode(int argc, char **argv, int s) +{ + int error = 0; + + struct eaps_state es; + bzero(&es, sizeof(es)); + + char *domain_name = *(++argv); + + // check eaps domain name + if (domain_name == NULL) { + err(1, "EAPS domain name is NULL!"); + } + + char *mode = *(++argv); + printf("Debug print: the switch mode is %s!\n", mode); + + //check the eaps switch mode + if ((mode != eaps_mode_message[EAPS_MODE_TRANSIT]) + || (mode != aps_mode_message[EAPS_MODE_MASTER])) { + err(1, "Wrong swith mode, swith mode should be transit or master!\n"); + } + + exit(error); +} + + static void usage(const char *cp) { Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 09:11:50 2016 (r308007) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 10:49:13 2016 (r308008) @@ -48,16 +48,6 @@ uint8_t mode; /* switch mode for a node: transit or master, default transit */ uint8_t priority; /* EAPS domain priority high or normal */ }; -/* - * EAPS ring node states - */ -#define EAPS_S_IDLE 0x00 /* EAPS Domain (Master/Transit) not running */ -#define EAPS_S_COMPLETE 0x01 /* Master node in COMPLETE state */ -#define EAPS_S_FAILED 0x02 /* Master node in FAILED state */ -#define EAPS_S_LINKS_UP 0x03 /* Transit UP: Pri & Sec ring ports are up */ -#define EAPS_S_LINK_DOWN 0x04 /* Transit DOWN: Pri and/or Sec ports down */ -#define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ -#define EAPS_S_INIT 0x06 /* Master node in INIT state */ /* * EAPS ring status states (active or not active) @@ -65,4 +55,11 @@ #define EAPS_STATUS_ACTIVE 0x00 /* Eaps is active */ #define EAPS_STATUS_NOT_ACTIVE 0x01 /* Eaps is not active */ +#define EAPS_MODE_TRANSIT 0x00 /* EAPS swith mode - transit (default) */ +#define EAPS_MODE_MASTER 0x01 /* EAPS swith mode - master */ + +#define EAPS_PRIORITY_NORMAL 0x00 /* EAPS domain priority - normal */ +#define EAPS_PRIORITY_HIGH 0x01 /* EAPS domain priority - high (default) */ + + #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Fri Aug 19 09:11:50 2016 (r308007) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Fri Aug 19 10:49:13 2016 (r308008) @@ -4,3 +4,6 @@ create delete show +mode +priority + From owner-svn-soc-all@freebsd.org Fri Aug 19 10:50:40 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9621FBBFF71 for ; Fri, 19 Aug 2016 10:50:40 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 895391B2A for ; Fri, 19 Aug 2016 10:50:40 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JAoegc056845 for ; Fri, 19 Aug 2016 10:50:40 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JAodpX056787 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 10:50:39 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 10:50:39 GMT Message-Id: <201608191050.u7JAodpX056787@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308009 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 10:50:40 -0000 Author: yuanxunzhang Date: Fri Aug 19 10:50:39 2016 New Revision: 308009 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308009 Log: EAPS: set switch mode interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:49:13 2016 (r308008) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:50:39 2016 (r308009) @@ -246,10 +246,10 @@ char *mode = *(++argv); printf("Debug print: the switch mode is %s!\n", mode); - + //check the eaps switch mode if ((mode != eaps_mode_message[EAPS_MODE_TRANSIT]) - || (mode != aps_mode_message[EAPS_MODE_MASTER])) { + || (mode != eaps_mode_message[EAPS_MODE_MASTER])) { err(1, "Wrong swith mode, swith mode should be transit or master!\n"); } From owner-svn-soc-all@freebsd.org Fri Aug 19 10:52:35 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E0C2BBF0AA for ; Fri, 19 Aug 2016 10:52:35 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 815051EEF for ; Fri, 19 Aug 2016 10:52:35 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JAqZBO063896 for ; Fri, 19 Aug 2016 10:52:35 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JAqYMU063867 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 10:52:34 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 10:52:34 GMT Message-Id: <201608191052.u7JAqYMU063867@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308010 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 10:52:35 -0000 Author: yuanxunzhang Date: Fri Aug 19 10:52:34 2016 New Revision: 308010 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308010 Log: EAPS: set switch mode interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:50:39 2016 (r308009) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:52:34 2016 (r308010) @@ -125,6 +125,7 @@ show_eaps_status(argc, argv, s); break; case K_MODE: + set_eaps_mode(argc, argv, s); break; case K_PRIORITY: break; From owner-svn-soc-all@freebsd.org Fri Aug 19 10:55:00 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3F6BBF21A for ; Fri, 19 Aug 2016 10:55:00 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F91D1585 for ; Fri, 19 Aug 2016 10:55:00 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JAt02I066762 for ; Fri, 19 Aug 2016 10:55:00 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JAsxR0066605 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 10:54:59 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 10:54:59 GMT Message-Id: <201608191054.u7JAsxR0066605@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308011 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 10:55:00 -0000 Author: yuanxunzhang Date: Fri Aug 19 10:54:59 2016 New Revision: 308011 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308011 Log: EAPS: set switch mode interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:52:34 2016 (r308010) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:54:59 2016 (r308011) @@ -250,7 +250,7 @@ //check the eaps switch mode if ((mode != eaps_mode_message[EAPS_MODE_TRANSIT]) - || (mode != eaps_mode_message[EAPS_MODE_MASTER])) { + && (mode != eaps_mode_message[EAPS_MODE_MASTER])) { err(1, "Wrong swith mode, swith mode should be transit or master!\n"); } From owner-svn-soc-all@freebsd.org Fri Aug 19 10:55:18 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00FF5BBF232 for ; Fri, 19 Aug 2016 10:55:18 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E872C159B for ; Fri, 19 Aug 2016 10:55:17 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JAtHHc067220 for ; Fri, 19 Aug 2016 10:55:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JAtHoT067164 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 10:55:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 10:55:17 GMT Message-Id: <201608191055.u7JAtHoT067164@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308012 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 10:55:18 -0000 Author: yuanxunzhang Date: Fri Aug 19 10:55:16 2016 New Revision: 308012 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308012 Log: EAPS: set switch mode interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:54:59 2016 (r308011) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:55:16 2016 (r308012) @@ -246,7 +246,7 @@ } char *mode = *(++argv); - printf("Debug print: the switch mode is %s!\n", mode); + printf("Debug print: set switch mode is %s!\n", mode); //check the eaps switch mode if ((mode != eaps_mode_message[EAPS_MODE_TRANSIT]) From owner-svn-soc-all@freebsd.org Fri Aug 19 11:00:48 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4236BBBF388 for ; Fri, 19 Aug 2016 11:00:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3535B1628 for ; Fri, 19 Aug 2016 11:00:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JB0mQr089086 for ; Fri, 19 Aug 2016 11:00:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JB0llF088881 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 11:00:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 11:00:47 GMT Message-Id: <201608191100.u7JB0llF088881@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308016 - soc2016/yuanxunzhang/head/usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 11:00:48 -0000 Author: yuanxunzhang Date: Fri Aug 19 11:00:47 2016 New Revision: 308016 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308016 Log: EAPS: set switch mode interface Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 10:53:17 2016 (r308015) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 11:00:47 2016 (r308016) @@ -249,8 +249,8 @@ printf("Debug print: set switch mode is %s!\n", mode); //check the eaps switch mode - if ((mode != eaps_mode_message[EAPS_MODE_TRANSIT]) - && (mode != eaps_mode_message[EAPS_MODE_MASTER])) { + if ((strcmp(mode, eaps_mode_message[EAPS_MODE_TRANSIT]) != 0) + && strcmp(mode, eaps_mode_message[EAPS_MODE_MASTER]) != 0) { err(1, "Wrong swith mode, swith mode should be transit or master!\n"); } From owner-svn-soc-all@freebsd.org Fri Aug 19 20:02:52 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65FDFBBE27C for ; Fri, 19 Aug 2016 20:02:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B8351B65 for ; Fri, 19 Aug 2016 20:02:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7JK2qWq032577 for ; Fri, 19 Aug 2016 20:02:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7JK2oPd032514 for svn-soc-all@FreeBSD.org; Fri, 19 Aug 2016 20:02:50 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 19 Aug 2016 20:02:50 GMT Message-Id: <201608192002.u7JK2oPd032514@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308055 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2016 20:02:52 -0000 Author: yuanxunzhang Date: Fri Aug 19 20:02:49 2016 New Revision: 308055 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308055 Log: EAPS: set switch mode and set priority interfaces Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 19:31:55 2016 (r308054) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 20:02:49 2016 (r308055) @@ -73,6 +73,8 @@ void eaps_attach(struct eaps_softc *); void eaps_detach(struct eaps_softc *); void eaps_status(struct eaps_softc *, struct eaps_state *); +void set_eaps_mode(struct eaps_softc *, struct eaps_state *); +void set_eaps_priority(struct eaps_softc *, struct eaps_state *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) @@ -208,6 +210,14 @@ case SIOCSEAPSDOMAIN: eaps_status(sc, es); break; + + case SIOCSEAPSMODE: + set_eaps_mode(sc, es); + break; + + case SIOCSEAPSPRI: + set_eaps_priority(sc, es); + break; default: error = ether_ioctl(ifp, cmd, data); break; @@ -254,6 +264,24 @@ } void +set_eaps_mode(struct eaps_softc *sc, struct eaps_state *es) +{ + printf("Debug print: set_eaps_mode!\n"); + EAPS_WLOCK(sc); + sc->sc_eaps.mode = es->mode; + EAPS_WUNLOCK(sc); +} + +void +set_eaps_priority(struct eaps_softc *sc, struct eaps_state *es) +{ + printf("Debug print: set_eaps_priority!\n"); + EAPS_WLOCK(sc); + sc->sc_eaps.priority = es->priority; + EAPS_WUNLOCK(sc); +} + +void eaps_attach(struct eaps_softc *sc) { //set eaps domain protocol state to default value Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Aug 19 19:31:55 2016 (r308054) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Aug 19 20:02:49 2016 (r308055) @@ -53,10 +53,9 @@ u_char sc_defaddr[6]; /* Default MAC address */ }; - - #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) - +#define SIOCSEAPSMODE _IOW('i', 301, struct eaps_state) +#define SIOCSEAPSPRI _IOW('i', 302, struct eaps_state) /* * Extreme Active Protection System (EAPS) definitions. * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 19:31:55 2016 (r308054) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 20:02:49 2016 (r308055) @@ -249,14 +249,54 @@ printf("Debug print: set switch mode is %s!\n", mode); //check the eaps switch mode - if ((strcmp(mode, eaps_mode_message[EAPS_MODE_TRANSIT]) != 0) - && strcmp(mode, eaps_mode_message[EAPS_MODE_MASTER]) != 0) { - err(1, "Wrong swith mode, swith mode should be transit or master!\n"); + if (strcmp(mode, eaps_mode_message[EAPS_MODE_TRANSIT]) == 0) { + es.mode = EAPS_MODE_TRANSIT; + } else if (strcmp(mode, eaps_mode_message[EAPS_MODE_MASTER]) == 0) { + es.mode = EAPS_MODE_MASTER; + } else { + err(1, "Wrong swith mode, swith mode should be either transit or master!\n"); } + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + if (ioctl(s, SIOCSEAPSMODE, &es) != 0) + err(1, "SIOCSEAPSMODE"); + exit(error); } +static void +set_eaps_priority(int argc, char **argv, int s) +{ + int error = 0; + + struct eaps_state es; + bzero(&es, sizeof(es)); + + char *domain_name = *(++argv); + + // check eaps domain name + if (domain_name == NULL) { + err(1, "EAPS domain name is NULL!"); + } + + char *priority = *(++argv); + printf("Debug print: set priority mode is %s!\n", priority); + + //check the eaps domain priority + if (strcmp(priority, eaps_priority_message[EAPS_PRIORITY_NORMAL]) == 0) { + es.priority = EAPS_PRIORITY_NORMAL; + } else if (strcmp(priority, eaps_priority_message[EAPS_PRIORITY_HIGH]) == 0) { + es.priority = EAPS_PRIORITY_HIGH; + } else { + err(1, "Wrong priority, priority should be either high or normal!\n"); + } + + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + if (ioctl(s, SIOCSEAPSPRI, &es) != 0) + err(1, "SIOCSEAPSPRI"); + + exit(error); +} static void usage(const char *cp) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 19:31:55 2016 (r308054) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 20:02:49 2016 (r308055) @@ -60,6 +60,8 @@ #define EAPS_PRIORITY_NORMAL 0x00 /* EAPS domain priority - normal */ #define EAPS_PRIORITY_HIGH 0x01 /* EAPS domain priority - high (default) */ - #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) +#define SIOCSEAPSMODE _IOW('i', 301, struct eaps_state) +#define SIOCSEAPSPRI _IOW('i', 302, struct eaps_state) + From owner-svn-soc-all@freebsd.org Sat Aug 20 10:24:37 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46058BBEB28 for ; Sat, 20 Aug 2016 10:24:37 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 390451683 for ; Sat, 20 Aug 2016 10:24:37 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KAOb6M002372 for ; Sat, 20 Aug 2016 10:24:37 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KAOac8002367 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 10:24:36 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sat, 20 Aug 2016 10:24:36 GMT Message-Id: <201608201024.u7KAOac8002367@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308079 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 10:24:37 -0000 Author: yuanxunzhang Date: Sat Aug 20 10:24:35 2016 New Revision: 308079 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308079 Log: EAPS: set switch mode and set priority interfaces Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Sat Aug 20 09:13:14 2016 (r308078) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Sat Aug 20 10:24:35 2016 (r308079) @@ -201,7 +201,6 @@ static int eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - printf("Debug print: Receive message!\n"); int error = 0; struct eaps_softc *sc = (struct eaps_softc *)ifp->if_softc; struct eaps_state *es = (struct eaps_state *)data; Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sat Aug 20 09:13:14 2016 (r308078) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sat Aug 20 10:24:35 2016 (r308079) @@ -128,6 +128,7 @@ set_eaps_mode(argc, argv, s); break; case K_PRIORITY: + set_eaps_priority(argc, argv, s); break; } usage(*argv); From owner-svn-soc-all@freebsd.org Sat Aug 20 13:48:13 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C499BC0A81 for ; Sat, 20 Aug 2016 13:48:13 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E6B012C5 for ; Sat, 20 Aug 2016 13:48:13 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KDmDfL099078 for ; Sat, 20 Aug 2016 13:48:13 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KDmCql099004 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 13:48:12 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 13:48:12 GMT Message-Id: <201608201348.u7KDmCql099004@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308087 - soc2016/vincenzo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 13:48:13 -0000 Author: vincenzo Date: Sat Aug 20 13:48:12 2016 New Revision: 308087 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308087 Log: Add README for the project Added: soc2016/vincenzo/README Added: soc2016/vincenzo/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/vincenzo/README Sat Aug 20 13:48:12 2016 (r308087) @@ -0,0 +1,225 @@ +== High-performance TCP/IP networking for bhyve VMs using netmap passthrough == + + Student: Vincenzo Maffione (vincenzo AT freebsd DOT org) + Mentor: Luigi Rizzo (luigi AT freebsd DOT org) + + +=========================== Project proposal ========================== + +Netmap passhthrough (ptnetmap) has been recently introduced on Linux/FreeBSD +platforms, where QEMU-KVM/bhyve hypervisors allow VMs to exchange over 20 Mpps +through VALE switches. Unfortunately, the original ptnetmap implementation +was not able to exchange packets with the guest TCP/IP stack, it only +supported guest applications running directly over netmap. Moreover, ptnetmap +was not able to support multi-ring netmap ports. + +I have recently developed a prototype of ptnet, a new multi-ring +paravirtualized device for Linux and QEMU/KVM that builds on ptnetmap to allow +VMs to exchange TCP traffic at 20 Gbps, while still offering the same ptnetmap +performance to native netmap applications. + +In this project I would like to implement ptnet for FreeBSD and bhyve, which +do not currently allow TCP/IP traffic with such high performance. Taking +the above prototype as a reference, the following work is required: + + - Implement a ptnet driver for FreeBSD guests that is able to attach to netmap + to support native netmap applications (estimated new code ~700 loc). + - Export a network interface to the FreeBSD guest kernel that allows ptnet + to be used by the network stack, including virtio-net header support + (estimated new code ~800 loc). + - Extend bhyve to emulate the ptnet device model and interact with the netmap + instance used by the hypervisor (estimated new code ~600 loc). + + +================== An overview of netmap and ptnetmap ==================== + +Netmap is a framework for high performance network I/O. It exposes an +hardware-independent API which allows userspace application to directly +interact +with NIC hardware rings, in order to receive and transmit Ethernet frames. +Rings are always accessed in the context of system calls and NIC interrups +are used to notify applications about NIC processing completion. +The performance boost of netmap w.r.t. traditional socket API primarily comes +from: (i) batching, since it is possible to send/receive hundreds of packets +with a single system call, (ii) preallocation of packet buffers and memory +mapping of those in the application address space. + +Several netmap extension have been developed to support virtualization. +Netmap support for various paravirtualized drivers - e.g. virtio-net, Xen +netfront/netback - allows netmap applications to run in the guest over fast +paravirtualized I/O devices. + +The Virtual Ethernet (VALE) software switch, which supports scalable high +performance local communication (over 20 Mpps between two switch ports), can +then be used to connect together multiple VMs. + +However, in a typical scenario with two communicating netmap applications +running in different VMs (on the same host) connected through a VALE switch, +the journey of a packet is still quite convoluted. As a matter of facts, +while netmap is fast on both the host (the VALE switch) and the guest +(interaction between application and the emulated device), each packet still +needs to be processed from the hypervisor, which needs to emulate the +device model used in the guest (e.g. e1000, virtio-net). The emulation +involves device-specific overhead - queue processing, format conversions, +packet copies, address translations, etc. As a consequence, the maximum +packet rate between the two VMs is often limited by 2-5 Mpps. + +To overcome these limitations, ptnetmap has been introduced as a passthrough +technique to completely avoid hypervisor processing in the packet +datapath, unblocking the full potential of netmap also for virtual machine +environments. +With ptnetmap, a netmap port on the host can be exposed to the guest in a +protected way, so that netmap applications in the guest can directly access +the rings and packet buffers of the host port, avoiding all the extra overhead +involved in the emulation of network devices. System calls issued by guest +applications on ptnetmap ports are served by kernel threads (one +per ring) running in the netmap host. + +Similarly to VirtIO paravirtualization, synchronization between +guest netmap (driver) and host netmap (kernel threads) happens through a +shared memory area called Communication Status Block (CSB), which is used +to store producer-consumer state and notification suppression flags. + +Two notification mechanisms needs to be supported by the hypervisor to allow +guest and host netmap to wake up each other. +On QEMU/bhyve, notifications from guest to host are implemented with accesses +to I/O registers which cause a trap in the hypervisor. Notifications in the +other direction are implemented using KVM/bhyve interrupt injection mechanisms. +MSI-X interrupts are used since they have less overhead than traditional +PCI interrupts. + +Since I/O register accesses and interrupts are very expensive in the common +case of hardware assisted virtualization, they are suppressed when not needed, +i.e. each time the host (or the guest) is actively polling the CSB to +check for more work. From an high-level perspective, the system tries to +dynamically switch between polling operation under high load, and +interrupt-based operation under lower loads. + + +===================== The ptnet paravirtualized device ================ + +The original ptnetmap implementation required ptnetmap-enabled virtio-net/e1000 +drivers. Only the notification functionalities of those devices were reused, +while the datapath (e.g. e1000 rings or virtio-net Virtual Queues) was +completely bypassed. + +The ptnet device has been introduced as a cleaner approach to ptnetmap that +also adds the ability to interact with the standard TCP/IP network stack +and supports multi-ring netmap ports. The introduction of a new device model +does not limit the adoption of this solution, since ptnet drivers are +distributed together with netmap, and hypervisor modifications are needed in +any case. + +The ptnet device belongs to the classes of paravirtualized devices, like +virtio-net. Unlike virtio-net, however, ptnet does not define an interface +to exchange packets (datapath), but the existing netmap API is used instead. +However, a CSB - cleaned up and extended to support an arbitrary number of +rings - is still used for producer-consumer synchronization and notification +suppression. + +A number of device registers are used for configuration (number of rings and +slots, device MAC address, supported features, ...) while "kick" registers +are used for guest-to-host notifications. +The ptnetmap kthread infrastructure, moreover, has been already extended to +suppor an arbitrary number of rings, where currently each ring is served +by a different kernel thread. + + +=============================== Deliverables =============================== + +==== D1 (due by week 3) ==== +Implement a ptnet driver for FreeBSD guests, which only supports native netmap +applications. This new driver can be tested using Linux and QEMU-KVM as +hypervisor, which already supports ptnetmap and emulates the ptnet device model. +Since the datapath will be equivalent, we expect to have the same performance +of the original ptnetmap (over 20 Mpps for VALE ports, 14.88 Mpps for hardware +10Gbit ports). + +==== D2 (due by mid-term) ==== +Extend the ptnet FreeBSD driver to export a regular network interface to the +FreeBSD kernel. In terms of latency, we expect a performance similar to the the +ptnet linux driver. + +==== D3 (due by week 9) ==== +Extend the ptnet FreeBSD driver to support TCP Segmentation Offloading (TSO) +and Checksum offloading, by means of the virtio-net header, similarly to +what is done in the linux driver. After this step we expect to have a TCP +performance similar to the Linux one. + +==== D4 (due by the end of project) ==== +Implement the emulation of the ptnet device model in bhyve, starting from a +bhyve version supporting netmap and ptnetmap, which is already available. +At this point we expect FreeBSD guests over bhyve to see similar TCP/IP +throughput and latency performance as Linux guests over QEMU-KVM (about 20 Gbps +for TCP bulk traffic and about 40 thousand HTTP-like transactions per second +between two guests running through a VALE switch). + + +================================= Milestones ================================ + +Start date: 2016/05/23 + +Estimated end dates: 2016/08/23 + +Timetable: + + * Week 1-2: Write ptnet FreeBSD driver supporting netmap native applications [D1] --> COMPLETED + * Week 3: Tests, bug-fixing, and performance evaluation [D1] --> COMPLETED + * Week 4-5: Write FreeBSD network interface support for the ptnet driver. [D2] --> COMPLETED + * Week 6: Tests, bug-fixing [D2]. Prepare documents for mid-term evaluation. --> COMPLETED + * Week 7-8: Add virtio-net header support to the ptnet driver [D3]. --> COMPLETED + * Week 9: Test, bug-fixes and performance evaluation [D3]. --> COMPLETED + * Week 10: Write ptnet device model emulation for bhyve [D4] --> COMPLETED + * Week 11: Test and performance evaluation over bhyve [D4]. + * Week 12: Clean code and prepare documentation for final evaluation. + + +========================== Final submission ================================= + +Final code of my project is available at the following SVN repository: + + https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/ + +which refers to FreeBSD head (11.0-CURRENT). + +Moreover, all modifications I did to netmap (see below) have also been +merged also in the netmap GIT repository, so that can be also found at +https://github.com/luigirizzo/netmap. + +My code modifications belong to two different subsystems: + + (1) netmap, where I added the ptnet device driver, implemented as a single + source file, named head/sys/dev/netmap/if_ptnet.c. + The file is available at the following link into the SVN repository: + https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c?view=markup + + Moreover, some code reorganization and bug-fixing to other parts of + netmap were necessary, including rearrangements of the ptnet driver + for Linux that I had already developed. A complete patch (which + also includes the if_ptnet.c FreeBSD driver) can be obtained with + the following command on the github netmap repository: + git diff --author="Vincenzo Maffione" 09936864fa5b67b82ef4a9907819b7018e9a38f2 master + + (2) bhyve, where I reworked and fixed the netmap support and added the + emulation of the ptnet device. Code modifications can be obtained + with the following SVN diff on the SVN repository: + + $ svn diff -r 302612 usr.sbin/bhyve + + +A modified version of QEMU that supports ptnet (not developed in the +context of this GSOC project) is available here: + + https://github.com/vmaffione/qemu/tree/ptnet + + + + +======================= Useful links ============================== + + * [0] http://info.iet.unipi.it/~luigi/netmap/ + * [1] https://wiki.freebsd.org/SummerOfCode2016/PtnetDriverAndDeviceModel#preview + * [2] https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/ + * [3] https://github.com/luigirizzo/netmap + * [4] https://github.com/vmaffione/qemu/tree/ptnet + From owner-svn-soc-all@freebsd.org Sat Aug 20 14:58:12 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 542B2BC0F2C for ; Sat, 20 Aug 2016 14:58:12 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A0FA1CA9 for ; Sat, 20 Aug 2016 14:58:12 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KEwCfU077715 for ; Sat, 20 Aug 2016 14:58:12 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KEwBsq077696 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 14:58:11 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 14:58:11 GMT Message-Id: <201608201458.u7KEwBsq077696@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308089 - soc2016/vincenzo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 14:58:12 -0000 Author: vincenzo Date: Sat Aug 20 14:58:10 2016 New Revision: 308089 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308089 Log: more README update Modified: soc2016/vincenzo/README Modified: soc2016/vincenzo/README ============================================================================== --- soc2016/vincenzo/README Sat Aug 20 13:29:58 2016 (r308088) +++ soc2016/vincenzo/README Sat Aug 20 14:58:10 2016 (r308089) @@ -177,42 +177,94 @@ ========================== Final submission ================================= Final code of my project is available at the following SVN repository: - - https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/ - + https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/ which refers to FreeBSD head (11.0-CURRENT). -Moreover, all modifications I did to netmap (see below) have also been -merged also in the netmap GIT repository, so that can be also found at +The complete list of my SVN commits can be obtained with the following command +on the SVN repository + $ svn log -r 302612:HEAD +Instructions to extract patches of the subsystem I modified are reported +below. + +Moreover, all the modifications I did to netmap (see below) have also been +merged in the netmap GIT repository, and can be also found at https://github.com/luigirizzo/netmap. My code modifications belong to two different subsystems: - (1) netmap, where I added the ptnet device driver, implemented as a single + * netmap, where I added the ptnet device driver, implemented as a single source file, named head/sys/dev/netmap/if_ptnet.c. The file is available at the following link into the SVN repository: https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c?view=markup - Moreover, some code reorganization and bug-fixing to other parts of + Moreover, some code reorganization and bug-fixes to other parts of netmap were necessary, including rearrangements of the ptnet driver for Linux that I had already developed. A complete patch (which also includes the if_ptnet.c FreeBSD driver) can be obtained with - the following command on the github netmap repository: + the following command on the netmap GIT repository: git diff --author="Vincenzo Maffione" 09936864fa5b67b82ef4a9907819b7018e9a38f2 master - (2) bhyve, where I reworked and fixed the netmap support and added the - emulation of the ptnet device. Code modifications can be obtained - with the following SVN diff on the SVN repository: - + * bhyve, where I reworked and fixed the netmap support and added the + emulation of the ptnet device. A patch containing my code + modifications can be obtained with the following command on the SVN + repository: $ svn diff -r 302612 usr.sbin/bhyve A modified version of QEMU that supports ptnet (not developed in the context of this GSOC project) is available here: - https://github.com/vmaffione/qemu/tree/ptnet - + +Short report of the work done during the project: + + * As a first step, I implemented the ptnet driver for FreeBSD, using + as a reference the driver that I had already developed on linux + (https://github.com/luigirizzo/netmap/blob/master/LINUX/ptnet/ptnet.c). + + I implemented the routines required to attach/detach the ptnet PCI + device (ptnet_probe, ptnet_attach, ptnet_detach, ...). + I developed the routines necessary to open and use the ptnet NIC in + netmap mode (ptnet_nm_register, ptnet_nm_txsync, ptnet_nm_rxsync, + ptnet_nm_config, ...). I managed to share some routines + (ptnet_nm_krings_create, ptnet_nm_krings_delete, ptnet_nm_dtor) between + the Linux and FreeBSD drivers, to improve code reuse. + + To allow the ptnet driver to be used by the network stack (and so by + socket applications), the FreeBSD network driver callbacks have been + implemented (ptnet_init, ptnet_ioctl, ptnet_transmit, ptnet_qflush, ...). + I also implemented a ptnet_poll() routine to support FreeBSD polling + (DEVICE_POLLING). + + * As a second step, I extended bhyve to emulate the ptnet device, + using as a reference the emulation that I had already developed for QEMU: + (https://github.com/vmaffione/qemu/blob/ptnet/hw/net/ptnetmap-netif.c). + I reused previous work from by myself, my mentor Luigi Rizzo + and Stefano Garzarella, that we did in the past to add netmap and + ptnetmap support for bhyve, and to extend libvmm and the vmm module to + +Example on how to use various NICs (including ptnet) with bhyve VMs: + + # bhyve ‐A ‐H ‐P ‐m 1G \ + ‐s 0,hostbridge \ + ‐s 1,lpc \ + ‐s 2:1,virtio‐net,tap1 \ /* virtio-net NIC + TAP backend */ + ‐s 2:2,virtio‐net,vale0:1 \ /* virtio-net NIC + netmap userspace backend */ + ‐s 2:3,ptnetmap‐memdev \ /* ptnetmap memory device, needed by the ptnet NIC */ + ‐s 2:4,ptnet,vale1:1 \ /* ptnet NIC + ptnetmap kernelspace backend */ + ‐l com1,stdio \ + vm1 + +where the bhyve VM named "vm1" has three virtual NICs: + * A virtio-net NIC which uses a traditional TAP device as a backend. + The TAP backend is implemented in userspace, as a part of bhyve. + * A virtio-net NIC which uses an host netmap VALE port as backend. The + netmap backend is implemented in userspace, as part of bhyve. + * A ptnet NIC which does the passthough of an host VALE port inside + the guest. The ptnetmap backend runs in a kernel thread, and it is + implemented as part of the netmap subsystem. + + ======================= Useful links ============================== From owner-svn-soc-all@freebsd.org Sat Aug 20 15:32:01 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1F52BC0791 for ; Sat, 20 Aug 2016 15:32:01 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4EC31275 for ; Sat, 20 Aug 2016 15:32:01 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KFW1C1079271 for ; Sat, 20 Aug 2016 15:32:01 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KFW1LL079268 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 15:32:01 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 15:32:01 GMT Message-Id: <201608201532.u7KFW1LL079268@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308091 - soc2016/vincenzo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 15:32:02 -0000 Author: vincenzo Date: Sat Aug 20 15:32:00 2016 New Revision: 308091 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308091 Log: update README with report Modified: soc2016/vincenzo/README Modified: soc2016/vincenzo/README ============================================================================== --- soc2016/vincenzo/README Sat Aug 20 14:04:51 2016 (r308090) +++ soc2016/vincenzo/README Sat Aug 20 15:32:00 2016 (r308091) @@ -4,7 +4,7 @@ Mentor: Luigi Rizzo (luigi AT freebsd DOT org) -=========================== Project proposal ========================== +======================== Original project proposal ======================= Netmap passhthrough (ptnetmap) has been recently introduced on Linux/FreeBSD platforms, where QEMU-KVM/bhyve hypervisors allow VMs to exchange over 20 Mpps @@ -96,7 +96,7 @@ interrupt-based operation under lower loads. -===================== The ptnet paravirtualized device ================ +================== The ptnet paravirtualized device =================== The original ptnetmap implementation required ptnetmap-enabled virtio-net/e1000 drivers. Only the notification functionalities of those devices were reused, @@ -163,15 +163,15 @@ Timetable: - * Week 1-2: Write ptnet FreeBSD driver supporting netmap native applications [D1] --> COMPLETED - * Week 3: Tests, bug-fixing, and performance evaluation [D1] --> COMPLETED - * Week 4-5: Write FreeBSD network interface support for the ptnet driver. [D2] --> COMPLETED - * Week 6: Tests, bug-fixing [D2]. Prepare documents for mid-term evaluation. --> COMPLETED - * Week 7-8: Add virtio-net header support to the ptnet driver [D3]. --> COMPLETED - * Week 9: Test, bug-fixes and performance evaluation [D3]. --> COMPLETED - * Week 10: Write ptnet device model emulation for bhyve [D4] --> COMPLETED - * Week 11: Test and performance evaluation over bhyve [D4]. - * Week 12: Clean code and prepare documentation for final evaluation. + * Week 1-2: Write ptnet FreeBSD driver supporting netmap native applications [D1] + * Week 3: Tests, bug-fixing, and performance evaluation [D1] + * Week 4-5: Write FreeBSD network interface support for the ptnet driver [D2] + * Week 6: Tests, bug-fixing [D2]. Prepare documents for mid-term evaluation + * Week 7-8: Add virtio-net header support to the ptnet driver [D3] + * Week 9: Test, bug-fixes and performance evaluation [D3] + * Week 10: Write ptnet device model emulation for bhyve [D4] + * Week 11: Test and performance evaluation over bhyve [D4] + * Week 12: Clean code and prepare documentation for final evaluation ========================== Final submission ================================= @@ -183,7 +183,7 @@ The complete list of my SVN commits can be obtained with the following command on the SVN repository $ svn log -r 302612:HEAD -Instructions to extract patches of the subsystem I modified are reported +Instructions to extract patches of the subsystems I modified are reported below. Moreover, all the modifications I did to netmap (see below) have also been @@ -224,9 +224,10 @@ I implemented the routines required to attach/detach the ptnet PCI device (ptnet_probe, ptnet_attach, ptnet_detach, ...). - I developed the routines necessary to open and use the ptnet NIC in + I developed the routines necessary to open and use a ptnet NIC in netmap mode (ptnet_nm_register, ptnet_nm_txsync, ptnet_nm_rxsync, - ptnet_nm_config, ...). I managed to share some routines + ptnet_nm_config, ...), and to react to MSI-X interrupts. + I managed to share some routines (ptnet_nm_krings_create, ptnet_nm_krings_delete, ptnet_nm_dtor) between the Linux and FreeBSD drivers, to improve code reuse. @@ -236,12 +237,39 @@ I also implemented a ptnet_poll() routine to support FreeBSD polling (DEVICE_POLLING). + Using as a reference the FreeBSD virtio-net driver (if_vtnet.c), I added + support for hw offloadings (TSO and TCP/UDP checksum offloading), by + means of the virtio-net header, which is prepended to each Ethernet + frame. The virtio-net header can be enabled or disabled by configuring + a register of the ptnet device. A boolean sysctl belonging to the + netmap module (named ptnet_vnet_hdr) can be tuned for this purpose. + * As a second step, I extended bhyve to emulate the ptnet device, using as a reference the emulation that I had already developed for QEMU: (https://github.com/vmaffione/qemu/blob/ptnet/hw/net/ptnetmap-netif.c). - I reused previous work from by myself, my mentor Luigi Rizzo - and Stefano Garzarella, that we did in the past to add netmap and - ptnetmap support for bhyve, and to extend libvmm and the vmm module to + + As a preliminary step, I adapted previous work from by myself, my mentor + Luigi Rizzo and Stefano Garzarella, that we did in the past to (i) add + netmap and ptnetmap support for bhyve, and (ii) extend libvmm and the vmm + module to allow netmap (kernel-space code) to inject interrupts in the + guest and intercept guest I/O register accesses. + + The emulation for ptnet is available here + https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c?view=markup + which implements (i) the callbacks to manage accesses to the register of + the ptnet device (PTCTL, CSBBAH, CSBBAL, VNET_HDR_LEN, ...); (ii) the + setup necessary to let netmap inject MSI-X interrupts and intercept + writes to the ptnet kick registers. + + Finally, I reorganized and fixed the userspace netmap backend for + bhyve, completing the work we did in the past. This new backend is + intended to replace the old one that is currently in FreeBSD head. + The code in pci_virtio_net.c has been reorganized to support different + backends (TAP, netmap, ptnetmap), while previously it was only able + to support the TAP backend. The backends are now implemented in + a separate file: + https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c?view=markup + Example on how to use various NICs (including ptnet) with bhyve VMs: @@ -256,6 +284,7 @@ vm1 where the bhyve VM named "vm1" has three virtual NICs: + * A virtio-net NIC which uses a traditional TAP device as a backend. The TAP backend is implemented in userspace, as a part of bhyve. * A virtio-net NIC which uses an host netmap VALE port as backend. The @@ -265,13 +294,12 @@ implemented as part of the netmap subsystem. - - ======================= Useful links ============================== - * [0] http://info.iet.unipi.it/~luigi/netmap/ - * [1] https://wiki.freebsd.org/SummerOfCode2016/PtnetDriverAndDeviceModel#preview - * [2] https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/ - * [3] https://github.com/luigirizzo/netmap - * [4] https://github.com/vmaffione/qemu/tree/ptnet + * [0] http://info.iet.unipi.it/~luigi/papers/20160613-ptnet.pdf + * [1] http://info.iet.unipi.it/~luigi/netmap/ + * [2] https://wiki.freebsd.org/SummerOfCode2016/PtnetDriverAndDeviceModel#preview + * [3] https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/ + * [4] https://github.com/luigirizzo/netmap + * [5] https://github.com/vmaffione/qemu/tree/ptnet From owner-svn-soc-all@freebsd.org Sat Aug 20 15:42:42 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEB23BC0ADC for ; Sat, 20 Aug 2016 15:42:42 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B239F18B4 for ; Sat, 20 Aug 2016 15:42:42 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KFggqO000820 for ; Sat, 20 Aug 2016 15:42:42 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KFggbW000805 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 15:42:42 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 15:42:42 GMT Message-Id: <201608201542.u7KFggbW000805@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308092 - soc2016/vincenzo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 15:42:42 -0000 Author: vincenzo Date: Sat Aug 20 15:42:41 2016 New Revision: 308092 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308092 Log: update README about bhyve Modified: soc2016/vincenzo/README Modified: soc2016/vincenzo/README ============================================================================== --- soc2016/vincenzo/README Sat Aug 20 15:32:00 2016 (r308091) +++ soc2016/vincenzo/README Sat Aug 20 15:42:41 2016 (r308092) @@ -188,7 +188,7 @@ Moreover, all the modifications I did to netmap (see below) have also been merged in the netmap GIT repository, and can be also found at -https://github.com/luigirizzo/netmap. +https://github.com/luigirizzo/netmap . My code modifications belong to two different subsystems: @@ -264,10 +264,10 @@ Finally, I reorganized and fixed the userspace netmap backend for bhyve, completing the work we did in the past. This new backend is intended to replace the old one that is currently in FreeBSD head. - The code in pci_virtio_net.c has been reorganized to support different - backends (TAP, netmap, ptnetmap), while previously it was only able - to support the TAP backend. The backends are now implemented in - a separate file: + The code in pci_virtio_net.c has been refactored to be independent + on the backed used, and this is particularly useful w.r.t the + management of the virtio-net header. The backends (TAP, netmap, + ptnetmap) are now implemented in a separate file: https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c?view=markup From owner-svn-soc-all@freebsd.org Sat Aug 20 19:25:30 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 507ADBC0A18 for ; Sat, 20 Aug 2016 19:25:30 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A27B1E05 for ; Sat, 20 Aug 2016 19:25:30 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KJPUpJ001126 for ; Sat, 20 Aug 2016 19:25:30 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KJPU6K001111 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 19:25:30 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 19:25:30 GMT Message-Id: <201608201925.u7KJPU6K001111@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308101 - soc2016/vincenzo/current MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 19:25:30 -0000 Author: vincenzo Date: Sat Aug 20 19:25:29 2016 New Revision: 308101 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308101 Log: Add current directory for updated head Added: soc2016/vincenzo/current/ From owner-svn-soc-all@freebsd.org Sat Aug 20 19:29:08 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC656BC0A3A for ; Sat, 20 Aug 2016 19:29:08 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4C9F1E30 for ; Sat, 20 Aug 2016 19:29:08 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KJT8Cv007222 for ; Sat, 20 Aug 2016 19:29:08 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KJT88P007220 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 19:29:08 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 19:29:08 GMT Message-Id: <201608201929.u7KJT88P007220@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308102 - soc2016/vincenzo/current/head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 19:29:09 -0000 Author: vincenzo Date: Sat Aug 20 19:29:08 2016 New Revision: 308102 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308102 Log: copy current head into current/ Added: soc2016/vincenzo/current/head/ (props changed) - copied from r308101, mirror/FreeBSD/head/ From owner-svn-soc-all@freebsd.org Sat Aug 20 20:22:27 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AB09BC06CB for ; Sat, 20 Aug 2016 20:22:27 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BD441E16 for ; Sat, 20 Aug 2016 20:22:27 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u7KKMRFL067155 for ; Sat, 20 Aug 2016 20:22:27 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7KKMLHU067000 for svn-soc-all@FreeBSD.org; Sat, 20 Aug 2016 20:22:21 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sat, 20 Aug 2016 20:22:21 GMT Message-Id: <201608202022.u7KKMLHU067000@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r308107 - in soc2016/vincenzo/current/head: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/conf sys/dev/netmap sys/modules/netmap sys/modules/vmm sys/net usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 20:22:27 -0000 Author: vincenzo Date: Sat Aug 20 20:22:20 2016 New Revision: 308107 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308107 Log: import gsoc2016-ptnet patch Added: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_usermem.c soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_usermem.h soc2016/vincenzo/current/head/sys/dev/netmap/if_nfe_netmap.h soc2016/vincenzo/current/head/sys/dev/netmap/if_ptnet.c soc2016/vincenzo/current/head/sys/dev/netmap/ptnetmap.c soc2016/vincenzo/current/head/sys/net/netmap_virt.h soc2016/vincenzo/current/head/usr.sbin/bhyve/net_backends.c soc2016/vincenzo/current/head/usr.sbin/bhyve/net_backends.h soc2016/vincenzo/current/head/usr.sbin/bhyve/net_utils.c soc2016/vincenzo/current/head/usr.sbin/bhyve/net_utils.h soc2016/vincenzo/current/head/usr.sbin/bhyve/pci_ptnetmap_memdev.c soc2016/vincenzo/current/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Modified: soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.c soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.h soc2016/vincenzo/current/head/sys/amd64/include/vmm.h soc2016/vincenzo/current/head/sys/amd64/include/vmm_dev.h soc2016/vincenzo/current/head/sys/amd64/vmm/vmm.c soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_dev.c soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.c soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.h soc2016/vincenzo/current/head/sys/conf/files soc2016/vincenzo/current/head/sys/dev/netmap/if_ixl_netmap.h soc2016/vincenzo/current/head/sys/dev/netmap/if_lem_netmap.h soc2016/vincenzo/current/head/sys/dev/netmap/if_vtnet_netmap.h soc2016/vincenzo/current/head/sys/dev/netmap/ixgbe_netmap.h soc2016/vincenzo/current/head/sys/dev/netmap/netmap.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_freebsd.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_generic.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_kern.h soc2016/vincenzo/current/head/sys/dev/netmap/netmap_mbq.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_mbq.h soc2016/vincenzo/current/head/sys/dev/netmap/netmap_mem2.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_mem2.h soc2016/vincenzo/current/head/sys/dev/netmap/netmap_monitor.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_offloadings.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_pipe.c soc2016/vincenzo/current/head/sys/dev/netmap/netmap_vale.c soc2016/vincenzo/current/head/sys/modules/netmap/Makefile soc2016/vincenzo/current/head/sys/modules/vmm/Makefile soc2016/vincenzo/current/head/sys/net/netmap.h soc2016/vincenzo/current/head/sys/net/netmap_user.h soc2016/vincenzo/current/head/usr.sbin/bhyve/Makefile soc2016/vincenzo/current/head/usr.sbin/bhyve/pci_virtio_net.c Modified: soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.c ============================================================================== --- soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.c Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.c Sat Aug 20 20:22:20 2016 (r308107) @@ -883,6 +883,42 @@ } int +vm_get_fd(struct vmctx *ctx) +{ + return (ctx->fd); +} + +int +vm_map_user_buf(struct vmctx *ctx, vm_paddr_t gpa, size_t len, void *host_buf) +{ + struct vm_user_buf user_buf; + + bzero(&user_buf, sizeof(user_buf)); + user_buf.gpa = gpa; + user_buf.len = len; + user_buf.addr = host_buf; + + return (ioctl(ctx->fd, VM_MAP_USER_BUF, &user_buf)); +} + +int +vm_io_reg_handler(struct vmctx *ctx, uint16_t port, uint16_t in, uint32_t mask_data, uint32_t data, + enum vm_io_regh_type type, void *arg) +{ + struct vm_io_reg_handler ioregh; + + bzero(&ioregh, sizeof(ioregh)); + ioregh.port = port; + ioregh.in = in; + ioregh.mask_data = mask_data; + ioregh.data = data; + ioregh.type = type; + ioregh.arg = arg; + + return (ioctl(ctx->fd, VM_IO_REG_HANDLER, &ioregh)); +} + +int vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec) { Modified: soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.h ============================================================================== --- soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.h Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/lib/libvmmapi/vmmapi.h Sat Aug 20 20:22:20 2016 (r308107) @@ -161,7 +161,10 @@ int vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *i1, uint64_t *i2); int vm_set_intinfo(struct vmctx *ctx, int vcpu, uint64_t exit_intinfo); - +int vm_get_fd(struct vmctx *ctx); +int vm_map_user_buf(struct vmctx *ctx, vm_paddr_t gpa, size_t len, void *host_buf); +int vm_io_reg_handler(struct vmctx *ctx, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data, enum vm_io_regh_type type, void *arg); /* * Return a pointer to the statistics buffer. Note that this is not MT-safe. */ Modified: soc2016/vincenzo/current/head/sys/amd64/include/vmm.h ============================================================================== --- soc2016/vincenzo/current/head/sys/amd64/include/vmm.h Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/amd64/include/vmm.h Sat Aug 20 20:22:20 2016 (r308107) @@ -183,6 +183,7 @@ int vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool sysmem); void vm_free_memseg(struct vm *vm, int ident); int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); +int vm_map_usermem(struct vm *vm, vm_paddr_t gpa, size_t len, void *buf, struct thread *td); int vm_unmap_mmio(struct vm *vm, vm_paddr_t gpa, size_t len); int vm_assign_pptdev(struct vm *vm, int bus, int slot, int func); int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func); @@ -321,6 +322,7 @@ struct vatpit *vm_atpit(struct vm *vm); struct vpmtmr *vm_pmtmr(struct vm *vm); struct vrtc *vm_rtc(struct vm *vm); +struct ioregh *vm_ioregh(struct vm *vm); /* * Inject exception 'vector' into the guest vcpu. This function returns 0 on @@ -417,7 +419,13 @@ EDGE_TRIGGER, LEVEL_TRIGGER }; - + +enum vm_io_regh_type { + VM_IO_REGH_DELETE, + VM_IO_REGH_KWEVENTS, /* kernel wait events */ + VM_IO_REGH_MAX +}; + /* * The 'access' field has the format specified in Table 21-2 of the Intel * Architecture Manual vol 3b. Modified: soc2016/vincenzo/current/head/sys/amd64/include/vmm_dev.h ============================================================================== --- soc2016/vincenzo/current/head/sys/amd64/include/vmm_dev.h Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/amd64/include/vmm_dev.h Sat Aug 20 20:22:20 2016 (r308107) @@ -123,6 +123,21 @@ size_t len; }; +struct vm_user_buf { + vm_paddr_t gpa; + void *addr; + size_t len; +}; + +struct vm_io_reg_handler { + uint16_t port; /* I/O address */ + uint16_t in; /* 0 out, 1 in */ + uint32_t mask_data; /* 0 means match anything */ + uint32_t data; /* data to match */ + enum vm_io_regh_type type; /* handler type */ + void *arg; /* handler argument */ +}; + struct vm_pptdev_msi { int vcpu; int bus; @@ -286,6 +301,10 @@ IOCNUM_RTC_WRITE = 101, IOCNUM_RTC_SETTIME = 102, IOCNUM_RTC_GETTIME = 103, + + /* host mmap and IO handler */ + IOCNUM_MAP_USER_BUF = 104, + IOCNUM_IO_REG_HANDLER = 105, }; #define VM_RUN \ @@ -344,6 +363,10 @@ _IOW('v', IOCNUM_UNBIND_PPTDEV, struct vm_pptdev) #define VM_MAP_PPTDEV_MMIO \ _IOW('v', IOCNUM_MAP_PPTDEV_MMIO, struct vm_pptdev_mmio) +#define VM_MAP_USER_BUF \ + _IOW('v', IOCNUM_MAP_USER_BUF, struct vm_user_buf) +#define VM_IO_REG_HANDLER \ + _IOW('v', IOCNUM_IO_REG_HANDLER, struct vm_io_reg_handler) #define VM_PPTDEV_MSI \ _IOW('v', IOCNUM_PPTDEV_MSI, struct vm_pptdev_msi) #define VM_PPTDEV_MSIX \ Modified: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm.c ============================================================================== --- soc2016/vincenzo/current/head/sys/amd64/vmm/vmm.c Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/amd64/vmm/vmm.c Sat Aug 20 20:22:20 2016 (r308107) @@ -66,6 +66,7 @@ #include "vmm_ktr.h" #include "vmm_host.h" #include "vmm_mem.h" +#include "vmm_usermem.h" #include "vmm_util.h" #include "vatpic.h" #include "vatpit.h" @@ -148,6 +149,7 @@ struct vatpit *vatpit; /* (i) virtual atpit */ struct vpmtmr *vpmtmr; /* (i) virtual ACPI PM timer */ struct vrtc *vrtc; /* (o) virtual RTC */ + struct ioregh *ioregh; /* () I/O reg handler */ volatile cpuset_t active_cpus; /* (i) active vcpus */ int suspend; /* (i) stop VM execution */ volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */ @@ -419,6 +421,7 @@ vm->vpmtmr = vpmtmr_init(vm); if (create) vm->vrtc = vrtc_init(vm); + vm->ioregh = ioregh_init(vm); CPU_ZERO(&vm->active_cpus); @@ -475,11 +478,13 @@ vrtc_cleanup(vm->vrtc); else vrtc_reset(vm->vrtc); + ioregh_cleanup(vm->ioregh); vpmtmr_cleanup(vm->vpmtmr); vatpit_cleanup(vm->vatpit); vhpet_cleanup(vm->vhpet); vatpic_cleanup(vm->vatpic); vioapic_cleanup(vm->vioapic); + vmm_usermem_cleanup(vm->vmspace); for (i = 0; i < VM_MAXCPU; i++) vcpu_cleanup(vm, i, destroy); @@ -553,6 +558,17 @@ } int +vm_map_usermem(struct vm *vm, vm_paddr_t gpa, size_t len, void *buf, struct thread *td) +{ + vm_object_t obj; + + if ((obj = vmm_usermem_alloc(vm->vmspace, gpa, len, buf, td)) == NULL) + return (ENOMEM); + + return (0); +} + +int vm_unmap_mmio(struct vm *vm, vm_paddr_t gpa, size_t len) { @@ -588,6 +604,9 @@ if (ppt_is_mmio(vm, gpa)) return (true); /* 'gpa' is pci passthru mmio */ + if (usermem_mapped(vm->vmspace, gpa)) + return (true); /* 'gpa' is user-space buffer mapped */ + return (false); } @@ -2457,6 +2476,12 @@ return (vm->vrtc); } +struct ioregh * +vm_ioregh(struct vm *vm) +{ + return (vm->ioregh); +} + enum vm_reg_name vm_segment_name(int seg) { Modified: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_dev.c Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_dev.c Sat Aug 20 20:22:20 2016 (r308107) @@ -55,6 +55,7 @@ #include "vmm_lapic.h" #include "vmm_stat.h" #include "vmm_mem.h" +#include "vmm_ioport.h" #include "io/ppt.h" #include "io/vatpic.h" #include "io/vioapic.h" @@ -300,6 +301,8 @@ struct vm_pptdev_mmio *pptmmio; struct vm_pptdev_msi *pptmsi; struct vm_pptdev_msix *pptmsix; + struct vm_user_buf *usermem; + struct vm_io_reg_handler *ioregh; struct vm_nmi *vmnmi; struct vm_stats *vmstats; struct vm_stat_desc *statdesc; @@ -358,6 +361,7 @@ case VM_UNBIND_PPTDEV: case VM_ALLOC_MEMSEG: case VM_MMAP_MEMSEG: + case VM_MAP_USER_BUF: case VM_REINIT: /* * ioctls that operate on the entire virtual machine must @@ -433,6 +437,16 @@ pptmmio->func, pptmmio->gpa, pptmmio->len, pptmmio->hpa); break; + case VM_MAP_USER_BUF: + usermem = (struct vm_user_buf *)data; + error = vm_map_usermem(sc->vm, usermem->gpa, usermem->len, + usermem->addr, td); + break; + case VM_IO_REG_HANDLER: + ioregh = (struct vm_io_reg_handler *)data; + error = vmm_ioport_reg_handler(sc->vm, ioregh->port, ioregh->in, ioregh->mask_data, + ioregh->data, ioregh->type, ioregh->arg); + break; case VM_BIND_PPTDEV: pptdev = (struct vm_pptdev *)data; error = vm_assign_pptdev(sc->vm, pptdev->bus, pptdev->slot, Modified: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.c ============================================================================== --- soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.c Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.c Sat Aug 20 20:22:20 2016 (r308107) @@ -97,31 +97,274 @@ } #endif /* KTR */ +#ifdef VMM_IOPORT_REG_HANDLER +#include +#include +#include +#include +#include +#include + +static MALLOC_DEFINE(M_IOREGH, "ioregh", "bhyve ioport reg handlers"); + +#define IOPORT_MAX_REG_HANDLER 16 + +/* + * ioport_reg_handler functions allows us to to catch VM write/read + * on specific I/O address and send notification. + * + * When the VM writes or reads a specific value on I/O address, if the address + * and the value matches with the info stored durign the handler registration, + * then we send a notification (we can have multiple type of notification, + * but for now is implemented only the VM_IO_REGH_KWEVENTS handler. + */ + +typedef int (*ioport_reg_handler_func_t)(struct vm *vm, + struct ioport_reg_handler *regh, uint32_t *val); + +struct ioport_reg_handler { + uint16_t port; /* I/O address */ + uint16_t in; /* 0 out, 1 in */ + uint32_t mask_data; /* 0 means match anything */ + uint32_t data; /* data to match */ + ioport_reg_handler_func_t handler; /* handler pointer */ + void *handler_arg; /* handler argument */ +}; + +struct ioregh { + struct sx lock; + /* TODO: use hash table */ + struct ioport_reg_handler handlers[IOPORT_MAX_REG_HANDLER]; +}; + +/* ----- I/O reg handlers ----- */ + +/* + * VM_IO_REGH_KWEVENTS handler + * + * wakeup() on specified address that uniquely identifies the event + * + */ +static int +vmm_ioport_reg_wakeup(struct vm *vm, struct ioport_reg_handler *regh, uint32_t *val) +{ + wakeup(regh->handler_arg); + return (0); +} + +/* + * TODO: + * - VM_IO_REGH_CONDSIGNAL: pthread_cond_signal + * - VM_IO_REGH_WRITEFD: write on fd + * - VM_IO_REGH_IOCTL: ioctl on fd + */ + +/* call with ioregh->lock held */ +static struct ioport_reg_handler * +vmm_ioport_find_handler(struct ioregh *ioregh, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data) +{ + struct ioport_reg_handler *regh; + uint32_t mask; + int i; + + regh = ioregh->handlers; + for (i = 0; i < IOPORT_MAX_REG_HANDLER; i++) { + if (regh[i].handler != NULL) { + mask = regh[i].mask_data & mask_data; + if ((regh[i].port == port) && (regh[i].in == in) + && ((mask & regh[i].data) == (mask & data))) { + return ®h[i]; + } + } + } + + return (NULL); +} + +/* call with ioregh->lock held */ +static struct ioport_reg_handler * +vmm_ioport_empty_handler(struct ioregh *ioregh) +{ + struct ioport_reg_handler *regh; + int i; + + regh = ioregh->handlers; + for (i = 0; i < IOPORT_MAX_REG_HANDLER; i++) { + if (regh[i].handler == NULL) { + return ®h[i]; + } + } + + return (NULL); +} + + +static int +vmm_ioport_add_handler(struct vm *vm, uint16_t port, uint16_t in, uint32_t mask_data, + uint32_t data, ioport_reg_handler_func_t handler, void *handler_arg) +{ + struct ioport_reg_handler *regh; + struct ioregh *ioregh; + int ret = 0; + + ioregh = vm_ioregh(vm); + + sx_xlock(&ioregh->lock); + + regh = vmm_ioport_find_handler(ioregh, port, in, mask_data, data); + if (regh != NULL) { + printf("%s: handler for port %d in %d mask_data %d data %d \ + already registered\n", + __FUNCTION__, port, in, mask_data, data); + ret = EEXIST; + goto err; + } + + regh = vmm_ioport_empty_handler(ioregh); + if (regh == NULL) { + printf("%s: empty reg_handler slot not found\n", __FUNCTION__); + ret = ENOMEM; + goto err; + } + + regh->port = port; + regh->in = in; + regh->mask_data = mask_data; + regh->data = data; + regh->handler = handler; + regh->handler_arg = handler_arg; + +err: + sx_xunlock(&ioregh->lock); + return (ret); +} + +static int +vmm_ioport_del_handler(struct vm *vm, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data) +{ + struct ioport_reg_handler *regh; + struct ioregh *ioregh; + int ret = 0; + + ioregh = vm_ioregh(vm); + + sx_xlock(&ioregh->lock); + + regh = vmm_ioport_find_handler(ioregh, port, in, mask_data, data); + + if (regh == NULL) { + ret = EINVAL; + goto err; + } + + bzero(regh, sizeof(struct ioport_reg_handler)); +err: + sx_xunlock(&ioregh->lock); + return (ret); +} + +/* + * register or delete a new I/O event handler. + */ +int +vmm_ioport_reg_handler(struct vm *vm, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data, enum vm_io_regh_type type, void *arg) +{ + int ret = 0; + + switch (type) { + case VM_IO_REGH_DELETE: + ret = vmm_ioport_del_handler(vm, port, in, mask_data, data); + break; + case VM_IO_REGH_KWEVENTS: + ret = vmm_ioport_add_handler(vm, port, in, mask_data, data, + vmm_ioport_reg_wakeup, arg); + break; + default: + printf("%s: unknown reg_handler type\n", __FUNCTION__); + ret = EINVAL; + break; + } + + return (ret); +} + +/* + * Invoke an handler, if the data matches. + */ +static int +invoke_reg_handler(struct vm *vm, int vcpuid, struct vm_exit *vmexit, + uint32_t *val, int *error) +{ + struct ioport_reg_handler *regh; + struct ioregh *ioregh; + uint32_t mask_data; + + mask_data = vie_size2mask(vmexit->u.inout.bytes); + ioregh = vm_ioregh(vm); + + sx_slock(&ioregh->lock); + regh = vmm_ioport_find_handler(ioregh, vmexit->u.inout.port, + vmexit->u.inout.in, mask_data, vmexit->u.inout.eax); + if (regh != NULL) { + *error = (*(regh->handler))(vm, regh, val); + } + sx_sunlock(&ioregh->lock); + return (regh != NULL); +} + +struct ioregh * +ioregh_init(struct vm *vm) +{ + struct ioregh *ioregh; + + ioregh = malloc(sizeof(struct ioregh), M_IOREGH, M_WAITOK | M_ZERO); + sx_init(&ioregh->lock, "ioregh lock"); + + return (ioregh); +} + +void +ioregh_cleanup(struct ioregh *ioregh) +{ + sx_destroy(&ioregh->lock); + free(ioregh, M_IOREGH); +} +#else /* !VMM_IOPORT_REG_HANDLER */ +#define invoke_reg_handler(_1, _2, _3, _4, _5) (0) +#endif /* VMM_IOPORT_REG_HANDLER */ + static int emulate_inout_port(struct vm *vm, int vcpuid, struct vm_exit *vmexit, bool *retu) { ioport_handler_func_t handler; uint32_t mask, val; - int error; + int regh = 0, error = 0; /* * If there is no handler for the I/O port then punt to userspace. */ - if (vmexit->u.inout.port >= MAX_IOPORTS || - (handler = ioport_handler[vmexit->u.inout.port]) == NULL) { + if ((vmexit->u.inout.port >= MAX_IOPORTS || + (handler = ioport_handler[vmexit->u.inout.port]) == NULL) && + (regh = invoke_reg_handler(vm, vcpuid, vmexit, &val, &error)) == 0) { *retu = true; return (0); } - mask = vie_size2mask(vmexit->u.inout.bytes); + if (!regh) { + mask = vie_size2mask(vmexit->u.inout.bytes); + + if (!vmexit->u.inout.in) { + val = vmexit->u.inout.eax & mask; + } - if (!vmexit->u.inout.in) { - val = vmexit->u.inout.eax & mask; + error = (*handler)(vm, vcpuid, vmexit->u.inout.in, + vmexit->u.inout.port, vmexit->u.inout.bytes, &val); } - error = (*handler)(vm, vcpuid, vmexit->u.inout.in, - vmexit->u.inout.port, vmexit->u.inout.bytes, &val); if (error) { /* * The value returned by this function is also the return value Modified: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.h ============================================================================== --- soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.h Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_ioport.h Sat Aug 20 20:22:20 2016 (r308107) @@ -29,6 +29,22 @@ #ifndef _VMM_IOPORT_H_ #define _VMM_IOPORT_H_ +#define VMM_IOPORT_REG_HANDLER +#ifdef VMM_IOPORT_REG_HANDLER +struct ioport_reg_handler; +struct ioregh; + +struct ioregh *ioregh_init(struct vm *vm); +void ioregh_cleanup(struct ioregh *ioregh); + +int vmm_ioport_reg_handler(struct vm *vm, uint16_t port, uint16_t in, + uint32_t mask_data, uint32_t data, enum vm_io_regh_type type, void *arg); +#else /* !VMM_IOPORT_REG_HANDLER */ +#define ioregh_init(_1) (NULL) +#define ioregh_cleanup(_1) +#define vmm_ioport_reg_handler(_1, _2, _3, _4,_5, _6, _7) (EINVAL) +#endif /* VMM_IOPORT_REG_HANDLER */ + typedef int (*ioport_handler_func_t)(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *val); Added: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_usermem.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_usermem.c Sat Aug 20 20:22:20 2016 (r308107) @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2015 Stefano Garzarella (stefano.garzarella@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "vmm_mem.h" +#include "vmm_usermem.h" + +/* + * usermem functions allow us to map an host userspace buffer (eg. from bhyve) + * in the guest VM. + * + * This feature is used to implement ptnetmap on bhyve, mapping the netmap memory + * (returned by the mmap() in the byvhe userspace application) in the guest VM. + */ + +/* TODO: we can create a dynamical list of usermem */ +#define MAX_USERMEMS 64 + +static struct usermem { + struct vmspace *vmspace; /* guest address space */ + vm_paddr_t gpa; /* guest physical address */ + size_t len; +} usermems[MAX_USERMEMS]; + +static int +vmm_usermem_add(struct vmspace *vmspace, vm_paddr_t gpa, size_t len) +{ + int i; + + for (i = 0; i < MAX_USERMEMS; i++) { + if (usermems[i].len == 0) { + usermems[i].vmspace = vmspace; + usermems[i].gpa = gpa; + usermems[i].len = len; + break; + } + } + + if (i == MAX_USERMEMS) { + printf("vmm_usermem_add: empty usermem slot not found\n"); + return (ENOMEM); + } + + return 0; +} + +static int +vmm_usermem_del(struct vmspace *vmspace, vm_paddr_t gpa, size_t len) +{ + int i; + + for (i = 0; i < MAX_USERMEMS; i++) { + if (usermems[i].vmspace == vmspace && usermems[i].gpa == gpa + && usermems[i].len == len) { + bzero(&usermems[i], sizeof(struct usermem)); + return 1; + } + } + + return 0; +} + +boolean_t +usermem_mapped(struct vmspace *vmspace, vm_paddr_t gpa) +{ + int i; + + for (i = 0; i < MAX_USERMEMS; i++) { + if (usermems[i].vmspace != vmspace || usermems[i].len == 0) + continue; + if (gpa >= usermems[i].gpa && + gpa < usermems[i].gpa + usermems[i].len) + return (TRUE); + } + return (FALSE); +} + +vm_object_t +vmm_usermem_alloc(struct vmspace *vmspace, vm_paddr_t gpa, size_t len, + void *buf, struct thread *td) +{ + int error; + vm_object_t obj; + vm_map_t map; + vm_map_entry_t entry; + vm_pindex_t index; + vm_prot_t prot; + boolean_t wired; + + map = &td->td_proc->p_vmspace->vm_map; + /* lookup the vm_object that describe user addr */ + error = vm_map_lookup(&map, (unsigned long)buf, VM_PROT_RW, &entry, + &obj, &index, &prot, &wired); + + /* map th vm_object in the vmspace */ + if (obj != NULL) { + error = vm_map_find(&vmspace->vm_map, obj, index, &gpa, len, 0, + VMFS_NO_SPACE, VM_PROT_RW, VM_PROT_RW, 0); + if (error != KERN_SUCCESS) { + vm_object_deallocate(obj); + obj = NULL; + } + } + vm_map_lookup_done(map, entry); + + /* acquire the reference to the vm_object */ + if (obj != NULL) { + vm_object_reference(obj); + vmm_usermem_add(vmspace, gpa, len); + } + + return (obj); +} + +void +vmm_usermem_free(struct vmspace *vmspace, vm_paddr_t gpa, size_t len) +{ + int ret; + + ret = vmm_usermem_del(vmspace, gpa, len); + if (ret) { + //TODO check return value of vm_map_remove ? + vm_map_remove(&vmspace->vm_map, gpa, gpa + len); + //TODO should we call vm_object_deallocate ? + } +} + +void +vmm_usermem_cleanup(struct vmspace *vmspace) +{ + int i; + + for (i = 0; i < MAX_USERMEMS; i++) { + if (usermems[i].vmspace == vmspace) { + //TODO same as above + vm_map_remove(&vmspace->vm_map, usermems[i].gpa, + usermems[i].gpa + usermems[i].len); + bzero(&usermems[i], sizeof(struct usermem)); + } + } +} Added: soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_usermem.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/vincenzo/current/head/sys/amd64/vmm/vmm_usermem.h Sat Aug 20 20:22:20 2016 (r308107) @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2015 Stefano Garzarella (stefano.garzarella@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VMM_USERMEM_H_ +#define _VMM_USERMEM_H_ + +struct vm; + +struct vm_object *vmm_usermem_alloc(struct vmspace *, vm_paddr_t gpa, + size_t len, void *buf, struct thread *td); +void vmm_usermem_free(struct vmspace *, vm_paddr_t gpa, size_t len); +void vmm_usermem_cleanup(struct vmspace *); +boolean_t usermem_mapped(struct vmspace *, vm_paddr_t gpa); + +#endif Modified: soc2016/vincenzo/current/head/sys/conf/files ============================================================================== --- soc2016/vincenzo/current/head/sys/conf/files Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/conf/files Sat Aug 20 20:22:20 2016 (r308107) @@ -2166,6 +2166,7 @@ dev/ncr/ncr.c optional ncr pci dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard +dev/netmap/if_ptnet.c optional netmap dev/netmap/netmap.c optional netmap dev/netmap/netmap_freebsd.c optional netmap dev/netmap/netmap_generic.c optional netmap @@ -2175,6 +2176,7 @@ dev/netmap/netmap_offloadings.c optional netmap dev/netmap/netmap_pipe.c optional netmap dev/netmap/netmap_vale.c optional netmap +dev/netmap/ptnetmap.c optional netmap # compile-with "${NORMAL_C} -Wconversion -Wextra" dev/nfsmb/nfsmb.c optional nfsmb pci dev/nge/if_nge.c optional nge Modified: soc2016/vincenzo/current/head/sys/dev/netmap/if_ixl_netmap.h ============================================================================== --- soc2016/vincenzo/current/head/sys/dev/netmap/if_ixl_netmap.h Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/dev/netmap/if_ixl_netmap.h Sat Aug 20 20:22:20 2016 (r308107) @@ -59,7 +59,7 @@ /* * device-specific sysctl variables: * - * ixl_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ixl_crcstrip: 0: NIC keeps CRC in rx frames (default), 1: NIC strips it. * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. @@ -74,7 +74,7 @@ int ixl_rx_miss, ixl_rx_miss_bufs, ixl_crcstrip = 1; #if 0 SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_crcstrip, - CTLFLAG_RW, &ixl_crcstrip, 1, "strip CRC on rx frames"); + CTLFLAG_RW, &ixl_crcstrip, 1, "NIC strips CRC on rx frames"); #endif SYSCTL_INT(_dev_netmap, OID_AUTO, ixl_rx_miss, CTLFLAG_RW, &ixl_rx_miss, 0, "potentially missed rx intr"); Modified: soc2016/vincenzo/current/head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- soc2016/vincenzo/current/head/sys/dev/netmap/if_lem_netmap.h Sat Aug 20 19:48:03 2016 (r308106) +++ soc2016/vincenzo/current/head/sys/dev/netmap/if_lem_netmap.h Sat Aug 20 20:22:20 2016 (r308107) @@ -38,6 +38,10 @@ #include #include /* vtophys ? */ #include +#ifdef WITH_PTNETMAP_GUEST +#include +#endif +#include extern int netmap_adaptive_io; @@ -80,6 +84,20 @@ return (ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1); } +static void +lem_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + + EM_CORE_LOCK(adapter); + if (onoff) { + lem_enable_intr(adapter); + } else { + lem_disable_intr(adapter); + } + EM_CORE_UNLOCK(adapter); +} /* * Reconcile kernel and user view of the transmit ring. @@ -470,6 +488,176 @@ return netmap_ring_reinit(kring); } +#if defined (NIC_PTNETMAP) && defined (WITH_PTNETMAP_GUEST) +/* + * ptnetmap support for: lem (FreeBSD version) + * + * For details on ptnetmap support please see if_vtnet_netmap.h + */ +static uint32_t lem_ptnetmap_ptctl(struct ifnet *, uint32_t); + +/* Returns device configuration from the CSB */ +static int +lem_ptnetmap_config(struct netmap_adapter *na, + u_int *txr, u_int *txd, u_int *rxr, u_int *rxd) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + struct paravirt_csb *csb = adapter->csb; + int ret; + + if (csb == NULL) + return EINVAL; + + ret = lem_ptnetmap_ptctl(ifp, PTNETMAP_PTCTL_CONFIG); + if (ret) + return ret; + + *txr = 1; //*txr = csb->num_tx_rings; + *rxr = 1; //*rxr = csb->num_rx_rings; + *txd = csb->num_tx_slots; + *rxd = csb->num_rx_slots; + + D("txr %u rxr %u txd %u rxd %u", + *txr, *rxr, *txd, *rxd); + + return 0; +} + +/* Reconcile host and guest view of the transmit ring. */ +static int +lem_ptnetmap_txsync(struct netmap_kring *kring, int flags) +{ + struct netmap_adapter *na = kring->na; + //u_int ring_nr = kring->ring_id; + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + bool notify; + + notify = netmap_pt_guest_txsync(&adapter->csb->tx_ring, kring, flags); + if (notify) + E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), 0); + + return 0; +} + +/* Reconcile host and guest view of the receive ring. */ +static int +lem_ptnetmap_rxsync(struct netmap_kring *kring, int flags) +{ + struct netmap_adapter *na = kring->na; + //u_int ring_nr = kring->ring_id; + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + bool notify; + + notify = netmap_pt_guest_rxsync(&adapter->csb->rx_ring, kring, flags); + if (notify) + E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), 0); + + return 0; +} + +/* Register/unregister. We are already under netmap lock. */ +static int +lem_ptnetmap_reg(struct netmap_adapter *na, int onoff) +{ + struct ifnet *ifp = na->ifp; + struct adapter *adapter = ifp->if_softc; + struct paravirt_csb *csb = adapter->csb; + struct netmap_kring *kring; + int ret; + + if (onoff) { + ret = lem_ptnetmap_ptctl(ifp, PTNETMAP_PTCTL_REGIF); + if (ret) + return ret; + + na->na_flags |= NAF_NETMAP_ON; + adapter->ptnetmap_enabled = 1; + /* + * Init ring and kring pointers + * After PARAVIRT_PTCTL_REGIF, the csb contains a snapshot of a + * host kring pointers. + * XXX This initialization is required, because we don't close + * the host port on UNREGIF. + */ + + // Init rx ring + kring = na->rx_rings; + kring->rhead = kring->ring->head = csb->rx_ring.head; + kring->rcur = kring->ring->cur = csb->rx_ring.cur; + kring->nr_hwcur = csb->rx_ring.hwcur; + kring->nr_hwtail = kring->rtail = kring->ring->tail = + csb->rx_ring.hwtail; + + // Init tx ring + kring = na->tx_rings; + kring->rhead = kring->ring->head = csb->tx_ring.head; + kring->rcur = kring->ring->cur = csb->tx_ring.cur; + kring->nr_hwcur = csb->tx_ring.hwcur; + kring->nr_hwtail = kring->rtail = kring->ring->tail = + csb->tx_ring.hwtail; + } else { + na->na_flags &= ~NAF_NETMAP_ON; + adapter->ptnetmap_enabled = 0; + ret = lem_ptnetmap_ptctl(ifp, PTNETMAP_PTCTL_UNREGIF); + } + + return lem_netmap_reg(na, onoff); +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***