/[pkgs]/devel/dhcp/dhcp-4.1.0-release-by-ifup.patch
ViewVC logotype

Contents of /devel/dhcp/dhcp-4.1.0-release-by-ifup.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Tue Jan 6 23:46:51 2009 UTC (10 months, 2 weeks ago) by dcantrel
Branch: MAIN
CVS Tags: F-12-split, dhcp-4_1_0-3_fc11, dhcp-4_1_0-2_fc11, dhcp-4_1_0-22_fc12, dhcp-4_1_0-1_fc11, dhcp-4_1_0-20_fc12, dhcp-4_1_0p1-5_fc12, dhcp-4_1_0-16_fc11, dhcp-4_1_0p1-13_fc13, dhcp-4_1_0-11_fc11, dhcp-4_1_0p1-11_fc12, dhcp-4_1_0-10_fc11, dhcp-4_1_0-15_fc11, dhcp-4_1_0-12_fc11, dhcp-4_1_0-14_fc11, F-11-split, dhcp-4_1_0p1-6_fc12, dhcp-4_1_0p1-7_fc12, dhcp-4_1_0p1-8_fc12, dhcp-4_1_0-4_fc11, dhcp-4_1_0p1-4_fc12, dhcp-4_1_0-13_fc11, dhcp-4_1_0-18_fc12, dhcp-4_1_0p1-14_fc13, dhcp-4_1_0-23_fc12, dhcp-4_1_0-6_fc11, dhcp-4_1_0-17_fc12, dhcp-4_1_0-19_fc12, dhcp-4_1_0p1-1_fc12, dhcp-4_1_0p1-3_fc12, dhcp-4_1_0p1-9_fc12, dhcp-4_1_0-9_fc11, dhcp-4_1_0p1-12_fc13, dhcp-4_1_0-26_fc12, dhcp-4_1_0p1-10_fc12, dhcp-4_1_0-8_fc11, dhcp-4_1_0-5_fc11, dhcp-4_1_0-25_fc12, dhcp-4_1_0-24_fc12, dhcp-4_1_0-7_fc11, dhcp-4_1_0-27_fc12, dhcp-4_1_0-21_fc12, dhcp-4_1_0p1-2_fc12, HEAD
File MIME type: text/x-patch
* Tue Jan 06 2009 David Cantrell <dcantrell@redhat.com> - 12:4.1.0-1
- Upgraded to ISC dhcp-4.1.0
- Had to rename the -T option to -timeout as ISC is now using -T
- Allow package rebuilders to easily enable DHCPv6 support with:
      rpmbuild --with DHCPv6 dhcp.spec
  Note that Fedora is still using the 'dhcpv6' package, but some
  users may want to experiment with the ISC DHCPv6 implementation
  locally.
1 diff -up dhcp-4.1.0/client/dhclient.c.ifup dhcp-4.1.0/client/dhclient.c
2 --- dhcp-4.1.0/client/dhclient.c.ifup 2009-01-06 08:29:14.000000000 -1000
3 +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 10:07:08.000000000 -1000
4 @@ -474,9 +474,81 @@ main(int argc, char **argv) {
5 kill(oldpid, SIGTERM);
6 }
7 fclose(pidfd);
8 + } else {
9 + /* handle release for interfaces requested with Red Hat
10 + * /sbin/ifup - pidfile will be /var/run/dhclient-$interface.pid
11 + */
12 +
13 + if ((path_dhclient_pid == NULL) || (*path_dhclient_pid == '\0'))
14 + path_dhclient_pid = "/var/run/dhclient.pid";
15 +
16 + char *new_path_dhclient_pid;
17 + struct interface_info *ip;
18 + int pdp_len = strlen(path_dhclient_pid), pfx, dpfx;
19 +
20 + /* find append point: beginning of any trailing '.pid'
21 + * or '-$IF.pid' */
22 + for (pfx=pdp_len; (pfx >= 0) && (path_dhclient_pid[pfx] != '.') && (path_dhclient_pid[pfx] != '/'); pfx--);
23 + if (pfx == -1)
24 + pfx = pdp_len;
25 +
26 + if (path_dhclient_pid[pfx] == '/')
27 + pfx += 1;
28 +
29 + for (dpfx=pfx; (dpfx >= 0) && (path_dhclient_pid[dpfx] != '-') && (path_dhclient_pid[dpfx] != '/'); dpfx--);
30 + if ((dpfx > -1) && (path_dhclient_pid[dpfx] != '/'))
31 + pfx = dpfx;
32 +
33 + for (ip = interfaces; ip; ip = ip->next) {
34 + if (interfaces_requested && (ip->flags & (INTERFACE_REQUESTED)) && (ip->name != NULL)) {
35 + int n_len = strlen(ip->name);
36 +
37 + new_path_dhclient_pid = (char*) malloc(pfx + n_len + 6);
38 + strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
39 + sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
40 +
41 + if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) {
42 + e = fscanf(pidfd, "%ld\n", &temp);
43 + oldpid = (pid_t)temp;
44 +
45 + if (e != 0 && e != EOF) {
46 + if (oldpid) {
47 + if (kill(oldpid, SIGTERM) == 0)
48 + unlink(path_dhclient_pid);
49 + }
50 + }
51 +
52 + fclose(pidfd);
53 + }
54 +
55 + free(new_path_dhclient_pid);
56 + }
57 + }
58 + }
59 + } else {
60 + FILE *pidfp = NULL;
61 + long temp = 0;
62 + pid_t dhcpid = 0;
63 + int dhc_running = 0;
64 + char procfn[256] = "";
65 +
66 + if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) {
67 + if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
68 + snprintf(procfn,256,"/proc/%u",dhcpid);
69 + dhc_running = (access(procfn, F_OK) == 0);
70 + }
71 +
72 + fclose(pidfp);
73 + }
74 +
75 + if (dhc_running) {
76 + log_fatal("dhclient(%u) is already running - exiting. ", dhcpid);
77 + return(1);
78 }
79 }
80
81 + write_client_pid_file();
82 +
83 if (!quiet) {
84 log_info("%s %s", message, PACKAGE_VERSION);
85 log_info(copyright);

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2