]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add support for the following RFCs:
authorRoy Marples <roy@marples.name>
Mon, 3 Feb 2014 10:28:30 +0000 (10:28 +0000)
committerRoy Marples <roy@marples.name>
Mon, 3 Feb 2014 10:28:30 +0000 (10:28 +0000)
DHCP SLP Directory Agent, RFC2610
DHCP Name Service Search, RFC2937
DHCP PANA Authentication Agent, RFC5192
DHCP Lost Server, RFC5223
DHCP CAPWAP, RFC5417
DHCP Mobility Services, RFC5678
DHCP SIP UA, RFC6011
DHCP ANDSF, RFC6153
DHCP RDNSS Selection for MIF Nodes, RFC6731
DHCP TFTP Server Address, RFC5859
DHCP PXELINUX, RFC5071
DHCP Access Network Domain Name, RFC5986
DHCP Virtual Subnet Selection, RFC6607
DHCP Relay Agent Remote-ID, RFC4649
DHCP Relay Agent Subscriber-ID, RFC4580
DHCPv6 Relay-ID, RFC5460
DHCPv6 LIS Discovery, RFC5986
DHCPv6 SIP UA, RFC6011
DHCPv6 Network Boot, RFC5970
DHCPv6 Home Info Discovery in MIPv6, RFC6610
DHCPv6 RDNSS Selection for MIF Nodes, RFC6731
DHCPv6 Kerberos, RFC6784
DHCPv6 Relay-Triggered Reconfiguraion, RFC6977
DHCPv6 SOL_MAX_RT, RFC7083

dhcp6.c
dhcp6.h
dhcpcd-definitions.conf

diff --git a/dhcp6.c b/dhcp6.c
index eb5c7996d6d7ac661291573fdf445596e859fcfa..841eed2e3b3c3f9b805229a33aa539f4234b63cf 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1002,7 +1002,7 @@ dhcp6_startdiscover(void *arg)
        state->RTC = 0;
        state->IMD = SOL_MAX_DELAY;
        state->IRT = SOL_TIMEOUT;
-       state->MRT = SOL_MAX_RT;
+       state->MRT = state->sol_max_rt;
        state->MRC = 0;
 
        eloop_timeout_delete(NULL, ifp);
@@ -1159,7 +1159,7 @@ dhcp6_startinform(void *arg)
        state->RTC = 0;
        state->IMD = INF_MAX_DELAY;
        state->IRT = INF_TIMEOUT;
-       state->MRT = INF_MAX_RT;
+       state->MRT = state->inf_max_rt;
        state->MRC = 0;
 
        if (dhcp6_makemessage(ifp) == -1)
@@ -2248,6 +2248,31 @@ dhcp6_handledata(__unused void *arg)
                        op = NULL;
                        break;
                }
+               /* RFC7083 */
+               o = dhcp6_getmoption(D6_OPTION_SOL_MAX_RT, r, len);
+               if (o && ntohs(o->len) >= sizeof(u32)) {
+                       memcpy(&u32, D6_COPTION_DATA(o), sizeof(u32));
+                       u32 = ntohl(u32);
+                       if (u32 >= 60 && u32 <= 86400) {
+                               syslog(LOG_DEBUG, "%s: SOL_MAX_RT %d -> %d",
+                                   ifp->name, state->sol_max_rt, u32);
+                               state->sol_max_rt = u32;
+                       } else
+                               syslog(LOG_ERR, "%s: invalid SOL_MAX_RT %d",
+                                   ifp->name, u32);
+               }
+               o = dhcp6_getmoption(D6_OPTION_INF_MAX_RT, r, len);
+               if (o && ntohs(o->len) >= sizeof(u32)) {
+                       memcpy(&u32, D6_COPTION_DATA(o), sizeof(u32));
+                       u32 = ntohl(u32);
+                       if (u32 >= 60 && u32 <= 86400) {
+                               syslog(LOG_DEBUG, "%s: INF_MAX_RT %d -> %d",
+                                   ifp->name, state->inf_max_rt, u32);
+                               state->inf_max_rt = u32;
+                       } else
+                               syslog(LOG_ERR, "%s: invalid INF_MAX_RT %d",
+                                   ifp->name, u32);
+               }
                if (dhcp6_validatelease(ifp, r, len, sfrom) == -1)
                        return;
                break;
@@ -2589,6 +2614,9 @@ dhcp6_start(struct interface *ifp, enum DH6S init_state)
        if (state == NULL)
                return -1;
 
