lkundrak / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone
4bf24c8
diff -up dhcp-4.1.0/client/clparse.c.anycast dhcp-4.1.0/client/clparse.c
4bf24c8
--- dhcp-4.1.0/client/clparse.c.anycast	2009-01-06 10:43:52.000000000 -1000
4bf24c8
+++ dhcp-4.1.0/client/clparse.c	2009-01-06 10:43:53.000000000 -1000
4bf24c8
@@ -558,6 +558,17 @@ void parse_client_statement (cfile, ip, 
4bf24c8
 		}
4bf24c8
 		return;
203b45c
 
4bf24c8
+	      case ANYCAST_MAC:
4bf24c8
+		token = next_token (&val, (unsigned *)0, cfile);
4bf24c8
+		if (ip) {
4bf24c8
+			parse_hardware_param (cfile, &ip -> anycast_mac_addr);
4bf24c8
+		} else {
4bf24c8
+			parse_warn (cfile, "anycast mac address parameter %s",
4bf24c8
+			            "not allowed here.");
4bf24c8
+			skip_to_semi (cfile);
4bf24c8
+		}
4bf24c8
+		return;
203b45c
+
4bf24c8
 	      case REQUEST:
4bf24c8
 		token = next_token (&val, (unsigned *)0, cfile);
4bf24c8
 		if (config -> requested_options == default_requested_options)
4bf24c8
diff -up dhcp-4.1.0/common/conflex.c.anycast dhcp-4.1.0/common/conflex.c
4bf24c8
--- dhcp-4.1.0/common/conflex.c.anycast	2009-01-06 10:43:52.000000000 -1000
4bf24c8
+++ dhcp-4.1.0/common/conflex.c	2009-01-06 10:43:53.000000000 -1000
4bf24c8
@@ -729,6 +729,8 @@ intern(char *atom, enum dhcp_token dfv) 
203b45c
 		}
203b45c
 		if (!strcasecmp (atom + 1, "nd"))
203b45c
 			return AND;
203b45c
+		if (!strcasecmp (atom + 1, "nycast-mac"))
203b45c
+			return ANYCAST_MAC;
203b45c
 		if (!strcasecmp (atom + 1, "ppend"))
203b45c
 			return APPEND;
203b45c
 		if (!strcasecmp (atom + 1, "llow"))
4bf24c8
diff -up dhcp-4.1.0/common/lpf.c.anycast dhcp-4.1.0/common/lpf.c
4bf24c8
--- dhcp-4.1.0/common/lpf.c.anycast	2009-01-06 10:43:52.000000000 -1000
4bf24c8
+++ dhcp-4.1.0/common/lpf.c	2009-01-06 10:43:53.000000000 -1000
4bf24c8
@@ -333,6 +333,9 @@ ssize_t send_packet (interface, packet, 
4bf24c8
 		return send_fallback (interface, packet, raw,
4bf24c8
 				      len, from, to, hto);
4bf24c8
 
4bf24c8
+	if (hto == NULL && interface->anycast_mac_addr.hlen)
4bf24c8
+		hto = &interface->anycast_mac_addr;
4bf24c8
+
4bf24c8
 	/* Assemble the headers... */
4bf24c8
 	assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
4bf24c8
 	fudge = hbufp % 4;	/* IP header must be word-aligned. */
4bf24c8
diff -up dhcp-4.1.0/includes/dhcpd.h.anycast dhcp-4.1.0/includes/dhcpd.h
4bf24c8
--- dhcp-4.1.0/includes/dhcpd.h.anycast	2009-01-06 10:43:53.000000000 -1000
4bf24c8
+++ dhcp-4.1.0/includes/dhcpd.h	2009-01-06 10:43:53.000000000 -1000
4bf24c8
@@ -1215,6 +1215,7 @@ struct interface_info {
203b45c
 	int dlpi_sap_length;
203b45c
 	struct hardware dlpi_broadcast_addr;
203b45c
 # endif /* DLPI_SEND || DLPI_RECEIVE */
203b45c
+	struct hardware anycast_mac_addr;
203b45c
 };
203b45c
 
203b45c
 struct hardware_link {
4bf24c8
diff -up dhcp-4.1.0/includes/dhctoken.h.anycast dhcp-4.1.0/includes/dhctoken.h
4bf24c8
--- dhcp-4.1.0/includes/dhctoken.h.anycast	2009-01-06 10:43:52.000000000 -1000
4bf24c8
+++ dhcp-4.1.0/includes/dhctoken.h	2009-01-06 10:49:12.000000000 -1000
4bf24c8
@@ -353,7 +353,8 @@ enum dhcp_token {
4bf24c8
 	TEMPORARY = 656,
4bf24c8
 	PREFIX6 = 657,
4bf24c8
 	FIXED_PREFIX6 = 658,
4bf24c8
-	BOOTP_BROADCAST_ALWAYS = 659
4bf24c8
+	BOOTP_BROADCAST_ALWAYS = 659,
4bf24c8
+	ANYCAST_MAC = 660
203b45c
 };
203b45c
 
203b45c
 #define is_identifier(x)	((x) >= FIRST_TOKEN &&	\