← Back to team overview

hipl-core team mailing list archive

Re: [Branch ~hipl-core/hipl/trunk] Rev 4915: More verbose debug messages.

 

On Sat, 28 Aug 2010 15:49:21 +0200, Diego Biurrun <diego@xxxxxxxxxx> wrote:

OK; it's 8 spaces, right?

No, you should indent smartly, not mechanically.  It should be described
in the HACKING files of both PISA and HIPL.  Have you read them?

Yes but obviously not thoroughly enough :) didn't notice there's a distinction between assignments and function calls regarding indention.

Did I get it right this time?

=== modified file 'firewall/firewall.c'
--- firewall/firewall.c 2010-08-25 16:46:44 +0000
+++ firewall/firewall.c 2010-08-28 16:17:38 +0000
@@ -1189,10 +1189,10 @@
  */
 static int hip_fw_handle_other_output(hip_fw_context_t *ctx)
 {
+    int verdict = accept_normal_traffic_by_default;
+
     HIP_DEBUG("accept_normal_traffic_by_default = %d\n",
-        accept_normal_traffic_by_default);
-
-    int verdict = accept_normal_traffic_by_default;
+              accept_normal_traffic_by_default);

     if (ctx->ip_version == 6 && hip_userspace_ipsec) {

@@ -1566,13 +1566,12 @@
             // this might be a TCP packet for opportunistic mode
             HIP_DEBUG("plain TCP packet\n");

-            struct tcphdr *tcphdr = (struct tcphdr*)
-                (((char *) iphdr) + ip_hdr_len);
             ctx->packet_type       = TCP_PACKET;
-            ctx->transport_hdr.tcp = tcphdr;
+            ctx->transport_hdr.tcp = (struct tcphdr*)
+                    (((char *) iphdr) + ip_hdr_len);

-            HIP_DEBUG("src port: %u\n", ntohs(tcphdr->source));
-            HIP_DEBUG("dst port: %u\n", ntohs(tcphdr->dest));
+ HIP_DEBUG("src port: %u\n", ntohs(ctx->transport_hdr.tcp->source)); + HIP_DEBUG("dst port: %u\n", ntohs(ctx->transport_hdr.tcp->dest));

             goto end_init;
         } else if (iphdr->ip_p != IPPROTO_UDP) {
@@ -1636,13 +1635,12 @@
             // this might be a TCP packet for opportunistic mode
             HIP_DEBUG("plain TCP packet\n");

-            struct tcphdr *tcphdr = (struct tcphdr *)
+            ctx->packet_type       = TCP_PACKET;
+            ctx->transport_hdr.tcp = (struct tcphdr*)
                     (((char *) ip6_hdr) + sizeof(struct ip6_hdr));
-            ctx->packet_type       = TCP_PACKET;
-            ctx->transport_hdr.tcp = tcphdr;

-            HIP_DEBUG("src port: %u\n", ntohs(tcphdr->source));
-            HIP_DEBUG("dst port: %u\n", ntohs(tcphdr->dest));
+ HIP_DEBUG("src port: %u\n", ntohs(ctx->transport_hdr.tcp->source)); + HIP_DEBUG("dst port: %u\n", ntohs(ctx->transport_hdr.tcp->dest));

             goto end_init;
         } else if (ip6_hdr->ip6_nxt != IPPROTO_UDP) {
@@ -1672,7 +1670,7 @@
     }

     HIP_DEBUG("UDP header size  is %d (in header: %u) \n",
-        sizeof(struct udphdr), udphdr->len);
+              sizeof(struct udphdr), ntohs(udphdr->len));
     HIP_DEBUG("UDP src port: %u\n", ntohs(udphdr->source));
     HIP_DEBUG("UDP dst port: %u\n", ntohs(udphdr->dest));



Follow ups

References