|
@@ -0,0 +1,6371 @@
+diff -rupN keepalived-1.2.7/keepalived/include/vrrp.h keepalived-1.2.7-unicast/keepalived/include/vrrp.h
+--- keepalived-1.2.7/keepalived/include/vrrp.h 2012-08-29 00:05:12.000000000 +0200
++++ keepalived-1.2.7-unicast/keepalived/include/vrrp.h 2013-05-24 09:39:17.614831300 +0200
+@@ -100,6 +100,8 @@ typedef struct _vrrp_rt {
+ list track_ifp; /* Interface state we monitor */
+ list track_script; /* Script state we monitor */
+ uint32_t mcast_saddr; /* Src IP address to use in VRRP IP header */
++ uint32_t unicast_bind; /* listen to this IP if mcast is not possible */
++ uint32_t unicast_peer; /* send to this IP if mcast is not possible */
+ char *lvs_syncd_if; /* handle LVS sync daemon state using this
+ * instance FSM & running on specific interface
+ * => eth0 for example.
+@@ -216,8 +218,8 @@ typedef struct _vrrp_rt {
+
+ /* prototypes */
+ extern vrrp_pkt *vrrp_get_header(sa_family_t, char *, int *, uint32_t *);
+-extern int open_vrrp_send_socket(sa_family_t, int, int);
+-extern int open_vrrp_socket(sa_family_t, int, int);
++extern int open_vrrp_send_socket(sa_family_t, int, int, int);
++extern int open_vrrp_socket(sa_family_t, int, int, int);
+ extern int new_vrrp_socket(vrrp_rt *);
+ extern void close_vrrp_socket(vrrp_rt *);
+ extern void vrrp_send_link_update(vrrp_rt *);
+diff -rupN keepalived-1.2.7/keepalived/include/vrrp.h.orig keepalived-1.2.7-unicast/keepalived/include/vrrp.h.orig
+--- keepalived-1.2.7/keepalived/include/vrrp.h.orig 1970-01-01 01:00:00.000000000 +0100
++++ keepalived-1.2.7-unicast/keepalived/include/vrrp.h.orig 2012-08-29 00:05:12.000000000 +0200
+@@ -0,0 +1,238 @@
++/*
++ * Soft: Vrrpd is an implementation of VRRPv2 as specified in rfc2338.
++ * VRRP is a protocol which elect a master server on a LAN. If the
++ * master fails, a backup server takes over.
++ * The original implementation has been made by jerome etienne.
++ *
++ * Part: vrrp.c program include file.
++ *
++ * Author: Alexandre Cassen, <acassen@linux-vs.org>
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++ * See the GNU General Public License for more details.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version
++ * 2 of the License, or (at your option) any later version.
++ *
++ * Copyright (C) 2001-2012 Alexandre Cassen, <acassen@gmail.com>
++ */
++
++#ifndef _VRRP_H
++#define _VRRP_H
++
++/* system include */
++#include <unistd.h>
++
++/* local include */
++#include "vrrp_ipaddress.h"
++#include "vrrp_iproute.h"
++#include "vrrp_ipsecah.h"
++#include "vrrp_if.h"
++#include "vrrp_track.h"
++#include "timer.h"
++#include "utils.h"
++#include "vector.h"
++#include "list.h"
++
++typedef struct { /* rfc2338.5.1 */
++ uint8_t vers_type; /* 0-3=type, 4-7=version */
++ uint8_t vrid; /* virtual router id */
++ uint8_t priority; /* router priority */
++ uint8_t naddr; /* address counter */
++ uint8_t auth_type; /* authentification type */
++ uint8_t adver_int; /* advertissement interval(in sec) */
++ uint16_t chksum; /* checksum (ip-like one) */
++/* here <naddr> ip addresses */
++/* here authentification infos */
++} vrrp_pkt;
++
++/* protocol constants */
++#define INADDR_VRRP_GROUP 0xe0000012 /* multicast addr - rfc2338.5.2.2 */
++#define VRRP_IP_TTL 255 /* in and out pkt ttl -- rfc2338.5.2.3 */
++#define IPPROTO_VRRP 112 /* IP protocol number -- rfc2338.5.2.4 */
++#define VRRP_VERSION 2 /* current version -- rfc2338.5.3.1 */
++#define VRRP_PKT_ADVERT 1 /* packet type -- rfc2338.5.3.2 */
++#define VRRP_PRIO_OWNER 255 /* priority of the ip owner -- rfc2338.5.3.4 */
++#define VRRP_PRIO_DFL 100 /* default priority -- rfc2338.5.3.4 */
++#define VRRP_PRIO_STOP 0 /* priority to stop -- rfc2338.5.3.4 */
++#define VRRP_AUTH_NONE 0 /* no authentification -- rfc2338.5.3.6 */
++#define VRRP_AUTH_PASS 1 /* password authentification -- rfc2338.5.3.6 */
++#define VRRP_AUTH_AH 2 /* AH(IPSec) authentification - rfc2338.5.3.6 */
++#define VRRP_ADVER_DFL 1 /* advert. interval (in sec) -- rfc2338.5.3.7 */
++#define VRRP_GARP_DELAY (5 * TIMER_HZ) /* Default delay to launch gratuitous arp */
++
++/*
++ * parameters per vrrp sync group. A vrrp_sync_group is a set
++ * of VRRP instances that need to be state sync together.
++ */
++typedef struct _vrrp_sgroup {
++ char *gname; /* Group name */
++ vector_t *iname; /* Set of VRRP instances in this group */
++ list index_list; /* List of VRRP instances */
++ int state; /* current stable state */
++ int global_tracking; /* Use floating priority and scripts
++ * All VRRP must share same tracking conf
++ */
++
++ /* State transition notification */
++ int notify_exec;
++ char *script_backup;
++ char *script_master;
++ char *script_fault;
++ char *script;
++ int smtp_alert;
++} vrrp_sgroup;
++
++/* parameters per virtual router -- rfc2338.6.1.2 */
++typedef struct _vrrp_rt {
++ sa_family_t family; /* AF_INET|AF_INET6 */
++ char *iname; /* Instance Name */
++ vrrp_sgroup *sync; /* Sync group we belong to */
++ interface *ifp; /* Interface we belong to */
++ int dont_track_primary; /* If set ignores ifp faults */
++ int vmac; /* If set try to set VRRP VMAC */
++ char vmac_ifname[IFNAMSIZ]; /* Name of VRRP VMAC interface */
++ unsigned int vmac_ifindex; /* ifindex of vmac interface */
++ list track_ifp; /* Interface state we monitor */
++ list track_script; /* Script state we monitor */
++ uint32_t mcast_saddr; /* Src IP address to use in VRRP IP header */
++ char *lvs_syncd_if; /* handle LVS sync daemon state using this
++ * instance FSM & running on specific interface
++ * => eth0 for example.
++ */
++ int garp_delay; /* Delay to launch gratuitous ARP */
++ int vrid; /* virtual id. from 1(!) to 255 */
++ int base_priority; /* configured priority value */
++ int effective_priority; /* effective priority value */
++ int vipset; /* All the vips are set ? */
++ list vip; /* list of virtual ip addresses */
++ list evip; /* list of protocol excluded VIPs.
++ * Those VIPs will not be presents into the
++ * VRRP adverts
++ */
++ list vroutes; /* list of virtual routes */
++ int adver_int; /* delay between advertisements(in sec) */
++ int nopreempt; /* true if higher prio does not preempt lower */
++ long preempt_delay; /* Seconds*TIMER_HZ after startup until
++ * preemption based on higher prio over lower
++ * prio is allowed. 0 means no delay.
++ */
++ timeval_t preempt_time; /* Time after which preemption can happen */
++ int state; /* internal state (init/backup/master) */
++ int init_state; /* the initial state of the instance */
++ int wantstate; /* user explicitly wants a state (back/mast) */
++ int fd_in; /* IN socket descriptor */
++ int fd_out; /* OUT socket descriptor */
++
++ int debug; /* Debug level 0-4 */
++
++ /* State transition notification */
++ int smtp_alert;
++ int notify_exec;
++ char *script_backup;
++ char *script_master;
++ char *script_fault;
++ char *script_stop;
++ char *script;
++
++ /* rfc2336.6.2 */
++ uint32_t ms_down_timer;
++ struct timeval sands;
++
++ /* Sending buffer */
++ char *send_buffer; /* Allocated send buffer */
++ int send_buffer_size;
++
++ /* Authentication data */
++ int auth_type; /* authentification type. VRRP_AUTH_* */
++ uint8_t auth_data[8]; /* authentification data */
++
++ /*
++ * To have my own ip_id creates collision with kernel ip->id
++ * but it should be ok because the packets are unlikely to be
++ * fragmented (they are non routable and small)
++ * This packet isnt routed, i can check the outgoing MTU
++ * to warn the user only if the outoing mtu is too small
++ */
++ int ip_id;
++
++ /* IPSEC AH counter def --rfc2402.3.3.2 */
++ seq_counter *ipsecah_counter;
++} vrrp_rt;
++
++/* VRRP state machine -- rfc2338.6.4 */
++#define VRRP_STATE_INIT 0 /* rfc2338.6.4.1 */
++#define VRRP_STATE_BACK 1 /* rfc2338.6.4.2 */
++#define VRRP_STATE_MAST 2 /* rfc2338.6.4.3 */
++#define VRRP_STATE_FAULT 3 /* internal */
++#define VRRP_STATE_GOTO_MASTER 4 /* internal */
|