------------------------------------------------------------ revno: 6365 committer: Diego Biurrun <diego@xxxxxxxxxx> branch nick: trunk timestamp: Tue 2012-04-17 13:20:20 +0200 message: protodefs: Improve hip_common* struct member names. modified: hipd/close.c hipd/cookie.c hipd/esp_prot_hipd_msg.c hipd/hidb.c hipd/hiprelay.c hipd/input.c hipd/opp_mode.c hipd/output.c hipfw/conntrack.c hipfw/hipfw.c hipfw/midauth.c lib/core/builder.c lib/core/gpl/pk.c lib/core/protodefs.h modules/midauth/hipd/midauth.c modules/update/hipd/update_builder.c test/hipfw/midauth.c -- lp:hipl https://code.launchpad.net/~hipl-core/hipl/trunk Your team HIPL core team is subscribed to branch lp:hipl. To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'hipd/close.c' --- hipd/close.c 2012-03-21 13:14:54 +0000 +++ hipd/close.c 2012-04-17 11:20:20 +0000 @@ -240,7 +240,7 @@ hip_perf_start_benchmark(perf_set, PERF_HANDLE_CLOSE); #endif - HIP_IFEL(ipv6_addr_any(&ctx->input_msg->hitr), -1, + HIP_IFEL(ipv6_addr_any(&ctx->input_msg->hit_receiver), -1, "Received NULL receiver HIT in CLOSE. Dropping\n"); HIP_IFEL(!hip_controls_sane(ntohs(ctx->input_msg->control), 0), -1, @@ -360,13 +360,13 @@ #ifdef CONFIG_HIP_RVS if (hip_relay_get_status()) { struct hip_relrec dummy; - memcpy(&dummy.hit_r, &ctx->input_msg->hits, - sizeof(ctx->input_msg->hits)); + memcpy(&dummy.hit_r, &ctx->input_msg->hit_sender, + sizeof(ctx->input_msg->hit_sender)); hip_relht_rec_free_doall(&dummy); /* Check that the element really got deleted. */ if (hip_relht_get(&dummy) == NULL) { HIP_DEBUG_HIT("Deleted relay record for HIT", - &ctx->input_msg->hits); + &ctx->input_msg->hit_sender); } } #endif @@ -408,7 +408,7 @@ hip_perf_start_benchmark(perf_set, PERF_HANDLE_CLOSE_ACK); #endif - HIP_IFEL(ipv6_addr_any(&ctx->input_msg->hitr), -1, + HIP_IFEL(ipv6_addr_any(&ctx->input_msg->hit_receiver), -1, "Received NULL receiver HIT in CLOSE ACK. Dropping\n"); if (!hip_controls_sane(ntohs(ctx->input_msg->control), HIP_PACKET_CTRL_NON)) { === modified file 'hipd/cookie.c' --- hipd/cookie.c 2012-03-01 14:06:24 +0000 +++ hipd/cookie.c 2012-04-17 11:20:20 +0000 @@ -279,7 +279,7 @@ int err = 0; /* Find the proper R1 table */ - HIP_IFEL(!(hid = hip_get_hostid_entry_by_lhi_and_algo(&hdr->hitr, + HIP_IFEL(!(hid = hip_get_hostid_entry_by_lhi_and_algo(&hdr->hit_receiver, HIP_ANY_ALGO, -1)), -1, "Requested source HIT not (any more) available.\n"); @@ -317,8 +317,8 @@ } memcpy(puzzle_input.puzzle, solution->I, PUZZLE_LENGTH); - puzzle_input.initiator_hit = hdr->hits; - puzzle_input.responder_hit = hdr->hitr; + puzzle_input.initiator_hit = hdr->hit_sender; + puzzle_input.responder_hit = hdr->hit_receiver; memcpy(puzzle_input.solution, solution->J, PUZZLE_LENGTH); HIP_IFEL(hip_verify_puzzle_solution(&puzzle_input, solution->K), === modified file 'hipd/esp_prot_hipd_msg.c' --- hipd/esp_prot_hipd_msg.c 2012-03-01 14:06:24 +0000 +++ hipd/esp_prot_hipd_msg.c 2012-04-17 11:20:20 +0000 @@ -91,8 +91,8 @@ hip_build_network_hdr(resp_update, HIP_UPDATE, mask, - &recv_update->hitr, - &recv_update->hits); + &recv_update->hit_receiver, + &recv_update->hit_sender); /* Add ESP_INFO */ HIP_IFEL(hip_build_param_esp_info(resp_update, === modified file 'hipd/hidb.c' --- hipd/hidb.c 2012-03-20 13:08:56 +0000 +++ hipd/hidb.c 2012-04-17 11:20:20 +0000 @@ -541,8 +541,8 @@ bool anonymous; HIP_DEBUG("/* --------- */ \n"); - HIP_DEBUG_IN6ADDR("input->hits = ", &input->hits); - HIP_DEBUG_IN6ADDR("input->hitr = ", &input->hitr); + HIP_DEBUG_IN6ADDR("input->hit_sender = ", &input->hit_sender); + HIP_DEBUG_IN6ADDR("input->hit_receiver = ", &input->hit_receiver); if ((err = hip_get_msg_err(input)) != 0) { HIP_ERROR("daemon failed (%d)\n", err); return err; === modified file 'hipd/hiprelay.c' --- hipd/hiprelay.c 2012-02-23 10:43:16 +0000 +++ hipd/hiprelay.c 2012-04-17 11:20:20 +0000 @@ -850,7 +850,8 @@ "No memory\n"); hip_build_network_hdr(msg_to_be_relayed, type_hdr, 0, - &ctx->input_msg->hits, &ctx->input_msg->hitr); + &ctx->input_msg->hit_sender, + &ctx->input_msg->hit_receiver); /* Notice that in most cases the incoming I1 has no paramaters at all, * and this "while" loop is skipped. Multiple rvses en route to responder @@ -961,7 +962,7 @@ "No memory to copy original I1\n"); hip_build_network_hdr(r_to_be_relayed, type_hdr, 0, - &r->hits, &r->hitr); + &r->hit_sender, &r->hit_receiver); while ((current_param = hip_get_next_param(r, current_param)) != NULL) { HIP_DEBUG("Found parameter in R.\n"); @@ -1016,9 +1017,10 @@ * I's HIT. We should find one, if the I is * registered to relay.*/ HIP_DEBUG_HIT("Searching relay record on HIT:", - &ctx->input_msg->hits); + &ctx->input_msg->hit_sender); - memcpy(&dummy.hit_r, &ctx->input_msg->hits, sizeof(ctx->input_msg->hits)); + memcpy(&dummy.hit_r, &ctx->input_msg->hit_sender, + sizeof(ctx->input_msg->hit_sender)); rec = hip_relht_get(&dummy); if (rec == NULL) { @@ -1157,13 +1159,13 @@ */ #ifdef CONFIG_HIP_RVS relay_ha_entry = - hip_hadb_find_rvs_candidate_entry(&source_msg->hitr, relay_ip); + hip_hadb_find_rvs_candidate_entry(&source_msg->hit_receiver, relay_ip); if (relay_ha_entry == NULL) { HIP_DEBUG_HIT("relay hit not found in the entry table rvs_ip:", relay_ip); HIP_DEBUG_HIT("relay hit not found in the entry table " - "&source_msg->hitr:", &source_msg->hitr); + "&source_msg->hit_receiver:", &source_msg->hit_receiver); HIP_DEBUG("The I1 packet was received from Relay, but the host " "association created during registration is not found. " "RVS_HMAC cannot be verified.\n"); === modified file 'hipd/input.c' --- hipd/input.c 2012-03-20 21:45:03 +0000 +++ hipd/input.c 2012-04-17 11:20:20 +0000 @@ -336,8 +336,8 @@ &km, keymat, keymat_len, - &ctx->input_msg->hits, - &ctx->input_msg->hitr, + &ctx->input_msg->hit_sender, + &ctx->input_msg->hit_receiver, &ctx->hadb_entry->keymat_calc_index, I, J); @@ -345,8 +345,8 @@ /* draw from km to keymat, copy keymat to dst, length of * keymat is len */ - we_are_HITg = hip_hit_is_bigger(&ctx->input_msg->hitr, - &ctx->input_msg->hits); + we_are_HITg = hip_hit_is_bigger(&ctx->input_msg->hit_receiver, + &ctx->input_msg->hit_sender); HIP_DEBUG("We are %s HIT.\n", we_are_HITg ? "greater" : "lesser"); @@ -500,10 +500,10 @@ } /* check for invalid loopback message */ - if (hip_hidb_hit_is_our(&ctx->input_msg->hits) && - (IN6_ARE_ADDR_EQUAL(&ctx->input_msg->hitr, - &ctx->input_msg->hits) || - IN6_ARE_ADDR_EQUAL(&ctx->input_msg->hitr, + if (hip_hidb_hit_is_our(&ctx->input_msg->hit_sender) && + (IN6_ARE_ADDR_EQUAL(&ctx->input_msg->hit_receiver, + &ctx->input_msg->hit_sender) || + IN6_ARE_ADDR_EQUAL(&ctx->input_msg->hit_receiver, &ipv6_any_addr)) && !hip_addr_is_loopback(&ctx->dst_addr) && !hip_addr_is_loopback(&ctx->src_addr) && @@ -514,8 +514,8 @@ /* Check packet destination */ /* I1 may be opportunistic with zero dst HIT */ - if (!hip_hidb_hit_is_our(&ctx->input_msg->hitr) && - !ipv6_addr_any(&ctx->input_msg->hitr)) { + if (!hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver) && + !ipv6_addr_any(&ctx->input_msg->hit_receiver)) { HIP_DEBUG("Packet is not destined for this host.\n"); #ifdef CONFIG_HIP_RVS /* RVS/Relay is handled later in the code. */ @@ -537,12 +537,12 @@ type = hip_get_msg_type(ctx->input_msg); - ctx->hadb_entry = hip_hadb_find_byhits(&ctx->input_msg->hits, - &ctx->input_msg->hitr); + ctx->hadb_entry = hip_hadb_find_byhits(&ctx->input_msg->hit_sender, + &ctx->input_msg->hit_receiver); // Check if we need to drop the packet if (ctx->hadb_entry && - packet_to_drop(ctx->hadb_entry, type, &ctx->input_msg->hitr) == 1) { + packet_to_drop(ctx->hadb_entry, type, &ctx->input_msg->hit_receiver) == 1) { HIP_DEBUG("Ignoring the packet sent.\n"); return -1; } @@ -616,8 +616,8 @@ { #ifndef CONFIG_HIP_RVS int type = hip_get_msg_type(ctx->input_msg); - struct hip_hadb_state *entry = hip_hadb_find_byhits(&ctx->input_msg->hits, - &ctx->input_msg->hitr); + struct hip_hadb_state *entry = hip_hadb_find_byhits(&ctx->input_msg->hit_sender, + &ctx->input_msg->hit_receiver); /* The ip of RVS is taken to be ip of the peer while using RVS server * to relay R1. Hence have removed this part for RVS --Abi */ @@ -681,9 +681,9 @@ hip_handle_opp_r1(ctx); } - if (!hip_hidb_hit_is_our(&ctx->input_msg->hitr)) { + if (!hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver)) { HIP_DEBUG_HIT("Dst HIT does not belong to this host", - &ctx->input_msg->hitr); + &ctx->input_msg->hit_receiver); return -1; } @@ -829,8 +829,8 @@ } memcpy(puzzle_input.puzzle, pz->I, PUZZLE_LENGTH); - puzzle_input.initiator_hit = ctx->input_msg->hitr; - puzzle_input.responder_hit = ctx->input_msg->hits; + puzzle_input.initiator_hit = ctx->input_msg->hit_receiver; + puzzle_input.responder_hit = ctx->input_msg->hit_sender; RAND_bytes(puzzle_input.solution, PUZZLE_LENGTH); if (hip_solve_puzzle(&puzzle_input, pz->K)) { @@ -850,8 +850,8 @@ hip_build_network_hdr(ctx->output_msg, HIP_I2, 0, - &ctx->input_msg->hitr, - &ctx->input_msg->hits); + &ctx->input_msg->hit_receiver, + &ctx->input_msg->hit_sender); /* note: we could skip keying material generation in the case * of a retransmission but then we'd had to fill ctx->hmac etc */ @@ -986,9 +986,9 @@ hip_perf_start_benchmark(perf_set, PERF_R2); #endif - if (!hip_hidb_hit_is_our(&ctx->input_msg->hitr)) { + if (!hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver)) { HIP_DEBUG_HIT("Dst HIT does not belong to this host", - &ctx->input_msg->hitr); + &ctx->input_msg->hit_receiver); return -1; } @@ -1177,11 +1177,11 @@ #ifdef CONFIG_HIP_RVS if (hip_relay_get_status() != HIP_RELAY_OFF && - !hip_hidb_hit_is_our(&ctx->input_msg->hitr)) { + !hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver)) { struct hip_relrec *rec = NULL, dummy; - memcpy(&dummy.hit_r, &ctx->input_msg->hitr, - sizeof(ctx->input_msg->hitr)); + memcpy(&dummy.hit_r, &ctx->input_msg->hit_receiver, + sizeof(ctx->input_msg->hit_receiver)); HIP_DEBUG_HIT("Searching relay record on HIT ", &dummy.hit_r); rec = hip_relht_get(&dummy); if (rec == NULL) { @@ -1244,7 +1244,7 @@ * arrive at the local host too. The following variable handles * that special case. Since we are using source HIT (and not * destination) it should handle also opportunistic I1 broadcast */ - int src_hit_is_our = hip_hidb_hit_is_our(&ctx->input_msg->hits); + int src_hit_is_our = hip_hidb_hit_is_our(&ctx->input_msg->hit_sender); /* check i1 for broadcast/multicast addresses */ if (IN6_IS_ADDR_V4MAPPED(&ctx->dst_addr)) { @@ -1356,14 +1356,14 @@ #ifdef CONFIG_HIP_RVS if (hip_relay_get_status() != HIP_RELAY_OFF && - !hip_hidb_hit_is_our(&ctx->input_msg->hitr)) { + !hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver)) { struct hip_relrec *rec = NULL, dummy; /* Check if we have a relay record in our database matching the * Responder's HIT. We should find one if the Responder is * registered to relay. */ - memcpy(&dummy.hit_r, &ctx->input_msg->hitr, - sizeof(ctx->input_msg->hitr)); + memcpy(&dummy.hit_r, &ctx->input_msg->hit_receiver, + sizeof(ctx->input_msg->hit_receiver)); HIP_DEBUG_HIT("Searching relay record on HIT ", &dummy.hit_r); rec = hip_relht_get(&dummy); if (rec == NULL) { @@ -1377,9 +1377,9 @@ } #endif - if (!hip_hidb_hit_is_our(&ctx->input_msg->hitr)) { + if (!hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver)) { HIP_DEBUG_HIT("Dst HIT does not belong to this host", - &ctx->input_msg->hitr); + &ctx->input_msg->hit_receiver); return -1; } @@ -1416,10 +1416,10 @@ "Out of memory when allocating memory for a new HIP " "association. Dropping the I2 packet.\n"); - ipv6_addr_copy(&ctx->hadb_entry->hit_peer, &ctx->input_msg->hits); + ipv6_addr_copy(&ctx->hadb_entry->hit_peer, &ctx->input_msg->hit_sender); ipv6_addr_copy(&ctx->hadb_entry->our_addr, &ctx->dst_addr); HIP_DEBUG("Initializing the HIP association.\n"); - hip_init_us(ctx->hadb_entry, &ctx->input_msg->hitr); + hip_init_us(ctx->hadb_entry, &ctx->input_msg->hit_receiver); hip_hadb_insert_state(ctx->hadb_entry); } @@ -1451,8 +1451,8 @@ } /* Verify HMAC. */ - if (hip_hidb_hit_is_our(&ctx->input_msg->hits) && - hip_hidb_hit_is_our(&ctx->input_msg->hitr)) { + if (hip_hidb_hit_is_our(&ctx->input_msg->hit_sender) && + hip_hidb_hit_is_our(&ctx->input_msg->hit_receiver)) { is_loopback = 1; ctx->hadb_entry->is_loopback = 1; HIP_IFEL(hip_verify_packet_hmac(ctx->input_msg, @@ -1682,7 +1682,7 @@ /* If there was already state, these may be uninitialized */ if (!ctx->hadb_entry->our_pub) { - hip_init_us(ctx->hadb_entry, &ctx->input_msg->hitr); + hip_init_us(ctx->hadb_entry, &ctx->input_msg->hit_receiver); } /* If the incoming I2 packet has hip_get_nat_udp_port() as destination port, NAT * mode is set on for the host association, I2 source port is === modified file 'hipd/opp_mode.c' --- hipd/opp_mode.c 2011-10-25 21:14:16 +0000 +++ hipd/opp_mode.c 2012-04-17 11:20:20 +0000 @@ -81,12 +81,12 @@ struct hip_hadb_state *entry = NULL; if (type == HIP_I1) { - if (!ipv6_addr_is_null(&msg->hitr)) { + if (!ipv6_addr_is_null(&msg->hit_receiver)) { return NULL; } - hip_get_default_hit(&msg->hitr); + hip_get_default_hit(&msg->hit_receiver); } else if (type == HIP_R1) { - entry = opp_get_hadb_entry(&msg->hitr, src_addr); + entry = opp_get_hadb_entry(&msg->hit_receiver, src_addr); } else { HIP_ASSERT(0); } @@ -108,22 +108,22 @@ opp_entry = ctx->hadb_entry; - HIP_DEBUG_HIT("peer hit", &ctx->input_msg->hits); - HIP_DEBUG_HIT("local hit", &ctx->input_msg->hitr); + HIP_DEBUG_HIT("peer hit", &ctx->input_msg->hit_sender); + HIP_DEBUG_HIT("local hit", &ctx->input_msg->hit_receiver); - HIP_IFEL(hip_hadb_add_peer_info_complete(&ctx->input_msg->hitr, - &ctx->input_msg->hits, + HIP_IFEL(hip_hadb_add_peer_info_complete(&ctx->input_msg->hit_receiver, + &ctx->input_msg->hit_sender, NULL, &ctx->dst_addr, &ctx->src_addr, NULL), -1, "Failed to insert peer map\n"); - HIP_IFEL(!(ctx->hadb_entry = hip_hadb_find_byhits(&ctx->input_msg->hits, - &ctx->input_msg->hitr)), + HIP_IFEL(!(ctx->hadb_entry = hip_hadb_find_byhits(&ctx->input_msg->hit_sender, + &ctx->input_msg->hit_receiver)), -1, "Did not find opp entry\n"); - HIP_IFEL(hip_init_us(ctx->hadb_entry, &ctx->input_msg->hitr), + HIP_IFEL(hip_init_us(ctx->hadb_entry, &ctx->input_msg->hit_receiver), -1, "hip_init_us failed\n"); /* old HA has state 2, new HA has state 1, so copy it */ ctx->hadb_entry->state = opp_entry->state; @@ -135,8 +135,8 @@ HIP_DEBUG("RVS: Error moving the pending requests to a new HA"); } - HIP_DEBUG_HIT("peer hit", &ctx->input_msg->hits); - HIP_DEBUG_HIT("local hit", &ctx->input_msg->hitr); + HIP_DEBUG_HIT("peer hit", &ctx->input_msg->hit_sender); + HIP_DEBUG_HIT("local hit", &ctx->input_msg->hit_receiver); HIP_IFEL(hip_opportunistic_ipv6_to_hit(&ctx->src_addr, &phit, HIP_HIT_TYPE_HASH100), === modified file 'hipd/output.c' --- hipd/output.c 2012-03-20 12:52:49 +0000 +++ hipd/output.c 2012-04-17 11:20:20 +0000 @@ -132,10 +132,10 @@ { int err = 0; - /* If hitr is hashed NULL hit, send it as NULL on the wire. + /* If hit_receiver is a hashed NULL HIT, send it as NULL on the wire. * This case is an opportunistic BEX. */ - if (hit_is_opportunistic_hit(&i1->hitr)) { - ipv6_addr_copy(&i1->hitr, &in6addr_any); + if (hit_is_opportunistic_hit(&i1->hit_receiver)) { + ipv6_addr_copy(&i1->hit_receiver, &in6addr_any); } if (local_addr) { @@ -213,8 +213,8 @@ /* Calculate the HIP header length */ hip_calc_hdr_len(i1); - HIP_DEBUG_HIT("HIT source", &i1->hits); - HIP_DEBUG_HIT("HIT dest", &i1->hitr); + HIP_DEBUG_HIT("HIT source", &i1->hit_sender); + HIP_DEBUG_HIT("HIT dest", &i1->hit_receiver); HIP_DEBUG("Sending I1 to the following addresses:\n"); print_peer_addresses_to_be_added(entry); @@ -465,7 +465,7 @@ /* add host id in plaintext without encrypted wrapper */ /* Parameter HOST_ID. Notice that hip_get_public_key overwrites * the argument pointer, so we have to allocate some extra memory */ - HIP_IFEL(!(host_id_entry = hip_get_hostid_entry_by_lhi_and_algo(&ctx->input_msg->hitr, + HIP_IFEL(!(host_id_entry = hip_get_hostid_entry_by_lhi_and_algo(&ctx->input_msg->hit_receiver, HIP_ANY_ALGO, -1)), -1, "Unknown HIT\n"); @@ -845,7 +845,7 @@ /* It should not be NULL hit, NULL hit has been replaced by real local * hit. */ - HIP_ASSERT(!hit_is_opportunistic_hit(&ctx->input_msg->hitr)); + HIP_ASSERT(!hit_is_opportunistic_hit(&ctx->input_msg->hit_receiver)); /* Case: I ----->IPv4---> RVS ---IPv6---> R */ if (IN6_IS_ADDR_V4MAPPED(r1_src_addr) != @@ -862,16 +862,16 @@ } HIP_IFEL(!(r1pkt = hip_get_r1(r1_dst_addr, &ctx->dst_addr, - &ctx->input_msg->hitr)), + &ctx->input_msg->hit_receiver)), -ENOENT, "No precreated R1\n"); - if (&ctx->input_msg->hits) { - ipv6_addr_copy(&r1pkt->hitr, &ctx->input_msg->hits); + if (&ctx->input_msg->hit_sender) { + ipv6_addr_copy(&r1pkt->hit_receiver, &ctx->input_msg->hit_sender); } else { - memset(&r1pkt->hitr, 0, sizeof(struct in6_addr)); + memset(&r1pkt->hit_receiver, 0, sizeof(struct in6_addr)); } - HIP_DEBUG_HIT("hip_xmit_r1(): ripkt->hitr", &r1pkt->hitr); + HIP_DEBUG_HIT("hip_xmit_r1(): r1pkt->hit_receiver", &r1pkt->hit_receiver); #ifdef CONFIG_HIP_RVS /** @todo Parameters must be in ascending order, should this === modified file 'hipfw/conntrack.c' --- hipfw/conntrack.c 2012-03-27 12:51:53 +0000 +++ hipfw/conntrack.c 2012-04-17 11:20:20 +0000 @@ -228,8 +228,8 @@ return NULL; } - memcpy(&data->src_hit, &common->hits, sizeof(struct in6_addr)); - memcpy(&data->dst_hit, &common->hitr, sizeof(struct in6_addr)); + memcpy(&data->src_hit, &common->hit_sender, sizeof(struct in6_addr)); + memcpy(&data->dst_hit, &common->hit_receiver, sizeof(struct in6_addr)); return data; } @@ -895,7 +895,7 @@ return -1; } - tuple = get_tuple_by_hits(&common->hits, &common->hitr); + tuple = get_tuple_by_hits(&common->hit_sender, &common->hit_receiver); if (!tuple || esp_tuple_from_esp_info(esp_info, ctx, tuple)) { HIP_ERROR("unable to create esp state from UPDATE packet\n"); @@ -962,8 +962,9 @@ HIP_IFEL(!(tuple = get_tuple_by_esp(NULL, spi)), 0, "No tuple, skip\n"); - HIP_IFEL(!(reverse_tuple = get_tuple_by_hits(&common->hits, &common->hitr)), 0, - "No reverse tuple, skip\n"); + HIP_IFEL(!(reverse_tuple = get_tuple_by_hits(&common->hit_sender, + &common->hit_receiver)), + 0, "No reverse tuple, skip\n"); HIP_DEBUG("tuple src=%d dst=%d\n", tuple->src_port, tuple->dst_port); HIP_DEBUG("tuple dir=%d, sport=%d, dport=%d, rel=%d\n", tuple->direction, @@ -1058,7 +1059,7 @@ hip_host_id_to_hit(host_id, &hit, HIP_HIT_TYPE_HASH100); // match received hit and calculated hit - HIP_IFEL(ipv6_addr_cmp(&hit, &common->hits), 1, + HIP_IFEL(ipv6_addr_cmp(&hit, &common->hit_sender), 1, "HI -> HIT mapping does NOT match\n"); HIP_INFO("HI -> HIT mapping verified\n"); @@ -1172,7 +1173,7 @@ } //if peer hit is all-zero in I1 packet, replace it with pseudo hit - if (IN6_ARE_ADDR_EQUAL(&common->hitr, &all_zero_addr)) { + if (IN6_ARE_ADDR_EQUAL(&common->hit_receiver, &all_zero_addr)) { hip_opportunistic_ipv6_to_hit(&ctx->dst, &phit, HIP_HIT_TYPE_HASH100); data->dst_hit = phit; @@ -1587,7 +1588,8 @@ /* if there was no tuple before, the previous packet processing will have * created it */ if (!tuple) { - tuple = get_tuple_by_hits(&common->hits, &common->hitr); + tuple = get_tuple_by_hits(&common->hit_sender, + &common->hit_receiver); } if (!tuple || !hipfw_midauth_add_challenge(ctx, common)) { === modified file 'hipfw/hipfw.c' --- hipfw/hipfw.c 2012-03-20 21:45:03 +0000 +++ hipfw/hipfw.c 2012-04-17 11:20:20 +0000 @@ -917,8 +917,8 @@ } if (print_addr) { - HIP_INFO_HIT("src hit", &buf->hits); - HIP_INFO_HIT("dst hit", &buf->hitr); + HIP_INFO_HIT("src hit", &buf->hit_sender); + HIP_INFO_HIT("dst hit", &buf->hit_receiver); HIP_INFO_IN6ADDR("src ip", &ctx->src); HIP_INFO_IN6ADDR("dst ip", &ctx->dst); } @@ -931,8 +931,7 @@ if (match && rule->src_hit) { HIP_DEBUG("src_hit\n"); - if (!match_hit(rule->src_hit->value, - buf->hits, + if (!match_hit(rule->src_hit->value, buf->hit_sender, rule->src_hit->boolean)) { match = 0; } @@ -942,8 +941,7 @@ if (match && rule->dst_hit) { HIP_DEBUG("dst_hit\n"); - if (!match_hit(rule->dst_hit->value, - buf->hitr, + if (!match_hit(rule->dst_hit->value, buf->hit_receiver, rule->dst_hit->boolean)) { match = 0; } === modified file 'hipfw/midauth.c' --- hipfw/midauth.c 2012-03-20 09:44:54 +0000 +++ hipfw/midauth.c 2012-04-17 11:20:20 +0000 @@ -197,8 +197,8 @@ request.K = DEFAULT_DIFFICULTY; request.lifetime = lifetime(DEFAULT_DIFFICULTY); - if (build_midauth_opaque(request.opaque, common->hits, common->hitr, - current_nonce) == -1) { + if (build_midauth_opaque(request.opaque, common->hit_sender, + common->hit_receiver, current_nonce) == -1) { HIP_ERROR("Failed to generate CHALLENGE_REQUEST nonce\n"); return ignore_missing_challenge_request; } @@ -276,7 +276,8 @@ uint8_t nonce[MIDAUTH_DEFAULT_NONCE_LENGTH]; unsigned nonce_index = (current_nonce + i) % MIDAUTH_NONCES; - if (build_midauth_opaque(nonce, common->hitr, common->hits, nonce_index) == -1) { + if (build_midauth_opaque(nonce, common->hit_receiver, + common->hit_sender, nonce_index) == -1) { return ERROR; } else if (!memcmp(response->opaque, nonce, MIDAUTH_DEFAULT_NONCE_LENGTH)) { match = true; @@ -301,8 +302,8 @@ HIP_ERROR("failed to derive midauth puzzle\n"); return ERROR; } - tmp_puzzle.initiator_hit = hip->hits; - tmp_puzzle.responder_hit = hip->hitr; + tmp_puzzle.initiator_hit = hip->hit_sender; + tmp_puzzle.responder_hit = hip->hit_receiver; memcpy(tmp_puzzle.solution, response->J, PUZZLE_LENGTH); if (hip_verify_puzzle_solution(&tmp_puzzle, response->K)) { === modified file 'lib/core/builder.c' --- lib/core/builder.c 2012-03-20 21:45:03 +0000 +++ lib/core/builder.c 2012-04-17 11:20:20 +0000 @@ -1231,8 +1231,8 @@ * length of padding. */ size_t total_len = 0, pad_len = 0; HIP_DEBUG("--------------- MSG START ------------------\n"); - HIP_DEBUG_HIT("HIT Sender ", &msg->hits); - HIP_DEBUG_HIT("HIT Receiver", &msg->hitr); + HIP_DEBUG_HIT("HIT Sender ", &msg->hit_sender); + HIP_DEBUG_HIT("HIT Receiver", &msg->hit_receiver); HIP_DEBUG("Msg type : %s (%d)\n", hip_get_msg_type_name(hip_get_msg_type(msg)), hip_get_msg_type(msg)); @@ -1678,8 +1678,10 @@ msg->control = htons(control); msg->checksum = htons(0); /* this will be written by xmit */ - ipv6_addr_copy(&msg->hits, hit_sender ? hit_sender : &in6addr_any); - ipv6_addr_copy(&msg->hitr, hit_receiver ? hit_receiver : &in6addr_any); + ipv6_addr_copy(&msg->hit_sender, + hit_sender ? hit_sender : &in6addr_any); + ipv6_addr_copy(&msg->hit_receiver, + hit_receiver ? hit_receiver : &in6addr_any); } /** @@ -1852,21 +1854,21 @@ return -EPROTOTYPE; } - HIP_IFEL(!ipv6_addr_is_hit(&hip_common->hits), -EAFNOSUPPORT, + HIP_IFEL(!ipv6_addr_is_hit(&hip_common->hit_sender), -EAFNOSUPPORT, "Received a non-HIT in HIT-source. Dropping\n"); - HIP_IFEL(!ipv6_addr_is_hit(&hip_common->hitr) && - !ipv6_addr_any(&hip_common->hitr), + HIP_IFEL(!ipv6_addr_is_hit(&hip_common->hit_receiver) && + !ipv6_addr_any(&hip_common->hit_receiver), -EAFNOSUPPORT, "Received a non-HIT or non NULL in HIT-receiver. Dropping\n"); - HIP_IFEL(ipv6_addr_any(&hip_common->hits), -EAFNOSUPPORT, + HIP_IFEL(ipv6_addr_any(&hip_common->hit_sender), -EAFNOSUPPORT, "Received a NULL in HIT-sender. Dropping\n"); /** @todo handle the RVS case better. */ - if (ipv6_addr_any(&hip_common->hitr)) { + if (ipv6_addr_any(&hip_common->hit_receiver)) { HIP_DEBUG("Received a connection to opportunistic HIT\n"); } else { - HIP_DEBUG_HIT("Received a connection to HIT", &hip_common->hitr); + HIP_DEBUG_HIT("Received a connection to HIT", &hip_common->hit_receiver); } /* Check checksum. */ === modified file 'lib/core/gpl/pk.c' --- lib/core/gpl/pk.c 2011-11-10 10:35:47 +0000 +++ lib/core/gpl/pk.c 2012-04-17 11:20:20 +0000 @@ -196,7 +196,7 @@ HIP_IFEL(!peer_pub, -1, "NULL public key\n"); HIP_IFEL(!msg, -1, "NULL message\n"); - ipv6_addr_copy(&tmpaddr, &msg->hitr); /* so update is handled, too */ + ipv6_addr_copy(&tmpaddr, &msg->hit_receiver); /* so update is handled, too */ origlen = hip_get_msg_total_len(msg); if (hip_get_msg_type(msg) == HIP_R1) { @@ -204,7 +204,7 @@ HIP_PARAM_HIP_SIGNATURE2)), -ENOENT, "Could not find signature2\n"); - memset(&msg->hitr, 0, sizeof(struct in6_addr)); + memset(&msg->hit_receiver, 0, sizeof(struct in6_addr)); HIP_IFEL(!(pz = hip_get_param_readwrite(msg, HIP_PARAM_PUZZLE)), -ENOENT, "Illegal R1 packet (puzzle missing)\n"); @@ -254,7 +254,7 @@ memcpy(pz->I, rand_i, PUZZLE_LENGTH); } - ipv6_addr_copy(&msg->hitr, &tmpaddr); + ipv6_addr_copy(&msg->hit_receiver, &tmpaddr); if (err) { err = -1; === modified file 'lib/core/protodefs.h' --- lib/core/protodefs.h 2012-03-20 13:08:56 +0000 +++ lib/core/protodefs.h 2012-04-17 11:20:20 +0000 @@ -701,8 +701,8 @@ uint8_t ver_res; uint16_t checksum; uint16_t control; - struct in6_addr hits; /**< Sender HIT */ - struct in6_addr hitr; /**< Receiver HIT */ + struct in6_addr hit_sender; + struct in6_addr hit_receiver; } __attribute__((packed)); struct hip_common_user { @@ -711,8 +711,8 @@ uint8_t version; uint16_t error; uint16_t control; - struct in6_addr hitr; /* unused */ - struct in6_addr hits; /* unused */ + struct in6_addr hit_receiver; + struct in6_addr hit_sender; } __attribute__((packed)); /** === modified file 'modules/midauth/hipd/midauth.c' --- modules/midauth/hipd/midauth.c 2012-01-16 22:06:09 +0000 +++ modules/midauth/hipd/midauth.c 2012-04-17 11:20:20 +0000 @@ -79,8 +79,8 @@ return -1; } - tmp_puzzle.initiator_hit = ctx->input_msg->hitr; - tmp_puzzle.responder_hit = ctx->input_msg->hits; + tmp_puzzle.initiator_hit = ctx->input_msg->hit_receiver; + tmp_puzzle.responder_hit = ctx->input_msg->hit_sender; if (hip_solve_puzzle(&tmp_puzzle, request->K)) { HIP_ERROR("Solving of middlebox challenge failed\n"); @@ -125,7 +125,7 @@ // add HOST_ID to packets containing a CHALLENGE_RESPONSE if (challenge_request) { const struct local_host_id *const host_id_entry = - hip_get_hostid_entry_by_lhi_and_algo(&ctx->input_msg->hitr, + hip_get_hostid_entry_by_lhi_and_algo(&ctx->input_msg->hit_receiver, HIP_ANY_ALGO, -1); if (!host_id_entry) { === modified file 'modules/update/hipd/update_builder.c' --- modules/update/hipd/update_builder.c 2012-02-15 17:37:10 +0000 +++ modules/update/hipd/update_builder.c 2012-04-17 11:20:20 +0000 @@ -107,7 +107,7 @@ HIP_IFEL(!(locator = malloc(sizeof(struct hip_locator) + addrs_len)), -ENOMEM, "Could not allocate space for locator parameter\n"); - HIP_IFEL(!(ha = hip_hadb_find_byhits(&msg->hits, &msg->hitr)), + HIP_IFEL(!(ha = hip_hadb_find_byhits(&msg->hit_sender, &msg->hit_receiver)), -1, "Could not retrieve HA\n"); hip_set_param_type((struct hip_tlv_common *) locator, HIP_PARAM_LOCATOR); === modified file 'test/hipfw/midauth.c' --- test/hipfw/midauth.c 2012-03-20 09:50:42 +0000 +++ test/hipfw/midauth.c 2012-04-17 11:20:20 +0000 @@ -130,12 +130,13 @@ HIP_DEBUG("Testing verify_response on non-matching inputs\n"); - common.hits = in6addr_any; - common.hitr = in6addr_any; + common.hit_sender = in6addr_any; + common.hit_receiver = in6addr_any; hipfw_midauth_update_nonces(); - build_midauth_opaque(midauth_nonce, common.hits, common.hitr, 1); + build_midauth_opaque(midauth_nonce, common.hit_sender, + common.hit_receiver, 1); hip_set_param_contents_len(&response.tlv, 30); memcpy(response.opaque, midauth_nonce, MIDAUTH_DEFAULT_NONCE_LENGTH); @@ -161,12 +162,12 @@ // build context ctx.transport_hdr.hip = &hip; - hip.hits = in6addr_any; - hip.hitr = in6addr_any; + hip.hit_sender = in6addr_any; + hip.hit_receiver = in6addr_any; hipfw_midauth_update_nonces(); - build_midauth_opaque(midauth_nonce, hip.hitr, hip.hits, 1); + build_midauth_opaque(midauth_nonce, hip.hit_receiver, hip.hit_sender, 1); // build response fail_unless(hip_midauth_puzzle_seed(midauth_nonce, MIDAUTH_DEFAULT_NONCE_LENGTH, tmp_puzzle.puzzle) == 0, NULL); @@ -196,13 +197,13 @@ // build context hip = hip_msg_alloc(); - hip->hits = in6addr_any; - hip->hitr = in6addr_any; + hip->hit_sender = in6addr_any; + hip->hit_receiver = in6addr_any; ctx.transport_hdr.hip = hip; hipfw_midauth_update_nonces(); - build_midauth_opaque(midauth_nonce, hip->hits, hip->hitr, 1); + build_midauth_opaque(midauth_nonce, hip->hit_sender, hip->hit_receiver, 1); // build request request.K = 1;