dhcp 4.2.0 -> dhclient -6 -P ppp0

Udo van den Heuvel udovdh at xs4all.nl
Fri Sep 3 14:11:49 UTC 2010


On 2010-09-03 00:25, David W. Hankins wrote:
> On Thu, Sep 02, 2010 at 12:58:53PM -0400, Patrik Lahti wrote:
>> I may be missing something but the above shows that you only got a prefix 
>> from the server (not an address which would have been an iaaddr in the 
>> leases file) like David suspected.
> 
> Yes, that's correct.  In this case you should be looking in another
> environment variable passed to the script, I believe it is
> "new_ip6_prefix".

I added some code to the dhclient-script that is distributed with
Fedora's dhclient rpm, just before the main `case` statement:

if [ -z "${new_ip6_address}" ] &&
   [ ! -z "${new_ip6_prefix}" ]; then
    my_mac_addr=`ip link show $IFACE|awk '/ether/{print $2};'`
    my_scope=`echo $new_ip6_prefix|sed sed -e 's/\/.*//'`"/"$PREFIXLEN
    new_ip6_address=`ipv6calc --action prefixmac2ipv6 --in prefix+mac
--out ipv6addr $my_scope  $my_mac_addr`
    new_ip6_prefixlen=$PREFIXLEN
    old_ip6_prefixlen=$PREFIXLEN
    if [ ${new_ip6_prefix} = ${old_ip6_prefix} ]; then
      old_ip6_address=$new_ip6_address
    fi
fi

This code calculates a new ipv6 address based on the scope that was
delegated to dhclient and fills the missing variables so that
dhclient-script should work mostly unchanged (except for the $IFACE stuff).
I.e.: this adds PD support....

Any bugs in this code snippet?
Please mention them.

Thanks,
Udo



More information about the dhcp-users mailing list