Package: wide-dhcpv6-client
Version: 20080615-8
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I am using dhcp6c for prefix delegation, and wanted to configure lo with a
user friendly, "nice looking" address.  However, using this config: 

id-assoc pd {
        prefix-interface lo {
                sla-id 0;
        };
        ...
};

got me:

 Aug/05/2010 21:10:59: update_prefix: create a prefix 2001:4620:9::/48 
pltime=600, vltime=12884902488
 Aug/05/2010 21:10:59: ifaddrconf: add an address 
2001:4620:9:0:200:ff:fe00:0/64 on lo

In addition to being as butt ugly as any other EUI-64 address, this is also 
plain wrong.  The client has obviously used 00:00:00:00:00:00 as a macaddress
for lo.  Not good. 

Well, I haven't fixed that, but I did create a patch to allow configuring
an ifid instead of auto generating it.  With that, using this config:

id-assoc pd {
        prefix-interface lo {
                sla-id 0;
                ifid 1;
        };
        ...
};

I got:

 Aug/05/2010 21:11:36: update_prefix: create a prefix 2001:4620:9::/48 
pltime=30064771672, vltime=140338056397400
 Aug/05/2010 21:11:36: ifaddrconf: add an address 2001:4620:9::1/64 on lo

which of course looks much nicer.  The patch is rather primitive, but it is a
start.  Do you think it could be added to the Debian package?  Upstream does 
not seem to be active anymore.


Bjørn

- -- System Information:
Debian Release: squeeze/sid
  APT prefers stable
  APT policy: (700, 'stable'), (650, 'testing'), (600, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages wide-dhcpv6-client depends on:
ii  debconf [debconf-2.0]         1.5.24     Debian configuration management sy
ii  libc6                         2.11.2-2   Embedded GNU C Library: Shared lib
ii  lsb-base                      3.2-20     Linux Standard Base 3.2 init scrip
ii  sharutils                     1:4.6.3-1  shar, unshar, uuencode, uudecode

wide-dhcpv6-client recommends no packages.

wide-dhcpv6-client suggests no packages.

- -- debconf information:
* wide-dhcpv6-client/config_warn:
* wide-dhcpv6-client/interfaces:

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkxbEQAACgkQ10rqkowbIsmdowCfUAO4pmxs3oNUJcBrnvzE+SAM
5igAn0ycO302XAsrWk863X9wFqqgI8qr
=eV/x
-----END PGP SIGNATURE-----
Adding ifid option to the dhcp6c.conf prefix-interface statement

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 <[email protected]>

---
 cfparse.y     |   10 +++++++++-
 cftoken.l     |    1 +
 config.c      |    5 +++++
 config.h      |    2 +-
 dhcp6c.conf.5 |   10 ++++++++++
 5 files changed, 26 insertions(+), 2 deletions(-)


--- wide-dhcpv6-20080615.orig/config.c
+++ wide-dhcpv6-20080615/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",
--- wide-dhcpv6-20080615.orig/cfparse.y
+++ wide-dhcpv6-20080615/cfparse.y
@@ -104,7 +104,7 @@ static void cleanup_cflist __P((struct c
 
 %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:
--- wide-dhcpv6-20080615.orig/config.h
+++ wide-dhcpv6-20080615/config.h
@@ -266,7 +266,7 @@ enum { DECL_SEND, DECL_ALLOW, DECL_INFO_
        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,
--- wide-dhcpv6-20080615.orig/dhcp6c.conf.5
+++ wide-dhcpv6-20080615/dhcp6c.conf.5
@@ -443,6 +443,16 @@ This statement specifies the length of t
 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
 .\"
--- wide-dhcpv6-20080615.orig/cftoken.l
+++ wide-dhcpv6-20080615/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); }

Reply via email to