diff -ru dhcpcd-1.3.22-pl4-orig/client.c dhcpcd-1.3.22-pl4/client.c --- dhcpcd-1.3.22-pl4-orig/client.c 2003-01-01 09:24:37.000000000 +0800 +++ dhcpcd-1.3.22-pl4/client.c 2003-06-17 11:20:35.000000000 +0800 @@ -1076,10 +1076,16 @@ return &dhcpBound; } /*****************************************************************************/ -void *dhcpRelease() +void *dhcpRelease(int deleteCacheFlag) { struct sockaddr addr; - deleteDhcpCache(); + if ( deleteCacheFlag ) { + if ( DebugFlag ) syslog (LOG_DEBUG,"Deleting Dhcp Cache"); + deleteDhcpCache(); + } else { + if ( DebugFlag ) syslog (LOG_DEBUG,"Not Deleting Dhcp Cache"); + } + if ( DhcpIface.ciaddr == 0 ) return &dhcpInit; buildDhcpRelease(random()); diff -ru dhcpcd-1.3.22-pl4-orig/client.h dhcpcd-1.3.22-pl4/client.h --- dhcpcd-1.3.22-pl4-orig/client.h 2002-12-31 13:15:33.000000000 +0800 +++ dhcpcd-1.3.22-pl4/client.h 2003-06-17 11:21:51.000000000 +0800 @@ -197,7 +197,7 @@ void *dhcpBound(); void *dhcpRenew(); void *dhcpRebind(); -void *dhcpRelease(); +void *dhcpRelease(int deleteCacheFlag); void *dhcpStop(); void *dhcpInform(); #ifdef ARPCHECK diff -ru dhcpcd-1.3.22-pl4-orig/dhcpcd.8 dhcpcd-1.3.22-pl4/dhcpcd.8 --- dhcpcd-1.3.22-pl4-orig/dhcpcd.8 2003-01-01 09:31:31.000000000 +0800 +++ dhcpcd-1.3.22-pl4/dhcpcd.8 2003-06-17 13:11:12.000000000 +0800 @@ -9,7 +9,7 @@ .in +.5i .ti -.5i dhcpcd -\%[\-dknrBCDHNRSTY] +\%[\-dknrzBCDHNRSTY] \%[\-t\ ] \%[\-c\ ] \%[-h\ ] @@ -76,7 +76,7 @@ receives .B SIGHUP it will send -.B DCHP_RELEASE +.B DHCP_RELEASE message to the server and destroy dhcpcd cache. In a case .B dhcpcd receives @@ -93,6 +93,21 @@ from DHCP server which was assigned before the system went down. .TP +.BI \-z +Sends +.B SIGUSR1 +signal to the +.B dhcpcd +process that is currently running. If +.B dhcpcd +receives +.B SIGUSR1 +it will send +.B DHCP_RELEASE +message to the server +.B without +destroying the dhcpcd cache. +.TP .BI \-n Sends .B SIGALRM diff -ru dhcpcd-1.3.22-pl4-orig/dhcpcd.c dhcpcd-1.3.22-pl4/dhcpcd.c --- dhcpcd-1.3.22-pl4-orig/dhcpcd.c 2003-01-01 09:26:32.000000000 +0800 +++ dhcpcd-1.3.22-pl4/dhcpcd.c 2003-06-17 11:07:34.000000000 +0800 @@ -141,6 +141,10 @@ s++; killFlag=SIGALRM; goto prgs; + case 'z': + s++; + killFlag=SIGUSR1; + goto prgs; case 'd': s++; DebugFlag=1; @@ -325,7 +329,7 @@ default: usage: print_version(); fprintf(stderr, -"Usage: dhcpcd [-dknrBCDHNRSTY] [-l leasetime] [-h hostname] [-t timeout]\n\ +"Usage: dhcpcd [-dknrzBCDHNRSTY] [-l leasetime] [-h hostname] [-t timeout]\n\ [-i vendorClassID] [-I ClientID] [-c filename] [-s [ipaddr]]\n\ [-w windowsize] [-L ConfigDir] [-G [gateway]] [interface]\n"); exit(1); diff -ru dhcpcd-1.3.22-pl4-orig/dhcpconfig.c dhcpcd-1.3.22-pl4/dhcpconfig.c --- dhcpcd-1.3.22-pl4-orig/dhcpconfig.c 2002-12-30 06:05:44.000000000 +0800 +++ dhcpcd-1.3.22-pl4/dhcpconfig.c 2003-06-17 13:46:31.000000000 +0800 @@ -334,6 +334,16 @@ ((unsigned char *)&DhcpIface.ciaddr)[1], ((unsigned char *)&DhcpIface.ciaddr)[2], ((unsigned char *)&DhcpIface.ciaddr)[3]); + + /* In the case where machine dies for some reason, resolv.conf.sv would + * not have been restored to original glory + */ + if ( 1+rename(""RESOLV_CONF".sv",RESOLV_CONF) ) { + if ( DebugFlag ) syslog (LOG_DEBUG, "Restored resolv.conf.sv from improper shutdown"); + } else { + if ( DebugFlag ) syslog (LOG_DEBUG, "No resolv.conf.sv to restore"); + } + if ( ReplResolvConf ) { resolv_renamed=1+rename(RESOLV_CONF,""RESOLV_CONF".sv"); diff -ru dhcpcd-1.3.22-pl4-orig/signals.c dhcpcd-1.3.22-pl4/signals.c --- dhcpcd-1.3.22-pl4-orig/signals.c 2002-01-21 06:51:46.000000000 +0800 +++ dhcpcd-1.3.22-pl4/signals.c 2003-06-17 11:29:10.000000000 +0800 @@ -114,13 +114,15 @@ else { if ( sig == SIGHUP ) - { - dhcpRelease(); - /* allow time for final packets to be transmitted before shutting down */ - /* otherwise 2.0 drops unsent packets. fixme: find a better way than sleep */ - sleep(1); - } - syslog(LOG_ERR,"terminating on signal %d\n",sig); + /* Dhcp release with Cache file deletion */ + dhcpRelease(1); + else if ( sig == SIGUSR1) + /* Dhcp release without Cache file deletion */ + dhcpRelease(0); + /* allow time for final packets to be transmitted before shutting down */ + /* otherwise 2.0 drops unsent packets. fixme: find a better way than sleep */ + sleep(1); + syslog(LOG_ERR,"terminating on signal %d\n",sig); } dhcpStop(); deletePidFile();