← Back to team overview

hipl-core team mailing list archive

[Branch ~hipl-core/hipl/trunk] Rev 4889: Drop pointless void* casts from hip_get_param*() functions - firewall directory.

 

------------------------------------------------------------
revno: 4889
committer: Diego Biurrun <diego@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-08-18 18:14:20 +0200
message:
  Drop pointless void* casts from hip_get_param*() functions - firewall directory.
modified:
  firewall/conntrack.c
  firewall/esp_prot_conntrack.c
  firewall/esp_prot_fw_msg.c
  firewall/user_ipsec_fw_msg.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 'firewall/conntrack.c'
--- firewall/conntrack.c	2010-07-29 08:31:12 +0000
+++ firewall/conntrack.c	2010-08-18 16:14:20 +0000
@@ -899,8 +899,7 @@
     HIP_DEBUG("verify_responder: %i\n", verify_responder);
 
     // handling HOST_ID param
-    HIP_IFEL(!(host_id = (struct hip_host_id *) hip_get_param(common,
-                                                              HIP_PARAM_HOST_ID)),
+    HIP_IFEL(!(host_id = hip_get_param(common, HIP_PARAM_HOST_ID)),
              -1, "No HOST_ID found in control message\n");
 
     len = hip_get_param_total_len(host_id);
@@ -974,12 +973,11 @@
 
     HIP_DEBUG("\n");
 
-    HIP_IFEL(!(spi = (struct hip_esp_info *) hip_get_param(common,
-                                                           HIP_PARAM_ESP_INFO)),
-                                                           0, "no spi found\n");
+    HIP_IFEL(!(spi = hip_get_param(common, HIP_PARAM_ESP_INFO)),
+             0, "no spi found\n");
 
     // might not be there in case of BLIND
-    host_id = (struct hip_host_id *) hip_get_param(common, HIP_PARAM_HOST_ID);
+    host_id = hip_get_param(common, HIP_PARAM_HOST_ID);
 
     // handling HOST_ID param
     if (host_id) {
@@ -1077,7 +1075,7 @@
     const struct in6_addr *ip6_src = &ctx->src;
     int err                     = 1;
 
-    HIP_IFEL(!(spi = (struct hip_esp_info *) hip_get_param(common, HIP_PARAM_ESP_INFO)),
+    HIP_IFEL(!(spi = hip_get_param(common, HIP_PARAM_ESP_INFO)),
              0, "no spi found\n");
 
     // TODO: clean up
@@ -1272,11 +1270,11 @@
     int err                            = 1;
 
     /* get params from UPDATE message */
-    seq      = (struct hip_seq *) hip_get_param(common, HIP_PARAM_SEQ);
-    esp_info = (struct hip_esp_info *) hip_get_param(common, HIP_PARAM_ESP_INFO);
-    ack      = (struct hip_ack *) hip_get_param(common, HIP_PARAM_ACK);
-    locator  = (struct hip_locator *) hip_get_param(common, HIP_PARAM_LOCATOR);
-    spi      = (struct hip_spi *) hip_get_param(common, HIP_PARAM_ESP_INFO);
+    seq      = hip_get_param(common, HIP_PARAM_SEQ);
+    esp_info = hip_get_param(common, HIP_PARAM_ESP_INFO);
+    ack      = hip_get_param(common, HIP_PARAM_ACK);
+    locator  = hip_get_param(common, HIP_PARAM_LOCATOR);
+    spi      = hip_get_param(common, HIP_PARAM_ESP_INFO);
 
     /* connection changed to a path going through this firewall */
     if (tuple == NULL) {

=== modified file 'firewall/esp_prot_conntrack.c'
--- firewall/esp_prot_conntrack.c	2010-07-04 17:54:18 +0000
+++ firewall/esp_prot_conntrack.c	2010-08-18 16:14:20 +0000
@@ -903,9 +903,9 @@
     memset(esp_anchors, 0, MAX_NUM_PARALLEL_HCHAINS * sizeof(struct esp_prot_anchor *));
     memset(esp_roots, 0, MAX_NUM_PARALLEL_HCHAINS * sizeof(struct esp_prot_root *));
 
-    seq      = (struct hip_seq *) hip_get_param(update, HIP_PARAM_SEQ);
-    esp_info = (struct hip_esp_info *) hip_get_param(update, HIP_PARAM_ESP_INFO);
-    ack      = (struct hip_ack *) hip_get_param(update, HIP_PARAM_ACK);
+    seq      = hip_get_param(update, HIP_PARAM_SEQ);
+    esp_info = hip_get_param(update, HIP_PARAM_ESP_INFO);
+    ack      = hip_get_param(update, HIP_PARAM_ACK);
     // there might be several anchor elements
     param    = hip_get_param(update, HIP_PARAM_ESP_PROT_ANCHOR);
 
@@ -1018,8 +1018,8 @@
     HIP_DEBUG("handling light update...\n");
 
     // get params from UPDATE message
-    seq = (struct hip_seq *) hip_get_param(common, HIP_PARAM_SEQ);
-    ack = (struct hip_ack *) hip_get_param(common, HIP_PARAM_ACK);
+    seq = hip_get_param(common, HIP_PARAM_SEQ);
+    ack = hip_get_param(common, HIP_PARAM_ACK);
 
     if (seq) {
         HIP_DEBUG("received ANCHOR packet of LIGHT UPDATE\n");
@@ -1082,7 +1082,7 @@
     } else if (ack) {
         HIP_DEBUG("received ACK packet of LIGHT UPDATE\n");
 
-        esp_info = (struct hip_esp_info *) hip_get_param(common, HIP_PARAM_ESP_INFO);
+        esp_info = hip_get_param(common, HIP_PARAM_ESP_INFO);
 
         // lookup cached ANCHOR and update corresponding esp_tuple
         HIP_IFEL(esp_prot_conntrack_update_anchor(tuple, ack, esp_info), -1,

=== modified file 'firewall/esp_prot_fw_msg.c'
--- firewall/esp_prot_fw_msg.c	2010-07-16 18:17:47 +0000
+++ firewall/esp_prot_fw_msg.c	2010-08-18 16:14:20 +0000
@@ -614,8 +614,7 @@
     HIP_ASSERT(esp_prot_transform != NULL);
     HIP_ASSERT(num_anchors != NULL);
 
-    HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_param(msg,
-                                                               HIP_PARAM_ESP_PROT_TFM)),
+    HIP_IFEL(!(param = hip_get_param(msg, HIP_PARAM_ESP_PROT_TFM)),
              -1, "esp prot transform missing\n");
     *esp_prot_transform = *((uint8_t *) hip_get_param_contents_direct(param));
     HIP_DEBUG("esp protection transform is %u\n", *esp_prot_transform);
@@ -626,7 +625,7 @@
         HIP_IFEL((hash_length = esp_prot_get_hash_length(*esp_prot_transform)) <= 0,
                  -1, "error or tried to resolve UNUSED transform\n");
 
-        HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_ITEM_LENGTH)),
+        HIP_IFEL(!(param = hip_get_param(msg, HIP_PARAM_ITEM_LENGTH)),
                  -1, "transform suggests hash_item_length, but it is NOT included in msg\n");
         *hash_item_length = *((uint32_t *) hip_get_param_contents_direct(param));
         HIP_DEBUG("esp protection item length: %u\n", *hash_item_length);
@@ -636,12 +635,12 @@
         *num_anchors = *((uint16_t *) hip_get_param_contents_direct(param));
         HIP_DEBUG("esp protection number of transferred anchors: %u\n", *num_anchors);
 
-        HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_HCHAIN_ANCHOR)),
+        HIP_IFEL(!(param = hip_get_param(msg, HIP_PARAM_HCHAIN_ANCHOR)),
                  -1, "transform suggests anchor, but it is NOT included in msg\n");
 
         if (*num_anchors <= num_parallel_hchains) {
             for (i = 0; i < *num_anchors; i++) {
-                anchor = (unsigned char *) hip_get_param_contents_direct(param);
+                anchor = hip_get_param_contents_direct(param);
 
                 // store the current anchor
                 memcpy(&esp_prot_anchors[i][0], anchor, hash_length);

=== modified file 'firewall/user_ipsec_fw_msg.c'
--- firewall/user_ipsec_fw_msg.c	2010-07-16 18:17:47 +0000
+++ firewall/user_ipsec_fw_msg.c	2010-08-18 16:14:20 +0000
@@ -126,23 +126,23 @@
 
     /* get all attributes from the message */
 
-    param      = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_IPV6_ADDR);
-    src_addr   = (struct in6_addr *) hip_get_param_contents_direct(param);
+    param      = hip_get_param(msg, HIP_PARAM_IPV6_ADDR);
+    src_addr   = hip_get_param_contents_direct(param);
     HIP_DEBUG_IN6ADDR("Source IP address: ", src_addr);
 
     param      = hip_get_next_param(msg, param);
-    dst_addr   = (struct in6_addr *) hip_get_param_contents_direct(param);
+    dst_addr   = hip_get_param_contents_direct(param);
     HIP_DEBUG_IN6ADDR("Destination IP address : ", dst_addr);
 
-    param      = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_HIT);
-    src_hit    = (struct in6_addr *) hip_get_param_contents_direct(param);
+    param      = hip_get_param(msg, HIP_PARAM_HIT);
+    src_hit    = hip_get_param_contents_direct(param);
     HIP_DEBUG_HIT("Source Hit: ", src_hit);
 
     param      = hip_get_next_param(msg, param);
-    dst_hit    = (struct in6_addr *) hip_get_param_contents_direct(param);
+    dst_hit    = hip_get_param_contents_direct(param);
     HIP_DEBUG_HIT("Destination HIT: ", dst_hit);
 
-    param      = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_UINT);
+    param      = hip_get_param(msg, HIP_PARAM_UINT);
     spi        = *((uint32_t *) hip_get_param_contents_direct(param));
     HIP_DEBUG("the spi value is : 0x%lx \n", spi);
 
