File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / freevrrpd / vrrp_proto.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 14 12:01:54 2017 UTC (7 years ago) by misho
Branches: freevrrpd, MAIN
CVS tags: v1_1, HEAD
freevrrpd 1.1

    1: /*
    2:  * Copyright (c) 2001,2002 Sebastien Petit <spe@bsdfr.org>
    3:  *
    4:  * Redistribution and use in source forms, with and without modification,
    5:  * are permitted provided that the following conditions are met:
    6:  * 1. Redistributions of source code must retain the above copyright notice,
    7:  *    this list of conditions and the following disclaimer.
    8:  * 2. Redistributions in binary form must reproduce the above copyright notice,
    9:  *    this list of conditions and the following disclaimer in the documentation
   10:  *    and/or other materials provided with the distribution. Obviously, it
   11:  *    would be nice if you gave credit where credit is due but requiring it
   12:  *    would be too onerous.
   13:  * 3. All advertising materials mentioning features or use of this software
   14:  *    must display the following acknowledgement:
   15:  *      This product includes software developed by Sebastien Petit.
   16:  * 4. Neither the name of its contributors may be used to endorse or promote
   17:  *    products derived from this software without specific prior written
   18:  *    permission.
   19:  *
   20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30:  * SUCH DAMAGE.
   31:  *
   32:  * $Id: vrrp_proto.h,v 1.1.1.1 2017/06/14 12:01:54 misho Exp $
   33:  */
   34: 
   35: #ifndef _VRRP_PROTO_H
   36: #define _VRRP_PROTO_H
   37: 
   38: #include <sys/types.h>
   39: #include <sys/socket.h>
   40: #include <net/if.h>
   41: #include <netinet/in.h>
   42: #ifdef __FreeBSD__
   43: #include <net/ethernet.h>
   44: #endif
   45: #ifdef __NetBSD__
   46: #include <net/if_ether.h>
   47: #endif
   48: #ifdef __OpenBSD__
   49: #include <netinet/if_ether.h>
   50: #endif
   51: #include "vrrp_define.h"
   52: 
   53: /* RFC 2338 vrrp header */
   54: struct vrrp_hdr {
   55: #if BYTE_ORDER == LITTLE_ENDIAN
   56: 	u_int           vrrp_t:4, vrrp_v:4;
   57: #endif
   58: #if BYTE_ORDER == BIG_ENDIAN
   59: 	u_int           vrrp_v:4, vrrp_t:4;
   60: #endif
   61: 	u_char          vr_id;
   62: 	u_char          priority;
   63: 	u_char          cnt_ip;
   64: 	u_char          auth_type;
   65: 	u_char          adv_int;
   66: 	u_short         csum;
   67: 	/* Some IP adresses, number are not defined */
   68: 	/*
   69: 	 * After IP adresses, we can found Authentification Data 1 & 2 (total
   70: 	 * of 8 bytes)
   71: 	 */
   72: };
   73: 
   74: struct vrrp_if {
   75: 	char            if_name[IFNAMSIZ];
   76: 	u_char          nb_ip;
   77: 	int		alive;
   78: 	int		nberrors;
   79: 	int		checksok;
   80: 	int		reportsyslog;
   81: 	struct in_addr  ip_addrs[MAX_IP_ALIAS];
   82: 	struct ether_addr ethaddr;
   83: 	struct ether_addr actualethaddr;
   84: 	struct vrrp_ethaddr_list *p, *d;
   85: 	struct vrrp_vlan_list *vlanp, *vland;
   86: 	int		carrier_timeout;
   87: };
   88: 
   89: struct vrrp_vip {
   90: 	struct in_addr  addr;
   91: 	u_char          owner;
   92: 	char		*if_name;
   93: };
   94: 
   95: /* Timers RFC2338-6.2 */
   96: struct vrrp_timer {
   97: 	struct timeval  master_down_tm;
   98: 	struct timeval  adv_tm;
   99: };
  100: 
  101: /*
  102:  * Parameters per Virtual Router RFC2338-6.1.2 and
  103:  * draft-ietf-vrrp-spec-v2-05.txt
  104:  */
  105: struct vrrp_vr {
  106: 	u_char          vr_id;
  107: 	u_char          priority;
  108: 	int             sd;
  109: 	int		ioctl_sd;			/* socket used to pass ioctl */
  110: 	struct ether_addr ethaddr;
  111: 	u_char          cnt_ip;
  112: 	struct vrrp_vip *vr_ip;
  113: 	u_int          *vr_netmask;
  114: 	u_char          adv_int;
  115: 	u_int           master_down_int;
  116: 	u_int           skew_time;
  117: 	struct vrrp_timer tm;
  118: 	u_char          preempt_mode;	/* False = 0, True = 1 */
  119: 	u_char          state;	/* 0 = INITIALIZE, 1 = MASTER, 2 = BACKUP */
  120: 	u_char          auth_type;
  121: 	u_char          auth_data[VRRP_AUTH_DATA_LEN];
  122: 	struct vrrp_if *vr_if;
  123: 	char		viface_name[IFNAMSIZ]; /* Real interface name for vrrp announces */
  124: 	int		bridge_link_number;
  125: #ifdef ENABLE_VRRP_AH
  126: 	struct ah_header *ahctx;
  127: #endif
  128: 	char           *password;
  129: 	char           *master_script;
  130: 	char           *backup_script;
  131: 	int	       *vridsdeps;
  132: 	int		fault;
  133: 	int		useIKE;
  134: 	int		useMonitoredCircuits;
  135: 	int		AHencryption;
  136: 	int		sendGratuitousArp;
  137: 	int		spanningTreeLatency;
  138: 	int		monitoredCircuitsClearErrorsCount;
  139: };
  140: 
  141: struct vrrp_ethaddr_list {
  142: 	struct ether_addr ethaddr;
  143: 	struct vrrp_ethaddr_list *next;
  144: 	struct vrrp_ethaddr_list *previous;
  145: };
  146: 
  147: struct vrrp_vlan_list {
  148: 	char vlan_ifname[IFNAMSIZ];
  149: 	struct vrrp_vlan_list *next;
  150: 	struct vrrp_vlan_list *previous;
  151: };
  152: 
  153: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>