Date: Tue, 16 Aug 2016 09:01:13 GMT From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307723 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps Message-ID: <201608160901.u7G91DYe053214@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: yuanxunzhang Date: Tue Aug 16 09:01:12 2016 New Revision: 307723 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307723 Log: EAPS: query eaps domian status Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/if.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 16 08:48:41 2016 (r307722) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Tue Aug 16 09:01:12 2016 (r307723) @@ -59,7 +59,7 @@ #include <net/bpf.h> #include <net/vnet.h> -#include <net/if.h> +#include <net/eaps.h> /* * EAPS Protocol Module Modified: soc2016/yuanxunzhang/head/sys/net/if.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if.h Tue Aug 16 08:48:41 2016 (r307722) +++ soc2016/yuanxunzhang/head/sys/net/if.h Tue Aug 16 09:01:12 2016 (r307723) @@ -546,137 +546,4 @@ __END_DECLS #endif - -#ifndef _KERNEL - -/* !!!!!!!!!Temporarily move eaps header file content to here!!!!!!!!!!! */ - -/* - * Software state for each EAPS Domain - */ -struct eaps_softc { - struct ifnet *sc_ifp; /* make this an interface */ - struct rmlock sc_mtx; - LIST_ENTRY(eaps_softc) sc_list; - u_char sc_defaddr[6]; /* Default MAC address */ -}; - -/* -* eaps ring information -*/ -struct eaps_reqall { - char eaps_ifname[IFNAMSIZ]; /* name of the eaps */ - uint8_t eaps_state; /* state of eaps */ - uint8_t enable_state; /* enable or disable eaps ring */ -}; - -#define SIOCSEAPSDOMAIN _IOWR('i', 300, struct eaps_reqall) - -/* - * Extreme Active Protection System (EAPS) definitions. - * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] - */ - -/* TODO: */ -/* EDP/EAPS packets are SNAP encapsulated on Ethernet. */ -/* dsap/ssap are LLV_SNAP_LSAP, llc_control is LLC_UI, oui is EXTREME_OUI, PID is EDP.*/ - -/* - * Extreme Networks proprietary MAC addresses. - */ -#define EXTREME_OUI_INIT { 0x00, 0xE0, 0x2B } -#define EDP_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x00 } -#define EAPS_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x04 } - -/* -const uint8_t eaps_etheraddr[] = EAPS_ETHERADDR_INIT; -const uint8_t edp_etheraddr[] = EDP_ETHERADDR_INIT; -*/ - -/* - * Extreme Discovery Protocol (EDP) header. - */ -struct edp_hdr { - uint8_t edp_version; /* EDP_VERSION_1 */ - uint8_t edp_reserved00; /* must be zero */ - uint16_t edp_len; /* Payload length including edp_hdr */ - uint16_t edp_cksum; /* RFC 1071-like */ - uint16_t edp_seq; /* simple monotonic */ - uint16_t edp_devid; /* 0 for MAC address */ - struct ether_addr edp_dev_mac; /* 48 bits */ - /* followed by 0..N TLVs. */ -} __packed; -#define EDP_VERSION_1 0x01 - -/* - * EDP Tag-Length-Value (TLV) header. - * Minimum length: 32 bits (length: 0x0004). - */ -struct edp_tlv_hdr { - uint8_t etv_marker; /* always set to EDP_MARKER 0x99 */ - uint8_t etv_tag; /* Tag: see below. */ - uint16_t etv_len; /* network-endian; includes this header */ - /* followed by [0..etv_len] octets */ -} __packed; - -#define EDP_MARKER 0x99 /* etv_marker constant */ -#define EDP_TAG_NULL 0x00 /* No-op, length must be 0x04. */ -#define EDP_TAG_ESRP 0x08 /* Extreme Standby Router Protocol (undocumented) */ -#define EDP_TAG_EAPS 0x0B /* RFC 3619 Extreme Active Protection System */ - -/* - * EAPS TLV payload. - */ -struct eaps_pdu { - uint8_t eaps_version; /* Always EAPS_VERSION_1 (for now) */ - uint8_t eaps_type; /* PDU type */ - uint16_t eaps_cvlan; /* Control VLAN Tag ID */ - uint32_t eaps_rsvd0; /* Reserved; set to zero */ - struct ether_addr eaps_origin; /* Originating MAC address */ - uint16_t eaps_hello; /* HELLO interval (hardcoded) */ - uint16_t eaps_fail; /* FAIL interval (set by master) */ - uint8_t eaps_state; /* EAPS_S_xxx; see below */ - uint8_t eaps_rsvd1; /* Reserved; set to zero */ - uint16_t eaps_seq; /* Health PDU sequence number */ - uint16_t eaps_rsvd2[38]; /* Reserved; set to zero */ -} __packed; - - -#define EAPS_VERSION_1 0x01 /* EAPSv1; may support v2 in future */ -#define EAPS_HELLO_INTERVAL 0x04 /* hardcoded value of eaps_hello */ - -/* - * EAPS PDU Types - */ -#define EAPS_P_HEALTH 0x05 /* Polling for ring health */ -#define EAPS_P_RING_UP 0x06 /* Master indicates link is up */ -#define EAPS_P_RING_DOWN 0x07 /* Master indicates link is down */ -#define EAPS_P_LINK_DOWN 0x08 /* Peer indicates link is down */ -#define EAPS_P_FLUSH 0x0D /* Topology change: flush FDB for domain */ -#define EAPS_P_LINK_QUERY 0x0F /* Link status query from peer */ -#define EAPS_P_LINK_UP 0x10 /* Peer indicates link is up */ - -/* - * EAPS ring node states - */ -#define EAPS_S_IDLE 0x00 /* EAPS Domain (Master/Transit) not running */ -#define EAPS_S_COMPLETE 0x01 /* Master node in COMPLETE state */ -#define EAPS_S_FAILED 0x02 /* Master node in FAILED state */ -#define EAPS_S_LINKS_UP 0x03 /* Transit UP: Pri & Sec ring ports are up */ -#define EAPS_S_LINK_DOWN 0x04 /* Transit DOWN: Pri and/or Sec ports down */ -#define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ -#define EAPS_S_INIT 0x06 /* Master node in INIT state */ - - -#define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") -#define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) -#define EAPS_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p)) -#define EAPS_WLOCK(_sc) rm_wlock(&(_sc)->sc_mtx) -#define EAPS_RUNLOCK(_sc, _p) rm_runlock(&(_sc)->sc_mtx, (_p)) -#define EAPS_WUNLOCK(_sc) rm_wunlock(&(_sc)->sc_mtx) -#define EAPS_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) -#define EAPS_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) -#define EAPS_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) - -#endif #endif /* !_NET_IF_H_ */ Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 08:48:41 2016 (r307722) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue Aug 16 09:01:12 2016 (r307723) @@ -37,6 +37,7 @@ #include <sys/socket.h> #include <sys/sockio.h> #include <net/if.h> +#include <net/eaps.h> #include <ctype.h> #include <err.h> #include <errno.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608160901.u7G91DYe053214>