Magellan Linux

Annotation of /trunk/dhcpcd/patches/dhcpcd-1.3.22-pl4-keepCacheAndResolv.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (hide annotations) (download)
Tue May 8 20:06:05 2007 UTC (17 years, 1 month ago) by niro
File size: 4668 byte(s)
-import

1 niro 144 diff -ru dhcpcd-1.3.22-pl4-orig/client.c dhcpcd-1.3.22-pl4/client.c
2     --- dhcpcd-1.3.22-pl4-orig/client.c 2003-01-01 09:24:37.000000000 +0800
3     +++ dhcpcd-1.3.22-pl4/client.c 2003-06-17 11:20:35.000000000 +0800
4     @@ -1076,10 +1076,16 @@
5     return &dhcpBound;
6     }
7     /*****************************************************************************/
8     -void *dhcpRelease()
9     +void *dhcpRelease(int deleteCacheFlag)
10     {
11     struct sockaddr addr;
12     - deleteDhcpCache();
13     + if ( deleteCacheFlag ) {
14     + if ( DebugFlag ) syslog (LOG_DEBUG,"Deleting Dhcp Cache");
15     + deleteDhcpCache();
16     + } else {
17     + if ( DebugFlag ) syslog (LOG_DEBUG,"Not Deleting Dhcp Cache");
18     + }
19     +
20     if ( DhcpIface.ciaddr == 0 ) return &dhcpInit;
21    
22     buildDhcpRelease(random());
23     diff -ru dhcpcd-1.3.22-pl4-orig/client.h dhcpcd-1.3.22-pl4/client.h
24     --- dhcpcd-1.3.22-pl4-orig/client.h 2002-12-31 13:15:33.000000000 +0800
25     +++ dhcpcd-1.3.22-pl4/client.h 2003-06-17 11:21:51.000000000 +0800
26     @@ -197,7 +197,7 @@
27     void *dhcpBound();
28     void *dhcpRenew();
29     void *dhcpRebind();
30     -void *dhcpRelease();
31     +void *dhcpRelease(int deleteCacheFlag);
32     void *dhcpStop();
33     void *dhcpInform();
34     #ifdef ARPCHECK
35     diff -ru dhcpcd-1.3.22-pl4-orig/dhcpcd.8 dhcpcd-1.3.22-pl4/dhcpcd.8
36     --- dhcpcd-1.3.22-pl4-orig/dhcpcd.8 2003-01-01 09:31:31.000000000 +0800
37     +++ dhcpcd-1.3.22-pl4/dhcpcd.8 2003-06-17 13:11:12.000000000 +0800
38     @@ -9,7 +9,7 @@
39     .in +.5i
40     .ti -.5i
41     dhcpcd
42     -\%[\-dknrBCDHNRSTY]
43     +\%[\-dknrzBCDHNRSTY]
44     \%[\-t\ <timeout>]
45     \%[\-c\ <ExecFilePath>]
46     \%[-h\ <hostname>]
47     @@ -76,7 +76,7 @@
48     receives
49     .B SIGHUP
50     it will send
51     -.B DCHP_RELEASE
52     +.B DHCP_RELEASE
53     message to the server and destroy dhcpcd cache. In a case
54     .B dhcpcd
55     receives
56     @@ -93,6 +93,21 @@
57     from DHCP server which was assigned before the
58     system went down.
59     .TP
60     +.BI \-z
61     +Sends
62     +.B SIGUSR1
63     +signal to the
64     +.B dhcpcd
65     +process that is currently running. If
66     +.B dhcpcd
67     +receives
68     +.B SIGUSR1
69     +it will send
70     +.B DHCP_RELEASE
71     +message to the server
72     +.B without
73     +destroying the dhcpcd cache.
74     +.TP
75     .BI \-n
76     Sends
77     .B SIGALRM
78     diff -ru dhcpcd-1.3.22-pl4-orig/dhcpcd.c dhcpcd-1.3.22-pl4/dhcpcd.c
79     --- dhcpcd-1.3.22-pl4-orig/dhcpcd.c 2003-01-01 09:26:32.000000000 +0800
80     +++ dhcpcd-1.3.22-pl4/dhcpcd.c 2003-06-17 11:07:34.000000000 +0800
81     @@ -141,6 +141,10 @@
82     s++;
83     killFlag=SIGALRM;
84     goto prgs;
85     + case 'z':
86     + s++;
87     + killFlag=SIGUSR1;
88     + goto prgs;
89     case 'd':
90     s++;
91     DebugFlag=1;
92     @@ -325,7 +329,7 @@
93     default:
94     usage: print_version();
95     fprintf(stderr,
96     -"Usage: dhcpcd [-dknrBCDHNRSTY] [-l leasetime] [-h hostname] [-t timeout]\n\
97     +"Usage: dhcpcd [-dknrzBCDHNRSTY] [-l leasetime] [-h hostname] [-t timeout]\n\
98     [-i vendorClassID] [-I ClientID] [-c filename] [-s [ipaddr]]\n\
99     [-w windowsize] [-L ConfigDir] [-G [gateway]] [interface]\n");
100     exit(1);
101     diff -ru dhcpcd-1.3.22-pl4-orig/dhcpconfig.c dhcpcd-1.3.22-pl4/dhcpconfig.c
102     --- dhcpcd-1.3.22-pl4-orig/dhcpconfig.c 2002-12-30 06:05:44.000000000 +0800
103     +++ dhcpcd-1.3.22-pl4/dhcpconfig.c 2003-06-17 13:46:31.000000000 +0800
104     @@ -334,6 +334,16 @@
105     ((unsigned char *)&DhcpIface.ciaddr)[1],
106     ((unsigned char *)&DhcpIface.ciaddr)[2],
107     ((unsigned char *)&DhcpIface.ciaddr)[3]);
108     +
109     + /* In the case where machine dies for some reason, resolv.conf.sv would
110     + * not have been restored to original glory
111     + */
112     + if ( 1+rename(""RESOLV_CONF".sv",RESOLV_CONF) ) {
113     + if ( DebugFlag ) syslog (LOG_DEBUG, "Restored resolv.conf.sv from improper shutdown");
114     + } else {
115     + if ( DebugFlag ) syslog (LOG_DEBUG, "No resolv.conf.sv to restore");
116     + }
117     +
118     if ( ReplResolvConf )
119     {
120     resolv_renamed=1+rename(RESOLV_CONF,""RESOLV_CONF".sv");
121     diff -ru dhcpcd-1.3.22-pl4-orig/signals.c dhcpcd-1.3.22-pl4/signals.c
122     --- dhcpcd-1.3.22-pl4-orig/signals.c 2002-01-21 06:51:46.000000000 +0800
123     +++ dhcpcd-1.3.22-pl4/signals.c 2003-06-17 11:29:10.000000000 +0800
124     @@ -114,13 +114,15 @@
125     else
126     {
127     if ( sig == SIGHUP )
128     - {
129     - dhcpRelease();
130     - /* allow time for final packets to be transmitted before shutting down */
131     - /* otherwise 2.0 drops unsent packets. fixme: find a better way than sleep */
132     - sleep(1);
133     - }
134     - syslog(LOG_ERR,"terminating on signal %d\n",sig);
135     + /* Dhcp release with Cache file deletion */
136     + dhcpRelease(1);
137     + else if ( sig == SIGUSR1)
138     + /* Dhcp release without Cache file deletion */
139     + dhcpRelease(0);
140     + /* allow time for final packets to be transmitted before shutting down */
141     + /* otherwise 2.0 drops unsent packets. fixme: find a better way than sleep */
142     + sleep(1);
143     + syslog(LOG_ERR,"terminating on signal %d\n",sig);
144     }
145     dhcpStop();
146     deletePidFile();