Merge lp:~fahad-aizaz/hipl/hipd-hipfw-conf into lp:hipl

Proposed by Fahad Aizaz
Status: Merged
Merged at revision: 6195
Proposed branch: lp:~fahad-aizaz/hipl/hipd-hipfw-conf
Merge into: lp:hipl
Diff against target: 150 lines (+17/-59)
7 files modified
Makefile.am (+2/-1)
debian/hipl-firewall.dirs (+1/-0)
debian/hipl-firewall.install (+1/-0)
hipfw/hipfw.conf (+11/-0)
hipfw/rule_management.c (+0/-58)
packaging/hipl.spec (+1/-0)
packaging/openwrt/hipl/Makefile.in (+1/-0)
To merge this branch: bzr merge lp:~fahad-aizaz/hipl/hipd-hipfw-conf
Reviewer Review Type Date Requested Status
Diego Biurrun Approve
Review via email: mp+85869@code.launchpad.net

Description of the change

Removing run-time generation of hipfw configuration file. The configuration file is now distributed as part of HIP source.

Neccessary changes to distribute and install hipfw configuration file can be seen in the modifications for different distributions including OpenWRT, RPM and Debian. The Makefile.am is also modified to distribute and install hipfw configuration file at its correct path.

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

 review approve

On Thu, Dec 15, 2011 at 02:16:26PM +0000, Fahad Aizaz wrote:
> Fahad Aizaz has proposed merging lp:~fahad-aizaz/hipl/hipd-hipfw-conf into lp:hipl.

No more issues, please merge :)

Diego

review: Approve
Revision history for this message
Diego Biurrun (diego-biurrun) wrote :

On Thu, Dec 15, 2011 at 02:16:26PM +0000, Fahad Aizaz wrote:
>
> For more details, see:
> https://code.launchpad.net/~fahad-aizaz/hipl/hipd-hipfw-conf/+merge/85869
>
> Removing run-time generation of hipfw configuration file. The configuration file is now distributed as part of HIP source.

This arguably misses hipfw/esp_prot_config.cfg, which should also be
installed by "make install".

