Committer: Tim Just <tim.just@xxxxxxxxxxxxxx> Date: Wed Feb 24 15:43:38 2010 +0100 Revision: 3568 Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: tiny Log: Handling of R2 packets now uses libmodularization. Modified: M hipd/init.c M hipd/input.c === modified file 'hipd/init.c' --- hipd/init.c 2010-02-24 14:21:39 +0000 +++ hipd/init.c 2010-02-24 14:43:38 +0000 @@ -478,6 +478,27 @@ hip_perf_write_benchmark(perf_set, PERF_R1); #endif #endif + + hip_register_handle_function(HIP_R2, HIP_STATE_UNASSOCIATED, &hip_drop_packet, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_I1_SENT, &hip_drop_packet, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_I2_SENT, &hip_handle_r2, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_R2_SENT, &hip_drop_packet, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_ESTABLISHED, &hip_drop_packet, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_CLOSING, &hip_drop_packet, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_CLOSED, &hip_drop_packet, 0); + hip_register_handle_function(HIP_R2, HIP_STATE_NONE, &hip_drop_packet, 0); + +#if 0 +#ifdef CONFIG_HIP_PERFORMANCE + HIP_DEBUG("Start PERF_R2\n"); + hip_perf_start_benchmark(perf_set, PERF_R2); + + HIP_DEBUG("Stop and write PERF_R2\n"); + hip_perf_stop_benchmark(perf_set, PERF_R2); + hip_perf_write_benchmark(perf_set, PERF_R2); +#endif +#endif + return err; } === modified file 'hipd/input.c' --- hipd/input.c 2010-02-24 14:21:39 +0000 +++ hipd/input.c 2010-02-24 14:43:38 +0000 @@ -599,18 +599,7 @@ HIP_IFCS(ctx.hadb_entry, err = esp_prot_handle_light_update(type, state, &ctx)); break; case HIP_R2: -#ifdef CONFIG_HIP_PERFORMANCE - HIP_DEBUG("Start PERF_R2\n"); - hip_perf_start_benchmark(perf_set, PERF_R2); -#endif - HIP_IFCS(ctx.hadb_entry, err = hip_handle_r2(type, state, &ctx)); -#ifdef CONFIG_HIP_PERFORMANCE - HIP_DEBUG("Stop and write PERF_R2\n"); - hip_perf_stop_benchmark(perf_set, PERF_R2); - hip_perf_write_benchmark(perf_set, PERF_R2); -#endif break; - case HIP_NOTIFY: HIP_IFCS(ctx.hadb_entry, err = hip_handle_notify(type, state, &ctx)); break; @@ -1136,7 +1125,9 @@ char *str = NULL; struct in6_addr daddr; - HIP_IFEL(!packet_ctx->hadb_entry, -1, "No entry when receiving R1\n"); + HIP_IFEL(!packet_ctx->hadb_entry, -1, + "No entry in host association database when receiving R1." \ + "Dropping.\n"); #ifdef CONFIG_HIP_OPPORTUNISTIC /* Check and remove the IP of the peer from the opp non-HIP database */ @@ -2175,10 +2166,9 @@ "Received illegal controls in R2: 0x%x. Dropping\n", ntohs(packet_ctx->msg->control)); - HIP_IFEL(!packet_ctx->hadb_entry, -EFAULT, - "Received R2 by unknown sender\n"); - - HIP_LOCK_HA(packet_ctx->hadb_entry); + HIP_IFEL(!packet_ctx->hadb_entry, -1, + "No entry in host association database when receiving R2." \ + "Dropping.\n"); /* if the NAT mode is used, update the port numbers of the host association */ if (packet_ctx->msg_info->dst_port == hip_get_local_nat_udp_port()) {