Merge lp:~fahad-aizaz/hipl/hipd-init-config into lp:hipl

Proposed by Fahad Aizaz
Status: Needs review
Proposed branch: lp:~fahad-aizaz/hipl/hipd-init-config
Merge into: lp:hipl
Diff against target: 270 lines (+79/-112)
9 files modified
Makefile.am (+4/-0)
debian/hipl-daemon.dirs (+1/-0)
debian/hipl-daemon.install (+3/-0)
hipd/hipd.conf (+21/-0)
hipd/hosts (+4/-0)
hipd/init.c (+5/-112)
hipd/nsupdate.conf (+35/-0)
packaging/hipl.spec (+3/-0)
packaging/openwrt/hipl/Makefile.in (+3/-0)
To merge this branch: bzr merge lp:~fahad-aizaz/hipl/hipd-init-config
Reviewer Review Type Date Requested Status
Miika Komu Approve
Diego Biurrun Needs Information
Review via email: mp+84605@code.launchpad.net

Description of the change

The run-time generation for configuration file removal. The following configuration files are affected by this change.

hipd.conf
hosts
nsupdate.conf

These configuration files are no longer part of HIP code. And are distributed along the HIPL package. With this the other packages namely Debian, OpenWRT, RPM are also updated so that these configuration files are also part of them.

Makefile.am is also updated by adding script to handle the location/placement of these configuration files.

To post a comment you must log in.
Revision history for this message
Diego Biurrun (diego-biurrun) wrote :

 review needs-info

On Tue, Dec 06, 2011 at 12:32:26PM +0000, Fahad Aizaz wrote:
> --- packaging/hipl.spec 2011-12-01 21:29:13 +0000
> +++ packaging/hipl.spec 2011-12-06 12:31:24 +0000
> @@ -154,6 +154,9 @@
> %{_sbindir}/pisacert
> %{_sbindir}/nsupdate.pl
> %{_initddir}/hipd
> +%config(noreplace) %{_sysconfdir}/hip/hipd.conf
> +%config(noreplace) %{_sysconfdir}/hip/hosts
> +%config(noreplace) %{_sysconfdir}/hip/nsupdate.conf

Did you test this? configure should set sysconfdir to the correct value,
why did you add a hip/ subdirectory?

Diego

review: Needs Information
Revision history for this message
Miika Komu (miika-iki) wrote :

Fine by me, good work.

review: Approve

Unmerged revisions

6188. By Fahad Aizaz

The runtime generation of configuration files needs to be removed.

The changes made to 'init.c' removes the run-time generation of the
the following configuration files:

hipd.conf
hosts
nsupdate.conf

6187. By Fahad Aizaz

The OpenWRT package needs to be updated for configuration files.

The following configuration files are part of OpenWRT package:

hipd.conf
hosts
nsupdate.conf

6186. By Fahad Aizaz

The RPM package needs to be updated for configuration files.

The following configuration files are part of RPM package:

hipd.conf
hosts
nsupdate.conf

6185. By Fahad Aizaz

The configuration files need to be added to the Makefile.am.

The following configuration files are part of Makefile.am

hipd.conf
hosts
nsupdate.conf

6184. By Fahad Aizaz

Fix merge conflict

6183. By Fahad Aizaz

Debian: package update to handle configuration files.

The changes made in these files updates the debian package to
take care of configuration files placement. The following configuration
files:

hipd.conf
hosts
nsupdate.conf

are placed at the following location

etc/hip

6182. By Fahad Aizaz

Adding configuration files to HIPL package.

