Package: firestarter / 1.0.3-11

02_support_isc-dhcp4.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
From: Paul Cupis <paul@cupis.co.uk>
Subject: support Debian isc-dhcp-server which is configured via /etc/dhcpd/ (Closes: #615264)

diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' firestarter-1.0.3~/src/dhcp-server.c firestarter-1.0.3/src/dhcp-server.c
--- firestarter-1.0.3~/src/dhcp-server.c	2011-02-27 20:40:37.000000000 +0000
+++ firestarter-1.0.3/src/dhcp-server.c	2011-02-27 20:40:38.000000000 +0000
@@ -21,6 +21,7 @@
 #define DHCPD "/usr/sbin/dhcpd"
 #define DHCPD_CONFIG "/etc/dhcpd.conf"
 #define DHCP3_CONFIG "/etc/dhcp3/dhcpd.conf"
+#define DHCP4_CONFIG "/etc/dhcpd/dhcpd.conf"
 #define DHCPD_LOCK_FILE "/var/lock/subsys/dhcpd"
 
 #define DEFAULT_LEASE_TIME "21600"
@@ -56,7 +57,8 @@
 dhcp_server_configuration_exists (void)
 {
 	return g_file_test (DHCPD_CONFIG, G_FILE_TEST_EXISTS) ||
-	       g_file_test (DHCP3_CONFIG, G_FILE_TEST_EXISTS);
+	       g_file_test (DHCP3_CONFIG, G_FILE_TEST_EXISTS) ||
+	       g_file_test (DHCP4_CONFIG, G_FILE_TEST_EXISTS);
 }
 
 
@@ -86,7 +88,7 @@
 	gchar *configuration;
 	GIOChannel *out;
 	GError *error = NULL;
-	gboolean dhcp3_in_use, debian_in_use;
+	gboolean dhcp3_in_use, debian_in_use, dhcp4_in_use;
 
 	/* Load DHCP user configurable settings */
 	int_if = preferences_get_string (PREFS_FW_INT_IF);
@@ -101,13 +103,14 @@
 	
 	/* Merge the settings with the config file template */
 	dhcp3_in_use = g_file_test (DHCP3_CONFIG, G_FILE_TEST_EXISTS);
+	dhcp4_in_use = g_file_test (DHCP4_CONFIG, G_FILE_TEST_EXISTS);
 	debian_in_use = g_file_test ("/etc/debian_version", G_FILE_TEST_EXISTS);
 
 	configuration = g_strconcat (
 		"# DHCP configuration generated by Firestarter\n", NULL);
 
 	/* Debian doesn't suport ddns unless the dhcp3 package is used */
-	if (dhcp3_in_use || !debian_in_use) {
+	if (dhcp3_in_use || dhcp4_in_use || !debian_in_use) {
 		configuration = g_strconcat (configuration, 
 			"ddns-update-style interim;\n" \
 			"ignore client-updates;\n", NULL);
@@ -115,7 +118,9 @@
 	configuration = g_strconcat (configuration,
 		DHCPD_CONF_TEMPLATE, NULL);
 
-	if (dhcp3_in_use)
+	if (dhcp4_in_use)
+		out = g_io_channel_new_file (DHCP4_CONFIG, "w+", &error);
+	else if (dhcp3_in_use)
 		out = g_io_channel_new_file (DHCP3_CONFIG, "w+", &error);
 	else
 		out = g_io_channel_new_file (DHCPD_CONFIG, "w+", &error);
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' firestarter-1.0.3~/src/scriptwriter.c firestarter-1.0.3/src/scriptwriter.c
--- firestarter-1.0.3~/src/scriptwriter.c	2011-02-27 20:40:37.000000000 +0000
+++ firestarter-1.0.3/src/scriptwriter.c	2011-02-27 20:44:58.000000000 +0000
@@ -174,19 +174,25 @@
 		    "				sed \"s/domain-name-servers.*$/domain-name-servers $NAMESERVER;/\" /etc/dhcp3/dhcpd.conf > /etc/dhcp3/dhcpd.conf.tmp\n"
 		    "				mv /etc/dhcp3/dhcpd.conf.tmp /etc/dhcp3/dhcpd.conf\n"
 		    "			fi\n"
+		    "			if [ -f /etc/dhcpd/dhcpd.conf ]; then\n"
+		    "				sed \"s/domain-name-servers.*$/domain-name-servers $NAMESERVER;/\" /etc/dhcpd/dhcpd.conf > /etc/dhcpd/dhcpd.conf.tmp\n"
+		    "				mv /etc/dhcpd/dhcpd.conf.tmp /etc/dhcpd/dhcpd.conf\n"
+		    "			fi\n"
 		    "		else\n"
 		    "			echo -e \"Warning: Could not determine new DNS settings for DHCP\\nKeeping old configuration\"\n"
 		    "		fi\n"
 		    "	fi\n\n"
 
-		    "   if [ -e /etc/init.d/dhcp3-server ]; then\n"
-		    "		/etc/init.d/dhcp3-server restart > /dev/null\n"
+		    "	if [ -e /etc/init.d/isc-dhcp-server ]; then\n"
+		    "		  /etc/init.d/isc-dhcp-server restart > /dev/null\n"
+		    "	elif [ -e /etc/init.d/dhcp3-server ]; then\n"
+		    "		  /etc/init.d/dhcp3-server restart > /dev/null\n"
 		    "	elif [ -e /etc/init.d/dhcpd ]; then\n"
 		    "		  /etc/init.d/dhcpd restart > /dev/null\n"
 		    "	elif [ -e /etc/init.d/dnsmasq ]; then\n"
 		    "		  /etc/init.d/dnsmasq restart > /dev/null\n"
 		    "	else\n"
-		    "		/usr/sbin/dhcpd 2> /dev/null\n"
+		    "		  /usr/sbin/dhcpd 2> /dev/null\n"
 		    "	fi\n\n"
 
 		    "	if [ $? -ne 0 ]; then\n"