+       state->sol_max_rt = SOL_MAX_RT;
+       state->inf_max_rt = INF_MAX_RT;
+
        TAILQ_INIT(&state->addrs);
        if (dhcp6_find_delegates(ifp))
                return 0;
diff --git a/dhcp6.h b/dhcp6.h
index e6febe6467a5f2496be9b31a5b423e565adabcfa..50680d3a0ef7008285077f3fcc008cb89fbbc301 100644 (file)
--- a/dhcp6.h
+++ b/dhcp6.h
@@ -52,6 +52,8 @@
 #define DHCP6_INFORMATION_REQ  11
 #define DHCP6_RELAY_FLOW       12
 #define DHCP6_RELAY_REPL       13
+#define DHCP6_RECONFIGURE_REQ  18
+#define DHCP6_RECONFIGURE_REPLY        19
 
 #define D6_OPTION_CLIENTID             1
 #define D6_OPTION_SERVERID             2
@@ -87,6 +89,8 @@
 #define D6_OPTION_FQDN                 39
 #define D6_OPTION_POSIX_TIMEZONE       41
 #define D6_OPTION_TZDB_TIMEZONE                42
+#define D6_OPTION_SOL_MAX_RT           82
+#define D6_OPTION_INF_MAX_RT           83
 
 #define D6_FQDN_PTR    0x00
 #define D6_FQDN_BOTH   0x01