Following configuration are part of HIPL package:
hipd.conf
hosts
nsupdate.conf

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2011-11-25 13:52:20 +0000
3+++ Makefile.am 2011-12-06 12:31:24 +0000
4@@ -134,6 +134,10 @@
5 modules/midauth/hipd/midauth.c \
6 hipd/main.c
7
8+dist_sysconf_DATA = hipd/hipd.conf \
9+ hipd/hosts \
10+ hipd/nsupdate.conf
11+
12 hipfw_hipfw_sources = hipfw/cache.c \
13 hipfw/dlist.c \
14 hipfw/esp_prot_api.c \
15
16=== modified file 'debian/hipl-daemon.dirs'
17--- debian/hipl-daemon.dirs 2010-12-28 16:53:40 +0000
18+++ debian/hipl-daemon.dirs 2011-12-06 12:31:24 +0000
19@@ -1,1 +1,2 @@
20 usr/sbin
21+etc/hip
22
23=== modified file 'debian/hipl-daemon.install'
24--- debian/hipl-daemon.install 2010-12-28 16:53:40 +0000
25+++ debian/hipl-daemon.install 2011-12-06 12:31:24 +0000
26@@ -2,3 +2,6 @@
27 debian/tmp/usr/sbin/hipconf usr/sbin/
28 debian/tmp/usr/sbin/pisacert usr/sbin/
29 debian/tmp/usr/sbin/nsupdate.pl usr/sbin/
30+debian/tmp/etc/hip/hipd.conf etc/hip/
31+debian/tmp/etc/hip/hosts etc/hip/
32+debian/tmp/etc/hip/nsupdate.conf etc/hip/
33
34=== added file 'hipd/hipd.conf'
35--- hipd/hipd.conf 1970-01-01 00:00:00 +0000
36+++ hipd/hipd.conf 2011-12-06 12:31:24 +0000
37@@ -0,0 +1,21 @@
38+# Format of this file is as with hipconf, but without "hipconf daemon" prefix
39+# add hi default # add all four HITs (see bug id 592127)
40+# add map HIT IP # preload some HIT-to-IP mappings to hipd
41+# add service rvs # the host acts as HIP rendezvous (also see relay.conf)
42+# add server rvs [RVS-HIT] <RVS-IP-OR-HOSTNAME> <lifetime-secs> # register to rendezvous server
43+# add server relay [RELAY-HIT] <RVS-IP-OR-HOSTNAME> <lifetime-secs> # register to relay server
44+# add server full-relay [RELAY-HIT] <RVS-IP-OR-HOSTNAME> <lifetime-secs> # register to relay server
45+hit-to-ip on # resolve HITs to locators in dynamic DNS zone
46+# hit-to-ip set hit-to-ip.infrahip.net. # resolve HITs to locators in dynamic DNS zone
47+nsupdate on # send dynamic DNS updates
48+# add server rvs hiprvs.infrahip.net 50000 # Register to free RVS at infrahip
49+# heartbeat 10 # send ICMPv6 messages inside HIP tunnels
50+# locator on # host sends all of its locators in base exchange
51+# shotgun on # use all possible src/dst IP combinations to send I1/UPDATE
52+# broadcast on # broadcast to LAN if no matching IP address found
53+# opp normal|advanced|none
54+# transform order 213 # crypto preference order (1=AES, 2=3DES, 3=NULL)
55+nat plain-udp # use UDP capsulation (for NATted environments)
56+#nat port local 11111 # change local default UDP port
57+#nat port peer 22222 # change local peer UDP port
58+debug medium # debug verbosity: all, medium, low or none
59
60=== added file 'hipd/hosts'
61--- hipd/hosts 1970-01-01 00:00:00 +0000
62+++ hipd/hosts 2011-12-06 12:31:24 +0000
63@@ -0,0 +1,4 @@
64+# This file stores the HITs of the hosts, in a similar fashion to /etc/hosts.
65+# The aliases are optional. Examples:
66+#2001:1e:361f:8a55:6730:6f82:ef36:2fff kyle kyle.com # This is a HIT with alias
67+#2001:17:53ab:9ff1:3cba:15f:86d6:ea2e kenny # This is a HIT without alias
68
69=== modified file 'hipd/init.c'
70--- hipd/init.c 2011-11-29 11:37:54 +0000
71+++ hipd/init.c 2011-12-06 12:31:24 +0000
72@@ -141,117 +141,6 @@
73 }
74
75 /**
76- * Create a file with the given contents unless it already exists
77- *
78- * @param path the file with its path
79- * @param contents a string to write to the file
80- */
81-static void create_file_unless_exists(const char *path, const char *contents)
82-{
83- struct stat status;
84- FILE *fp;
85- size_t items;
86-
87- if (stat(path, &status) == 0) {
88- return;
89- }
90-
91- fp = fopen(path, "w");
92- HIP_ASSERT(fp);
93- items = fwrite(contents, strlen(contents), 1, fp);
94- HIP_ASSERT(items > 0);
95- fclose(fp);
96-}
97-
98-#define HIPL_CONFIG_FILE_EX \
99- "# Format of this file is as with hipconf, but without \"hipconf daemon\" prefix\n\
100-# add hi default # add all four HITs (see bug id 592127)\n\
101-# add map HIT IP # preload some HIT-to-IP mappings to hipd\n\
102-# add service rvs # the host acts as HIP rendezvous (also see relay.conf)\n\
103-# add server rvs [RVS-HIT] <RVS-IP-OR-HOSTNAME> <lifetime-secs> # register to rendezvous server\n\
104-# add server relay [RELAY-HIT] <RVS-IP-OR-HOSTNAME> <lifetime-secs> # register to relay server\n\
105-# add server full-relay [RELAY-HIT] <RVS-IP-OR-HOSTNAME> <lifetime-secs> # register to relay server\n\
106-hit-to-ip on # resolve HITs to locators in dynamic DNS zone\n\
107-# hit-to-ip set hit-to-ip.infrahip.net. # resolve HITs to locators in dynamic DNS zone\n\
108-nsupdate on # send dynamic DNS updates\n\
109-# add server rvs hiprvs.infrahip.net 50000 # Register to free RVS at infrahip\n\
110-# heartbeat 10 # send ICMPv6 messages inside HIP tunnels\n\
111-# locator on # host sends all of its locators in base exchange\n\
112-# shotgun on # use all possible src/dst IP combinations to send I1/UPDATE\n\
113-# broadcast on # broadcast to LAN if no matching IP address found\n\
114-# opp normal|advanced|none\n\
115-# transform order 213 # crypto preference order (1=AES, 2=3DES, 3=NULL)\n\
116-nat plain-udp # use UDP capsulation (for NATted environments)\n\
117-#nat port local 11111 # change local default UDP port\n\
118-#nat port peer 22222 # change local peer UDP port\n\
119-debug medium # debug verbosity: all, medium, low or none\n"
120-
121-#define HIPL_HOSTS_FILE_EX \
122- "# This file stores the HITs of the hosts, in a similar fashion to /etc/hosts.\n\
123-# The aliases are optional. Examples:\n\
124-#2001:1e:361f:8a55:6730:6f82:ef36:2fff kyle kyle.com # This is a HIT with alias\n\
125-#2001:17:53ab:9ff1:3cba:15f:86d6:ea2e kenny # This is a HIT without alias\n"
126-
127-#define HIPL_NSUPDATE_CONF_FILE HIPL_SYSCONFDIR "/nsupdate.conf"
128-
129-#define HIPL_NSUPDATE_CONF_FILE_EX \
130- "##########################################################\n" \
131- "# configuration examples\n" \
132- "##########################################################\n" \
133- "# update records for 5.7.d.1.c.c.8.d.0.6.3.b.a.4.6.2.5.0.5.2.e.4.7.5.e.1.0.0.1.0.0.2.hit-to-ip.infrahip.net.\n" \
134- "# $HIT_TO_IP_ZONE = 'hit-to-ip.infrahip.net.';\n" \
135- "# or in some other zone\n" \
136- "# $HIT_TO_IP_ZONE = 'hit-to-ip.example.org.';\n" \
137- "\n" \
138- "# update is sent to SOA if server empty\n" \
139- "# $HIT_TO_IP_SERVER = '';\n" \
140- "# or you may define it \n" \
141- "# $HIT_TO_IP_SERVER = 'ns.example.net.';\n" \
142- "\n" \
143- "# name of key if you configured it on the server\n" \
144- "# please also chown this file to nobody and chmod 400\n" \
145- "# $HIT_TO_IP_KEY_NAME='key.hit-to-ip';\n" \
146- "# $HIT_TO_IP_KEY_NAME = '';\n" \
147- "\n" \
148- "# secret of that key\n" \
149- "# $HIT_TO_IP_KEY_SECRET='Ousu6700S9sfYSL4UIKtvnxY4FKwYdgXrnEgDAu/rmUAoyBGFwGs0eY38KmYGLT1UbcL/O0igGFpm+NwGftdEQ==';\n" \
150- "# $HIT_TO_IP_KEY_SECRET = '';\n" \
151- "\n" \
152- "# TTL inserted for the records\n" \
153- "# $HIT_TO_IP_TTL = 1;\n" \
154- "###########################################################\n" \
155- "# domain with ORCHID prefix \n" \
156- "# $REVERSE_ZONE = '1.0.0.1.0.0.2.ip6.arpa.'; \n" \
157- "# \n" \
158- "# $REVERSE_SERVER = 'ptr-soa-hit.infrahip.net.'; # since SOA 1.0.0.1.0.0.2.ip6.arpa. is dns1.icann.org. now\n" \
159- "# $REVERSE_KEY_NAME = '';\n" \
160- "# $REVERSE_KEY_SECRET = '';\n" \
161- "# $REVERSE_TTL = 86400;\n" \
162- "# System hostname is used if empty\n" \
163- "# $REVERSE_HOSTNAME = 'stargazer-hit.pc.infrahip.net';\n" \
164- "###########################################################\n"
165-
166-/**
167- * load hipd configuration files
168- */
169-static void load_configuration(void)
170-{
171- const char *cfile = "default";
172-
173- create_file_unless_exists(HIPL_CONFIG_FILE, HIPL_CONFIG_FILE_EX);
174-
175- create_file_unless_exists(HIPL_HOSTS_FILE, HIPL_HOSTS_FILE_EX);
176-
177- create_file_unless_exists(HIPL_NSUPDATE_CONF_FILE, HIPL_NSUPDATE_CONF_FILE_EX);
178-
179- /* Load the configuration. The configuration is loaded as a sequence
180- * of hipd system calls. Assumably the user socket buffer is large
181- * enough to buffer all of the hipconf commands.. */
182-
183- hip_conf_handle_load(NULL, 0, &cfile, 1, 1);
184-}
185-
186-/**
187 * initialize OS-dependent variables
188 */
189 static void set_os_dep_variables(void)
190@@ -1145,7 +1034,11 @@
191 sizeof(daemon_addr)), -1,
192 "Bind on daemon addr failed\n");
193
194- load_configuration();
195+ const char *cfile = "default";
196+ if (hip_conf_handle_load(NULL, 0, &cfile, 1, 1) == -1) {
197+ HIP_ERROR("Loading configuration file failed.\n");
198+ return -1;
199+ }
200
201 certerr = 0;
202 certerr = init_certs();
203
204=== added file 'hipd/nsupdate.conf'
205--- hipd/nsupdate.conf 1970-01-01 00:00:00 +0000
206+++ hipd/nsupdate.conf 2011-12-06 12:31:24 +0000
207@@ -0,0 +1,35 @@
208+##########################################################
209+# configuration examples
210+##########################################################
211+# update records for 5.7.d.1.c.c.8.d.0.6.3.b.a.4.6.2.5.0.5.2.e.4.7.5.e.1.0.0.1.0.0.2.hit-to-ip.infrahip.net.
212+# $HIT_TO_IP_ZONE = 'hit-to-ip.infrahip.net.';
213+# or in some other zone
214+# $HIT_TO_IP_ZONE = 'hit-to-ip.example.org.';
215+
216+# update is sent to SOA if server empty
217+# $HIT_TO_IP_SERVER = '';
218+# or you may define it
219+# $HIT_TO_IP_SERVER = 'ns.example.net.';
220+
221+# name of key if you configured it on the server
222+# please also chown this file to nobody and chmod 400
223+# $HIT_TO_IP_KEY_NAME='key.hit-to-ip';
224+# $HIT_TO_IP_KEY_NAME = '';
225+
226+# secret of that key
227+# $HIT_TO_IP_KEY_SECRET='Ousu6700S9sfYSL4UIKtvnxY4FKwYdgXrnEgDAu/rmUAoyBGFwGs0eY38KmYGLT1UbcL/O0igGFpm+NwGftdEQ==';
228+# $HIT_TO_IP_KEY_SECRET = '';
229+
230+# TTL inserted for the records
231+# $HIT_TO_IP_TTL = 1;
232+###########################################################
233+# domain with ORCHID prefix
234+# $REVERSE_ZONE = '1.0.0.1.0.0.2.ip6.arpa.';
235+#
236+# $REVERSE_SERVER = 'ptr-soa-hit.infrahip.net.'; # since SOA 1.0.0.1.0.0.2.ip6.arpa. is dns1.icann.org. now
237+# $REVERSE_KEY_NAME = '';
238+# $REVERSE_KEY_SECRET = '';
239+# $REVERSE_TTL = 86400;
240+# System hostname is used if empty
241+# $REVERSE_HOSTNAME = 'stargazer-hit.pc.infrahip.net';
242+###########################################################
243
244=== modified file 'packaging/hipl.spec'
245--- packaging/hipl.spec 2011-12-01 21:29:13 +0000
246+++ packaging/hipl.spec 2011-12-06 12:31:24 +0000
247@@ -154,6 +154,9 @@
248 %{_sbindir}/pisacert
249 %{_sbindir}/nsupdate.pl
250 %{_initddir}/hipd
251+%config(noreplace) %{_sysconfdir}/hip/hipd.conf
252+%config(noreplace) %{_sysconfdir}/hip/hosts
253+%config(noreplace) %{_sysconfdir}/hip/nsupdate.conf
254
255 %files dnsproxy
256 %{_sbindir}/hipdnsproxy
257
258=== modified file 'packaging/openwrt/hipl/Makefile.in'
259--- packaging/openwrt/hipl/Makefile.in 2011-12-01 13:34:53 +0000
260+++ packaging/openwrt/hipl/Makefile.in 2011-12-06 12:31:24 +0000
261@@ -73,6 +73,9 @@
262 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hipd $(1)/usr/sbin/
263 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hipconf $(1)/usr/sbin/
264 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hipdnsproxy $(1)/usr/sbin/
265+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/hip/hipd.conf $(1)/etc/hip/
266+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/hip/hosts $(1)/etc/hip/
267+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/hip/nsupdate.conf $(1)/etc/hip/
268 endef
269
270 define Package/hipl-firewall/install

Subscribers

People subscribed via source and target branches

to all changes: