From 9c262c43444441dbbbf5bbccc6dae0583abbdec6 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Thu, 24 Jan 2008 16:46:48 -0800 Subject: add script to /etc/dhcp3/dhclient-exit-hooks to store values received by dhclient --- scripts/vyatta-dhclient-hook | 19 +++++++++++++++++++ scripts/vyatta-interfaces.pl | 1 + 2 files changed, 20 insertions(+) create mode 100644 scripts/vyatta-dhclient-hook (limited to 'scripts') diff --git a/scripts/vyatta-dhclient-hook b/scripts/vyatta-dhclient-hook new file mode 100644 index 0000000..cc3cb08 --- /dev/null +++ b/scripts/vyatta-dhclient-hook @@ -0,0 +1,19 @@ + +# To enable this script set the following variable to "yes" +RUN="yes" + +if [ "$RUN" = "yes" ]; then + LOG=/var/lib/dhcp3/dhclient_"$interface"_lease + echo `date` > $LOG + + for i in reason interface new_expiry new_dhcp_lease_time medium \ + alias_ip_address new_ip_address new_broadcast_address \ + new_subnet_mask new_domain_name new_network_number \ + new_domain_name_servers new_routers new_static_routes \ + new_dhcp_server_identifier new_dhcp_message_type \ + old_ip_address old_subnet_mask old_domain_name \ + old_domain_name_servers old_routers \ + old_static_routes; do + echo $i=\'${!i}\' >> $LOG + done +fi diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index dde54c7..1f13e20 100644 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -277,6 +277,7 @@ sub delete_eth_addrs { if ($addr eq "dhcp") { dhcp_release_addr($intf); update_dhcp_client(); + system("rm -f /var/lib/dhcp3/dhclient_$intf\_lease"); return; } my $version = is_ip_v4_or_v6($addr); -- cgit v1.2.3