@@ -174,6 +178,8 @@ struct dhcp6_state {
        int MRC;
        int MRT;
        void (*MRCcallback)(void *);
+       int sol_max_rt;
+       int inf_max_rt;
 
        struct dhcp6_message *send;
        size_t send_len;
index 4fe093c08d9e9d1ad4f491e3fa787471ceb53f35..0244dd92dcf4518a3becc664792c1f7caef84e21 100644 (file)
@@ -92,6 +92,14 @@ define 76    array ipaddress         streettalk_directory_assistance_server
 # DHCP User Class, RFC3004
 define 77      string                  user_class
 
+# DHCP SLP Directory Agent, RFC2610
+define 78      embed                   slp_agent
+embed          byte                    mandatory
+embed          array ipaddress         address
+define 79      embed                   slp_service
+embed          byte                    mandatory
+embed          string                  scope_list
+
 # DHCP Rapid Commit, RFC4039
 define 80      norequest flag          rapid_commit
 
@@ -102,6 +110,10 @@ embed              byte                    rcode1
 embed          byte                    rcode2
 embed          domain                  fqdn
 
+# Option 82 is for Relay Agents and DHCP servers
+
+# Options 83 ad 84 are unused, RFC3679
+
 # DHCP Novell Directory Services, RFC2241
 define 85      array ipaddress         nds_servers
 define 86      string                  nds_tree_name
@@ -123,16 +135,33 @@ embed             binhex                  information
 define 91      uint32                  client_last_transaction_time
 define 92      array ipaddress         associated_ip
 
+# DHCP Options for Intel Preboot eXecution Environent (PXE), RFC4578
+# Options 93, 94 and 97 are used but of no use to dhcpcd
+
+# Option 95 used by Apple but never published RFC3679
+# Option 96 is unused, RFC3679
+
 # DHCP The Open Group's User Authentication Protocol, RFC2485
 define 98      string                  uap_servers
 
+# DHCP Civic Addresses Configuration Information, RFC4776
+define 99      encap                   geoconf_civic
+embed          byte                    what
+embed          uint16                  country_code
+# The rest of this option is not supported
+
 # DHCP Timezone, RFC4883
 define 100     string                  posix_timezone
 define 101     string                  tzdb_timezone
 
+# Options 102-115 are unused, RFC3679
+
 # DHCP Auto-Configuration, RFC2563
 define 116     byte                    auto_configure
 
+# DHCP Name Service Search, RFC2937
+define 117     array uint16            name_service_search
+
 # DHCP Subnet Selection, RFC3011
 define 118     ipaddress               subnet_selection
 
@@ -142,6 +171,8 @@ define 119  domain                  domain_search
 # DHCP Session Initiated Protocol Servers, RFC3361
 define 120     rfc3361                 sip_server
 
+# Option 121 is defined at the top of this file
+
 # DHCP CableLabs Client, RFC3495
 define 122     encap                   tsp
 encap 1                ipaddress               dhcp_server
@@ -159,6 +190,10 @@ encap 6            domain                  kerberos_realm
 encap 7                byte                    ticket_granting_server_utilization
 encap 8                byte                    provisioning_timer
 
+# DHCP Coordinate LCI, RFC6225
+# We have no means of expressing 6 bit lengths
+define 123     binhex                  geoconf
+
 # DHCP Vendor-Identifying Vendor Options, RFC3925
 define 124     binhex                  vivco
 define 125     embed                   vivso
@@ -167,12 +202,88 @@ embed             uint32                  enterprise_number
 # Their code is matched to the enterprise number defined above
 # see the end of this file for an example
 
+# Options 126 and 127 are unused, RFC3679
+
+# DHCP Options for Intel Preboot eXecution Environent (PXE), RFC4578
+# Options 128-135 are used but of no use to dhcpcd
+
+# DHCP PANA Authentication Agent, RFC5192
+define 136     array ipaddress         pana_agent
+
+# DHCP Lost Server, RFC5223
+define 137     domain                  lost_server
+
+# DHCP CAPWAP, RFC5417
+define 138     array ipaddress         capwap_ac
+
+# DHCP Mobility Services, RFC5678
+define 139     encap                   mos_ip
+encap 1                array ipaddress         is
+encap 2                array ipaddress         cs
+encap 3                array ipaddress         es
+define 140     encap                   mos_domain
+encap 1                domain                  is
+encap 2                domain                  cs
+encap 3                domain                  es
+
+# DHCP SIP UA, RFC6011
+define 141     domain                  sip_ua_cs_list
+
+# DHCP ANDSF, RFC6153
+define 142     array ipaddress         andsf
+define 143     array ip6address        andsf6
+
+# DHCP Coordinate LCI, RFC6225
+# We have no means of expressing 6 bit lengths
+define 144     binhex                  geoloc
+
 # DHCP FORCERENEW Nonce Capability, RFC6704
 define 145     array byte              forcerenew_nonce_capable
 
+# DHCP RDNSS Selection for MIF Nodes, RFC6731
+define 146     embed                   rdnss_selection
+embed          byte                    prf
+embed          ipaddress               primary
+embed          ipaddress               secondary
+embed          domain                  domains
+
+# Options 147, 148 and 149 are unused, RFC3942
+
+# DHCP TFTP Server Address, RFC5859
+define 150     array ipaddress         tftp_servers
+
+# Options 151-157 are used for Lease Query, RFC6926 and not for dhcpcd
+# Options 158-174 are unused, RFC3942
+# Options 175-177 are tentativel assigned for Etherboot
+# Options 178-207 are unused, RFC3942
+
+# DHCP PXELINUX, RFC5071
+define 208     binhex                  pxelinux_magic
+define 209     string                  config_file
+define 210     string                  path_prefix
+define 211     uint32                  reboot_time
+
 # DHCP IPv6 Rapid Deployment on IPv4 Infrastructures, RFC5969
 define 212     rfc5969                 sixrd
 
+# DHCP Access Network Domain Name, RFC5986
+define 213     domain                  access_domain
+
+# Options 214-219 are unused, RFC3942
+
+# DHCP Subnet Allocation, RFC6656
+# Option 220 looks specific to Cisco hardware.
+
+# DHCP Virtual Subnet Selection, RFC6607
+define 221     encap                   vss
+encap 0                string                  nvt
+encap 1                binhex                  vpn_id
+encap 255      flag                    global
+
+# Options 222 and 223 are unused, RFC3942
+# Options 224-254 are reserved for Private Use
+# Option 255 End
+
 ##############################################################################
 # DHCPv6 options, RFC3315
 define6 1      binhex                  client_id
@@ -201,6 +312,8 @@ define6 7   byte                    preference
 define6 8      uint16                  elased_time
 define6 9      binhex                  dhcp_relay_msg
 
+# Option 10 is unused
+
 define6 11     embed                   auth
 embed          byte                    protocol
 embed          byte                    algorithm
@@ -242,7 +355,6 @@ embed               binhex:4                iaid
 embed          uint32                  t1
 embed          uint32                  t2
 encap 26       option
-
 define6 26     index embed             prefix
 embed          uint32                  pltime
 embed          uint32                  vltime
@@ -265,24 +377,142 @@ define6 32       uint32                  info_refresh_time
 define6 33     domain                  bcms_server_d
 define6 34     array ip6address        bcms_server_a
 
+# DHCP Civic Addresses Configuration Information, RFC4776
+define6 36     encap                   geoconf_civic
+embed          byte                    what
+embed          uint16                  country_code
+# The rest of this option is not supported
+
+# DHCP Relay Agent Remote-ID, RFC4649
+define6 37     embed                   remote_id
+embed          uint32                  enterprise_number
+embed          binhex                  remote_id
+
+# DHCP Relay Agent Subscriber-ID, RFC4580
+define6 38     binhex                  subscriber_id
+
 # DHCPv6 Fully Qualified Domain Name, RFC4704
 define6 39     embed                   fqdn
 embed          byte                    flags
 embed          domain                  fqdn
 
+# DHCPv6 PANA Authentication Agnet, RC5192
+define6 40     array ip6address        pana_agent
+
 # DHCPv6 Timezone options, RFC4883
 define6 41     string                  posix_timezone
 define6 42     string                  tzdb_timezone
 
+# DHCPv6 Relay Agent Echo Request
+define6 43     array uint16            ero
+
+# Options 44-48 are used for Lease Query, RFC5007 and not for dhcpcd
+
+# DHCPv6 Home Info Discovery in MIPv6, RFC6610
+define6 49     domain                  mip6_hnidf
+define6 50     encap                   mip6_vdinf
+encap 71       option
+encap 72       option
+encap 73       option
+
+# DHCPv6 Lost Server, RFC5223
+define6 51     domain                  lost_server
+
+# DHCPv6 CAPWAP, RFC5417
+define6 52     array ip6address        capwap_ac
+
+# DHCPv6 Relay-ID, RFC5460
+define6 53     binhex                  relay_id
+
+# DHCP Mobility Services, RFC5678
+define6 54     encap                   mos_ip
+encap 1                array ip6address        is
+encap 2                array ip6address        cs
+encap 3                array ip6address        es
+define6 55     encap                   mos_domain
+encap 1                domain                  is
+encap 2                domain                  cs
+encap 3                domain                  es
+
 # DHCPv6 Network Time Protocol Server, RFC5908
 define6 56     encap                   ntp_server
 encap 1                ip6address              addr
 encap 2                ip6address              mcast_addr
 encap 3                ip6address              fqdn
 
+# DHCPv6 LIS Discovery, RFC5986
+define6 57     domain                  access_domain
+
+# DHCPv6 SIP UA, RFC6011
+define6 58     domain                  sip_ua_cs_list
+
+# DHCPv6 Network Boot, RFC5970
+define6 59     string                  bootfile_url
+# We presently cannot decode bootfile_param
+define6 60     binhex                  bootfile_param
+define6 61     array uint16            architecture_types
+define6 62     embed                   nii
+embed          byte                    type
+embed          byte                    major
+embed          byte                    minor
+
+# DHCPv6 Coordinate LCI, RFC6225
+# We have no means of expressing 6 bit lengths
+define6 63     binhex                  geoloc
+
 # DHCPv6 AFTR-Name, RFC6334
 define6 64     domain                  aftr_name
 
+# DHCPv6 Home Info Discovery in MIPv6, RFC6610
+define6 69     encap                   mip6_idinf
+encap 71       option
+encap 72       option
+encap 73       option
+define6 70     encap                   mip6_udinf
+encap 71       option
+encap 72       option
+encap 73       option
+define6        71      embed                   mip6_hnp
+embed          byte                    prefix_len
+embed          ip6address              prefix
+define6 72     ip6address              mip6_haa
+define6 73     domain                  mip6_haf
+
+# DHCPv6 RDNSS Selection for MIF Nodes, RFC6731
+define6 74     embed                   rdnss_selection
+embed          ip6address              server
+embed          byte                    prf
+embed          domain                  domains
+
+# DHCPv6 Kerberos, RFC6784
+define6 75     domain                  krb_principal_name
+define6 76     domain                  krb_realm_name
+define6 78     embed                   krb_kdc
+embed          uint16                  priority
+embed          uint16                  weight
+embed          byte                    transport_type
+embed          uint16                  port
+embed          ip6address              address
+embed          domain                  realm_name
+
+# DHCPv6 Client Link-Layer Address, RFC6939
+# Section 7 states that clients MUST ignore the option 79
+
+# DHCPv6 Relay-Triggered Reconfiguraion, RFC6977
+define6 80     ip6address              link_address
+
+# DHCPv6 Radius, RFC7037
+# Section 7 states that clients MUST ignore the option 81
+
+# DHCPv6 SOL_MAX_RT, RFC7083
+define6 82     request uint32          sol_max_rt
+define6        83      request uint32          inf_max_rt
+
+# DHCPv6 Address Selection Policy
+# Currently not supported
+
+# Options 86-65535 are unasssinged
+
 ##############################################################################
 # Vendor-Identifying Vendor Options
 # An example: