~rene-hummen/hipl/ipsec_esp

« back to all changes in this revision

Viewing changes to hipd/close.c

  • Committer: Rene Hummen
  • Date: 2010-11-09 16:37:54 UTC
  • mfrom: (4914.1.226 trunk)
  • Revision ID: rene.hummen@cs.rwth-aachen.de-20101109163754-axamstiyb3taln2h
merged to lp:hipl revision 5140

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * @file
3
 
 *
4
 
 * Copyright (c) 2010 Aalto University) and RWTH Aachen University.
 
1
/*
 
2
 * Copyright (c) 2010 Aalto University and RWTH Aachen University.
5
3
 *
6
4
 * Permission is hereby granted, free of charge, to any person
7
5
 * obtaining a copy of this software and associated documentation
23
21
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
22
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
23
 * OTHER DEALINGS IN THE SOFTWARE.
26
 
 *
 
24
 */
 
25
 
 
26
/**
 
27
 * @file
27
28
 * @brief Processing for CLOSE control packets
28
 
 *
29
29
 * @author Miika Komu <miika@iki.fi>
30
30
 */
31
31
 
71
71
{
72
72
    int err                      = 0, mask = 0;
73
73
    int delete_ha_info           = *(int *) ((uint8_t *)opaque + sizeof(hip_hit_t));
74
 
    hip_hit_t *peer              = (hip_hit_t *) opaque;
 
74
    hip_hit_t *peer              = opaque;
75
75
    struct hip_common *msg_close = NULL;
76
76
 
77
77
#ifdef CONFIG_HIP_PERFORMANCE
306
306
    int err = 0, echo_len;
307
307
    const struct hip_echo_request *request;
308
308
 
309
 
    HIP_IFE(!(ctx->output_msg = hip_msg_alloc()), -ENOMEM);
310
 
 
311
309
    HIP_IFEL(!(request =
312
310
                 hip_get_param(ctx->input_msg, HIP_PARAM_ECHO_REQUEST_SIGN)),
313
311
             -1, "No echo request under signature.\n");
314
312
 
315
313
    echo_len = hip_get_param_contents_len(request);
316
314
 
 
315
    hip_msg_init(ctx->output_msg);
317
316
    hip_build_network_hdr(ctx->output_msg,
318
317
                        HIP_CLOSE_ACK,
319
 
                        0,
 
318
                        HIP_PACKET_CTRL_NON,
320
319
                        &(ctx->hadb_entry)->hit_our,
321
320
                        &(ctx->hadb_entry)->hit_peer);
322
321
 
394
393
             -1,
395
394
             "Deleting peer info failed.\n");
396
395
out_err:
397
 
    if (ctx->output_msg) {
398
 
        free(ctx->output_msg);
399
 
    }
400
396
#ifdef CONFIG_HIP_PERFORMANCE
401
397
    HIP_DEBUG("Stop and write PERF_HANDLE_CLOSE\n");
402
398
    hip_perf_stop_benchmark( perf_set, PERF_HANDLE_CLOSE );
434
430
    HIP_IFEL(ipv6_addr_any(&ctx->input_msg->hitr), -1,
435
431
            "Received NULL receiver HIT in CLOSE ACK. Dropping\n");
436
432
 
437
 
    if (!hip_controls_sane(ntohs(ctx->input_msg->control), 0)) {
 
433
    if (!hip_controls_sane(ntohs(ctx->input_msg->control), HIP_PACKET_CTRL_NON)) {
438
434
        HIP_ERROR("Received illegal controls in CLOSE ACK: 0x%x. Dropping\n",
439
435
                ntohs(ctx->input_msg->control));
440
436
        goto out_err;