hipl-core team mailing list archive
-
hipl-core team
-
Mailing list archive
-
Message #00096
[Branch ~hipl-core/hipl/trunk] Rev 4919: Fix revision 4915: indentation, add missing ntohs(), remove temporary variables.
------------------------------------------------------------
revno: 4919
committer: Christof Mroz <christof.mroz@xxxxxxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-08-29 16:48:42 +0200
message:
Fix revision 4915: indentation, add missing ntohs(), remove temporary variables.
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 16:46:44 +0000
+++ firewall/firewall.c 2010-08-29 14:48:42 +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));