[hipl-commit] [trunk] Rev 4323: Remove disabled code from hipd/hadb.c.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Fri, 16 Apr 2010 21:41:21 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 16/04/2010 at 21:41:21
Revision: 4323
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Remove disabled code from hipd/hadb.c.

Modified:
  M  hipd/hadb.c

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-04-15 20:47:19 +0000
+++ hipd/hadb.c 2010-04-16 18:41:06 +0000
@@ -431,15 +431,6 @@
 
     if (entry) {
         HIP_DEBUG_LSI("    Peer lsi   ", &entry->lsi_peer);
-
-#if 0 /* Required for OpenDHT code of Pardeep?  */
-        /* Check if LSIs are different */
-        if (peer_lsi) {
-            HIP_IFEL(hip_lsi_are_equal(&entry->lsi_peer, peer_lsi) ||
-                     peer_lsi->s_addr == 0, 0,
-                     "Ignoring new mapping, old one exists\n");
-        }
-#endif
     }
 
     if (!entry) {
@@ -765,7 +756,6 @@
 #ifdef CONFIG_HIP_HIPPROXY
     entry->hipproxy = 0;
 #endif
-    //HIP_LOCK_INIT(entry);
 
     entry->state         = HIP_STATE_UNASSOCIATED;
     entry->hastate       = HIP_HASTATE_INVALID;
@@ -778,11 +768,6 @@
     HIP_IFEL(hip_hadb_set_handle_function_set(entry,
                                               &default_handle_func_set),
              -1, "Can't set new function pointer set.\n");
-#if 0
-    HIP_IFEL(hip_hadb_set_update_function_set(entry,
-                                              &default_update_func_set),
-             -1, "Can't set new function pointer set\n");
-#endif
     HIP_IFEL(hip_hadb_set_misc_function_set(entry, &default_misc_func_set),
              -1, "Can't set new function pointer set.\n");
 
@@ -846,59 +831,6 @@
 
 /* END OF PRIMITIVE FUNCTIONS */
 
-#if 0
-/**
- * Select the preferred address within the addresses of the given SPI.
- * The selected address is copied to @c addr, if it is non-NULL.
- *
- * @param entry the host association
- * @param spi_out hip_spi_out_item a pointer to the structure containing 
outbound SPI information
- * @param addr the resulting outbound address will be copied here if found
- * @return zero on success and negative on error
- */
-int hip_hadb_select_spi_addr(hip_ha_t *entry, struct hip_spi_out_item 
*spi_out, struct in6_addr *addr)
-{
-    int err = 0, i;
-    struct hip_peer_addr_list_item *s, *candidate = NULL;
-    struct timeval latest, dt;
-    hip_list_t *item, *tmp;
-
-    list_for_each_safe(item, tmp, spi_out->peer_addr_list, i)
-    {
-        s = (struct hip_peer_addr_list_item *) list_entry(item);
-        if (s->address_state != PEER_ADDR_STATE_ACTIVE) {
-            _HIP_DEBUG("skipping non-active address %s\n", addrstr);
-            continue;
-        }
-
-        if (candidate) {
-            int this_is_later;
-            this_is_later = hip_timeval_diff(&s->modified_time, &latest, &dt);
-            _HIP_DEBUG("latest=%ld.%06ld\n", latest.tv_sec, latest.tv_usec);
-            _HIP_DEBUG("dt=%ld.%06ld\n", dt.tv_sec, dt.tv_usec);
-            if (this_is_later) {
-                _HIP_DEBUG("is later, change\n");
-                memcpy(&latest, &s->modified_time, sizeof(struct timeval));
-                candidate = s;
-            }
-        } else {
-            candidate = s;
-            memcpy(&latest, &s->modified_time, sizeof(struct timeval));
-        }
-    }
-
-    if (!candidate) {
-        HIP_ERROR("did not find usable peer address\n");
-        HIP_DEBUG("todo: select from other SPIs ?\n");
-        /* todo: select other SPI as the default SPI out */
-        err = -ENOMSG;
-    } else {ipv6_addr_copy(addr, &candidate->address);
-    }
-
-    return err;
-}
-#endif /* 0 */
-
 /**
  * Gets some of the peer's usable IPv6 address.
  * @param entry corresponding hadb entry of the peer
@@ -1282,17 +1214,6 @@
     /* initialize alternative function pointer sets for misc functions*/
     /* insert your alternative function sets here!*/
 
-    /* initialize default function pointer sets for update functions*/
-#if 0
-    default_update_func_set.hip_handle_update_plain_locator  = 
hip_handle_update_plain_locator_old;
-    default_update_func_set.hip_handle_update_addr_verify    = 
hip_handle_update_addr_verify_old;
-    default_update_func_set.hip_update_handle_ack            = 
hip_update_handle_ack_old;
-    default_update_func_set.hip_handle_update_established    = 
hip_handle_update_established_old;
-    default_update_func_set.hip_handle_update_rekeying       = 
hip_handle_update_rekeying_old;
-    default_update_func_set.hip_update_send_addr_verify      = 
hip_update_send_addr_verify_deprecated;
-    default_update_func_set.hip_update_send_echo             = 
hip_update_send_echo_old;
-#endif
-
     /* xmit function set */
 #ifdef CONFIG_HIP_I3
     if (hip_get_hi3_status()) {
@@ -1341,52 +1262,6 @@
     }
 }
 
