Index: sys/netinet/if_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.162.2.7.2.1
diff -u -r1.162.2.7.2.1 if_ether.c
--- sys/netinet/if_ether.c	15 Apr 2009 03:14:26 -0000	1.162.2.7.2.1
+++ sys/netinet/if_ether.c	24 Aug 2010 19:42:01 -0000
@@ -569,7 +569,11 @@
 static int log_arp_wrong_iface = 1;
 static int log_arp_movements = 1;
 static int log_arp_permanent_modify = 1;
+static int arp_carp_mac = 0;
 
+SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, carp_mac, CTLFLAG_RW,
+        &arp_carp_mac, 0,
+        "Send CARP mac with replies to CARP ips");
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW,
 	&log_arp_wrong_iface, 0,
 	"log arp packets arriving on the wrong interface");
@@ -977,12 +981,34 @@
 	}
 	(void)memcpy(ar_tpa(ah), ar_spa(ah), ah->ar_pln);
 	(void)memcpy(ar_spa(ah), &itaddr, ah->ar_pln);
+#ifdef DEV_CARP
+        if (V_arp_carp_mac && carp_match) {
+                struct ether_header eh;
+                short type = htons(ETHERTYPE_ARP);
+
+                ah->ar_hrd = htons(ARPHRD_ETHER);
+
+                (void)memcpy(&eh.ether_type, &type,
+                        sizeof(eh.ether_type));
+                (void)memcpy(eh.ether_dhost, ar_tha(ah),
+                        sizeof (eh.ether_dhost));
+                (void)memcpy(eh.ether_shost, enaddr,
+                        sizeof(eh.ether_shost));
+
+                (void)memcpy(sa.sa_data, &eh, sizeof(eh));
+                sa.sa_family = pseudo_AF_HDRCMPLT;
+                sa.sa_len = sizeof(sa);
+        } else {
+#endif
+                sa.sa_family = AF_ARP;
+                sa.sa_len = 2;
+#ifdef DEV_CARP
+        }
+#endif
 	ah->ar_op = htons(ARPOP_REPLY);
 	ah->ar_pro = htons(ETHERTYPE_IP); /* let's be sure! */
 	m->m_len = sizeof(*ah) + (2 * ah->ar_pln) + (2 * ah->ar_hln);   
 	m->m_pkthdr.len = m->m_len;   
-	sa.sa_family = AF_ARP;
-	sa.sa_len = 2;
 	(*ifp->if_output)(ifp, m, &sa, (struct rtentry *)0);
 	return;
 

