summaryrefslogtreecommitdiffstats
path: root/debian/patches/0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch146
1 files changed, 146 insertions, 0 deletions
diff --git a/debian/patches/0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch b/debian/patches/0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch
new file mode 100644
index 0000000..eb9869e
--- /dev/null
+++ b/debian/patches/0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch
@@ -0,0 +1,146 @@
+From: =?utf-8?q?Bj=C3=B8rn_Mork?= <bjorn@mork.no>
+Date: Wed, 10 Nov 2010 07:41:55 +0100
+Subject: Adding ifid option to the dhcp6c.conf prefix-interface statement
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+This adds the ability to override the default EUI-64 address selection.
+Useful for interfaces without a unique hardware address, or for creating
+more userfriendly addresses in general.
+
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Jeremie Corbier <jeremie@famille-corbier.net>
+---
+ cfparse.y | 10 +++++++++-
+ cftoken.l | 1 +
+ config.c | 19 ++++++++++++++-----
+ config.h | 2 +-
+ dhcp6c.conf.5 | 10 ++++++++++
+ 5 files changed, 35 insertions(+), 7 deletions(-)
+
+diff --git a/cfparse.y b/cfparse.y
+index c79d131..e83ecf7 100644
+--- a/cfparse.y
++++ b/cfparse.y
+@@ -104,7 +104,7 @@ static void cleanup_cflist __P((struct cf_list *));
+
+ %token INTERFACE IFNAME
+ %token PROFILE PROFILENAME
+-%token PREFIX_INTERFACE SLA_ID SLA_LEN DUID_ID
++%token PREFIX_INTERFACE SLA_ID SLA_LEN IFID DUID_ID
+ %token ID_ASSOC IA_PD IAID IA_NA
+ %token ADDRESS
+ %token REQUEST SEND ALLOW PREFERENCE
+@@ -1056,6 +1056,14 @@ ifparam:
+ l->num = $2;
+ $$ = l;
+ }
++ | IFID NUMBER EOS
++ {
++ struct cf_list *l;
++
++ MAKE_CFLIST(l, IFPARAM_IFID, NULL, NULL);
++ l->num = (u_int64_t)$2;
++ $$ = l;
++ }
+ ;
+
+ ianaconf_list:
+diff --git a/cftoken.l b/cftoken.l
+index 4c9ed10..6afda5f 100644
+--- a/cftoken.l
++++ b/cftoken.l
+@@ -240,6 +240,7 @@ ecl \}
+ <S_CNF>prefix-interface { DECHO; BEGIN S_IFACE; return (PREFIX_INTERFACE); }
+ <S_CNF>sla-id { DECHO; return (SLA_ID); }
+ <S_CNF>sla-len { DECHO; return (SLA_LEN); }
++<S_CNF>ifid { DECHO; return (IFID); }
+
+ /* duration */
+ <S_CNF>infinity { DECHO; return (INFINITY); }
+diff --git a/config.c b/config.c
+index 23598fc..e04d6a5 100644
+--- a/config.c
++++ b/config.c
+@@ -471,6 +471,7 @@ add_pd_pif(iapdc, cfl0)
+ {
+ struct cf_list *cfl;
+ struct prefix_ifconf *pif;
++ int i, use_default_ifid = 1;
+
+ /* duplication check */
+ for (pif = TAILQ_FIRST(&iapdc->iapd_pif_list); pif;
+@@ -504,11 +505,6 @@ add_pd_pif(iapdc, cfl0)
+
+ pif->ifid_len = IFID_LEN_DEFAULT;
+ pif->sla_len = SLA_LEN_DEFAULT;
+- if (get_default_ifid(pif)) {
+- debug_printf(LOG_NOTICE, FNAME,
+- "failed to get default IF ID for %s", pif->ifname);
+- goto bad;
+- }
+
+ for (cfl = cfl0->list; cfl; cfl = cfl->next) {
+ switch(cfl->type) {
+@@ -524,6 +520,11 @@ add_pd_pif(iapdc, cfl0)
+ goto bad;
+ }
+ break;
++ case IFPARAM_IFID:
++ for (i = sizeof(pif->ifid) -1; i >= 0; i--)
++ pif->ifid[i] = (cfl->num >> 8*(sizeof(pif->ifid) - 1 - i)) & 0xff;
++ use_default_ifid = 0;
++ break;
+ default:
+ debug_printf(LOG_ERR, FNAME, "%s:%d internal error: "
+ "invalid configuration",
+@@ -532,6 +533,14 @@ add_pd_pif(iapdc, cfl0)
+ }
+ }
+
++ if (use_default_ifid) {
++ if (get_default_ifid(pif)) {
++ debug_printf(LOG_NOTICE, FNAME,
++ "failed to get default IF ID for %s", pif->ifname);
++ goto bad;
++ }
++ }
++
+ TAILQ_INSERT_TAIL(&iapdc->iapd_pif_list, pif, link);
+ return (0);
+
+diff --git a/config.h b/config.h
+index ea8d17c..64ce9e8 100644
+--- a/config.h
++++ b/config.h
+@@ -266,7 +266,7 @@ enum { DECL_SEND, DECL_ALLOW, DECL_INFO_ONLY, DECL_REQUEST, DECL_DUID,
+ DECL_PREFIX, DECL_PREFERENCE, DECL_SCRIPT, DECL_DELAYEDKEY,
+ DECL_ADDRESS,
+ DECL_RANGE, DECL_ADDRESSPOOL,
+- IFPARAM_SLA_ID, IFPARAM_SLA_LEN,
++ IFPARAM_SLA_ID, IFPARAM_SLA_LEN, IFPARAM_IFID,
+ DHCPOPT_RAPID_COMMIT, DHCPOPT_AUTHINFO,
+ DHCPOPT_DNS, DHCPOPT_DNSNAME,
+ DHCPOPT_IA_PD, DHCPOPT_IA_NA, DHCPOPT_NTP,
+diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5
+index 3d5d25a..1c91d72 100644
+--- a/dhcp6c.conf.5
++++ b/dhcp6c.conf.5
+@@ -443,6 +443,16 @@ This statement specifies the length of the SLA ID in bits.
+ must be a decimal number between 0 and 128.
+ If the length is not specified by this statement,
+ the default value 16 will be used.
++.It Xo
++.Ic ifid Ar ID
++;
++.Xc
++This statement specifies the interface id.
++.Ar ID
++must be a decimal integer. It will be combined with the delegated
++prefix and the sla-id to form a complete interface address. The
++default is to use the EUI-64 address of the
++.Ar interface .
+ .El
+ .El
+ .\"