Attached patch to implement the functionality.

It is supposed to be applied to version 1.2.2-3.

Kind regards
Marc
diff -r -u keepalived-1.2.2/doc/man/man5/keepalived.conf.5 keepalived-1.2.2.new/doc/man/man5/keepalived.conf.5
--- keepalived-1.2.2/doc/man/man5/keepalived.conf.5	2011-05-29 10:19:59.000000000 +0000
+++ keepalived-1.2.2.new/doc/man/man5/keepalived.conf.5	2012-08-09 09:32:29.548371841 +0000
@@ -172,6 +172,13 @@
     # Binding interface for lvs syncd
     lvs_sync_daemon_interface eth1 
 
+    # keepalived will normally send GARP (gratuitous ARP)
+    # packets to the network for every IP address it
+    # takes over on transition to the MASTER state.
+    # "nogarp" inhibits creation of GARP packets for this
+    # VRRP instance.
+    nogarp
+
     # delay for gratuitous ARP after transition to MASTER
     garp_master_delay 10 # secs, default 5 
 
diff -r -u keepalived-1.2.2/keepalived/include/vrrp.h keepalived-1.2.2.new/keepalived/include/vrrp.h
--- keepalived-1.2.2/keepalived/include/vrrp.h	2011-05-29 10:19:59.000000000 +0000
+++ keepalived-1.2.2.new/keepalived/include/vrrp.h	2012-08-08 12:21:17.833015722 +0000
@@ -111,6 +111,9 @@
 	list vroutes;		/* list of virtual routes */
 	int adver_int;		/* delay between advertisements(in sec) */
 	int nopreempt;          /* true if higher prio does not preempt lower */
+	int nogarp;             /* true if creation of GARP packets
+				 * is not desired
+				 */
 	long preempt_delay;     /* Seconds*TIMER_HZ after startup until
 				 * preemption based on higher prio over lower
 				 * prio is allowed.  0 means no delay.
diff -r -u keepalived-1.2.2/keepalived/vrrp/vrrp.c keepalived-1.2.2.new/keepalived/vrrp/vrrp.c
--- keepalived-1.2.2/keepalived/vrrp/vrrp.c	2011-05-29 10:19:59.000000000 +0000
+++ keepalived-1.2.2.new/keepalived/vrrp/vrrp.c	2012-08-09 09:32:07.560366984 +0000
@@ -660,6 +660,10 @@
 	char *msg;
 	char addr_str[41];
 
+	/* do not send GARP if configured not to */
+	if (vrrp->nogarp)
+		return;
+
 	if (!IP_IS6(ipaddress)) {
 		msg = "gratuitous ARPs";
 		inet_ntop(AF_INET, &ipaddress->u.sin.sin_addr, addr_str, 41);
@@ -683,6 +687,10 @@
 	ip_address *ipaddress;
 	element e;
 
+	/* do not send GARP if configured not to */
+	if (vrrp->nogarp)
+		return;
+
 	/* Only send gratuitous ARP if VIP are set */
 	if (!VRRP_VIP_ISSET(vrrp))
 		return;
diff -r -u keepalived-1.2.2/keepalived/vrrp/vrrp_parser.c keepalived-1.2.2.new/keepalived/vrrp/vrrp_parser.c
--- keepalived-1.2.2/keepalived/vrrp/vrrp_parser.c	2011-05-29 10:19:59.000000000 +0000
+++ keepalived-1.2.2.new/keepalived/vrrp/vrrp_parser.c	2012-08-08 12:19:30.289013755 +0000
@@ -289,6 +289,12 @@
 	vrrp->garp_delay = atoi(VECTOR_SLOT(strvec, 1)) * TIMER_HZ;
 }
 static void
+vrrp_nogarp_handler(vector strvec)
+{
+	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
+	vrrp->nogarp = 1;
+}
+static void
 vrrp_auth_type_handler(vector strvec)
 {
 	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
@@ -446,6 +452,7 @@
 	install_keyword("smtp_alert", &vrrp_smtp_handler);
 	install_keyword("lvs_sync_daemon_interface", &vrrp_lvs_syncd_handler);
 	install_keyword("garp_master_delay", &vrrp_garp_delay_handler);
+	install_keyword("nogarp", &vrrp_nogarp_handler);
 	install_keyword("authentication", NULL);
 	install_sublevel();
 	install_keyword("auth_type", &vrrp_auth_type_handler);

Reply via email to