← Back to team overview

hipl-core team mailing list archive

[Branch ~hipl-core/hipl/trunk] Rev 4927: Removed superfluous typedef. Some const, cosmetic and doc changes.

 

Merge authors:
  Christof Mroz (christof-mroz)
------------------------------------------------------------
revno: 4927 [merge]
committer: Christof Mroz <christof.mroz@xxxxxxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-09-13 15:59:36 +0200
message:
  Removed superfluous typedef. Some const, cosmetic and doc changes.
modified:
  firewall/cache_port.c
  firewall/cache_port.h
  firewall/conntrack.c
  firewall/firewall.c
  firewall/lsi.c
  firewall/rule_management.h
  lib/core/icomm.h


--
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/cache_port.c'
--- firewall/cache_port.c	2010-07-29 08:51:54 +0000
+++ firewall/cache_port.c	2010-09-09 00:54:32 +0000
@@ -153,11 +153,11 @@
  */
 static int hip_port_cache_add_new_entry(const char *key, int value)
 {
-    firewall_port_cache_hl_t *new_entry = NULL;
+    struct firewall_port_cache_hl *new_entry = NULL;
     int err = 0;
 
     HIP_DEBUG("\n");
-    new_entry = (firewall_port_cache_hl_t *) (hip_cache_create_hl_entry());
+    new_entry = (struct firewall_port_cache_hl *) (hip_cache_create_hl_entry());
     memcpy(new_entry->port_and_protocol, key, strlen(key));
     new_entry->traffic_type = value;
     hip_ht_add(firewall_port_cache_db, new_entry);
@@ -173,10 +173,10 @@
  *
  * @return the cache entry if found or NULL otherwise
  */
-firewall_port_cache_hl_t *hip_firewall_port_cache_db_match(in_port_t port,
+struct firewall_port_cache_hl *hip_firewall_port_cache_db_match(in_port_t port,
                                                            int proto)
 {
-    firewall_port_cache_hl_t *found_entry = NULL;
+    struct firewall_port_cache_hl *found_entry = NULL;
     char key[FIREWALL_PORT_CACHE_KEY_LENGTH];
     char protocol[10], proto_for_bind[10];
     int bindto = FIREWALL_PORT_CACHE_IPV4_TRAFFIC; //3 - default to ipv4, non-LSI traffic
@@ -238,7 +238,7 @@
     uint8_t hash[HIP_AH_SHA_LEN];
 
     key = (const char *)
-          &((const firewall_port_cache_hl_t *) ptr)->port_and_protocol;
+          &((const struct firewall_port_cache_hl *) ptr)->port_and_protocol;
     hip_build_digest(HIP_DIGEST_SHA1, key, sizeof(*key), hash);
     return *((unsigned long *) hash);
 }
@@ -273,9 +273,9 @@
 void hip_firewall_port_cache_uninit_hldb(void)
 {
     int i;
-    firewall_port_cache_hl_t *this = NULL;
-    hip_list_t *item               = NULL;
-    hip_list_t *tmp                = NULL;
+    struct firewall_port_cache_hl *this = NULL;
+    hip_list_t *item                    = NULL;
+    hip_list_t *tmp                     = NULL;
 
     HIP_DEBUG("Start hldb delete\n");
     HIP_LOCK_HT(&firewall_port_cache_db);
@@ -283,7 +283,7 @@
     list_for_each_safe(item, tmp, firewall_port_cache_db, i)
     {
       HIP_DEBUG("xx\n");
-        this = (firewall_port_cache_hl_t *) list_entry(item);
+        this = (struct firewall_port_cache_hl *) list_entry(item);
         hip_ht_delete(firewall_port_cache_db, this);
         free(this);
       HIP_DEBUG("yy\n");

=== modified file 'firewall/cache_port.h'
--- firewall/cache_port.h	2010-07-04 17:54:18 +0000
+++ firewall/cache_port.h	2010-09-09 00:54:32 +0000
@@ -33,7 +33,7 @@
 #include "lib/core/icomm.h"
 
 void hip_firewall_port_cache_init_hldb(void);
-firewall_port_cache_hl_t *hip_firewall_port_cache_db_match(in_port_t port,
+struct firewall_port_cache_hl *hip_firewall_port_cache_db_match(in_port_t port,
                                                            int proto);
 void hip_firewall_port_cache_uninit_hldb(void);
 

=== modified file 'firewall/conntrack.c'
--- firewall/conntrack.c	2010-09-06 11:51:23 +0000
+++ firewall/conntrack.c	2010-09-09 00:54:32 +0000
@@ -577,10 +577,9 @@
             list              = tuple->esp_tuples;
         }
         tuple->esp_tuples = NULL;
-
         tuple->connection = NULL;
+
         // tuple was not malloced -> no free here
-
         if (tuple->src_ip) {
             free(tuple->src_ip);
             tuple->src_ip = NULL;
@@ -853,13 +852,10 @@
 
     /* Store Responder's IP address and port */
     tuple->esp_relay = 1;
-    ipv6_addr_copy(&tuple->esp_relay_daddr,
-                   &ctx->src);
+    ipv6_addr_copy(&tuple->esp_relay_daddr, &ctx->src);
     tuple->esp_relay_dport = tuple->dst_port;
-    HIP_DEBUG("tuple relay port=%d\n",
-              tuple->esp_relay_dport);
-    HIP_DEBUG_IN6ADDR("tuple relay ip",
-                      &tuple->esp_relay_daddr);
+    HIP_DEBUG("tuple relay port=%d\n", tuple->esp_relay_dport);
+    HIP_DEBUG_IN6ADDR("tuple relay ip", &tuple->esp_relay_daddr);
 
     /* Store Initiator's IP address and port */
     reverse_tuple->esp_relay = 1;
@@ -961,10 +957,10 @@
                      const hip_fw_context_t *ctx)
 {
     const struct hip_esp_info *spi    = NULL;
+    const SList *other_dir_esps       = NULL;
+    const struct hip_host_id *host_id = NULL;
     struct tuple *other_dir           = NULL;
     struct esp_tuple *esp_tuple       = NULL;
-    SList *other_dir_esps             = NULL;
-    const struct hip_host_id *host_id = NULL;
     struct in6_addr hit;
     // assume correct packet
     int err                     = 1;

=== modified file 'firewall/firewall.c'
--- firewall/firewall.c	2010-08-30 08:28:41 +0000
+++ firewall/firewall.c	2010-09-09 00:54:32 +0000
@@ -1308,8 +1308,8 @@
 }
 
 /**
- * Process an other (not HIP, ESP, TCP) packet from the inbound packet capture
- * queue
+ * Process another (not HIP, ESP, TCP) packet from the inbound packet
+ * capture queue. May result in LSI or SysOPP Transformation.
  *
  * @param ctx the packet context
  *
@@ -1486,7 +1486,7 @@
  *
  * @param  ctx        the context.
  * @param  buf        a pointer to a IP packet.
- * @param ip_version  the IP version for this packet
+ * @param  ip_version the IP version for this packet
  * @return            One if @c hdr is a HIP packet, zero otherwise.
  */
 static int hip_fw_init_context(hip_fw_context_t *ctx,
@@ -1925,6 +1925,7 @@
  *
  * @return zero on success and non-zero on failure
  *
+ * @todo   Set up atexit() for clean shutdown on HIP_ASSERT.
  */
 int main(int argc, char **argv)
 {

=== modified file 'firewall/lsi.c'
--- firewall/lsi.c	2010-08-20 14:34:13 +0000
+++ firewall/lsi.c	2010-09-09 00:54:32 +0000
@@ -311,16 +311,16 @@
                                const struct in6_addr *ip_dst,
                                const int lsi_support)
 {
-    int err                                    = 0;
-    int verdict                                = 1;
-    int ip_hdr_size                            = 0;
-    int portDest                               = 0;
-    int process_as_lsi                         = 0;
+    int err                                               = 0;
+    int verdict                                           = 1;
+    int ip_hdr_size                                       = 0;
+    int portDest                                          = 0;
+    int process_as_lsi                                    = 0;
+    fw_cache_hl_t *entry                                  = NULL;
+    const struct firewall_port_cache_hl *port_cache_entry = NULL;
+    const struct ip6_hdr *ip6_hdr                         = NULL;
     char proto[PROTO_STRING_MAX];
     struct in6_addr src_addr, dst_addr;
-    const struct ip6_hdr *ip6_hdr;
-    firewall_port_cache_hl_t *port_cache_entry = NULL;
-    fw_cache_hl_t *entry                       = NULL;
 
     ip6_hdr = (const struct ip6_hdr *) m->payload;
     ip_hdr_size = sizeof(struct ip6_hdr);
@@ -348,7 +348,8 @@
 
     if (port_cache_entry &&
         (port_cache_entry->traffic_type ==
-         FIREWALL_PORT_CACHE_IPV6_TRAFFIC)) {
+         FIREWALL_PORT_CACHE_IPV6_TRAFFIC))
+    {
         verdict = 1;
         HIP_DEBUG("Cached port, accepting\n");
         goto out_err;

=== modified file 'firewall/rule_management.h'
--- firewall/rule_management.h	2010-07-04 17:54:18 +0000
+++ firewall/rule_management.h	2010-09-09 00:54:32 +0000
@@ -50,14 +50,14 @@
 };
 
 struct int_option {
-    int value; //int value
-    int boolean; // 0 if negation, else 1
+    int value;   /**< int value */
+    int boolean; /**< 0 if negation, else 1 */
 };
 
 struct state_option {
     struct int_option int_opt;
-    int verify_responder; //1 if responder signatures are verified
-    int accept_mobile; //1 if state can be established from updates signalling
+    int verify_responder; /**< 1 if responder signatures are verified */
+    int accept_mobile;    /**< 1 if state can be established from updates signalling */
     int decrypt_contents;
 };
 
@@ -68,10 +68,10 @@
     int boolean;
 };
 
-//Pointer values must be NULL if option is not specified.
-//Use alloc_empty_rule() to allocate rule with pointers set to NULL!!
-//when updating rule structure, update also (at least) free_rule(),
-//print_rule(), rules_equal(), copy_rule (), alloc_empty_rule() functions
+// Pointer values must be NULL if option is not specified.
+// Use alloc_empty_rule() to allocate rule with pointers set to NULL!!
+// when updating rule structure, update also (at least) free_rule(),
+// print_rule(), rules_equal(), copy_rule (), alloc_empty_rule() functions
 struct rule {
     struct hit_option *src_hit;
     struct hit_option *dst_hit;

=== modified file 'lib/core/icomm.h'
--- lib/core/icomm.h	2010-08-25 09:06:43 +0000
+++ lib/core/icomm.h	2010-09-09 00:54:32 +0000
@@ -212,6 +212,5 @@
     char port_and_protocol[FIREWALL_PORT_CACHE_KEY_LENGTH];     //key
     int  traffic_type;                                          //value
 };
-typedef struct firewall_port_cache_hl firewall_port_cache_hl_t;
 
 #endif /* HIP_LIB_CORE_ICOMM_H */


Follow ups