-#if 0
-/**
- * receive a pointer to the default network delivery function pointer
- * set of a host association
- *
- * @return the default function pointer set
- */
-hip_xmit_func_set_t *hip_get_xmit_default_func_set(void)
-{
-    return &default_xmit_func_set;
-}
-
-/**
- * receive a pointer to the default "misc" function pointer
- * set of a host association
- *
- * @return the default function pointer set
- */
-hip_misc_func_set_t *hip_get_misc_default_func_set(void)
-{
-    return &default_misc_func_set;
-}
-
-/**
- * receive a pointer to the default input filter function
- * pointer set of a host association
- *
- * @return the default function pointer set
- */
-hip_input_filter_func_set_t *hip_get_input_filter_default_func_set(void)
-{
-    return &default_input_filter_func_set;
-}
-
-/**
- * receive a pointer to the default output filter function pointer
- * set of a host association
- *
- * @return the default function pointer set
- */
-hip_output_filter_func_set_t *hip_get_output_filter_default_func_set(void)
-{
-    return &default_output_filter_func_set;
-}
-#endif /* 0 */
-
 /**
  * receive a pointer to the default preprocessing function pointer
  * set of a host association
@@ -1450,28 +1325,6 @@
     return -1;
 }
 
-#if 0
-/**
- * Sets function pointer set for an hadb record. Pointer values will not be
- * copied!
- *
- * @param entry        a pointer to the hadb record.
- * @param new_func_set a pointer to the new function set.
- * @return             0 if everything was stored successfully, otherwise < 0.
- */
-int hip_hadb_set_update_function_set(hip_ha_t *entry,
-                                     hip_update_func_set_t *new_func_set)
-{
-    /** @todo add check whether all function pointers are set */
-    if (entry) {
-        entry->hadb_update_func = new_func_set;
-        return 0;
-    }
-    //HIP_ERROR("Func pointer set malformed. Func pointer set NOT appied.");
-    return -1;
-}
-#endif /* 0 */
-
 /**
  * Switches on a local control bit for a host assosiation entry.
  *
@@ -1493,12 +1346,6 @@
         case HIP_HA_CTRL_LOCAL_REQ_FULLRELAY:
         case HIP_HA_CTRL_LOCAL_REQ_RVS:
         case HIP_HA_CTRL_LOCAL_GRANTED_FULLRELAY:
-#if 0
-            if (mask == HIP_HA_CTRL_LOCAL_REQ_RELAY) {
-                hip_nat_set_control(entry, 1);
-                HIP_DEBUG("nat control has been reset to 1\n");
-            }
-#endif
             entry->local_controls |= mask;
             break;
         default:
@@ -1784,16 +1631,8 @@
     hid.heartbeats_on       = hip_icmp_interval;
     calc_statistics(&entry->heartbeats_statistics, (uint32_t *) 
&hid.heartbeats_received, NULL, NULL,
                     &hid.heartbeats_mean, &hid.heartbeats_variance, 
STATS_IN_MSECS);
-#if 0
-    hid.heartbeats_mean     = entry->heartbeats_mean;
-    hid.heartbeats_variance = entry->heartbeats_variance;
-    hid.heartbeats_received = entry->heartbeats_statistics.num_items;
-#endif
     hid.heartbeats_sent     = entry->heartbeats_sent;
 
-    /*For some reason this gives negative result*/
-    //hip_timeval_diff(&entry->bex_start, &entry->bex_end, &hid.bex_duration);
-
     _HIP_HEXDUMP("HEXHID ", &hid, sizeof(struct hip_hadb_user_info_state));
 
     hid.nat_udp_port_peer  = entry->peer_udp_port;
@@ -2160,14 +1999,6 @@
 
     HIP_DEBUG("New inbound SA created with SPI=0x%x\n", new_spi_in);
 
-#if 0
-    HIP_IFEL(ha->hadb_ipsec_func->hip_setup_hit_sp_pair(&ha->hit_our,
-                                                        &ha->hit_peer, 
src_addr,
-                                                        dst_addr, IPPROTO_ESP,
-                                                        1, 0),
-             -1, "Setting up SP pair failed\n");
-#endif
-
     // Create a new outbound SA
     HIP_DEBUG("Creating a new outbound SA, SPI=0x%x\n", new_spi_out);
     ha->local_udp_port = ha->nat_mode ? hip_get_local_nat_udp_port() : 0;

Other related posts:

  • » [hipl-commit] [trunk] Rev 4323: Remove disabled code from hipd/hadb.c. - Diego Biurrun