aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-08-25 11:50:54 +0000
committerChristian Grothoff <christian@grothoff.org>2016-08-25 11:50:54 +0000
commit182fae1b29eafe14018d45beb9613725651a779c (patch)
treeaed3313a9adbf763a658266741f363da8b846fa3 /src/exit
parent6b13a87d2165669c5b0f4a16b4c599d9cf0ac1db (diff)
downloadgnunet-182fae1b29eafe14018d45beb9613725651a779c.tar.gz
gnunet-182fae1b29eafe14018d45beb9613725651a779c.zip
-fix indent
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c68
1 files changed, 44 insertions, 24 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index e555e8638..aa96583c0 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -166,6 +166,7 @@ struct LocalService
166 166
167}; 167};
168 168
169
169/** 170/**
170 * Information we use to track a connection (the classical 6-tuple of 171 * Information we use to track a connection (the classical 6-tuple of
171 * IP-version, protocol, source-IP, destination-IP, source-port and 172 * IP-version, protocol, source-IP, destination-IP, source-port and
@@ -629,7 +630,7 @@ receive_dns_request (void *cls GNUNET_UNUSED,
629 630
630/** 631/**
631 * Given IP information about a connection, calculate the respective 632 * Given IP information about a connection, calculate the respective
632 * hash we would use for the 'connections_map'. 633 * hash we would use for the #connections_map.
633 * 634 *
634 * @param hash resulting hash 635 * @param hash resulting hash
635 * @param ri information about the connection 636 * @param ri information about the connection
@@ -742,10 +743,12 @@ get_redirect_state (int af,
742 ri.local_address.address.ipv6 = * ((struct in6_addr*) local_ip); 743 ri.local_address.address.ipv6 = * ((struct in6_addr*) local_ip);
743 ri.local_address.port = local_port; 744 ri.local_address.port = local_port;
744 ri.local_address.proto = protocol; 745 ri.local_address.proto = protocol;
745 hash_redirect_info (&key, &ri); 746 hash_redirect_info (&key,
747 &ri);
746 if (NULL != state_key) 748 if (NULL != state_key)
747 *state_key = key; 749 *state_key = key;
748 state = GNUNET_CONTAINER_multihashmap_get (connections_map, &key); 750 state = GNUNET_CONTAINER_multihashmap_get (connections_map,
751 &key);
749 if (NULL == state) 752 if (NULL == state)
750 return NULL; 753 return NULL;
751 /* Mark this connection as freshly used */ 754 /* Mark this connection as freshly used */
@@ -1079,19 +1082,26 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1079 switch (protocol) 1082 switch (protocol)
1080 { 1083 {
1081 case IPPROTO_ICMP: 1084 case IPPROTO_ICMP:
1082 state = get_redirect_state (af, IPPROTO_ICMP, 1085 state = get_redirect_state (af,
1083 source_ip, 0, 1086 IPPROTO_ICMP,
1084 destination_ip, 0, 1087 source_ip,
1088 0,
1089 destination_ip,
1090 0,
1085 NULL); 1091 NULL);
1086 break; 1092 break;
1087 case IPPROTO_ICMPV6: 1093 case IPPROTO_ICMPV6:
1088 state = get_redirect_state (af, IPPROTO_ICMPV6, 1094 state = get_redirect_state (af,
1089 source_ip, 0, 1095 IPPROTO_ICMPV6,
1090 destination_ip, 0, 1096 source_ip,
1097 0,
1098 destination_ip,
1099 0,
1091 NULL); 1100 NULL);
1092 break; 1101 break;
1093 case IPPROTO_UDP: 1102 case IPPROTO_UDP:
1094 state = get_redirect_state (af, IPPROTO_UDP, 1103 state = get_redirect_state (af,
1104 IPPROTO_UDP,
1095 source_ip, 1105 source_ip,
1096 source_port, 1106 source_port,
1097 destination_ip, 1107 destination_ip,
@@ -1099,7 +1109,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1099 NULL); 1109 NULL);
1100 break; 1110 break;
1101 case IPPROTO_TCP: 1111 case IPPROTO_TCP:
1102 state = get_redirect_state (af, IPPROTO_TCP, 1112 state = get_redirect_state (af,
1113 IPPROTO_TCP,
1103 source_ip, 1114 source_ip,
1104 source_port, 1115 source_port,
1105 destination_ip, 1116 destination_ip,
@@ -1109,7 +1120,8 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1109 default: 1120 default:
1110 GNUNET_STATISTICS_update (stats, 1121 GNUNET_STATISTICS_update (stats,
1111 gettext_noop ("# ICMP packets dropped (not allowed)"), 1122 gettext_noop ("# ICMP packets dropped (not allowed)"),
1112 1, GNUNET_NO); 1123 1,
1124 GNUNET_NO);
1113 return; 1125 return;
1114 } 1126 }
1115 if (NULL == state) 1127 if (NULL == state)
@@ -1182,7 +1194,8 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1182 GNUNET_break (0); 1194 GNUNET_break (0);
1183 return; 1195 return;
1184 } 1196 }
1185 state = get_redirect_state (af, IPPROTO_UDP, 1197 state = get_redirect_state (af,
1198 IPPROTO_UDP,
1186 source_ip, 1199 source_ip,
1187 ntohs (udp->source_port), 1200 ntohs (udp->source_port),
1188 destination_ip, 1201 destination_ip,
@@ -1256,7 +1269,8 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1256 GNUNET_break (0); 1269 GNUNET_break (0);
1257 return; 1270 return;
1258 } 1271 }
1259 state = get_redirect_state (af, IPPROTO_TCP, 1272 state = get_redirect_state (af,
1273 IPPROTO_TCP,
1260 source_ip, 1274 source_ip,
1261 ntohs (tcp->source_port), 1275 ntohs (tcp->source_port),
1262 destination_ip, 1276 destination_ip,
@@ -1585,20 +1599,22 @@ setup_state_record (struct ChannelState *state)
1585 setup_fresh_address (state->specifics.tcp_udp.serv->address.af, 1599 setup_fresh_address (state->specifics.tcp_udp.serv->address.af,
1586 state->specifics.tcp_udp.serv->address.proto, 1600 state->specifics.tcp_udp.serv->address.proto,
1587 &state->specifics.tcp_udp.ri.local_address); 1601 &state->specifics.tcp_udp.ri.local_address);
1588 } while (NULL != get_redirect_state (state->specifics.tcp_udp.ri.remote_address.af, 1602 } while (NULL !=
1589 state->specifics.tcp_udp.ri.remote_address.proto, 1603 get_redirect_state (state->specifics.tcp_udp.ri.remote_address.af,
1590 &state->specifics.tcp_udp.ri.remote_address.address, 1604 state->specifics.tcp_udp.ri.remote_address.proto,
1591 state->specifics.tcp_udp.ri.remote_address.port, 1605 &state->specifics.tcp_udp.ri.remote_address.address,
1592 &state->specifics.tcp_udp.ri.local_address.address, 1606 state->specifics.tcp_udp.ri.remote_address.port,
1593 state->specifics.tcp_udp.ri.local_address.port, 1607 &state->specifics.tcp_udp.ri.local_address.address,
1594 &key)); 1608 state->specifics.tcp_udp.ri.local_address.port,
1609 &key));
1595 { 1610 {
1596 char buf[INET6_ADDRSTRLEN]; 1611 char buf[INET6_ADDRSTRLEN];
1597 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1598 "Picked local address %s:%u for new connection\n", 1613 "Picked local address %s:%u for new connection\n",
1599 inet_ntop (state->specifics.tcp_udp.ri.local_address.af, 1614 inet_ntop (state->specifics.tcp_udp.ri.local_address.af,
1600 &state->specifics.tcp_udp.ri.local_address.address, 1615 &state->specifics.tcp_udp.ri.local_address.address,
1601 buf, sizeof (buf)), 1616 buf,
1617 sizeof (buf)),
1602 (unsigned int) state->specifics.tcp_udp.ri.local_address.port); 1618 (unsigned int) state->specifics.tcp_udp.ri.local_address.port);
1603 } 1619 }
1604 state->specifics.tcp_udp.state_key = key; 1620 state->specifics.tcp_udp.state_key = key;
@@ -1790,7 +1806,9 @@ prepare_ipv6_packet (const void *payload,
1790 pkt6_udp, 1806 pkt6_udp,
1791 payload, 1807 payload,
1792 payload_length); 1808 payload_length);
1793 GNUNET_memcpy (&pkt6_udp[1], payload, payload_length); 1809 GNUNET_memcpy (&pkt6_udp[1],
1810 payload,
1811 payload_length);
1794 } 1812 }
1795 break; 1813 break;
1796 case IPPROTO_TCP: 1814 case IPPROTO_TCP:
@@ -1805,7 +1823,9 @@ prepare_ipv6_packet (const void *payload,
1805 pkt6_tcp, 1823 pkt6_tcp,
1806 payload, 1824 payload,
1807 payload_length); 1825 payload_length);
1808 GNUNET_memcpy (&pkt6_tcp[1], payload, payload_length); 1826 GNUNET_memcpy (&pkt6_tcp[1],
1827 payload,
1828 payload_length);
1809 } 1829 }
1810 break; 1830 break;
1811 default: 1831 default: