[hipl-dev] [Branch ~rene-hummen/hipl/ipsec_esp] Rev 4941: removed a lot of unnecessary usage of pointer in function arguments

  • From: noreply@xxxxxxxxxxxxx
  • To: HIPL core team <hipl-dev@xxxxxxxxxxxxx>
  • Date: Tue, 09 Nov 2010 21:48:26 -0000

------------------------------------------------------------
revno: 4941
committer: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx>
branch nick: ipsec_esp
timestamp: Tue 2010-11-09 22:44:54 +0100
message:
  removed a lot of unnecessary usage of pointer in function arguments
  
  Most of the changes were required due to changes to the packet context
  imported from trunk.
  
  This branch compiles again.
modified:
  hipd/hadb.c
  hipd/hadb.h
  hipd/hiprelay.c
  hipd/hiprelay.h
  hipd/input.c
  hipd/output.c
  lib/core/builder.c
  lib/core/builder.h
  lib/tool/xfrmapi.c
  lib/tool/xfrmapi.h
  modules/esp_tokens/hipd/esp_prot_hipd_msg.c
  modules/esp_tokens/hipd/esp_prot_hipd_msg.h
  modules/esp_tokens/hipd/esp_prot_light_update.c
  modules/update/hipd/update.c
  modules/user_ipsec/hipd/user_ipsec_hipd_msg.c
  modules/user_ipsec/hipd/user_ipsec_hipd_msg.h
  modules/user_ipsec/hipd/user_ipsec_sadb_api.c
  modules/user_ipsec/hipd/user_ipsec_sadb_api.h


--
lp:~rene-hummen/hipl/ipsec_esp
https://code.launchpad.net/~rene-hummen/hipl/ipsec_esp

Your team HIPL core team is subscribed to branch lp:~rene-hummen/hipl/ipsec_esp.
To unsubscribe from this branch go to 
https://code.launchpad.net/~rene-hummen/hipl/ipsec_esp/+edit-subscription
=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-11-09 16:37:54 +0000
+++ hipd/hadb.c 2010-11-09 21:44:54 +0000
@@ -930,7 +930,7 @@
      * should be 1 */
     HIP_DEBUG_HIT("our HIT", &ha->hit_our);
     HIP_DEBUG_HIT("peer HIT", &ha->hit_peer);
-    hip_delete_hit_sp_pair(&ha->hit_peer, &ha->hit_our, 1);
+    hip_delete_hit_sp_pair(ha->hit_peer, ha->hit_our, 1);
 
 #ifdef CONFIG_HIP_OPPORTUNISTIC
     opp_entry = hip_oppdb_find_by_ip(&ha->peer_addr);
@@ -1341,8 +1341,8 @@
  * @return           a pointer to a matching host association or NULL if
  *                   a matching host association was not found.
  */
-hip_ha_t *hip_hadb_find_rvs_candidate_entry(const hip_hit_t *local_hit,
-                                            const hip_hit_t *rvs_ip)
+hip_ha_t *hip_hadb_find_rvs_candidate_entry(const hip_hit_t local_hit,
+                                            const hip_hit_t rvs_ip)
 {
     int i            = 0;
     hip_ha_t *this   = NULL, *result = NULL;
@@ -1353,8 +1353,8 @@
     {
         this = (hip_ha_t *) list_entry(item);
         /* @todo: lock ha when we have threads */
-        if ((ipv6_addr_cmp(local_hit, &this->hit_our) == 0) &&
-            (ipv6_addr_cmp(rvs_ip, &this->peer_addr) == 0)) {
+        if ((ipv6_addr_cmp(&local_hit, &this->hit_our) == 0) &&
+            (ipv6_addr_cmp(&rvs_ip, &this->peer_addr) == 0)) {
             result = this;
             break;
         }
@@ -1512,8 +1512,8 @@
     int prev_spi_in  = ha->spi_inbound_current;
 
     // Delete previous security policies
-    hip_delete_hit_sp_pair(&ha->hit_our, &ha->hit_peer, 1);
-    hip_delete_hit_sp_pair(&ha->hit_peer, &ha->hit_our, 1);
+    hip_delete_hit_sp_pair(ha->hit_our, ha->hit_peer, 1);
+    hip_delete_hit_sp_pair(ha->hit_peer, ha->hit_our, 1);
 
     // Delete the previous SAs
     HIP_DEBUG("Previous SPI out =0x%x\n", prev_spi_out);
@@ -1523,11 +1523,11 @@
     HIP_DEBUG_IN6ADDR("Peer's current active addr", &ha->peer_addr);
 
     hip_delete_sa(prev_spi_out,
-                  &ha->peer_addr,
+                  ha->peer_addr,
                   HIP_SPI_DIRECTION_OUT,
                   ha);
     hip_delete_sa(prev_spi_in,
-                  &ha->our_addr,
+                  ha->our_addr,
                   HIP_SPI_DIRECTION_IN,
                   ha);
 
@@ -1542,8 +1542,8 @@
  * @param dst_addr the new destination address for the SAs
  * @return zero on success and negative on error
  */
-int hip_recreate_security_associations_and_sp(struct hip_hadb_state *ha, 
struct in6_addr *src_addr,
-                                              struct in6_addr *dst_addr)
+int hip_recreate_security_associations_and_sp(struct hip_hadb_state *ha, 
struct in6_addr src_addr,
+                                              struct in6_addr dst_addr)
 {
     int err         = 0;
 
@@ -1553,8 +1553,8 @@
     hip_delete_security_associations_and_sp(ha);
 
     // Create a new security policy
-    HIP_IFEL(hip_setup_hit_sp_pair(&ha->hit_peer,
-                                   &ha->hit_our,
+    HIP_IFEL(hip_setup_hit_sp_pair(ha->hit_peer,
+                                   ha->hit_our,
                                    dst_addr,
                                    src_addr,
                                    IPPROTO_ESP,
@@ -1567,8 +1567,8 @@
 
     HIP_IFEL(hip_add_sa(dst_addr,
                         src_addr,
-                        &ha->hit_peer,
-                        &ha->hit_our,
+                        ha->hit_peer,
+                        ha->hit_our,
                         new_spi_in,
                         ha->esp_transform,
                         &ha->esp_in,
@@ -1586,8 +1586,8 @@
 
     HIP_IFEL(hip_add_sa(src_addr,
                         dst_addr,
-                        &ha->hit_our,
-                        &ha->hit_peer,
+                        ha->hit_our,
+                        ha->hit_peer,
                         new_spi_out,
                         ha->esp_transform,
                         &ha->esp_out,

=== modified file 'hipd/hadb.h'
--- hipd/hadb.h 2010-11-09 16:37:54 +0000
+++ hipd/hadb.h 2010-11-09 21:44:54 +0000
@@ -114,8 +114,8 @@
 
 int hip_count_open_connections(void);
 
-hip_ha_t *hip_hadb_find_rvs_candidate_entry(const hip_hit_t *,
-                                            const hip_hit_t *);
+hip_ha_t *hip_hadb_find_rvs_candidate_entry(const hip_hit_t,
+                                            const hip_hit_t);
 
 int hip_handle_get_ha_info(hip_ha_t *entry, void *);
 
@@ -125,7 +125,7 @@
 hip_ha_t *hip_hadb_try_to_find_by_pair_lsi(hip_lsi_t *lsi_src, hip_lsi_t 
*lsi_dst);
 
 int hip_recreate_security_associations_and_sp(struct hip_hadb_state *ha,
-                                              struct in6_addr *src_addr,
-                                              struct in6_addr *dst_addr);
+                                              struct in6_addr src_addr,
+                                              struct in6_addr dst_addr);
 
 #endif /* HIP_HIPD_HADB_H */

=== modified file 'hipd/hiprelay.c'
--- hipd/hiprelay.c     2010-10-20 03:38:26 +0000
+++ hipd/hiprelay.c     2010-11-09 21:44:54 +0000
@@ -1193,7 +1193,7 @@
  *         if one is found, negative on error
  */
 int hip_relay_handle_relay_from(hip_common_t *source_msg,
-                                RVS struct in6_addr *relay_ip,
+                                RVS struct in6_addr relay_ip,
                                 struct in6_addr *dest_ip, in_port_t *dest_port)
 {
     int param_type;
@@ -1244,11 +1244,11 @@
      */
 #ifdef CONFIG_HIP_RVS
     relay_ha_entry =
-        hip_hadb_find_rvs_candidate_entry(&source_msg->hitr, relay_ip);
+        hip_hadb_find_rvs_candidate_entry(source_msg->hitr, relay_ip);
 
     if (relay_ha_entry == NULL) {
         HIP_DEBUG_HIT("relay hit not found in the entry table rvs_ip:",
-                      relay_ip);
+                      &relay_ip);
         HIP_DEBUG_HIT("relay hit not found in the entry table " \
                       "&source_msg->hitr:", &source_msg->hitr);
         HIP_DEBUG("The I1 packet was received from Relay, but the host " \

=== modified file 'hipd/hiprelay.h'
--- hipd/hiprelay.h     2010-10-15 15:29:14 +0000
+++ hipd/hiprelay.h     2010-11-09 21:44:54 +0000
@@ -116,7 +116,7 @@
                               uint8_t *granted_lifetime);
 int hip_relay_add_rvs_to_ha(const hip_common_t *source_msg, hip_ha_t *entry);
 int hip_relay_handle_relay_from(hip_common_t *source_msg,
-                                struct in6_addr *relay_ip,
+                                struct in6_addr relay_ip,
                                 struct in6_addr *dest_ip, in_port_t 
*dest_port);
 
 int hip_relay_handle_relay_to_in_client(const uint8_t packet_type,

=== modified file 'hipd/input.c'
--- hipd/input.c        2010-11-09 16:37:54 +0000
+++ hipd/input.c        2010-11-09 21:44:54 +0000
@@ -1171,12 +1171,12 @@
     // set up inbound IPsec SA
     HIP_IFEL(hip_add_sa(ctx->src_addr,
                         ctx->dst_addr,
-                        &ctx->input_msg->hits,
-                        &ctx->input_msg->hitr,
+                        ctx->input_msg->hits,
+                        ctx->input_msg->hitr,
                         ctx->hadb_entry->spi_inbound_current,
                         ctx->hadb_entry->esp_transform,
-                        &(ctx->hadb_entry)->esp_in,
-                        &(ctx->hadb_entry)->auth_in,
+                        &ctx->hadb_entry->esp_in,
+                        &ctx->hadb_entry->auth_in,
                         HIP_SPI_DIRECTION_IN,
                         0,
                         ctx->hadb_entry),
@@ -1185,8 +1185,8 @@
     // set up outbound IPsec SA
     HIP_IFEL(hip_add_sa(ctx->dst_addr,
                         ctx->src_addr,
-                        &ctx->input_msg->hitr,
-                        &ctx->input_msg->hits,
+                        ctx->input_msg->hitr,
+                        ctx->input_msg->hits,
                         ctx->hadb_entry->spi_outbound_current,
                         ctx->hadb_entry->esp_transform,
                         &ctx->hadb_entry->esp_out,
@@ -1197,8 +1197,8 @@
              -1, "Failed to setup IPsec SPD/SA entries, peer:dst\n");
 
     // set up corresponding IPsec policies
-    HIP_IFEL(hip_setup_hit_sp_pair(&ctx->input_msg->hits,
-                                   &ctx->input_msg->hitr,
+    HIP_IFEL(hip_setup_hit_sp_pair(ctx->input_msg->hits,
+                                   ctx->input_msg->hitr,
                                    ctx->src_addr, ctx->dst_addr,
                                    IPPROTO_ESP,
                                    1,

=== modified file 'hipd/output.c'
--- hipd/output.c       2010-11-09 16:37:54 +0000
+++ hipd/output.c       2010-11-09 21:44:54 +0000
@@ -832,7 +832,7 @@
     HIP_DEBUG_IN6ADDR("dst_ip", &dst_ip);
 
     relay_para_type = hip_relay_handle_relay_from(ctx->input_msg,
-                                                  &ctx->src_addr,
+                                                  ctx->src_addr,
                                                   &dst_ip, &r1_dst_port);
 
     /* Get the final destination address and port for the outgoing R1.
@@ -905,7 +905,7 @@
     if (!ipv6_addr_any(&dst_ip) && relay_para_type) {
         if (relay_para_type == HIP_PARAM_RELAY_FROM) {
             HIP_DEBUG("Build param relay_to\n");
-            hip_build_param_relay_to(r1pkt, &dst_ip, r1_dst_port);
+            hip_build_param_relay_to(r1pkt, dst_ip, r1_dst_port);
         } else if (relay_para_type == HIP_PARAM_FROM)    {
             HIP_DEBUG("Build param via_rvs\n");
             hip_build_param_via_rvs(r1pkt, &ctx->src_addr);
@@ -973,7 +973,7 @@
                                  ctx->input_msg, ctx->output_msg);
     if (hip_relay_get_status() != HIP_RELAY_OFF) {
         hip_build_param_reg_from(ctx->output_msg,
-                                 ctx->src_addr, ctx->msg_ports->src_port);
+                                 ctx->src_addr, ctx->msg_ports.src_port);
     }
 #endif
 
@@ -1048,7 +1048,7 @@
                                      &dst, &dst_port) > 0)
         && !ipv6_addr_any(&dst)) {
         HIP_DEBUG("create relay_to parameter in R2\n");
-        hip_build_param_relay_to(ctx->output_msg, &dst, dst_port);
+        hip_build_param_relay_to(ctx->output_msg, dst, dst_port);
     }
 #endif
 

=== modified file 'lib/core/builder.c'
--- lib/core/builder.c  2010-11-09 16:37:54 +0000
+++ lib/core/builder.c  2010-11-09 21:44:54 +0000
@@ -2217,14 +2217,14 @@
  *             draft, this is now RELAY_TO.
  */
 int hip_build_param_relay_to(struct hip_common *msg,
-                             const struct in6_addr *addr,
+                             const struct in6_addr addr,
                              const in_port_t port)
 {
     struct hip_relay_to relay_to;
     int err = 0;
 
     hip_set_param_type((struct hip_tlv_common *) &relay_to, 
HIP_PARAM_RELAY_TO);
-    ipv6_addr_copy((struct in6_addr *) &relay_to.address, addr);
+    ipv6_addr_copy((struct in6_addr *) &relay_to.address, &addr);
     relay_to.port     = htons(port);
     relay_to.reserved = 0;
     relay_to.protocol = HIP_NAT_PROTO_UDP;
@@ -3810,16 +3810,16 @@
  *             draft, this is now RELAY_TO.
  */
 int hip_build_param_reg_from(struct hip_common *msg,
-                             const struct in6_addr *addr,
+                             const struct in6_addr addr,
                              const in_port_t port)
 {
     struct hip_reg_from reg_from;
     int err = 0;
 
     hip_set_param_type((struct hip_tlv_common *) &reg_from, 
HIP_PARAM_REG_FROM);
-    ipv6_addr_copy((struct in6_addr *) &reg_from.address, addr);
+    ipv6_addr_copy((struct in6_addr *) &reg_from.address, &addr);
     HIP_DEBUG_IN6ADDR("reg_from address is ", &reg_from.address);
-    HIP_DEBUG_IN6ADDR("the given address is ", addr);
+    HIP_DEBUG_IN6ADDR("the given address is ", &addr);
     reg_from.port     = htons(port);
     reg_from.reserved = 0;
     reg_from.protocol = HIP_NAT_PROTO_UDP;

=== modified file 'lib/core/builder.h'
--- lib/core/builder.h  2010-11-09 16:37:54 +0000
+++ lib/core/builder.h  2010-11-09 21:44:54 +0000
@@ -166,7 +166,7 @@
                                   const hip_transform_suite_t[],
                                   const uint16_t);
 int hip_build_param_relay_to(struct hip_common *msg,
-                             const struct in6_addr *rvs_addr,
+                             const struct in6_addr rvs_addr,
                              const in_port_t port);
 int hip_build_param_via_rvs(struct hip_common *msg,
                             const struct in6_addr rvs_addresses[]);
@@ -265,7 +265,7 @@
                                int type_count);
 
 int hip_build_param_reg_from(struct hip_common *msg,
-                             const struct in6_addr *addr,
+                             const struct in6_addr addr,
                              const in_port_t port);
 int hip_build_param_nat_port(hip_common_t *msg,
                              const in_port_t port,

=== modified file 'lib/tool/xfrmapi.c'
--- lib/tool/xfrmapi.c  2010-09-20 14:13:40 +0000
+++ lib/tool/xfrmapi.c  2010-11-09 21:44:54 +0000
@@ -82,12 +82,12 @@
 static int hip_xfrm_fill_encap(struct xfrm_encap_tmpl *encap,
                                const int sport,
                                const int dport,
-                               const struct in6_addr *oa)
+                               const struct in6_addr oa)
 {
     encap->encap_type  = HIP_UDP_ENCAP_ESPINUDP;
     encap->encap_sport = htons(sport);
     encap->encap_dport = htons(dport);
-    encap->encap_oa.a4 = oa->s6_addr32[3];
+    encap->encap_oa.a4 = oa.s6_addr32[3];
     return 0;
 }
 
@@ -103,23 +103,23 @@
  * @return 0
  */
 static int hip_xfrm_fill_selector(struct xfrm_selector *sel,
-                                  const struct in6_addr *id_our,
-                                  const struct in6_addr *id_peer,
+                                  const struct in6_addr id_our,
+                                  const struct in6_addr id_peer,
                                   const uint8_t proto, const uint8_t id_prefix,
                                   const int preferred_family)
 {
     struct in_addr in_id_our, in_id_peer;
 
-    if (IN6_IS_ADDR_V4MAPPED(id_our)) {
+    if (IN6_IS_ADDR_V4MAPPED(&id_our)) {
         sel->family = AF_INET;
-        IPV6_TO_IPV4_MAP(id_our, &in_id_our);
-        IPV6_TO_IPV4_MAP(id_peer, &in_id_peer);
+        IPV6_TO_IPV4_MAP(&id_our, &in_id_our);
+        IPV6_TO_IPV4_MAP(&id_peer, &in_id_peer);
         memcpy(&sel->daddr, &in_id_our, sizeof(sel->daddr));
         memcpy(&sel->saddr, &in_id_peer, sizeof(sel->saddr));
     } else {
         sel->family = preferred_family;
-        memcpy(&sel->daddr, id_peer, sizeof(sel->daddr));
-        memcpy(&sel->saddr, id_our, sizeof(sel->saddr));
+        memcpy(&sel->daddr, &id_peer, sizeof(sel->daddr));
+        memcpy(&sel->saddr, &id_our, sizeof(sel->saddr));
     }
 
     if (proto) {
@@ -199,8 +199,8 @@
  * @return 0 if successful, else < 0
  */
 static int hip_xfrm_policy_modify(struct rtnl_handle *rth, int cmd,
-                                  const struct in6_addr *id_our,
-                                  const struct in6_addr *id_peer,
+                                  const struct in6_addr id_our,
+                                  const struct in6_addr id_peer,
                                   const struct in6_addr *tmpl_saddr,
                                   const struct in6_addr *tmpl_daddr,
                                   int dir, uint8_t proto, uint8_t id_prefix,
@@ -349,8 +349,8 @@
  * @return 0 if successful, negative on error
  */
 static int hip_xfrm_policy_delete(struct rtnl_handle *rth,
-                                  const struct in6_addr *hit_our,
-                                  const struct in6_addr *hit_peer,
+                                  const struct in6_addr hit_our,
+                                  const struct in6_addr hit_peer,
                                   const int dir,
                                   const uint8_t hit_prefix,
                                   const int preferred_family)
@@ -403,10 +403,10 @@
  * @return 0 if successful, negative on error
  */
 static int hip_xfrm_state_modify(struct rtnl_handle *rth,
-                                 const int cmd, const struct in6_addr *saddr,
-                                 const struct in6_addr *daddr,
-                                 const struct in6_addr *src_id,
-                                 const struct in6_addr *dst_id,
+                                 const int cmd, const struct in6_addr saddr,
+                                 const struct in6_addr daddr,
+                                 const struct in6_addr src_id,
+                                 const struct in6_addr dst_id,
                                  const uint32_t spi, const int ealg,
                                  const struct hip_crypto_key *enckey,
                                  const int enckey_len,
@@ -426,18 +426,18 @@
 
     HIP_DEBUG("hip_xfrm_state_modify() invoked.\n");
     HIP_DEBUG("sport %d, dport %d\n", sport, dport);
-    HIP_DEBUG_IN6ADDR("saddr in sa", saddr);
-    HIP_DEBUG_IN6ADDR("daddr in sa", daddr);
+    HIP_DEBUG_IN6ADDR("saddr in sa", &saddr);
+    HIP_DEBUG_IN6ADDR("daddr in sa", &daddr);
 
     memset(&req, 0, sizeof(req));
 
-    if (IN6_IS_ADDR_V4MAPPED(saddr) || IN6_IS_ADDR_V4MAPPED(daddr)) {
-        req.xsinfo.saddr.a4    = saddr->s6_addr32[3];
-        req.xsinfo.id.daddr.a4 = daddr->s6_addr32[3];
+    if (IN6_IS_ADDR_V4MAPPED(&saddr) || IN6_IS_ADDR_V4MAPPED(&daddr)) {
+        req.xsinfo.saddr.a4    = saddr.s6_addr32[3];
+        req.xsinfo.id.daddr.a4 = daddr.s6_addr32[3];
         req.xsinfo.family      = AF_INET;
     } else {
-        memcpy(&req.xsinfo.saddr, saddr, sizeof(req.xsinfo.saddr));
-        memcpy(&req.xsinfo.id.daddr, daddr, sizeof(req.xsinfo.id.daddr));
+        memcpy(&req.xsinfo.saddr, &saddr, sizeof(req.xsinfo.saddr));
+        memcpy(&req.xsinfo.id.daddr, &daddr, sizeof(req.xsinfo.id.daddr));
         req.xsinfo.family = preferred_family;
     }
 
@@ -521,7 +521,7 @@
  * @return 0 on success or negative on error
  */
 static int hip_xfrm_state_delete(struct rtnl_handle *rth,
-                                 const struct in6_addr *peer_addr, uint32_t 
spi,
+                                 const struct in6_addr peer_addr, uint32_t spi,
                                  const int preferred_family,
                                  const int sport, const int dport)
 {
@@ -539,13 +539,13 @@
     req.n.nlmsg_flags = NLM_F_REQUEST;
     req.n.nlmsg_type  = XFRM_MSG_DELSA;
 
-    if (IN6_IS_ADDR_V4MAPPED(peer_addr)) {
+    if (IN6_IS_ADDR_V4MAPPED(&peer_addr)) {
         HIP_DEBUG("IPV4 SA deletion\n");
-        req.xsid.daddr.a4 = peer_addr->s6_addr32[3];
+        req.xsid.daddr.a4 = peer_addr.s6_addr32[3];
         req.xsid.family   = AF_INET;
     } else {
         HIP_DEBUG("IPV6 SA deletion\n");
-        memcpy(&req.xsid.daddr, peer_addr, sizeof(req.xsid.daddr));
+        memcpy(&req.xsid.daddr, &peer_addr, sizeof(req.xsid.daddr));
         req.xsid.family = preferred_family;
     }
 
@@ -585,12 +585,12 @@
  *                        and revert to maximum size prefix
  * @return the size of the calculated prefix
  */
-static int hip_calc_sp_prefix(const struct in6_addr *src_id,
+static int hip_calc_sp_prefix(const struct in6_addr src_id,
                               int use_full_prefix)
 {
     uint8_t prefix;
 
-    if (IN6_IS_ADDR_V4MAPPED(src_id)) {
+    if (IN6_IS_ADDR_V4MAPPED(&src_id)) {
         HIP_DEBUG("ipv4 address mapped as ipv6\n");
         prefix = (use_full_prefix) ? 32 : HIP_LSI_PREFIX_LEN;
     } else {
@@ -670,7 +670,7 @@
  * @param direction HIP_SPI_DIRECTION_OUT or HIP_SPI_DIRECTION_IN
  * @param entry corresponding host association
  */
-void hip_delete_sa(const uint32_t spi, const struct in6_addr *peer_addr,
+void hip_delete_sa(const uint32_t spi, const struct in6_addr peer_addr,
                    const int direction, hip_ha_t *entry)
 {
     in_port_t sport, dport;
@@ -717,10 +717,10 @@
  * @note If you make changes to this function, please change also
  * hipd/user_ipsec_sadb_api.c:hip_userspace_ipsec_add_sa().
  */
-uint32_t hip_add_sa(const struct in6_addr *saddr,
-                    const struct in6_addr *daddr,
-                    const struct in6_addr *src_hit,
-                    const struct in6_addr *dst_hit,
+uint32_t hip_add_sa(const struct in6_addr saddr,
+                    const struct in6_addr daddr,
+                    const struct in6_addr src_hit,
+                    const struct in6_addr dst_hit,
                     const uint32_t spi,
                     const int ealg,
                     const struct hip_crypto_key *enckey,
@@ -758,10 +758,10 @@
 
     HIP_DEBUG("************************************\n");
     HIP_DEBUG("%s SA\n", (update ? "updating" : "adding new"));
-    HIP_DEBUG_HIT("src_hit", src_hit);
-    HIP_DEBUG_HIT("dst_hit", dst_hit);
-    HIP_DEBUG_IN6ADDR("saddr", saddr);
-    HIP_DEBUG_IN6ADDR("daddr", daddr);
+    HIP_DEBUG_HIT("src_hit", &src_hit);
+    HIP_DEBUG_HIT("dst_hit", &dst_hit);
+    HIP_DEBUG_IN6ADDR("saddr", &saddr);
+    HIP_DEBUG_IN6ADDR("daddr", &daddr);
 
     HIP_DEBUG("direction %d\n", direction);
     HIP_DEBUG("SPI=0x%x\n", spi);
@@ -791,10 +791,10 @@
  * @param update zero if the the SP is new or one otherwise
  * @note  IPv4 addresses in IPv6 mapped format
  */
-int hip_setup_hit_sp_pair(const struct in6_addr *src_id,
-                          const struct in6_addr *dst_id,
-                          const struct in6_addr *src_addr,
-                          const struct in6_addr *dst_addr,
+int hip_setup_hit_sp_pair(const struct in6_addr src_id,
+                          const struct in6_addr dst_id,
+                          const struct in6_addr src_addr,
+                          const struct in6_addr dst_addr,
                           uint8_t proto,
                           int use_full_prefix,
                           int update)
@@ -809,13 +809,13 @@
     HIP_DEBUG("hip_setup_hit_sp_pair\n");
     HIP_IFE(hip_xfrm_policy_modify(hip_xfrmapi_nl_ipsec, cmd,
                                    dst_id, src_id,
-                                   src_addr, dst_addr,
+                                   &src_addr, &dst_addr,
                                    XFRM_POLICY_IN, proto, prefix,
                                    AF_INET6), -1);
 
     HIP_IFE(hip_xfrm_policy_modify(hip_xfrmapi_nl_ipsec, cmd,
                                    src_id, dst_id,
-                                   dst_addr, src_addr,
+                                   &dst_addr, &src_addr,
                                    XFRM_POLICY_OUT, proto, prefix,
                                    AF_INET6), -1);
     HIP_DEBUG("End\n");
@@ -831,8 +831,8 @@
  * @param use_full_prefix one if we should use /128 prefix for HITs
  *                        or zero otherwise
  */
-void hip_delete_hit_sp_pair(const hip_hit_t *src_hit,
-                            const hip_hit_t *dst_hit,
+void hip_delete_hit_sp_pair(const hip_hit_t src_hit,
+                            const hip_hit_t dst_hit,
                             const int use_full_prefix)
 {
     uint8_t prefix = (use_full_prefix) ? 128 : HIP_HIT_PREFIX_LEN;
@@ -857,7 +857,7 @@
     set_hit_prefix(&src_hit);
     set_hit_prefix(&dst_hit);
 
-    hip_delete_hit_sp_pair(&src_hit, &dst_hit, 0);
+    hip_delete_hit_sp_pair(src_hit, dst_hit, 0);
 }
 
 /**
@@ -880,7 +880,7 @@
     set_hit_prefix(&src_hit);
     set_hit_prefix(&dst_hit);
 
-    HIP_IFE(hip_setup_hit_sp_pair(&src_hit, &dst_hit, &ip, &ip, 0, 0, 0),
+    HIP_IFE(hip_setup_hit_sp_pair(src_hit, dst_hit, ip, ip, 0, 0, 0),
             -1);
 out_err:
     return err;

=== modified file 'lib/tool/xfrmapi.h'
--- lib/tool/xfrmapi.h  2010-09-09 01:12:24 +0000
+++ lib/tool/xfrmapi.h  2010-11-09 21:44:54 +0000
@@ -35,29 +35,29 @@
 int hip_xfrm_delete(hip_hit_t *hit, uint32_t spi, int dir);
 
 /* Setups the SA (with a given SPI if so said) */
-uint32_t hip_add_sa(const struct in6_addr *saddr,
-                    const struct in6_addr *daddr,
-                    const struct in6_addr *src_hit,
-                    const struct in6_addr *dst_hit,
+uint32_t hip_add_sa(const struct in6_addr saddr,
+                    const struct in6_addr daddr,
+                    const struct in6_addr src_hit,
+                    const struct in6_addr dst_hit,
                     const uint32_t spi, const int ealg,
                     const struct hip_crypto_key *enckey,
                     const struct hip_crypto_key *authkey,
                     const int direction, const int update,
                     hip_ha_t *entry);
 
-void hip_delete_sa(const uint32_t spi, const struct in6_addr *peer_addr,
+void hip_delete_sa(const uint32_t spi, const struct in6_addr peer_addr,
                    const int direction, hip_ha_t *entry);
 
 
-int hip_setup_hit_sp_pair(const hip_hit_t *src_hit,
-                          const hip_hit_t *dst_hit,
-                          const struct in6_addr *src_addr,
-                          const struct in6_addr *dst_addr,
+int hip_setup_hit_sp_pair(const hip_hit_t src_hit,
+                          const hip_hit_t dst_hit,
+                          const struct in6_addr src_addr,
+                          const struct in6_addr dst_addr,
                           uint8_t proto,
                           int use_full_prefix,
                           int update);
 
-void hip_delete_hit_sp_pair(const hip_hit_t *src_hit, const hip_hit_t *dst_hit,
+void hip_delete_hit_sp_pair(const hip_hit_t src_hit, const hip_hit_t dst_hit,
                             const int use_full_prefix);
 
 

=== modified file 'modules/esp_tokens/hipd/esp_prot_hipd_msg.c'
--- modules/esp_tokens/hipd/esp_prot_hipd_msg.c 2010-11-09 16:37:54 +0000
+++ modules/esp_tokens/hipd/esp_prot_hipd_msg.c 2010-11-09 21:44:54 +0000
@@ -1058,8 +1058,8 @@
  * @return          0 on success, -1 in case of an error
  **/
 int esp_prot_handle_second_update_packet(hip_ha_t *entry,
-                                         const struct in6_addr *src_ip,
-                                         const struct in6_addr *dst_ip)
+                                         const struct in6_addr src_ip,
+                                         const struct in6_addr dst_ip)
 {
     int err = 0;
 
@@ -1074,9 +1074,10 @@
     entry->update_state = 0;
 
     // notify sadb about next anchor
-    HIP_IFEL(hip_userspace_ipsec_add_sa(dst_ip, src_ip,
-                                        &entry->hit_our,
-                                        &entry->hit_peer,
+    HIP_IFEL(hip_userspace_ipsec_add_sa(dst_ip,
+                                        src_ip,
+                                        entry->hit_our,
+                                        entry->hit_peer,
                                         entry->spi_outbound_new,
                                         entry->esp_transform,
                                         &entry->esp_out,

=== modified file 'modules/esp_tokens/hipd/esp_prot_hipd_msg.h'
--- modules/esp_tokens/hipd/esp_prot_hipd_msg.h 2010-11-09 16:37:54 +0000
+++ modules/esp_tokens/hipd/esp_prot_hipd_msg.h 2010-11-09 21:44:54 +0000
@@ -77,8 +77,8 @@
                                         const struct in6_addr *src_ip,
                                         const struct in6_addr *dst_ip);
 int esp_prot_handle_second_update_packet(hip_ha_t *entry,
-                                         const struct in6_addr *src_ip,
-                                         const struct in6_addr *dst_ip);
+                                         const struct in6_addr src_ip,
+                                         const struct in6_addr dst_ip);
 int esp_prot_update_add_anchor(hip_common_t *update, hip_ha_t *entry);
 int esp_prot_update_handle_anchor(const hip_common_t *recv_update,
                                   hip_ha_t *entry,

=== modified file 'modules/esp_tokens/hipd/esp_prot_light_update.c'
--- modules/esp_tokens/hipd/esp_prot_light_update.c     2010-11-09 16:37:54 
+0000
+++ modules/esp_tokens/hipd/esp_prot_light_update.c     2010-11-09 21:44:54 
+0000
@@ -303,12 +303,12 @@
         // notify sadb about next anchor
         HIP_IFEL(hip_userspace_ipsec_add_sa(ctx->dst_addr,
                                             ctx->src_addr,
-                                            &(ctx->hadb_entry)->hit_our,
-                                            &(ctx->hadb_entry)->hit_peer,
+                                            ctx->hadb_entry->hit_our,
+                                            ctx->hadb_entry->hit_peer,
                                             ctx->hadb_entry->spi_outbound_new,
                                             ctx->hadb_entry->esp_transform,
-                                            &(ctx->hadb_entry)->esp_out,
-                                            &(ctx->hadb_entry)->auth_out,
+                                            &ctx->hadb_entry->esp_out,
+                                            &ctx->hadb_entry->auth_out,
                                             ctx->hadb_entry->retrans_state,
                                             HIP_SPI_DIRECTION_OUT,
                                             1,

=== modified file 'modules/update/hipd/update.c'
--- modules/update/hipd/update.c        2010-11-09 16:37:54 +0000
+++ modules/update/hipd/update.c        2010-11-09 21:44:54 +0000
@@ -1119,8 +1119,8 @@
                 == ESP_PROT_SECOND_UPDATE_PACKET)
    {
        esp_prot_handle_second_update_packet(ctx->hadb_entry,
-                                            &ctx->src_addr,
-                                            &ctx->dst_addr);
+                                            ctx->src_addr,
+                                            ctx->dst_addr);
 
        goto out_err;
    }

=== modified file 'modules/user_ipsec/hipd/user_ipsec_hipd_msg.c'
--- modules/user_ipsec/hipd/user_ipsec_hipd_msg.c       2010-11-09 16:37:54 
+0000
+++ modules/user_ipsec/hipd/user_ipsec_hipd_msg.c       2010-11-09 21:44:54 
+0000
@@ -102,10 +102,10 @@
  * @param entry             host association entry for this connection
  * @return                  the msg, NULL if an error occurred
  */
-struct hip_common *create_add_sa_msg(const struct in6_addr *saddr,
-                                     const struct in6_addr *daddr,
-                                     const struct in6_addr *src_hit,
-                                     const struct in6_addr *dst_hit,
+struct hip_common *create_add_sa_msg(const struct in6_addr saddr,
+                                     const struct in6_addr daddr,
+                                     const struct in6_addr src_hit,
+                                     const struct in6_addr dst_hit,
                                      const uint32_t spi, const int ealg,
                                      const struct hip_crypto_key *enckey,
                                      const struct hip_crypto_key *authkey,
@@ -124,25 +124,25 @@
     HIP_IFEL(hip_build_user_hdr(msg, HIP_MSG_IPSEC_ADD_SA, 0), -1,
              "build hdr failed\n");
 
-    HIP_DEBUG_IN6ADDR("Source IP address: ", saddr);
-    HIP_IFEL(hip_build_param_contents(msg, saddr,
-                                      HIP_PARAM_IPV6_ADDR,
-                                      sizeof(struct in6_addr)), -1,
-             "build param contents failed\n");
-
-    HIP_DEBUG_IN6ADDR("Destination IP address : ", daddr);
-    HIP_IFEL(hip_build_param_contents(msg, daddr,
-                                      HIP_PARAM_IPV6_ADDR,
-                                      sizeof(struct in6_addr)), -1,
-             "build param contents failed\n");
-
-    HIP_DEBUG_HIT("Source HIT: ", src_hit);
-    HIP_IFEL(hip_build_param_contents(msg, src_hit, HIP_PARAM_HIT,
-                                      sizeof(struct in6_addr)), -1,
-             "build param contents failed\n");
-
-    HIP_DEBUG_HIT("Destination HIT: ", dst_hit);
-    HIP_IFEL(hip_build_param_contents(msg, dst_hit, HIP_PARAM_HIT,
+    HIP_DEBUG_IN6ADDR("Source IP address: ", &saddr);
+    HIP_IFEL(hip_build_param_contents(msg, &saddr,
+                                      HIP_PARAM_IPV6_ADDR,
+                                      sizeof(struct in6_addr)), -1,
+             "build param contents failed\n");
+
+    HIP_DEBUG_IN6ADDR("Destination IP address : ", &daddr);
+    HIP_IFEL(hip_build_param_contents(msg, &daddr,
+                                      HIP_PARAM_IPV6_ADDR,
+                                      sizeof(struct in6_addr)), -1,
+             "build param contents failed\n");
+
+    HIP_DEBUG_HIT("Source HIT: ", &src_hit);
+    HIP_IFEL(hip_build_param_contents(msg, &src_hit, HIP_PARAM_HIT,
+                                      sizeof(struct in6_addr)), -1,
+             "build param contents failed\n");
+
+    HIP_DEBUG_HIT("Destination HIT: ", &dst_hit);
+    HIP_IFEL(hip_build_param_contents(msg, &dst_hit, HIP_PARAM_HIT,
                                       sizeof(struct in6_addr)), -1,
              "build param contents failed\n");
 

=== modified file 'modules/user_ipsec/hipd/user_ipsec_hipd_msg.h'
--- modules/user_ipsec/hipd/user_ipsec_hipd_msg.h       2010-11-09 16:37:54 
+0000
+++ modules/user_ipsec/hipd/user_ipsec_hipd_msg.h       2010-11-09 21:44:54 
+0000
@@ -43,10 +43,10 @@
 
 int hip_userspace_ipsec_activate(struct hip_common *msg,
                                  UNUSED struct sockaddr_in6 *src);
-struct hip_common *create_add_sa_msg(const struct in6_addr *saddr,
-                                     const struct in6_addr *daddr,
-                                     const struct in6_addr *src_hit,
-                                     const struct in6_addr *dst_hit,
+struct hip_common *create_add_sa_msg(const struct in6_addr saddr,
+                                     const struct in6_addr daddr,
+                                     const struct in6_addr src_hit,
+                                     const struct in6_addr dst_hit,
                                      const uint32_t spi, const int ealg,
                                      const struct hip_crypto_key *enckey,
                                      const struct hip_crypto_key *authkey,

=== modified file 'modules/user_ipsec/hipd/user_ipsec_sadb_api.c'
--- modules/user_ipsec/hipd/user_ipsec_sadb_api.c       2010-11-09 16:37:54 
+0000
+++ modules/user_ipsec/hipd/user_ipsec_sadb_api.c       2010-11-09 21:44:54 
+0000
@@ -103,18 +103,18 @@
  * @param entry             host association entry for this connection
  * @return                  0, if correct, otherwise -1
  */
-int hip_userspace_ipsec_add_sa(const struct in6_addr *saddr,
-                                      const struct in6_addr *daddr,
-                                      const struct in6_addr *src_hit,
-                                      const struct in6_addr *dst_hit,
-                                      const uint32_t spi,
-                                      const int ealg,
-                                      const struct hip_crypto_key *enckey,
-                                      const struct hip_crypto_key *authkey,
-                                      const int retransmission,
-                                      const int direction,
-                                      const int update,
-                                      hip_ha_t *entry)
+int hip_userspace_ipsec_add_sa(const struct in6_addr saddr,
+                               const struct in6_addr daddr,
+                               const struct in6_addr src_hit,
+                               const struct in6_addr dst_hit,
+                               const uint32_t spi,
+                               const int ealg,
+                               const struct hip_crypto_key *enckey,
+                               const struct hip_crypto_key *authkey,
+                               const int retransmission,
+                               const int direction,
+                               const int update,
+                               hip_ha_t *entry)
 {
     struct hip_common *msg = NULL;
     in_port_t sport, dport;
@@ -162,8 +162,8 @@
     /* Set up inbound IPsec associations */
     HIP_IFEL(hip_userspace_ipsec_add_sa(ctx->src_addr,
                                         ctx->dst_addr,
-                                        &ctx->input_msg->hits,
-                                        &ctx->input_msg->hitr,
+                                        ctx->input_msg->hits,
+                                        ctx->input_msg->hitr,
                                         ctx->hadb_entry->spi_inbound_current,
                                         ctx->hadb_entry->esp_transform,
                                         &ctx->hadb_entry->esp_in,
@@ -177,8 +177,8 @@
     /* Set up outbound IPsec associations */
     HIP_IFEL(hip_userspace_ipsec_add_sa(ctx->dst_addr,
                                         ctx->src_addr,
-                                        &ctx->input_msg->hitr,
-                                        &ctx->input_msg->hits,
+                                        ctx->input_msg->hitr,
+                                        ctx->input_msg->hits,
                                         ctx->hadb_entry->spi_outbound_current,
                                         ctx->hadb_entry->esp_transform,
                                         &ctx->hadb_entry->esp_out,
@@ -216,8 +216,8 @@
     /* Set up inbound IPsec associations */
     HIP_IFEL(hip_userspace_ipsec_add_sa(ctx->src_addr,
                                         ctx->dst_addr,
-                                        &ctx->input_msg->hits,
-                                        &ctx->input_msg->hitr,
+                                        ctx->input_msg->hits,
+                                        ctx->input_msg->hitr,
                                         ctx->hadb_entry->spi_inbound_current,
                                         ctx->hadb_entry->esp_transform,
                                         &ctx->hadb_entry->esp_in,
@@ -231,8 +231,8 @@
     /* Set up outbound IPsec associations */
     HIP_IFEL(hip_userspace_ipsec_add_sa(ctx->dst_addr,
                                         ctx->src_addr,
-                                        &ctx->input_msg->hitr,
-                                        &ctx->input_msg->hits,
+                                        ctx->input_msg->hitr,
+                                        ctx->input_msg->hits,
                                         ctx->hadb_entry->spi_outbound_current,
                                         ctx->hadb_entry->esp_transform,
                                         &ctx->hadb_entry->esp_out,

=== modified file 'modules/user_ipsec/hipd/user_ipsec_sadb_api.h'
--- modules/user_ipsec/hipd/user_ipsec_sadb_api.h       2010-11-09 16:37:54 
+0000
+++ modules/user_ipsec/hipd/user_ipsec_sadb_api.h       2010-11-09 21:44:54 
+0000
@@ -39,10 +39,10 @@
 #include "lib/core/builder.h"
 #include "lib/core/common.h"
 
-int hip_userspace_ipsec_add_sa(const struct in6_addr *saddr,
-                               const struct in6_addr *daddr,
-                               const struct in6_addr *src_hit,
-                               const struct in6_addr *dst_hit,
+int hip_userspace_ipsec_add_sa(const struct in6_addr saddr,
+                               const struct in6_addr daddr,
+                               const struct in6_addr src_hit,
+                               const struct in6_addr dst_hit,
                                const uint32_t spi,
                                const int ealg,
                                const struct hip_crypto_key *enckey,

Other related posts:

  • » [hipl-dev] [Branch ~rene-hummen/hipl/ipsec_esp] Rev 4941: removed a lot of unnecessary usage of pointer in function arguments - noreply