← Back to team overview

hipl-core team mailing list archive

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

 

On Aug 25, 2010, at 6:50 PM, noreply@xxxxxxxxxxxxx wrote:
> Merge authors:
>  Christoph Viethen <viethen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
> ------------------------------------------------------------
> revno: 4915 [merge]
> committer: Christof Mroz <christof.mroz@xxxxxxxxxxxxxx>
> branch nick: trunk
> timestamp: Wed 2010-08-25 18:46:44 +0200
> message:
>  More verbose debug messages.
> modified:
>  firewall/firewall.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/firewall.c'
> --- firewall/firewall.c	2010-08-25 09:06:43 +0000
> +++ firewall/firewall.c	2010-08-25 16:46:44 +0000
> @@ -1189,9 +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);

Miss-aligned.

> -    HIP_DEBUG("\n");
> +    int verdict = accept_normal_traffic_by_default;

It's good practice to first declare variables used in a function and to then add the remaining code afterwards.

>     if (ctx->ip_version == 6 && hip_userspace_ipsec) {
> 
> @@ -1565,9 +1566,13 @@
>             // 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 = (struct tcphdr *)
> -                    (((char *) iphdr) + ip_hdr_len);
> +            ctx->transport_hdr.tcp = tcphdr;
> +

Unrelated and unnecessary change.

> +            HIP_DEBUG("src port: %u\n", ntohs(tcphdr->source));
> +            HIP_DEBUG("dst port: %u\n", ntohs(tcphdr->dest));
> 
>             goto end_init;
>         } else if (iphdr->ip_p != IPPROTO_UDP) {
> @@ -1631,9 +1636,13 @@
>             // this might be a TCP packet for opportunistic mode
>             HIP_DEBUG("plain TCP packet\n");
> 
> +            struct tcphdr *tcphdr = (struct tcphdr *)
> +                    (((char *) ip6_hdr) + sizeof(struct ip6_hdr));
>             ctx->packet_type       = TCP_PACKET;
> -            ctx->transport_hdr.tcp = (struct tcphdr *)
> -                    (((char *) ip6_hdr) + sizeof(struct ip6_hdr));
> +            ctx->transport_hdr.tcp = tcphdr;
> +

See above.

> +            HIP_DEBUG("src port: %u\n", ntohs(tcphdr->source));
> +            HIP_DEBUG("dst port: %u\n", ntohs(tcphdr->dest));
> 
>             goto end_init;
>         } else if (ip6_hdr->ip6_nxt != IPPROTO_UDP) {
> @@ -1657,9 +1666,15 @@
> 
>         // add udp header to context
>         ctx->udp_encap_hdr = udphdr;
> +    } else {
> +        HIP_DEBUG("neither ipv4 nor ipv6\n");
> +        goto end_init;
>     }
> 
> -    HIP_DEBUG("UDP header size  is %d\n", sizeof(struct udphdr));
> +    HIP_DEBUG("UDP header size  is %d (in header: %u) \n",
> +        sizeof(struct udphdr), udphdr->len);

Miss-aligned.

> +    HIP_DEBUG("UDP src port: %u\n", ntohs(udphdr->source));
> +    HIP_DEBUG("UDP dst port: %u\n", ntohs(udphdr->dest));
> 
>     /* only handle IPv4 right now
>      * -> however this is the place to handle UDP encapsulated IPv6 */
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~hipl-core
> Post to     : hipl-core@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~hipl-core
> More help   : https://help.launchpad.net/ListHelp




--
Dipl.-Inform. Rene Hummen, Ph.D. Student
Distributed Systems Group
RWTH Aachen University, Germany
tel: +49 241 80 20772
web: http://ds.rwth-aachen.de/members/hummen




Follow ups

References