Merge lp:~stefan.goetz-deactivatedaccount/hipl/remove-peername into lp:hipl

Proposed by Stefan Götz
Status: Rejected
Rejected by: Stefan Götz
Proposed branch: lp:~stefan.goetz-deactivatedaccount/hipl/remove-peername
Merge into: lp:hipl
Diff against target: 295 lines (+15/-59)
8 files modified
hipd/hadb.c (+9/-37)
hipd/hadb.h (+2/-4)
hipd/input.c (+0/-6)
hipd/netdev.c (+1/-2)
hipd/opp_mode.c (+1/-2)
hipd/user.c (+2/-4)
lib/core/conf.c (+0/-1)
lib/core/state.h (+0/-3)
To merge this branch: bzr merge lp:~stefan.goetz-deactivatedaccount/hipl/remove-peername
Reviewer Review Type Date Requested Status
René Hummen Approve
Diego Biurrun Approve
Review via email: mp+50801@code.launchpad.net

Description of the change

Remove the effectively unused peer_hostname field from the HADB.

The data stored in this field was used exclusively for debugging output. This was achieved at the expense of copying around a fair bit of memory and cluttered function signatures.

This branch removes:
- the peer_hostname fields from HADB-related data structures
- the initialization and copying of the peer_hostname fields
- the debugging statements using the peer_hostname fields
- hostname-related function arguments from affected functions

To post a comment you must log in.
Revision history for this message
Miika Komu (miika-iki) wrote :

Does "hipconf get ha all" still return the hostname of the peer (this is actually a very useful thing)?

Revision history for this message
Stefan Götz (stefan.goetz-deactivatedaccount) wrote :

No, the change in conf.c removes exactly this output.

It's just that currently, the peername handling, used only for debugging, is not RFC compliant so I thought removing the whole thing in an RFC compliant way is the easiest option. Achieving proper RFC compliance would require quite a bit of work - that's why I'm looking for alternatives :)

