From owner-svn-soc-all@freebsd.org Mon May 30 20:08:19 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 81C8EB55CF4 for ; Mon, 30 May 2016 20:08:19 +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 66A1A148A for ; Mon, 30 May 2016 20:08:19 +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 u4UK8JwL098221 for ; Mon, 30 May 2016 20:08:19 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4UK8INl098195 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 20:08:18 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 20:08:18 GMT Message-Id: <201605302008.u4UK8INl098195@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: r304210 - 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, 30 May 2016 20:08:19 -0000 Author: yuanxunzhang Date: Mon May 30 20:08:18 2016 New Revision: 304210 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304210 Log: add eaps protocol header file Added: soc2016/yuanxunzhang/head/sys/net/eaps.h Added: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon May 30 20:08:18 2016 (r304210) @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2015 Bruce Simpson. + * + * 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. 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 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 _NET_EAPS_H_ +#define _NET_EAPS_H_ + +/* + * 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_rsvd1[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 */ + +#endif /* _NET_EAPS_H_ */