Committer: Tim Just <tim.just@xxxxxxxxxxxxxx> Date: Fri Mar 05 20:01:11 2010 +0100 Revision: 3633 Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: tiny Log: Modularized HIP_BOS handling and removed state check in hip_handle_bos. Modified: M hipd/bos.c M hipd/init.c M hipd/input.c === modified file 'hipd/bos.c' --- hipd/bos.c 2010-03-05 17:28:01 +0000 +++ hipd/bos.c 2010-03-05 19:01:11 +0000 @@ -224,20 +224,6 @@ * right now */ HIP_DEBUG("Received BOS packet in state %s\n", hip_state_str(ha_state)); - switch (ha_state) { - case HIP_STATE_UNASSOCIATED: - case HIP_STATE_I1_SENT: - case HIP_STATE_I2_SENT: - /* Proceed with packet handling */ - break; - case HIP_STATE_R2_SENT: - case HIP_STATE_ESTABLISHED: - HIP_DEBUG("BOS not handled in state %s\n", hip_state_str(ha_state)); - goto out_err; - default: - HIP_IFEL(1, 0, "Internal state (%d) is incorrect\n", ha_state); - } - /* according to the section 8.6 of the base draft, * we must first check signature */ === modified file 'hipd/init.c' --- hipd/init.c 2010-03-05 17:28:01 +0000 +++ hipd/init.c 2010-03-05 19:01:11 +0000 @@ -482,8 +482,14 @@ hip_register_handle_function(HIP_CLOSE, HIP_STATE_ESTABLISHED, &hip_handle_close, 1000); hip_register_handle_function(HIP_CLOSE, HIP_STATE_CLOSING, &hip_handle_close, 1000); - hip_register_handle_function(HIP_CLOSE_ACK, HIP_STATE_CLOSING, &hip_handle_close_ack, 1000); - hip_register_handle_function(HIP_CLOSE_ACK, HIP_STATE_CLOSED, &hip_handle_close_ack, 1000); + hip_register_handle_function(HIP_CLOSE_ACK, HIP_STATE_CLOSING, &hip_handle_close_ack, 1000); + hip_register_handle_function(HIP_CLOSE_ACK, HIP_STATE_CLOSED, &hip_handle_close_ack, 1000); + + hip_register_handle_function(HIP_CLOSE_ACK, HIP_STATE_CLOSED, &hip_handle_close_ack, 1000); + + hip_register_handle_function(HIP_BOS, HIP_STATE_UNASSOCIATED, &hip_handle_bos, 1000); + hip_register_handle_function(HIP_BOS, HIP_STATE_I1_SENT, &hip_handle_bos, 1000); + hip_register_handle_function(HIP_BOS, HIP_STATE_I2_SENT, &hip_handle_bos, 1000); return err; } === modified file 'hipd/input.c' --- hipd/input.c 2010-03-05 18:40:53 +0000 +++ hipd/input.c 2010-03-05 19:01:11 +0000 @@ -512,8 +512,7 @@ struct in6_addr *dst_addr, hip_portpair_t *msg_info) { - hip_ha_t tmp; - int err = 0, skip_sync = 0; + int err = 0; struct in6_addr ipv6_any_addr = IN6ADDR_ANY_INIT; struct hip_packet_context ctx = {0}; uint32_t type, state; @@ -601,24 +600,13 @@ case HIP_NOTIFY: case HIP_CLOSE: case HIP_CLOSE_ACK: + case HIP_BOS: break; case HIP_LUPDATE: HIP_IFCS(ctx.hadb_entry, err = esp_prot_handle_light_update(type, state, &ctx)); break; - case HIP_BOS: - err = hip_handle_bos(type, state, &ctx); - - /*In case of BOS the msg->hitr is null, therefore it is replaced - * with our own HIT, so that the beet state can also be - * synchronized. */ - ipv6_addr_copy(&tmp.hit_peer, &msg->hits); - hip_init_us(&tmp, NULL); - ipv6_addr_copy(&msg->hitr, &tmp.hit_our); - skip_sync = 0; - break; - default: HIP_ERROR("Unknown packet %d\n", type); err = -ENOSYS;