Diego

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-12-12 14:33:52 +0000
3+++ Makefile.am 2011-12-15 14:15:29 +0000
4@@ -137,7 +137,8 @@
5 dist_sysconf_DATA = hipd/hipd.conf \
6 hipd/hosts \
7 hipd/nsupdate.conf \
8- hipd/relay.conf
9+ hipd/relay.conf \
10+ hipfw/hipfw.conf
11
12 hipfw_hipfw_sources = hipfw/cache.c \
13 hipfw/dlist.c \
14
15=== modified file 'debian/hipl-firewall.dirs'
16--- debian/hipl-firewall.dirs 2010-12-28 16:53:40 +0000
17+++ debian/hipl-firewall.dirs 2011-12-15 14:15:29 +0000
18@@ -1,1 +1,2 @@
19 usr/sbin
20+etc/hip
21
22=== modified file 'debian/hipl-firewall.install'
23--- debian/hipl-firewall.install 2010-12-28 16:53:40 +0000
24+++ debian/hipl-firewall.install 2011-12-15 14:15:29 +0000
25@@ -1,1 +1,2 @@
26 debian/tmp/usr/sbin/hipfw usr/sbin/
27+debian/tmp/etc/hip/hipfw.conf etc/hip/
28
29=== added file 'hipfw/hipfw.conf'
30--- hipfw/hipfw.conf 1970-01-01 00:00:00 +0000
31+++ hipfw/hipfw.conf 2011-12-15 14:15:29 +0000
32@@ -0,0 +1,11 @@
33+# format: HOOK [match] TARGET
34+# HOOK = INPUT, OUTPUT or FORWARD
35+# TARGET = ACCEPT or DROP
36+# match = -src_hit [!] <hit value> --hi <file name>
37+# -dst_hit [!] <hit>
38+# -type [!] <hip packet type>
39+# -i [!] <incoming interface>
40+# -o [!] <outgoing interface>
41+# -state [!] <state> --verify_responder --accept_mobile --decrypt_contents
42+#
43+
44
45=== modified file 'hipfw/rule_management.c'
46--- hipfw/rule_management.c 2011-11-29 11:37:54 +0000
47+++ hipfw/rule_management.c 2011-12-15 14:15:29 +0000
48@@ -86,19 +86,6 @@
49 #define MAX_LINE_LENGTH 512
50
51 #define HIP_FW_DEFAULT_RULE_FILE HIPL_SYSCONFDIR "/hipfw.conf"
52-#define HIP_FW_CONFIG_FILE_EX \
53- "# format: HOOK [match] TARGET\n" \
54- "# HOOK = INPUT, OUTPUT or FORWARD\n" \
55- "# TARGET = ACCEPT or DROP\n" \
56- "# match = -src_hit [!] <hit value> --hi <file name>\n" \
57- "# -dst_hit [!] <hit>\n" \
58- "# -type [!] <hip packet type>\n" \
59- "# -i [!] <incoming interface>\n" \
60- "# -o [!] <outgoing interface>\n" \
61- "# -state [!] <state> --verify_responder --accept_mobile --decrypt_contents\n" \
62- "#\n" \
63- "\n"
64-
65
66 enum {
67 NO_OPTION,
68@@ -118,49 +105,6 @@
69 static struct dlist *forward_rules;
70
71 /**
72- * Writes the default firewall configuration file to the disk if it does
73- * not exist
74- */
75-static void check_and_write_default_config(const char *file)
76-{
77- struct stat status;
78- FILE *fp = NULL;
79- ssize_t items;
80- int i = 0;
81-
82- /* Firewall depends on hipd to create HIPL_SYSCONFDIR */
83- for (i = 0; i < 5; i++) {
84- if (stat(HIPL_SYSCONFDIR, &status) &&
85- errno == ENOENT) {
86- HIP_INFO("%s does not exist. Waiting for hipd to start...\n",
87- HIPL_SYSCONFDIR);
88- sleep(2);
89- } else {
90- break;
91- }
92- }
93-
94- if (i == 5) {
95- HIP_DIE("Please start hipd or execute 'hipd -c'\n");
96- }
97-
98- rename(HIPL_SYSCONFDIR "/firewall.conf", HIP_FW_DEFAULT_RULE_FILE);
99-
100- if (stat(file, &status) && errno == ENOENT) {
101- errno = 0;
102- fp = fopen(file, "w" /* mode */);
103- if (!fp) {
104- HIP_PERROR("Failed to write config file\n");
105- }
106- HIP_ASSERT(fp);
107- items = fwrite(HIP_FW_CONFIG_FILE_EX,
108- strlen(HIP_FW_CONFIG_FILE_EX), 1, fp);
109- HIP_ASSERT(items > 0);
110- fclose(fp);
111- }
112-}
113-
114-/**
115 * accessor function to get the rule list of the given iptables hook
116 *
117 * @param hook NF_IP6_LOCAL_IN, NF_IP6_LOCAL_OUT or NF_IP6_LOCAL_FORWARD
118@@ -906,8 +850,6 @@
119 file_name = HIP_FW_DEFAULT_RULE_FILE;
120 }
121
122- check_and_write_default_config(file_name);
123-
124 HIP_DEBUG("read_file: file %s\n", file_name);
125 file = fopen(file_name, "r");
126
127
128=== modified file 'packaging/hipl.spec'
129--- packaging/hipl.spec 2011-12-12 14:32:10 +0000
130+++ packaging/hipl.spec 2011-12-15 14:15:29 +0000
131@@ -170,6 +170,7 @@
132 %files firewall
133 %{_sbindir}/hipfw
134 %{_initddir}/hipfw
135+%config(noreplace) %{_sysconfdir}/hip/hipfw.conf
136
137 %files doc
138 %doc doc/HOWTO.txt doc/HOWTO.html
139
140=== modified file 'packaging/openwrt/hipl/Makefile.in'
141--- packaging/openwrt/hipl/Makefile.in 2011-12-12 14:33:06 +0000
142+++ packaging/openwrt/hipl/Makefile.in 2011-12-15 14:15:29 +0000
143@@ -85,6 +85,7 @@
144
145 $(INSTALL_BIN) ./files/hipfw.init $(1)/etc/init.d/hipfw
146 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hipfw $(1)/usr/sbin/
147+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/hip/hipfw.conf $(1)/etc/hip/
148 endef
149
150 define Package/hipl-common/install

Subscribers

People subscribed via source and target branches

to all changes: