1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../dhcp6c/ifid-option.patch
5 # Copyright (C) 2019 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 From: =?utf-8?q?Bj=C3=B8rn_Mork?= <bjorn@mork.no>
18 Date: Wed, 10 Nov 2010 07:41:55 +0100
19 Subject: Adding ifid option to the dhcp6c.conf prefix-interface statement
21 Content-Type: text/plain; charset="utf-8"
22 Content-Transfer-Encoding: 8bit
24 This adds the ability to override the default EUI-64 address selection.
25 Useful for interfaces without a unique hardware address, or for creating
26 more userfriendly addresses in general.
28 Signed-off-by: Bjørn Mork <bjorn@mork.no>
29 Signed-off-by: Jeremie Corbier <jeremie@famille-corbier.net>
31 cfparse.y | 10 +++++++++-
33 config.c | 19 ++++++++++++++-----
35 dhcp6c.conf.5 | 10 ++++++++++
36 5 files changed, 35 insertions(+), 7 deletions(-)
38 --- dhcp6c-20190419/cfparse.y.vanilla 2019-08-08 12:53:10.118777947 +0200
39 +++ dhcp6c-20190419/cfparse.y 2019-08-08 12:53:23.342778205 +0200
43 %token INTERFACE IFNAME
44 -%token PREFIX_INTERFACE SLA_ID SLA_LEN DUID_ID
45 +%token PREFIX_INTERFACE SLA_ID SLA_LEN IFID DUID_ID
46 %token ID_ASSOC IA_PD IAID IA_NA
48 %token REQUEST SEND ALLOW PREFERENCE
49 @@ -1056,6 +1056,14 @@ ifparam:
57 + MAKE_CFLIST(l, IFPARAM_IFID, NULL, NULL);
58 + l->num = (u_int64_t)$2;
64 diff --git a/cftoken.l b/cftoken.l
65 index 4c9ed10..6afda5f 100644
68 @@ -240,6 +240,7 @@ ecl \}
69 <S_CNF>prefix-interface { DECHO; BEGIN S_IFACE; return (PREFIX_INTERFACE); }
70 <S_CNF>sla-id { DECHO; return (SLA_ID); }
71 <S_CNF>sla-len { DECHO; return (SLA_LEN); }
72 +<S_CNF>ifid { DECHO; return (IFID); }
75 <S_CNF>infinity { DECHO; return (INFINITY); }
76 diff --git a/config.c b/config.c
77 index 23598fc..e04d6a5 100644
80 @@ -471,6 +471,7 @@ add_pd_pif(iapdc, cfl0)
83 struct prefix_ifconf *pif;
84 + int i, use_default_ifid = 1;
86 /* duplication check */
87 for (pif = TAILQ_FIRST(&iapdc->iapd_pif_list); pif;
90 pif->ifid_len = IFID_LEN_DEFAULT;
91 pif->sla_len = SLA_LEN_DEFAULT;
92 - if (get_default_ifid(pif)) {
93 - d_printf(LOG_NOTICE, FNAME,
94 - "failed to get default IF ID for %s", pif->ifname);
98 for (cfl = cfl0->list; cfl; cfl = cfl->next) {
100 @@ -524,6 +520,11 @@ add_pd_pif(iapdc, cfl0)
105 + for (i = sizeof(pif->ifid) -1; i >= 0; i--)
106 + pif->ifid[i] = (cfl->num >> 8*(sizeof(pif->ifid) - 1 - i)) & 0xff;
107 + use_default_ifid = 0;
110 debug_printf(LOG_ERR, FNAME, "%s:%d internal error: "
111 "invalid configuration",
112 @@ -532,6 +533,14 @@ add_pd_pif(iapdc, cfl0)
116 + if (use_default_ifid) {
117 + if (get_default_ifid(pif)) {
118 + d_printf(LOG_NOTICE, FNAME,
119 + "failed to get default IF ID for %s", pif->ifname);
124 TAILQ_INSERT_TAIL(&iapdc->iapd_pif_list, pif, link);
127 diff --git a/config.h b/config.h
128 index ea8d17c..64ce9e8 100644
131 @@ -266,7 +266,7 @@ enum { DECL_SEND, DECL_ALLOW, DECL_INFO_ONLY, DECL_REQUEST, DECL_DUID,
132 DECL_PREFIX, DECL_PREFERENCE, DECL_SCRIPT, DECL_DELAYEDKEY,
134 DECL_RANGE, DECL_ADDRESSPOOL,
135 - IFPARAM_SLA_ID, IFPARAM_SLA_LEN,
136 + IFPARAM_SLA_ID, IFPARAM_SLA_LEN, IFPARAM_IFID,
137 DHCPOPT_RAPID_COMMIT, DHCPOPT_AUTHINFO,
138 DHCPOPT_DNS, DHCPOPT_DNSNAME,
139 DHCPOPT_IA_PD, DHCPOPT_IA_NA, DHCPOPT_NTP,
140 diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5
141 index 3d5d25a..1c91d72 100644
144 @@ -443,6 +443,16 @@ This statement specifies the length of the SLA ID in bits.
145 must be a decimal number between 0 and 128.
146 If the length is not specified by this statement,
147 the default value 16 will be used.
152 +This statement specifies the interface id.
154 +must be a decimal integer. It will be combined with the delegated
155 +prefix and the sla-id to form a complete interface address. The
156 +default is to use the EUI-64 address of the