]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- If configured, dhclient may now transmit to an anycast MAC address,
authorDavid Hankins <dhankins@isc.org>
Fri, 13 Mar 2009 21:41:45 +0000 (21:41 +0000)
committerDavid Hankins <dhankins@isc.org>
Fri, 13 Mar 2009 21:41:45 +0000 (21:41 +0000)
  rather than using a broadcast address.  Thanks to a patch from David
  Cantrell at Red Hat. [ISC-Bugs #17740]

RELNOTES
client/clparse.c
client/dhclient.conf.5
common/bpf.c
common/conflex.c
common/dlpi.c
common/lpf.c
common/nit.c
common/upf.c
includes/dhcpd.h
includes/dhctoken.h

index 28b089283c625bab21decefc067838b0ad0d5a6c..46c28b354b5b336beb8b30d501954f74b27b368a 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -42,6 +42,10 @@ work on other platforms. Please report any problems and suggested fixes to
   described in the -12 revision of the Failover draft (and assigned by
   IANA).  Thanks in part to a patch from David Cantrell at Red Hat.
 
+- If configured, dhclient may now transmit to an anycast MAC address,
+  rather than using a broadcast address.  Thanks to a patch from David
+  Cantrell at Red Hat.
+
                        Changes since 4.1.0 (bug fixes)
 
 - Validate the argument to the -p option.
index 52a7db251f71e8fc84af83169d0a71562feb62c2..2cab5f93d0ebc2c6908e28ec5a85b1144213333b 100644 (file)
@@ -541,6 +541,17 @@ void parse_client_statement (cfile, ip, config)
                }
                return;
 
+             case ANYCAST_MAC:
+               token = next_token(&val, NULL, cfile);
+               if (ip != NULL) {
+                       parse_hardware_param(cfile, &ip->anycast_mac_addr);
+               } else {
+                       parse_warn(cfile, "anycast mac address parameter "
+                                  "not allowed here.");
+                       skip_to_semi (cfile);
+               }
+               return;
+
              case REQUEST:
                token = next_token (&val, (unsigned *)0, cfile);
                if (config -> requested_options == default_requested_options)
index b1453309877f623403858d2b79647ce09d9646d9..189a40998d153d4e3fca8a42026695f2028293f3 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $Id: dhclient.conf.5,v 1.23 2009/01/22 21:22:42 dhankins Exp $
+.\"    $Id: dhclient.conf.5,v 1.24 2009/03/13 21:41:45 dhankins Exp $
 .\"
 .\" Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
 .\" Copyright (c) 1996-2003 by Internet Software Consortium
@@ -583,7 +583,6 @@ the subnet, counting the number of significant bits in the netmask starting
 from the leftmost end.  Example configuration syntax:
 .PP
 .I \fIreject\fR 192.168.0.0\fB/\fR16\fB,\fR 10.0.0.5\fB;\fR
-.RE
 .PP
 The above example would cause offers from any server identifier in the
 entire RFC 1918 "Class C" network 192.168.0.0/16, or the specific
@@ -659,6 +658,30 @@ database and will record the media type used to acquire the address.
 Whenever the client tries to renew the lease, it will use that same
 media type.   The lease must expire before the client will go back to
 cycling through media types.
+.PP
+ \fBhardware\fR \fIlink-type mac-address\fR\fB;\fR
+.PP
+The
+.B hardware
+statement defines the hardware MAC address to use for this interface,
+for DHCP servers or relays to direct their replies.  dhclient will determine
+the interface's MAC address automatically, so use of this parameter
+is not recommended.  The \fIlink-type\fR corresponds to the interface's
+link layer type (example: 'ethernet'), while the \fImac-address\fR is
+a string of colon-separated hexadecimal values for octets.
+.PP
+ \fBanycast-mac\fR \fIlink-type mac-address\fR\fB;\fR
+.PP
+The
+.B anycast-mac
+statement over-rides the all-ones broadcast MAC address dhclient will use
+when it is transmitting packets to the all-ones limited broadcast IPv4
+address.  This configuration parameter is useful to reduce the number of
+broadcast packets transmitted by DHCP clients, but is only useful if you
+know the DHCP service(s) anycast MAC address prior to configuring your
+client.  The \fIlink-type\fR and \fImac-address\fR parameters are configured
+in a similar manner to the \fBhardware\fR statement.
+.PP
 .SH SAMPLE
 The following configuration file is used on a laptop running NetBSD
 1.3.   The laptop has an IP alias of 192.5.5.213, and has one
@@ -678,6 +701,7 @@ reject 192.33.137.209;
 
 interface "ep0" {
     send host-name "andare.fugue.com";
+    hardware ethernet 00:a0:24:ab:fb:9c;
     send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
     send dhcp-lease-time 3600;
     supersede domain-name "fugue.com rc.vix.com home.vix.com";
index 08fbf24291a9e8d8d526d12b15b0a26758f3f94d..f76fc27b63528d4376d98699bf4f6a9b44ec72c5 100644 (file)
@@ -362,6 +362,9 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
                return send_fallback (interface, packet, raw,
                                      len, from, to, hto);
 
+       if (hto == NULL && interface->anycast_mac_addr.hlen)
+               hto = &interface->anycast_mac_addr;
+
        /* Assemble the headers... */
        assemble_hw_header (interface, (unsigned char *)hw, &hbufp, hto);
        assemble_udp_ip_header (interface,
index 176551d9b39c1e27204b158477c762e1adc0d628..3625a78d62f7afd1111a9453c1d8ffbc915df7ff 100644 (file)
@@ -720,6 +720,8 @@ intern(char *atom, enum dhcp_token dfv) {
                }
                if (!strcasecmp (atom + 1, "nd"))
                        return AND;
+               if (!strcasecmp(atom + 1, "nycast-mac"))
+                       return ANYCAST_MAC;
                if (!strcasecmp (atom + 1, "ppend"))
                        return APPEND;
                if (!strcasecmp (atom + 1, "llow"))
index 6726e1036d62d0ba134651ee78f4d8a9070286b9..a2d5cb2d04f513a2227b820c31471d73650de1f4 100644 (file)
@@ -538,6 +538,9 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
                return send_fallback (interface, packet, raw,
                                      len, from, to, hto);
 
+       if (hto == NULL && interface->anycast_mac_addr.hlen)
+               hto = &interface->anycast_mac_addr;
+
        dbuflen = 0;
 
        /* Assemble the headers... */
@@ -593,7 +596,7 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
           else 
              memcpy ( phys, interface -> dlpi_broadcast_addr.hbuf, 
               interface -> dlpi_broadcast_addr.hlen);
-           
+
           if (sap_len < 0) { 
              memcpy ( dstaddr, phys, phys_len);
              memcpy ( (char *) &dstaddr [phys_len], sap, ABS (sap_len));
index 2269f01947a75391b592d16c075d034a9eadfb33..dfcdb3d8479200d9f73ff0207b0ec8c69635137e 100644 (file)
@@ -302,6 +302,9 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
                return send_fallback (interface, packet, raw,
                                      len, from, to, hto);
 
+       if (hto == NULL && interface->anycast_mac_addr.hlen)
+               hto = &interface->anycast_mac_addr;
+
        /* Assemble the headers... */
        assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
        fudge = hbufp % 4;      /* IP header must be word-aligned. */
index 7d92733f620ec4aa26faa5155bbe5c5eb0c3002c..db39b761e540fbdf31c9872227e865a3b4b1a92c 100644 (file)
@@ -298,6 +298,9 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
                return send_fallback (interface, packet, raw,
                                      len, from, to, hto);
 
+       if (hto == NULL && interface->anycast_mac_addr.hlen)
+               hto = &interface->anycast_mac_addr;
+
        /* Start with the sockaddr struct... */
        junk = (struct sockaddr *)&hh [0];
        hbufp = (((unsigned char *)&junk -> sa_data [0]) -
index 9c66a75862bd2d2faa47a9440aa0822c3f84e599..611ed23f0917538bdf1027baf971cfaa4afb07c6 100644 (file)
@@ -260,6 +260,9 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
                return send_fallback (interface, packet, raw,
                                      len, from, to, hto);
 
+       if (hto == NULL && interface->anycast_mac_addr.hlen)
+               hto = &interface->anycast_mac_addr;
+
        /* Assemble the headers... */
        assemble_hw_header (interface, (unsigned char *)hw, &hbufp, hto);
        assemble_udp_ip_header (interface,
index d1ca0fe21b8fa5c80624f589176f9a8a67b44be1..8a014bc51511986dcec2972b95468ebd4a05ab38 100644 (file)
@@ -1156,6 +1156,7 @@ struct interface_info {
        int dlpi_sap_length;
        struct hardware dlpi_broadcast_addr;
 # endif /* DLPI_SEND || DLPI_RECEIVE */
+       struct hardware anycast_mac_addr;
 };
 
 struct hardware_link {
index 0f013885747a283f8277c892a6bbe960e8aef539..f7382d2549749ce336a915f394654671e5790202 100644 (file)
@@ -352,7 +352,9 @@ enum dhcp_token {
        ZEROLEN = 655,
        TEMPORARY = 656,
        PREFIX6 = 657,
-       FIXED_PREFIX6 = 658
+       FIXED_PREFIX6 = 658,
+       ANYCAST_MAC = 659
+
 };
 
 #define is_identifier(x)       ((x) >= FIRST_TOKEN &&  \