Do you see an alternative that would keep the hostname output for hipconf but would allow us to get rid of the peername field? I guess the only alternative is to use reverse DNS lookups which, of course, will not work for HITs for a long time to come, nor work for LSIs, nor work for unregistered host names which is probably a fairly common case in the scenarios that HIPL is used today. :-(

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

 review: approve

On Tue, Feb 22, 2011 at 07:47:09PM +0000, Stefan Götz wrote:
>
> Remove the effectively unused peer_hostname field from the HADB.

LGTM

Diego

review: Approve
Revision history for this message
René Hummen (rene-hummen) wrote :

Looks good to me.

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

I disapprove the change. I'll comment this in a moment.

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

My disapproval is intentionally informal. As I don't have much time to work on this at the moment and the result is compliant with RFCs, I'll leave this the decision to your conscience.

As you mentioned, look ups for FQDNs do not work *globally* so that's actually a damn good reason to keep it there. How difficult it is actually to correct the FQDN in host id? What's the problem?

It sounds to me that removal of this feature will cause more work for the future. Who ever will be the poor soul to reimplement this will face a hard time in getting it back due to the current strict practices (which I don't object btw). So has the classic "somebody elses problem" or "leave it as exercise for followers" written all over it.

When you are dealing with servers that have a multitude of host associations, the HITs are rather difficult to track. So, even though the FQDN is not trustworthy (until reverse look upped), it's a damn good hint to where to start look it at.

If you're more into scientific references, I think we have already measured with usability tests that users do not understand or don't want to understand the HITs (available in the web as pdf):

http://www.computer.org/portal/web/csdl/doi/10.1109/AICCSA.2009.5069337

So keeping the FQDN there has high value for end-users.

Revision history for this message
Stefan Götz (stefan.goetz-deactivatedaccount) wrote :

> So keeping the FQDN there has high value for end-users.

I'll retract this merge proposal and the one for the host-id-hostname-remove branch then.

What is necessary to achieve RFC compliance for the HOST_ID parameter:

incoming HOST_ID parameter:
------------------------------------

- accept DI strings of up to 2^12-1 bytes - this effectively means that we need to move from a fixed size character array in 'struct hip_host_id*' to dynamically allocated memory

- if the DI is an FQDN, it is encoded on the wire in the slightly unusual DNS-style run-length encoding instead of as a simple 0-terminated dotted string. Make sure, HIPL parses and prints such strings correctly (a plain printf() is not enough)

outgoing HOST_ID parameter:
------------------------------------

- put the FQDN, not only the short hostname, on the wire

- use the DNS-style run-length encoding on the wire, not just a 0-terminated dotted string

HADB:
------------------------------------

- decide on an encoding for the FQDN case

General:
------------------------------------

- ensure 0-termination throughout the whole code base

- ensure proper memory management of the DI strings throughout the whole code base

plus all the things I forgot ;-)

Unmerged revisions

5692. By Stefan Götz

Remove the effectively unused peer_hostname field from the HADB.

The data stored in this field was used exclusively for debugging output. This
was achieved at the expense of copying around a fair bit of memory and
cluttered function signatures.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hipd/hadb.c'
2--- hipd/hadb.c 2011-02-20 17:40:45 +0000
3+++ hipd/hadb.c 2011-02-22 19:46:37 +0000
4@@ -106,7 +106,6 @@
5 struct in6_addr peer_addr;
6 hip_lsi_t peer_lsi;
7 struct in6_addr our_addr;
8- uint8_t peer_hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX];
9 };
10
11 /**
12@@ -394,7 +393,6 @@
13 * @param local_hit local HIT
14 * @param peer_hit peer HIT
15 * @param peer_lsi peer LSI
16- * @param peer_hostname peer host name
17 * @param local_nat_udp_port local UDP port
18 * @param peer_nat_udp_port peer UDP port
19 *
20@@ -404,7 +402,6 @@
21 const hip_hit_t *local_hit,
22 const hip_hit_t *peer_hit,
23 const hip_lsi_t *peer_lsi,
24- const char *peer_hostname,
25 const in_port_t *local_nat_udp_port,
26 const in_port_t *peer_nat_udp_port)
27 {
28@@ -423,9 +420,6 @@
29 if (peer_lsi) {
30 HIP_DEBUG_LSI("Peer LSI", peer_lsi);
31 }
32- if (peer_hostname) {
33- HIP_DEBUG("Peer hostname: %s\n", peer_hostname);
34- }
35
36 if (local_nat_udp_port) {
37 HIP_DEBUG("Local NAT traversal UDP port: %d\n", *local_nat_udp_port);
38@@ -444,15 +438,13 @@
39 * @param local_addr local address
40 * @param peer_addr peer address
41 * @param peer_lsi optional peer LSI (automatically generated if NULL)x
42- * @param peer_hostname peer hostname
43 * @return zero on success or negative on error
44 */
45 int hip_hadb_add_peer_info_complete(const hip_hit_t *local_hit,
46 const hip_hit_t *peer_hit,
47 const hip_lsi_t *peer_lsi,
48 const struct in6_addr *local_addr,
49- const struct in6_addr *peer_addr,
50- const char *peer_hostname)
51+ const struct in6_addr *peer_addr)
52 {
53 int err = 0;
54 struct hip_hadb_state *entry = NULL, *aux = NULL;
55@@ -464,7 +456,7 @@
56
57 hip_print_debug_info(local_addr, peer_addr,
58 local_hit, peer_hit,
59- peer_lsi, peer_hostname,
60+ peer_lsi,
61 &nat_udp_port_local,
62 &nat_udp_port_peer);
63
64@@ -554,8 +546,7 @@
65 &peer_map->peer_hit,
66 &peer_map->peer_lsi,
67 &peer_map->our_addr,
68- &peer_map->peer_addr,
69- (char *) &peer_map->peer_hostname),
70+ &peer_map->peer_addr),
71 -1,
72 "Failed to add peer info\n");
73
74@@ -569,13 +560,11 @@
75 * @param peer_hit the HIT of the remote host
76 * @param peer_addr the address of the remote host
77 * @param peer_lsi an optional LSI for the remote host
78- * @param peer_hostname an optional host name for the remote host
79 * @return zero on success or negative on error
80 */
81 int hip_hadb_add_peer_info(const hip_hit_t *peer_hit,
82 const struct in6_addr *peer_addr,
83- const hip_lsi_t *peer_lsi,
84- const char *peer_hostname)
85+ const hip_lsi_t *peer_lsi)
86 {
87 int err = 0;
88 struct hip_peer_map_info peer_map = { { { { 0 } } } };
89@@ -589,7 +578,6 @@
90 NULL,
91 peer_hit,
92 peer_lsi,
93- peer_hostname,
94 &nat_local_udp_port,
95 &nat_peer_udp_port);
96
97@@ -604,11 +592,6 @@
98 memcpy(&peer_map.peer_lsi, peer_lsi, sizeof(struct in6_addr));
99 }
100
101- if (peer_hostname) {
102- memcpy(peer_map.peer_hostname, peer_hostname,
103- HIP_HOST_ID_HOSTNAME_LEN_MAX - 1);
104- }
105-
106 HIP_IFEL(hip_select_source_address(&peer_map.our_addr, &peer_map.peer_addr),
107 -1, "Cannot find source address\n");
108
109@@ -628,10 +611,9 @@
110 */
111 int hip_add_peer_map(const struct hip_common *input)
112 {
113- const struct in6_addr *hit = NULL, *ip = NULL;
114- const hip_lsi_t *lsi = NULL;
115- const char *peer_hostname = NULL;
116- int err = 0;
117+ const struct in6_addr *hit = NULL, *ip = NULL;
118+ const hip_lsi_t *lsi = NULL;
119+ int err = 0;
120
121 hit = hip_get_param_contents(input, HIP_PARAM_HIT);
122
123@@ -639,8 +621,6 @@
124
125 ip = hip_get_param_contents(input, HIP_PARAM_IPV6_ADDR);
126
127- peer_hostname = hip_get_param_contents(input, HIP_PARAM_HOSTNAME);
128-
129 if (!ip && (!lsi || !hit)) {
130 HIP_ERROR("handle async map: no ip and maybe no lsi or hit\n");
131 err = -ENODATA;
132@@ -651,11 +631,7 @@
133 HIP_DEBUG_LSI("lsi value is\n", lsi);
134 }
135
136- if (peer_hostname) {
137- HIP_DEBUG("Peer hostname value is %s\n", peer_hostname);
138- }
139-
140- err = hip_hadb_add_peer_info(hit, ip, lsi, peer_hostname);
141+ err = hip_hadb_add_peer_info(hit, ip, lsi);
142
143 if (err) {
144 HIP_ERROR("Failed to insert peer map (%d)\n", err);
145@@ -682,9 +658,6 @@
146 entry->hastate = HIP_HASTATE_INVALID;
147 entry->purge_timeout = HIP_HA_PURGE_TIMEOUT;
148
149- /* Initialize the peer host name */
150- memset(entry->peer_hostname, '\0', HIP_HOST_ID_HOSTNAME_LEN_MAX);
151-
152 entry->peer_addresses_old = hip_linked_list_init();
153
154 /* Randomize inbound SPI */
155@@ -1254,7 +1227,6 @@
156 ipv6_addr_copy(&hid.ip_peer, &entry->peer_addr);
157 ipv4_addr_copy(&hid.lsi_our, &entry->lsi_our);
158 ipv4_addr_copy(&hid.lsi_peer, &entry->lsi_peer);
159- memcpy(&hid.peer_hostname, &entry->peer_hostname, HIP_HOST_ID_HOSTNAME_LEN_MAX);
160
161 /** @todo Modularize heartbeat */
162 #if 0
163@@ -1277,7 +1249,7 @@
164 /* does not print heartbeat info, but I do not think it even should -Samu*/
165 hip_print_debug_info(&hid.ip_our, &hid.ip_peer,
166 &hid.hit_our, &hid.hit_peer,
167- &hid.lsi_peer, (char *) &hid.peer_hostname,
168+ &hid.lsi_peer,
169 &hid.nat_udp_port_local, &hid.nat_udp_port_peer);
170
171 err = hip_build_param_contents(msg, &hid, HIP_PARAM_HA_INFO,
172
173=== modified file 'hipd/hadb.h'
174--- hipd/hadb.h 2011-01-17 12:09:48 +0000
175+++ hipd/hadb.h 2011-02-22 19:46:37 +0000
176@@ -82,15 +82,13 @@
177
178 int hip_hadb_add_peer_info(const hip_hit_t *peer_hit,
179 const struct in6_addr *peer_addr,
180- const hip_lsi_t *peer_lsi,
181- const char *peer_hostname);
182+ const hip_lsi_t *peer_lsi);
183
184 int hip_hadb_add_peer_info_complete(const hip_hit_t *local_hit,
185 const hip_hit_t *peer_hit,
186 const hip_lsi_t *peer_lsi,
187 const struct in6_addr *local_addr,
188- const struct in6_addr *peer_addr,
189- const char *peer_hostname);
190+ const struct in6_addr *peer_addr);
191
192 int hip_del_peer_info_entry(struct hip_hadb_state *ha);
193 int hip_del_peer_info(hip_hit_t *, hip_hit_t *);
194
195=== modified file 'hipd/input.c'
196--- hipd/input.c 2011-02-22 19:12:13 +0000
197+++ hipd/input.c 2011-02-22 19:46:37 +0000
198@@ -764,12 +764,6 @@
199 /* we have to convert the compressed on the wire format into the internal host id representation */
200 HIP_IFEL(hip_build_host_id_from_param((const struct hip_host_id *) param, &peer_host_id),
201 -1, "Failed to convert host id parameter \n");
202- /* copy hostname to hadb entry if local copy is empty */
203- if (strlen((char *) (ctx->hadb_entry->peer_hostname)) == 0) {
204- memcpy(ctx->hadb_entry->peer_hostname,
205- hip_get_param_host_id_hostname(&peer_host_id),
206- HIP_HOST_ID_HOSTNAME_LEN_MAX - 1);
207- }
208 HIP_IFE(hip_get_param_host_id_di_type_len(&peer_host_id, &str, &len) < 0, -1);
209 HIP_DEBUG("Identity type: %s, Length: %d, Name: %s\n",
210 str,
211
212=== modified file 'hipd/netdev.c'
213--- hipd/netdev.c 2011-02-22 19:12:13 +0000
214+++ hipd/netdev.c 2011-02-22 19:46:37 +0000
215@@ -906,8 +906,7 @@
216 hip_nat_status = ha_nat_mode;
217
218 /* To make it follow the same route as it was doing before locators */
219- HIP_IFEL(hip_hadb_add_peer_info(dst_hit, dst_addr,
220- dst_lsi, NULL), -1,
221+ HIP_IFEL(hip_hadb_add_peer_info(dst_hit, dst_addr, dst_lsi), -1,
222 "map failed\n");
223
224 /* restore nat status */
225
226=== modified file 'hipd/opp_mode.c'
227--- hipd/opp_mode.c 2011-02-21 18:26:05 +0000
228+++ hipd/opp_mode.c 2011-02-22 19:46:37 +0000
229@@ -115,8 +115,7 @@
230 &ctx->input_msg->hits,
231 NULL,
232 &ctx->dst_addr,
233- &ctx->src_addr,
234- NULL),
235+ &ctx->src_addr),
236 -1, "Failed to insert peer map\n");
237
238 HIP_IFEL(!(ctx->hadb_entry = hip_hadb_find_byhits(&ctx->input_msg->hits,
239
240=== modified file 'hipd/user.c'
241--- hipd/user.c 2011-02-15 17:19:38 +0000
242+++ hipd/user.c 2011-02-22 19:46:37 +0000
243@@ -477,8 +477,7 @@
244 }
245
246 if (!opp_mode) {
247- HIP_IFEL(hip_hadb_add_peer_info(dst_hit, dst_ip,
248- NULL, NULL),
249+ HIP_IFEL(hip_hadb_add_peer_info(dst_hit, dst_ip, NULL),
250 -1, "Error on adding server " \
251 "HIT to IP address mapping to the hadb.\n");
252
253@@ -516,8 +515,7 @@
254 &opp_hit,
255 NULL,
256 &src_ip,
257- dst_ip,
258- NULL),
259+ dst_ip),
260 -1,
261 "failed to add peer information to hadb\n");
262
263
264=== modified file 'lib/core/conf.c'
265--- lib/core/conf.c 2011-02-20 17:25:58 +0000
266+++ lib/core/conf.c 2011-02-22 19:46:37 +0000
267@@ -475,7 +475,6 @@
268 HIP_INFO(" Local NAT traversal UDP port: %d\n", ha->nat_udp_port_local);
269 HIP_INFO_IN6ADDR(" Peer IP", &ha->ip_peer);
270 HIP_INFO(" Peer NAT traversal UDP port: %d\n", ha->nat_udp_port_peer);
271- HIP_INFO(" Peer hostname: %s\n", &ha->peer_hostname);
272 if (ha->heartbeats_on > 0 && ha->state == HIP_STATE_ESTABLISHED) {
273 HIP_DEBUG(" Heartbeat %.3f ms mean RTT, "
274 "%.3f ms std dev,\n"
275
276=== modified file 'lib/core/state.h'
277--- lib/core/state.h 2011-02-06 09:03:39 +0000
278+++ lib/core/state.h 2011-02-22 19:46:37 +0000
279@@ -309,8 +309,6 @@
280 HIP_HASHTABLE *peer_addr_list_to_be_added;
281 /** For storing retransmission related data. */
282 struct hip_msg_retrans hip_msg_retrans;
283- /** peer hostname */
284- uint8_t peer_hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX];
285 /** Counters of heartbeats (ICMPv6s) */
286 int heartbeats_sent;
287 struct statistics_data heartbeats_statistics;
288@@ -358,7 +356,6 @@
289 struct in6_addr ip_peer;
290 hip_lsi_t lsi_our;
291 hip_lsi_t lsi_peer;
292- uint8_t peer_hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX];
293 int state;
294 int heartbeats_on;
295 int heartbeats_sent;

Subscribers

People subscribed via source and target branches

to all changes: