From owner-svn-soc-all@freebsd.org Sun Aug 21 10:14:16 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 4DE1CBB91DA for ; Sun, 21 Aug 2016 10:14:16 +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 40F611D32 for ; Sun, 21 Aug 2016 10:14:16 +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 u7LAEGn7006748 for ; Sun, 21 Aug 2016 10:14:16 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7LAEFwr006746 for svn-soc-all@FreeBSD.org; Sun, 21 Aug 2016 10:14:15 GMT (envelope-from vincenzo@FreeBSD.org) Date: Sun, 21 Aug 2016 10:14:15 GMT Message-Id: <201608211014.u7LAEFwr006746@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: r308122 - 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: Sun, 21 Aug 2016 10:14:16 -0000 Author: vincenzo Date: Sun Aug 21 10:14:15 2016 New Revision: 308122 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308122 Log: update README with test info Modified: soc2016/vincenzo/README Modified: soc2016/vincenzo/README ============================================================================== --- soc2016/vincenzo/README Sun Aug 21 09:32:20 2016 (r308121) +++ soc2016/vincenzo/README Sun Aug 21 10:14:15 2016 (r308122) @@ -271,6 +271,13 @@ https://svnweb.freebsd.org/socsvn/soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.c?view=markup +The backend of each ptnet NIC is a (different) port of the same VALE switch, so that the two VMs are on the same (virtual) LAN. +With this testbed I could test the unidirectional throughput of netmap and socket network applications, with one VM being +the sender and the other one being the receiver. To test netmap applications I used pkt-gen, and I measured about 25 Mpps at +minimum packet size (60 bytes). To test socket applications, I used the popular netperf tool, and in particular +the TCP_STREAM test, which reports about 15 Gbps. + + Example on how to use various NICs (including ptnet) with bhyve VMs: # bhyve ‐A ‐H ‐P ‐m 1G \ From owner-svn-soc-all@freebsd.org Mon Aug 22 10:17: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 81234BC0187 for ; Mon, 22 Aug 2016 10:17: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 73EAA180F for ; Mon, 22 Aug 2016 10:17: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 u7MAHbjl002177 for ; Mon, 22 Aug 2016 10:17:37 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MAHZim002130 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 10:17:35 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 10:17:35 GMT Message-Id: <201608221017.u7MAHZim002130@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: r308162 - 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, 22 Aug 2016 10:17:37 -0000 Author: yuanxunzhang Date: Mon Aug 22 10:17:34 2016 New Revision: 308162 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308162 Log: EAPS: set hellotime and failtime 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 soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 08:00:14 2016 (r308161) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 10:17:34 2016 (r308162) @@ -75,6 +75,8 @@ 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 *); +void set_eaps_hellotime(struct eaps_softc *, struct eaps_state *); +void set_eaps_failtime(struct eaps_softc *, struct eaps_state *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) @@ -217,6 +219,14 @@ case SIOCSEAPSPRI: set_eaps_priority(sc, es); break; + + case SIOCSEAPSHELLO: + set_eaps_hellotime(sc, es); + break; + + case SIOCSEAPSFAIL: + set_eaps_failtime(sc, es); + break; default: error = ether_ioctl(ifp, cmd, data); break; @@ -280,6 +290,22 @@ EAPS_WUNLOCK(sc); } +void +set_eaps_hellotime(struct eaps_softc *sc, struct eaps_state *es) +{ + EAPS_WLOCK(sc); + sc->sc_eaps.hellotime = es->hellotime; + EAPS_WUNLOCK(sc); +} + +void +set_eaps_failtime(struct eaps_softc *sc, struct eaps_state *es) +{ + EAPS_WLOCK(sc); + sc->sc_eaps.failtime = es->failtime; + EAPS_WUNLOCK(sc); +} + void eaps_attach(struct eaps_softc *sc) { @@ -289,6 +315,8 @@ sc->sc_eaps.status = EAPS_STATUS_NOT_ACTIVE; sc->sc_eaps.mode = EAPS_MODE_TRANSIT; sc->sc_eaps.priority = EAPS_PRIORITY_NORMAL; + sc->sc_eaps.hellotime = EAPS_HELLO_TIME_DEFAULT; + sc->sc_eaps.failtime = EAPS_FAIL_TIME_DEFAULT; EAPS_WUNLOCK(sc); } Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 22 08:00:14 2016 (r308161) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 22 10:17:34 2016 (r308162) @@ -31,15 +31,18 @@ #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 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 */ + 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 */ + uint16_t hellotime; /* hello time is set by master node for sending health check message */ + uint16_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ }; /* @@ -56,6 +59,9 @@ #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) #define SIOCSEAPSMODE _IOW('i', 301, struct eaps_state) #define SIOCSEAPSPRI _IOW('i', 302, struct eaps_state) +#define SIOCSEAPSHELLO _IOW('i', 303, struct eaps_state) +#define SIOCSEAPSFAIL _IOW('i', 304, struct eaps_state) + /* * Extreme Active Protection System (EAPS) definitions. * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] @@ -163,6 +169,9 @@ #define EAPS_PRIORITY_NORMAL 0x00 /* EAPS domain priority - normal */ #define EAPS_PRIORITY_HIGH 0x01 /* EAPS domain priority - high (default) */ +#define EAPS_HELLO_TIME_DEFAULT 1000 /* EAPS hello time default value 1000 milliseconds */ +#define EAPS_FAIL_TIME_DEFAULT 3000 /* EAPS fail time default value 3000 milliseconds */ + #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 Mon Aug 22 08:00:14 2016 (r308161) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 10:17:34 2016 (r308162) @@ -99,6 +99,8 @@ 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 set_eaps_hellotime(int, char **, int); +static void set_eaps_failtime(int, char **, int); static void usage(const char *); void load_module(const char *); @@ -130,6 +132,8 @@ case K_PRIORITY: set_eaps_priority(argc, argv, s); break; + case K_HELLOTIME: + set_eaps_hellotime(argc, argv, s); } usage(*argv); return retval; @@ -223,6 +227,8 @@ 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]); + printf("\thellotime: %s\n", es.hellotime); + printf("\tfailtime: %s\n", es.failtime); } else { printf("Debug print: ioctl failed!\n"); err(1, "SIOCSEAPSDOMAIN"); @@ -299,6 +305,74 @@ exit(error); } +static void +set_eaps_hellotime(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!"); + } + + uint16_t hellotime = atio(*(++argv)); + printf("Debug print: set_eaps_failtime %d!\n", hellotime); + + // hellotime must be greater than 0 + if (hellotime <= 0) + { + err(1, "invalid hellotime, hellotime must be greater than 0"); + } + + es.hellotime = hellotime; + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + if (ioctl(s, SIOCSEAPSHELLO, &es) != 0) + err(1, "SIOCSEAPSHELLO"); + + exit(error); +} + +static void +set_eaps_failtime(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!"); + } + + uint16_t failtime = atio(*(++argv)); + printf("Debug print: set_eaps_failtime %d!\n", failtime); + + // get current value of hellotime, because failtime must be greater than hellotime + if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { + if (failtime <= es.hellotime) { + err(1, "invalid failtime, failtime must be greater than hellotime"); + } + }else { + printf("Debug print: ioctl failed!\n"); + err(1, "SIOCSEAPSDOMAIN"); + } + + es.failtime = failtime; + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + if (ioctl(s, SIOCSEAPSFAIL, &es) != 0) + err(1, "SIOCSEAPSFAIL"); + + 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 Mon Aug 22 08:00:14 2016 (r308161) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 22 10:17:34 2016 (r308162) @@ -42,13 +42,14 @@ * eaps state information */ struct eaps_state { - 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 */ + 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 */ + uint16_t hellotime; /* hello time is set by master node for sending health check message */ + uint16_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ }; - /* * EAPS ring status states (active or not active) */ @@ -64,4 +65,6 @@ #define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) #define SIOCSEAPSMODE _IOW('i', 301, struct eaps_state) #define SIOCSEAPSPRI _IOW('i', 302, struct eaps_state) +#define SIOCSEAPSHELLO _IOW('i', 303, struct eaps_state) +#define SIOCSEAPSFAIL _IOW('i', 304, struct eaps_state) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Mon Aug 22 08:00:14 2016 (r308161) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Mon Aug 22 10:17:34 2016 (r308162) @@ -6,4 +6,5 @@ show mode priority - +hellotime +failtime From owner-svn-soc-all@freebsd.org Mon Aug 22 10:22:04 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 E4C47BC04CF for ; Mon, 22 Aug 2016 10:22:04 +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 D7C3B1E01 for ; Mon, 22 Aug 2016 10:22:04 +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 u7MAM4ot014494 for ; Mon, 22 Aug 2016 10:22:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MAM4s0014491 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 10:22:04 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 10:22:04 GMT Message-Id: <201608221022.u7MAM4s0014491@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: r308163 - 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, 22 Aug 2016 10:22:05 -0000 Author: yuanxunzhang Date: Mon Aug 22 10:22:03 2016 New Revision: 308163 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308163 Log: EAPS: set hellotime and failtime interfaces 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 22 10:17:34 2016 (r308162) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 10:22:03 2016 (r308163) @@ -227,8 +227,8 @@ 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]); - printf("\thellotime: %s\n", es.hellotime); - printf("\tfailtime: %s\n", es.failtime); + printf("\thellotime: %d\n", es.hellotime); + printf("\tfailtime: %d\n", es.failtime); } else { printf("Debug print: ioctl failed!\n"); err(1, "SIOCSEAPSDOMAIN"); @@ -320,8 +320,8 @@ err(1, "EAPS domain name is NULL!"); } - uint16_t hellotime = atio(*(++argv)); - printf("Debug print: set_eaps_failtime %d!\n", hellotime); + uint16_t hellotime = atoi(*(++argv)); + printf("Debug print: set_eaps_hellotime %d!\n", hellotime); // hellotime must be greater than 0 if (hellotime <= 0) From owner-svn-soc-all@freebsd.org Mon Aug 22 10:24:20 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 5B1FCBC0564 for ; Mon, 22 Aug 2016 10:24:20 +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 4E6221EB2 for ; Mon, 22 Aug 2016 10:24:20 +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 u7MAOKWb018117 for ; Mon, 22 Aug 2016 10:24:20 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MAOJk4018101 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 10:24:19 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 10:24:19 GMT Message-Id: <201608221024.u7MAOJk4018101@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: r308164 - 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, 22 Aug 2016 10:24:20 -0000 Author: yuanxunzhang Date: Mon Aug 22 10:24:19 2016 New Revision: 308164 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308164 Log: EAPS: fix bug 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 22 10:22:03 2016 (r308163) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 10:24:19 2016 (r308164) @@ -352,7 +352,7 @@ err(1, "EAPS domain name is NULL!"); } - uint16_t failtime = atio(*(++argv)); + uint16_t failtime = atoi(*(++argv)); printf("Debug print: set_eaps_failtime %d!\n", failtime); // get current value of hellotime, because failtime must be greater than hellotime From owner-svn-soc-all@freebsd.org Mon Aug 22 10:39: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 884DABC09DD for ; Mon, 22 Aug 2016 10:39: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 7B99015BF for ; Mon, 22 Aug 2016 10:39: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 u7MAdABw045215 for ; Mon, 22 Aug 2016 10:39:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MAd9XE045212 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 10:39:09 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 10:39:09 GMT Message-Id: <201608221039.u7MAd9XE045212@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: r308165 - 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, 22 Aug 2016 10:39:10 -0000 Author: yuanxunzhang Date: Mon Aug 22 10:39:09 2016 New Revision: 308165 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308165 Log: EAPS: fix bug 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 22 10:24:19 2016 (r308164) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 10:39:09 2016 (r308165) @@ -320,7 +320,7 @@ err(1, "EAPS domain name is NULL!"); } - uint16_t hellotime = atoi(*(++argv)); + int16_t hellotime = atoi(*(++argv)); printf("Debug print: set_eaps_hellotime %d!\n", hellotime); // hellotime must be greater than 0 @@ -352,7 +352,7 @@ err(1, "EAPS domain name is NULL!"); } - uint16_t failtime = atoi(*(++argv)); + int16_t failtime = atoi(*(++argv)); printf("Debug print: set_eaps_failtime %d!\n", failtime); // get current value of hellotime, because failtime must be greater than hellotime From owner-svn-soc-all@freebsd.org Mon Aug 22 10:58:21 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 00320BC1112 for ; Mon, 22 Aug 2016 10:58:21 +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 D924516D8 for ; Mon, 22 Aug 2016 10:58:20 +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 u7MAwKjr087306 for ; Mon, 22 Aug 2016 10:58:20 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MAwJBB087279 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 10:58:19 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 10:58:19 GMT Message-Id: <201608221058.u7MAwJBB087279@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: r308166 - 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, 22 Aug 2016 10:58:21 -0000 Author: yuanxunzhang Date: Mon Aug 22 10:58:18 2016 New Revision: 308166 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308166 Log: EAPS: change the type of variable Modified: 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.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 22 10:39:09 2016 (r308165) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 22 10:58:18 2016 (r308166) @@ -41,8 +41,8 @@ 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 */ - uint16_t hellotime; /* hello time is set by master node for sending health check message */ - uint16_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ + int32_t hellotime; /* hello time is set by master node for sending health check message */ + int32_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ }; /* Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 10:39:09 2016 (r308165) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 10:58:18 2016 (r308166) @@ -320,7 +320,7 @@ err(1, "EAPS domain name is NULL!"); } - int16_t hellotime = atoi(*(++argv)); + int32_t hellotime = atoi(*(++argv)); printf("Debug print: set_eaps_hellotime %d!\n", hellotime); // hellotime must be greater than 0 @@ -352,7 +352,7 @@ err(1, "EAPS domain name is NULL!"); } - int16_t failtime = atoi(*(++argv)); + int32_t failtime = atoi(*(++argv)); printf("Debug print: set_eaps_failtime %d!\n", failtime); // get current value of hellotime, because failtime must be greater than hellotime Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 22 10:39:09 2016 (r308165) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 22 10:58:18 2016 (r308166) @@ -47,9 +47,10 @@ 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 */ - uint16_t hellotime; /* hello time is set by master node for sending health check message */ - uint16_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ + int32_t hellotime; /* hello time is set by master node for sending health check message */ + int32_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ }; + /* * EAPS ring status states (active or not active) */ From owner-svn-soc-all@freebsd.org Mon Aug 22 11:12: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 149CCBC1DBF for ; Mon, 22 Aug 2016 11:12: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 07B3416B6 for ; Mon, 22 Aug 2016 11:12: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 u7MBCVoC059900 for ; Mon, 22 Aug 2016 11:12:31 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MBCV4b059828 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 11:12:31 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 11:12:31 GMT Message-Id: <201608221112.u7MBCV4b059828@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: r308170 - 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: Mon, 22 Aug 2016 11:12:32 -0000 Author: yuanxunzhang Date: Mon Aug 22 11:12:30 2016 New Revision: 308170 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308170 Log: EAPS: fix the bug Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 10:50:30 2016 (r308169) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 11:12:30 2016 (r308170) @@ -268,6 +268,8 @@ es->status = sc->sc_eaps.status; es->mode = sc->sc_eaps.mode; es->priority = sc->sc_eaps.priority; + es->hellotime = sc->sc_eaps.hellotime; + es->failtime = sc->sc_eaps.failtime; (void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname)); EAPS_RUNLOCK(sc, &tracker); } From owner-svn-soc-all@freebsd.org Mon Aug 22 15:08: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 98FE3BC2E47 for ; Mon, 22 Aug 2016 15:08: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 8C4C91AA8 for ; Mon, 22 Aug 2016 15:08: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 u7MF8Ap7021579 for ; Mon, 22 Aug 2016 15:08:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MF89CM021480 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 15:08:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 15:08:10 GMT Message-Id: <201608221508.u7MF89CM021480@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: r308177 - 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, 22 Aug 2016 15:08:10 -0000 Author: yuanxunzhang Date: Mon Aug 22 15:08:09 2016 New Revision: 308177 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308177 Log: EAPS: fix set_eaps_hellotime bugs 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 22 14:53:39 2016 (r308176) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 15:08:09 2016 (r308177) @@ -134,6 +134,10 @@ break; case K_HELLOTIME: set_eaps_hellotime(argc, argv, s); + break; + case K_FAILTIME: + set_eaps_failtime(argc, argv, s); + break; } usage(*argv); return retval; @@ -227,8 +231,8 @@ 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]); - printf("\thellotime: %d\n", es.hellotime); - printf("\tfailtime: %d\n", es.failtime); + printf("\thellotime: %d (milliseconds)\n", es.hellotime); + printf("\tfailtime: %d (milliseconds)\n", es.failtime); } else { printf("Debug print: ioctl failed!\n"); err(1, "SIOCSEAPSDOMAIN"); @@ -323,10 +327,14 @@ int32_t hellotime = atoi(*(++argv)); printf("Debug print: set_eaps_hellotime %d!\n", hellotime); - // hellotime must be greater than 0 - if (hellotime <= 0) - { - err(1, "invalid hellotime, hellotime must be greater than 0"); + // get current value of failtime, because hellotime must be greater than failtime + if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { + if (hellotime >= es.failtime) { + err(1, "invalid failtime, hellotime must be greater than failtime"); + } + }else { + printf("Debug print: ioctl failed!\n"); + err(1, "SIOCSEAPSDOMAIN"); } es.hellotime = hellotime; From owner-svn-soc-all@freebsd.org Mon Aug 22 15:38: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 C1115BC2469 for ; Mon, 22 Aug 2016 15:38: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 B438E1A58 for ; Mon, 22 Aug 2016 15:38: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 u7MFceox059027 for ; Mon, 22 Aug 2016 15:38:40 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MFceZb059016 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 15:38:40 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 15:38:40 GMT Message-Id: <201608221538.u7MFceZb059016@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: r308178 - 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, 22 Aug 2016 15:38:40 -0000 Author: yuanxunzhang Date: Mon Aug 22 15:38:39 2016 New Revision: 308178 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308178 Log: EAPS: fix set_eaps_hellotime bugs 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 22 15:08:09 2016 (r308177) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 15:38:39 2016 (r308178) @@ -328,6 +328,7 @@ printf("Debug print: set_eaps_hellotime %d!\n", hellotime); // get current value of failtime, because hellotime must be greater than failtime + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { if (hellotime >= es.failtime) { err(1, "invalid failtime, hellotime must be greater than failtime"); @@ -337,6 +338,7 @@ err(1, "SIOCSEAPSDOMAIN"); } + bzero(&es, sizeof(es)); es.hellotime = hellotime; strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSHELLO, &es) != 0) @@ -364,6 +366,7 @@ printf("Debug print: set_eaps_failtime %d!\n", failtime); // get current value of hellotime, because failtime must be greater than hellotime + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { if (failtime <= es.hellotime) { err(1, "invalid failtime, failtime must be greater than hellotime"); @@ -373,6 +376,7 @@ err(1, "SIOCSEAPSDOMAIN"); } + bzero(&es, sizeof(es)); es.failtime = failtime; strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSFAIL, &es) != 0) From owner-svn-soc-all@freebsd.org Mon Aug 22 15:54: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 2EEEEBC2D28 for ; Mon, 22 Aug 2016 15:54: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 1DF8B1C6B for ; Mon, 22 Aug 2016 15:54: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 u7MFsmjG096422 for ; Mon, 22 Aug 2016 15:54:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MFsm5Y096395 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 15:54:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 15:54:48 GMT Message-Id: <201608221554.u7MFsm5Y096395@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: r308179 - 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, 22 Aug 2016 15:54:49 -0000 Author: yuanxunzhang Date: Mon Aug 22 15:54:47 2016 New Revision: 308179 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308179 Log: EAPS: fix set_eaps_hellotime bugs 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 22 15:38:39 2016 (r308178) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 15:54:47 2016 (r308179) @@ -331,7 +331,7 @@ strlcpy(es.ifname, domain_name, sizeof(es.ifname)); if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) { if (hellotime >= es.failtime) { - err(1, "invalid failtime, hellotime must be greater than failtime"); + err(1, "invalid hellotime, hellotime must be smaller than failtime"); } }else { printf("Debug print: ioctl failed!\n"); From owner-svn-soc-all@freebsd.org Mon Aug 22 17:52: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 3D77FBC2850 for ; Mon, 22 Aug 2016 17:52: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 0981F1CA2 for ; Mon, 22 Aug 2016 17:52: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 u7MHqGh6029773 for ; Mon, 22 Aug 2016 17:52:16 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MHqFRK029755 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 17:52:15 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 17:52:15 GMT Message-Id: <201608221752.u7MHqFRK029755@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: r308188 - 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, 22 Aug 2016 17:52:17 -0000 Author: yuanxunzhang Date: Mon Aug 22 17:52:15 2016 New Revision: 308188 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308188 Log: EAPS: add check domain exists Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 16:39:51 2016 (r308187) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 17:52:15 2016 (r308188) @@ -101,6 +101,8 @@ static void set_eaps_priority(int, char **, int); static void set_eaps_hellotime(int, char **, int); static void set_eaps_failtime(int, char **, int); +static void set_eaps_primary_port(int, char **, int); +static void set_eaps_secondary_port(int, char **, int); static void usage(const char *); void load_module(const char *); @@ -138,6 +140,12 @@ case K_FAILTIME: set_eaps_failtime(argc, argv, s); break; + case K_PRIMARY: + set_eaps_primary_port(argc, argv, s); + break; + case K_SECONDARY: + set_eaps_secondary_port(argc, argv, s); + break; } usage(*argv); return retval; @@ -290,6 +298,12 @@ err(1, "EAPS domain name is NULL!"); } + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "EAPS domain %s does not exist", domain_name); + } + char *priority = *(++argv); printf("Debug print: set priority mode is %s!\n", priority); @@ -386,6 +400,28 @@ } static void +set_eaps_primary_port(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!"); + } +} + +static void +set_eaps_secondary_port(int argc, char **argv, int s) +{ + +} + +static void usage(const char *cp) { if (cp != NULL) Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Mon Aug 22 16:39:51 2016 (r308187) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Mon Aug 22 17:52:15 2016 (r308188) @@ -8,3 +8,5 @@ priority hellotime failtime +primary +secondary From owner-svn-soc-all@freebsd.org Mon Aug 22 17:54: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 8EABFBC29A4 for ; Mon, 22 Aug 2016 17:54: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 81E7B13E4 for ; Mon, 22 Aug 2016 17:54: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 u7MHsROM032738 for ; Mon, 22 Aug 2016 17:54:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MHsQac032683 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 17:54:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 17:54:26 GMT Message-Id: <201608221754.u7MHsQac032683@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: r308189 - 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, 22 Aug 2016 17:54:27 -0000 Author: yuanxunzhang Date: Mon Aug 22 17:54:26 2016 New Revision: 308189 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308189 Log: EAPS: fix compile errors 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 22 17:52:15 2016 (r308188) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 17:54:26 2016 (r308189) @@ -402,8 +402,6 @@ static void set_eaps_primary_port(int argc, char **argv, int s) { - int error = 0; - struct eaps_state es; bzero(&es, sizeof(es)); From owner-svn-soc-all@freebsd.org Mon Aug 22 20:17: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 7F924BC277F for ; Mon, 22 Aug 2016 20:17: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 722E411EF for ; Mon, 22 Aug 2016 20:17: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 u7MKH1ZI040671 for ; Mon, 22 Aug 2016 20:17:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKGxQj040602 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:16:59 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:16:59 GMT Message-Id: <201608222016.u7MKGxQj040602@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: r308210 - 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, 22 Aug 2016 20:17:01 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:16:58 2016 New Revision: 308210 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308210 Log: EAPS: implement add primary/secondary port 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 Mon Aug 22 19:58:42 2016 (r308209) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:16:58 2016 (r308210) @@ -72,11 +72,13 @@ static void eaps_init(void *); 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 *); -void set_eaps_hellotime(struct eaps_softc *, struct eaps_state *); -void set_eaps_failtime(struct eaps_softc *, struct eaps_state *); +int eaps_status(struct eaps_softc *, struct eaps_state *); +int set_eaps_mode(struct eaps_softc *, struct eaps_state *); +int set_eaps_priority(struct eaps_softc *, struct eaps_state *); +int set_eaps_hellotime(struct eaps_softc *, struct eaps_state *); +int set_eaps_failtime(struct eaps_softc *, struct eaps_state *); +int set_eaps_primary_port(struct eaps_softc *, struct eaps_state *); +int set_eaps_secondary_port(struct eaps_softc *, struct eaps_state *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) @@ -209,23 +211,23 @@ switch (cmd) { case SIOCSEAPSDOMAIN: - eaps_status(sc, es); + error = eaps_status(sc, es); break; case SIOCSEAPSMODE: - set_eaps_mode(sc, es); + error = set_eaps_mode(sc, es); break; case SIOCSEAPSPRI: - set_eaps_priority(sc, es); + error = set_eaps_priority(sc, es); break; case SIOCSEAPSHELLO: - set_eaps_hellotime(sc, es); + error = set_eaps_hellotime(sc, es); break; case SIOCSEAPSFAIL: - set_eaps_failtime(sc, es); + error = set_eaps_failtime(sc, es); break; default: error = ether_ioctl(ifp, cmd, data); @@ -258,7 +260,7 @@ } -void +int eaps_status(struct eaps_softc *sc, struct eaps_state *es) { printf("Debug print: Query eaps domain status!\n"); @@ -272,42 +274,81 @@ es->failtime = sc->sc_eaps.failtime; (void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname)); EAPS_RUNLOCK(sc, &tracker); + + reutrn (0); } -void +int 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); + reutrn (0); } -void +int 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); + reutrn (0); } -void +int set_eaps_hellotime(struct eaps_softc *sc, struct eaps_state *es) { EAPS_WLOCK(sc); sc->sc_eaps.hellotime = es->hellotime; EAPS_WUNLOCK(sc); + + reutrn (0); } -void +int set_eaps_failtime(struct eaps_softc *sc, struct eaps_state *es) { EAPS_WLOCK(sc); sc->sc_eaps.failtime = es->failtime; EAPS_WUNLOCK(sc); + + reutrn (0); } +int +set_eaps_primary_port(struct eaps_softc *sc, struct eaps_state *es) +{ + int error = 0; + + char p_port[IFNAMSIZ] = NULL; + (void) strlcpy(p_port, es->p_port, sizeof(es->p_port)); + + struct rm_priotracker tracker; + EAPS_RLOCK(sc, &tracker); + + // If the primary port has already used for secondary port, return error + if (sc->sc_eaps.s_port == p_port) { + return ENODEV; + } + EAPS_RUNLOCK(sc, &tracker); + + EAPS_WLOCK(sc); + sc->sc_eaps.p_port = p_port + EAPS_WUNLOCK(sc); + + reutrn (0); +} + +int +set_eaps_secondary_port(struct eaps_softc *sc, struct eaps_state *es) +{ + reutrn (0); +} + + void eaps_attach(struct eaps_softc *sc) { @@ -319,6 +360,8 @@ sc->sc_eaps.priority = EAPS_PRIORITY_NORMAL; sc->sc_eaps.hellotime = EAPS_HELLO_TIME_DEFAULT; sc->sc_eaps.failtime = EAPS_FAIL_TIME_DEFAULT; + sc->sc_eaps.p_port = NULL; + sc->sc_eaps.s_port = NULL; EAPS_WUNLOCK(sc); } Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 22 19:58:42 2016 (r308209) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Aug 22 20:16:58 2016 (r308210) @@ -36,13 +36,15 @@ * eaps state information */ struct eaps_state { - 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 */ - int32_t hellotime; /* hello time is set by master node for sending health check message */ - int32_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ + 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 */ + int32_t hellotime; /* hello time is set by master node for sending health check message */ + int32_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ + char p_port[IFNAMSIZ]; /* primary port of this eaps node, which is valid when it's master node */ + char s_port[IFNAMSIZ]; /* secondary port of this eaps node, which is valid for master and transit */ }; /* @@ -61,7 +63,8 @@ #define SIOCSEAPSPRI _IOW('i', 302, struct eaps_state) #define SIOCSEAPSHELLO _IOW('i', 303, struct eaps_state) #define SIOCSEAPSFAIL _IOW('i', 304, struct eaps_state) - +#define SIOCESAPSPRIMARY _IOW('i', 305, struct eaps_state) +#define SIOCESAPSSECONDARY _IOW('i', 306, 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 Mon Aug 22 19:58:42 2016 (r308209) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:16:58 2016 (r308210) @@ -241,6 +241,21 @@ printf("\tpriority: %s\n", eaps_priority_message[es.priority]); printf("\thellotime: %d (milliseconds)\n", es.hellotime); printf("\tfailtime: %d (milliseconds)\n", es.failtime); + + if (es.p_port == NULL) + { + printf("\tprimary port: not assigned\n"); + } else { + printf("\tprimary port: %s\n", es.p_port); + } + + if (es.s_port == NULL) + { + printf("\tsecondary port: not assigned\n"); + } else { + printf("\tsecondary port: %s\n", es.s_port); + } + } else { printf("Debug print: ioctl failed!\n"); err(1, "SIOCSEAPSDOMAIN"); @@ -264,6 +279,12 @@ err(1, "EAPS domain name is NULL!"); } + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "EAPS domain %s does not exist", domain_name); + } + char *mode = *(++argv); printf("Debug print: set switch mode is %s!\n", mode); @@ -338,6 +359,12 @@ err(1, "EAPS domain name is NULL!"); } + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "EAPS domain %s does not exist", domain_name); + } + int32_t hellotime = atoi(*(++argv)); printf("Debug print: set_eaps_hellotime %d!\n", hellotime); @@ -376,6 +403,12 @@ err(1, "EAPS domain name is NULL!"); } + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "EAPS domain %s does not exist", domain_name); + } + int32_t failtime = atoi(*(++argv)); printf("Debug print: set_eaps_failtime %d!\n", failtime); @@ -402,15 +435,39 @@ static void set_eaps_primary_port(int argc, char **argv, int s) { + int error = 0; + struct eaps_state es; bzero(&es, sizeof(es)); + // get eaps domain name char *domain_name = *(++argv); // check eaps domain name if (domain_name == NULL) { err(1, "EAPS domain name is NULL!"); - } + } + + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "EAPS domain %s does not exist", domain_name); + } + + // get port name + char *port_name = *(++argv); + + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "port %s does not exist", port_name); + } + + es.p_port = port_name; + if (ioctl(s, SIOCESAPSPRIMARY, &es) != 0) + err(1, "SIOCESAPSPRIMARY"); + + exit(error); } static void Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 22 19:58:42 2016 (r308209) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Mon Aug 22 20:16:58 2016 (r308210) @@ -42,13 +42,15 @@ * eaps state information */ struct eaps_state { - 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 */ - int32_t hellotime; /* hello time is set by master node for sending health check message */ - int32_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ + 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 */ + int32_t hellotime; /* hello time is set by master node for sending health check message */ + int32_t failtime; /* fail time is set by master node for waiting before the failtimer expires */ + char p_port[IFNAMSIZ]; /* primary port of this eaps node, which is valid when it's master node */ + char s_port[IFNAMSIZ]; /* secondary port of this eaps node, which is valid for master and transit */ }; /* @@ -63,9 +65,11 @@ #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) -#define SIOCSEAPSHELLO _IOW('i', 303, struct eaps_state) -#define SIOCSEAPSFAIL _IOW('i', 304, struct eaps_state) +#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_state) +#define SIOCSEAPSMODE _IOW('i', 301, struct eaps_state) +#define SIOCSEAPSPRI _IOW('i', 302, struct eaps_state) +#define SIOCSEAPSHELLO _IOW('i', 303, struct eaps_state) +#define SIOCSEAPSFAIL _IOW('i', 304, struct eaps_state) +#define SIOCESAPSPRIMARY _IOW('i', 305, struct eaps_state) +#define SIOCESAPSSECONDARY _IOW('i', 306, struct eaps_state) From owner-svn-soc-all@freebsd.org Mon Aug 22 20:20: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 8AF53BC27DC for ; Mon, 22 Aug 2016 20:20: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 7E3B61252 for ; Mon, 22 Aug 2016 20:20: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 u7MKKVgD045361 for ; Mon, 22 Aug 2016 20:20:31 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKKUNw045297 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:20:30 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:20:30 GMT Message-Id: <201608222020.u7MKKUNw045297@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: r308211 - 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, 22 Aug 2016 20:20:31 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:20:30 2016 New Revision: 308211 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308211 Log: EAPS: implement add primary/secondary port 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 Mon Aug 22 20:16:58 2016 (r308210) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:20:30 2016 (r308211) @@ -463,7 +463,8 @@ errx(1, "port %s does not exist", port_name); } - es.p_port = port_name; + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + strlcpy(es.p_port, port_name, sizeof(port_name)); if (ioctl(s, SIOCESAPSPRIMARY, &es) != 0) err(1, "SIOCESAPSPRIMARY"); From owner-svn-soc-all@freebsd.org Mon Aug 22 20:22: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 36719BC2951 for ; Mon, 22 Aug 2016 20:22: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 29E2D140F for ; Mon, 22 Aug 2016 20:22: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 u7MKMDJC052700 for ; Mon, 22 Aug 2016 20:22:13 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKMC8E052680 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:22:12 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:22:12 GMT Message-Id: <201608222022.u7MKMC8E052680@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: r308212 - 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, 22 Aug 2016 20:22:13 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:22:12 2016 New Revision: 308212 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308212 Log: EAPS: implement add primary/secondary port 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 Mon Aug 22 20:20:30 2016 (r308211) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:22:12 2016 (r308212) @@ -464,7 +464,7 @@ } strlcpy(es.ifname, domain_name, sizeof(es.ifname)); - strlcpy(es.p_port, port_name, sizeof(port_name)); + strlcpy(es.p_port, port_name, sizeof(es.p_port)); if (ioctl(s, SIOCESAPSPRIMARY, &es) != 0) err(1, "SIOCESAPSPRIMARY"); From owner-svn-soc-all@freebsd.org Mon Aug 22 20:37: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 C5AC1BC203B for ; Mon, 22 Aug 2016 20:37: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 AA9741328 for ; Mon, 22 Aug 2016 20:37: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 u7MKbCYb084756 for ; Mon, 22 Aug 2016 20:37:12 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKbBXK084704 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:37:11 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:37:11 GMT Message-Id: <201608222037.u7MKbBXK084704@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: r308213 - 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, 22 Aug 2016 20:37:12 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:37:11 2016 New Revision: 308213 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308213 Log: EAPS: implement add primary/secondary port interface 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 Mon Aug 22 20:22:12 2016 (r308212) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:37:11 2016 (r308213) @@ -275,7 +275,7 @@ (void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname)); EAPS_RUNLOCK(sc, &tracker); - reutrn (0); + return (0); } int @@ -285,7 +285,7 @@ EAPS_WLOCK(sc); sc->sc_eaps.mode = es->mode; EAPS_WUNLOCK(sc); - reutrn (0); + return (0); } int @@ -295,7 +295,7 @@ EAPS_WLOCK(sc); sc->sc_eaps.priority = es->priority; EAPS_WUNLOCK(sc); - reutrn (0); + return (0); } int @@ -305,7 +305,7 @@ sc->sc_eaps.hellotime = es->hellotime; EAPS_WUNLOCK(sc); - reutrn (0); + return (0); } int @@ -315,7 +315,7 @@ sc->sc_eaps.failtime = es->failtime; EAPS_WUNLOCK(sc); - reutrn (0); + return (0); } int @@ -323,29 +323,30 @@ { int error = 0; - char p_port[IFNAMSIZ] = NULL; + char p_port[IFNAMSIZ]; (void) strlcpy(p_port, es->p_port, sizeof(es->p_port)); struct rm_priotracker tracker; EAPS_RLOCK(sc, &tracker); // If the primary port has already used for secondary port, return error - if (sc->sc_eaps.s_port == p_port) { + if (strcmp(sc->sc_eaps.s_port, p_port) == 0) { return ENODEV; } + EAPS_RUNLOCK(sc, &tracker); EAPS_WLOCK(sc); sc->sc_eaps.p_port = p_port EAPS_WUNLOCK(sc); - reutrn (0); + return (0); } int set_eaps_secondary_port(struct eaps_softc *sc, struct eaps_state *es) { - reutrn (0); + return (0); } @@ -360,8 +361,8 @@ sc->sc_eaps.priority = EAPS_PRIORITY_NORMAL; sc->sc_eaps.hellotime = EAPS_HELLO_TIME_DEFAULT; sc->sc_eaps.failtime = EAPS_FAIL_TIME_DEFAULT; - sc->sc_eaps.p_port = NULL; - sc->sc_eaps.s_port = NULL; + sc->sc_eaps.p_port[0] = '\0'; //means empty + sc->sc_eaps.s_port[0] = '\0'; //means empty EAPS_WUNLOCK(sc); } Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:22:12 2016 (r308212) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon Aug 22 20:37:11 2016 (r308213) @@ -242,14 +242,14 @@ printf("\thellotime: %d (milliseconds)\n", es.hellotime); printf("\tfailtime: %d (milliseconds)\n", es.failtime); - if (es.p_port == NULL) + if (es.p_port[0] == '\0') { printf("\tprimary port: not assigned\n"); } else { printf("\tprimary port: %s\n", es.p_port); } - if (es.s_port == NULL) + if (es.s_port[0] == '\0') { printf("\tsecondary port: not assigned\n"); } else { From owner-svn-soc-all@freebsd.org Mon Aug 22 20:44: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 9ADE8BC21BB for ; Mon, 22 Aug 2016 20:44: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 8E1F4168F for ; Mon, 22 Aug 2016 20:44: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 u7MKi7mn000194 for ; Mon, 22 Aug 2016 20:44:07 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKi67b000146 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:44:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:44:06 GMT Message-Id: <201608222044.u7MKi67b000146@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: r308214 - 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: Mon, 22 Aug 2016 20:44:07 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:44:06 2016 New Revision: 308214 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308214 Log: EAPS: implement add primary/secondary port interface Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:37:11 2016 (r308213) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:44:06 2016 (r308214) @@ -337,7 +337,7 @@ EAPS_RUNLOCK(sc, &tracker); EAPS_WLOCK(sc); - sc->sc_eaps.p_port = p_port + (void) strlcpy(sc->sc_eaps.p_port, p_port, sizeof(sc->sc_eaps.p_port)); EAPS_WUNLOCK(sc); return (0); From owner-svn-soc-all@freebsd.org Mon Aug 22 20:52: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 47775BC2405 for ; Mon, 22 Aug 2016 20:52: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 3AC9B1CAC for ; Mon, 22 Aug 2016 20:52: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 u7MKqgj4017733 for ; Mon, 22 Aug 2016 20:52:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKqfqQ017690 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:52:41 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:52:41 GMT Message-Id: <201608222052.u7MKqfqQ017690@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: r308215 - 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: Mon, 22 Aug 2016 20:52:42 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:52:41 2016 New Revision: 308215 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308215 Log: EAPS: implement add primary/secondary port interface Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:44:06 2016 (r308214) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:52:41 2016 (r308215) @@ -321,8 +321,6 @@ int set_eaps_primary_port(struct eaps_softc *sc, struct eaps_state *es) { - int error = 0; - char p_port[IFNAMSIZ]; (void) strlcpy(p_port, es->p_port, sizeof(es->p_port)); From owner-svn-soc-all@freebsd.org Mon Aug 22 20:58: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 E46E4BC2451 for ; Mon, 22 Aug 2016 20:58: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 CA5DE1D6F for ; Mon, 22 Aug 2016 20:58: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 u7MKwH5L024847 for ; Mon, 22 Aug 2016 20:58:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7MKwHXB024844 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 20:58:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 20:58:17 GMT Message-Id: <201608222058.u7MKwHXB024844@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: r308216 - 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: Mon, 22 Aug 2016 20:58:18 -0000 Author: yuanxunzhang Date: Mon Aug 22 20:58:16 2016 New Revision: 308216 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308216 Log: EAPS: implement add primary/secondary port interface Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:52:41 2016 (r308215) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:58:16 2016 (r308216) @@ -229,6 +229,15 @@ case SIOCSEAPSFAIL: error = set_eaps_failtime(sc, es); break; + + case SIOCESAPSPRIMARY: + error = set_eaps_primary_port(sc, es); + break; + + case SIOCESAPSSECONDARY: + error = set_eaps_secondary_port(sc, es); + break; + default: error = ether_ioctl(ifp, cmd, data); break; From owner-svn-soc-all@freebsd.org Mon Aug 22 21:05:44 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 00B94BC25FF for ; Mon, 22 Aug 2016 21:05:44 +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 E7BD0143A for ; Mon, 22 Aug 2016 21:05:43 +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 u7ML5hTh069567 for ; Mon, 22 Aug 2016 21:05:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7ML5hSn069381 for svn-soc-all@FreeBSD.org; Mon, 22 Aug 2016 21:05:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 22 Aug 2016 21:05:43 GMT Message-Id: <201608222105.u7ML5hSn069381@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: r308221 - 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: Mon, 22 Aug 2016 21:05:44 -0000 Author: yuanxunzhang Date: Mon Aug 22 21:05:42 2016 New Revision: 308221 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308221 Log: EAPS: implement add primary/secondary port interface Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 20:59:34 2016 (r308220) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Aug 22 21:05:42 2016 (r308221) @@ -237,7 +237,7 @@ case SIOCESAPSSECONDARY: error = set_eaps_secondary_port(sc, es); break; - + default: error = ether_ioctl(ifp, cmd, data); break; @@ -304,6 +304,7 @@ EAPS_WLOCK(sc); sc->sc_eaps.priority = es->priority; EAPS_WUNLOCK(sc); + return (0); } From owner-svn-soc-all@freebsd.org Tue Aug 23 10:01:36 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 E4C72BC3594 for ; Tue, 23 Aug 2016 10:01:36 +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 CAA7D1E1F for ; Tue, 23 Aug 2016 10:01:36 +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 u7NA1acN097198 for ; Tue, 23 Aug 2016 10:01:36 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7NA1ZcC096323 for svn-soc-all@FreeBSD.org; Tue, 23 Aug 2016 10:01:35 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 23 Aug 2016 10:01:35 GMT Message-Id: <201608231001.u7NA1ZcC096323@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: r308259 - 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, 23 Aug 2016 10:01:37 -0000 Author: yuanxunzhang Date: Tue Aug 23 10:01:35 2016 New Revision: 308259 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308259 Log: EAPS: add primary/secondary port 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 Tue Aug 23 08:13:08 2016 (r308258) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 23 10:01:35 2016 (r308259) @@ -282,6 +282,8 @@ es->hellotime = sc->sc_eaps.hellotime; es->failtime = sc->sc_eaps.failtime; (void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname)); + (void) strlcpy(es->p_port, sc->sc_eaps.p_port, sizeof(es->p_port)); + (void) strlcpy(es->s_port, sc->sc_eaps.s_port, sizeof(es->s_port)); EAPS_RUNLOCK(sc, &tracker); return (0); @@ -304,7 +306,7 @@ EAPS_WLOCK(sc); sc->sc_eaps.priority = es->priority; EAPS_WUNLOCK(sc); - + return (0); } @@ -336,12 +338,11 @@ struct rm_priotracker tracker; EAPS_RLOCK(sc, &tracker); - - // If the primary port has already used for secondary port, return error + // If the port has already used for secondary port, then return error if (strcmp(sc->sc_eaps.s_port, p_port) == 0) { + EAPS_RUNLOCK(sc, &tracker); return ENODEV; } - EAPS_RUNLOCK(sc, &tracker); EAPS_WLOCK(sc); @@ -354,6 +355,22 @@ int set_eaps_secondary_port(struct eaps_softc *sc, struct eaps_state *es) { + char s_port[IFNAMSIZ]; + (void) strlcpy(s_port, es->s_port, sizeof(es->s_port)); + + struct rm_priotracker tracker; + EAPS_RLOCK(sc, &tracker); + // If the port has already used for primary port, then return error + if (strcmp(sc->sc_eaps.p_port, s_port) == 0) { + EAPS_RUNLOCK(sc, &tracker); + return ENODEV; + } + EAPS_RUNLOCK(sc, &tracker); + + EAPS_WLOCK(sc); + (void) strlcpy(sc->sc_eaps.s_port, s_port, sizeof(sc->sc_eaps.s_port)); + EAPS_WUNLOCK(sc); + return (0); } Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 23 08:13:08 2016 (r308258) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 23 10:01:35 2016 (r308259) @@ -474,7 +474,40 @@ static void set_eaps_secondary_port(int argc, char **argv, int s) { + int error = 0; + struct eaps_state es; + bzero(&es, sizeof(es)); + + // get eaps domain name + char *domain_name = *(++argv); + + // check eaps domain name + if (domain_name == NULL) { + err(1, "EAPS domain name is NULL!"); + } + + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "EAPS domain %s does not exist", domain_name); + } + + // get port name + char *port_name = *(++argv); + + // check if eaps domain exists + if (0 == if_nametoindex(domain_name)) + { + errx(1, "port %s does not exist", port_name); + } + + strlcpy(es.ifname, domain_name, sizeof(es.ifname)); + strlcpy(es.s_port, port_name, sizeof(es.s_port)); + if (ioctl(s, SIOCESAPSSECONDARY, &es) != 0) + err(1, "SIOCESAPSSECONDARY"); + + exit(error); } static void From owner-svn-soc-all@freebsd.org Tue Aug 23 16:32: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 1FBEFBC304D for ; Tue, 23 Aug 2016 16:32: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 1312C118F for ; Tue, 23 Aug 2016 16:32: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 u7NGWX9H068632 for ; Tue, 23 Aug 2016 16:32:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u7NGWXM1068630 for svn-soc-all@FreeBSD.org; Tue, 23 Aug 2016 16:32:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 23 Aug 2016 16:32:33 GMT Message-Id: <201608231632.u7NGWXM1068630@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: r308273 - 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, 23 Aug 2016 16:32:34 -0000 Author: yuanxunzhang Date: Tue Aug 23 16:32:32 2016 New Revision: 308273 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=308273 Log: EAPS: fix bug to check port 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 Tue Aug 23 15:49:31 2016 (r308272) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 23 16:32:32 2016 (r308273) @@ -458,7 +458,7 @@ char *port_name = *(++argv); // check if eaps domain exists - if (0 == if_nametoindex(domain_name)) + if (0 == if_nametoindex(port_name)) { errx(1, "port %s does not exist", port_name); } @@ -497,7 +497,7 @@ char *port_name = *(++argv); // check if eaps domain exists - if (0 == if_nametoindex(domain_name)) + if (0 == if_nametoindex(port_name)) { errx(1, "port %s does not exist", port_name); }