@@ -163,15 +163,15 @@
                   &esp_num_anchors, esp_prot_anchors, &hash_item_length), -1,
                   "failed to retrieve esp prot anchor\n");
 
-    param          = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_KEYS);
-    enc_key        = (struct hip_crypto_key *) hip_get_param_contents_direct(param);
+    param          = hip_get_param(msg, HIP_PARAM_KEYS);
+    enc_key        = hip_get_param_contents_direct(param);
     HIP_HEXDUMP("crypto key:", enc_key, sizeof(struct hip_crypto_key));
 
     param          = hip_get_next_param(msg, param);
-    auth_key       = (struct hip_crypto_key *) hip_get_param_contents_direct(param);
+    auth_key       = hip_get_param_contents_direct(param);
     HIP_HEXDUMP("auth key:", auth_key, sizeof(struct hip_crypto_key));
 
-    param          = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_INT);
+    param          = hip_get_param(msg, HIP_PARAM_INT);
     ealg           = *((int *) hip_get_param_contents_direct(param));
     HIP_DEBUG("ealg value is %d \n", ealg);
 
@@ -220,11 +220,11 @@
     HIP_DEBUG("spi value: 0x%lx \n", spi);
 
     param     = hip_get_param(msg, HIP_PARAM_IPV6_ADDR);
-    peer_addr = (struct in6_addr *) hip_get_param_contents_direct(param);
+    peer_addr = hip_get_param_contents_direct(param);
     HIP_DEBUG_IN6ADDR("peer address: ", peer_addr);
 
     param     = hip_get_next_param(msg, param);
-    dst_addr  = (struct in6_addr *) hip_get_param_contents_direct(param);
+    dst_addr  = hip_get_param_contents_direct(param);
     HIP_DEBUG_IN6ADDR("dst address: ", dst_addr);
 
     param     = hip_get_param(msg, HIP_PARAM_INT);