aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2010-08-06 15:33:05 +0200
committerBjørn Mork <bjorn@mork.no>2010-08-06 15:37:37 +0200
commit57721604f26eefbe3dfb628affec8ca167a9f4b8 (patch)
treef249d1e41229aa0ca6426ebc559044f52ae74487
parentfbf66aa98a358cd35f58844e59e420534f36cac4 (diff)
Adding ifid option to the dhcp6c.conf prefix-interface statementHEADmaster
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>
-rw-r--r--cfparse.y10
-rw-r--r--cftoken.l1
-rw-r--r--config.c5
-rw-r--r--config.h2
-rw-r--r--dhcp6c.conf.510
5 files changed, 26 insertions, 2 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..bb16c21 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;
/* duplication check */
for (pif = TAILQ_FIRST(&iapdc->iapd_pif_list); pif;
@@ -524,6 +525,10 @@ 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;
+ break;
default:
debug_printf(LOG_ERR, FNAME, "%s:%d internal error: "
"invalid configuration",
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
.\"