aboutsummaryrefslogtreecommitdiff
path: root/src/tun
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
commit61c39c60565b386e0e12ea669556b030e8cd7180 (patch)
tree59109aeab8297bdc996faca8c4e38ec7426c36cf /src/tun
parent780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff)
downloadgnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz
gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip
-remove trailing whitespace
Diffstat (limited to 'src/tun')
-rw-r--r--src/tun/regex.c10
-rw-r--r--src/tun/test_tun.c2
-rw-r--r--src/tun/tun.c22
3 files changed, 17 insertions, 17 deletions
diff --git a/src/tun/regex.c b/src/tun/regex.c
index 61d0b3e18..87e75b511 100644
--- a/src/tun/regex.c
+++ b/src/tun/regex.c
@@ -40,13 +40,13 @@ static void
40iptobinstr (const int af, const void *addr, char *str) 40iptobinstr (const int af, const void *addr, char *str)
41{ 41{
42 int i; 42 int i;
43 43
44 switch (af) 44 switch (af)
45 { 45 {
46 case AF_INET: 46 case AF_INET:
47 { 47 {
48 uint32_t b = htonl (((struct in_addr *) addr)->s_addr); 48 uint32_t b = htonl (((struct in_addr *) addr)->s_addr);
49 49
50 str[32] = '\0'; 50 str[32] = '\0';
51 str += 31; 51 str += 31;
52 for (i = 31; i >= 0; i--) 52 for (i = 31; i >= 0; i--)
@@ -60,7 +60,7 @@ iptobinstr (const int af, const void *addr, char *str)
60 case AF_INET6: 60 case AF_INET6:
61 { 61 {
62 struct in6_addr b = *(const struct in6_addr *) addr; 62 struct in6_addr b = *(const struct in6_addr *) addr;
63 63
64 str[128] = '\0'; 64 str[128] = '\0';
65 str += 127; 65 str += 127;
66 for (i = 127; i >= 0; i--) 66 for (i = 127; i >= 0; i--)
@@ -88,7 +88,7 @@ ipv4netmasktoprefixlen (const char *netmask)
88 struct in_addr a; 88 struct in_addr a;
89 unsigned int len; 89 unsigned int len;
90 uint32_t t; 90 uint32_t t;
91 91
92 if (1 != inet_pton (AF_INET, netmask, &a)) 92 if (1 != inet_pton (AF_INET, netmask, &a))
93 return 0; 93 return 0;
94 len = 32; 94 len = 32;
@@ -111,7 +111,7 @@ GNUNET_TUN_ipv4toregexsearch (const struct in_addr *ip, const char *netmask,
111 char *rxstr) 111 char *rxstr)
112{ 112{
113 unsigned int pfxlen; 113 unsigned int pfxlen;
114 114
115 pfxlen = ipv4netmasktoprefixlen (netmask); 115 pfxlen = ipv4netmasktoprefixlen (netmask);
116 iptobinstr (AF_INET, ip, rxstr); 116 iptobinstr (AF_INET, ip, rxstr);
117 rxstr[pfxlen] = '\0'; 117 rxstr[pfxlen] = '\0';
diff --git a/src/tun/test_tun.c b/src/tun/test_tun.c
index 3539fd177..71737d8f0 100644
--- a/src/tun/test_tun.c
+++ b/src/tun/test_tun.c
@@ -56,7 +56,7 @@ test_udp (size_t pll,
56 pll); 56 pll);
57 if (crc != ntohs (udp.crc)) 57 if (crc != ntohs (udp.crc))
58 { 58 {
59 fprintf (stderr, "Got CRC: %u, wanted: %u\n", 59 fprintf (stderr, "Got CRC: %u, wanted: %u\n",
60 ntohs (udp.crc), 60 ntohs (udp.crc),
61 crc); 61 crc);
62 ret = 1; 62 ret = 1;
diff --git a/src/tun/tun.c b/src/tun/tun.c
index 3b0e9b94a..ed3aef1c1 100644
--- a/src/tun/tun.c
+++ b/src/tun/tun.c
@@ -55,7 +55,7 @@ GNUNET_TUN_initialize_ipv4_header (struct GNUNET_TUN_IPv4Header *ip,
55 ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4; 55 ip->header_length = sizeof (struct GNUNET_TUN_IPv4Header) / 4;
56 ip->version = 4; 56 ip->version = 4;
57 ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length); 57 ip->total_length = htons (sizeof (struct GNUNET_TUN_IPv4Header) + payload_length);
58 ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 58 ip->identification = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
59 65536); 59 65536);
60 ip->ttl = FRESH_TTL; 60 ip->ttl = FRESH_TTL;
61 ip->protocol = protocol; 61 ip->protocol = protocol;
@@ -89,7 +89,7 @@ GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip,
89 ip->payload_length = htons ((uint16_t) payload_length); 89 ip->payload_length = htons ((uint16_t) payload_length);
90 ip->hop_limit = FRESH_TTL; 90 ip->hop_limit = FRESH_TTL;
91 ip->destination_address = *dst; 91 ip->destination_address = *dst;
92 ip->source_address = *src; 92 ip->source_address = *src;
93} 93}
94 94
95 95
@@ -116,7 +116,7 @@ GNUNET_TUN_calculate_tcp4_checksum (const struct GNUNET_TUN_IPv4Header *ip,
116 GNUNET_assert (IPPROTO_TCP == ip->protocol); 116 GNUNET_assert (IPPROTO_TCP == ip->protocol);
117 117
118 tcp->crc = 0; 118 tcp->crc = 0;
119 sum = GNUNET_CRYPTO_crc16_step (0, 119 sum = GNUNET_CRYPTO_crc16_step (0,
120 &ip->source_address, 120 &ip->source_address,
121 sizeof (struct in_addr) * 2); 121 sizeof (struct in_addr) * 2);
122 tmp = htons (IPPROTO_TCP); 122 tmp = htons (IPPROTO_TCP);
@@ -186,21 +186,21 @@ GNUNET_TUN_calculate_udp4_checksum (const struct GNUNET_TUN_IPv4Header *ip,
186 GNUNET_assert (IPPROTO_UDP == ip->protocol); 186 GNUNET_assert (IPPROTO_UDP == ip->protocol);
187 187
188 udp->crc = 0; /* technically optional, but we calculate it anyway, just to be sure */ 188 udp->crc = 0; /* technically optional, but we calculate it anyway, just to be sure */
189 sum = GNUNET_CRYPTO_crc16_step (0, 189 sum = GNUNET_CRYPTO_crc16_step (0,
190 &ip->source_address, 190 &ip->source_address,
191 sizeof (struct in_addr) * 2); 191 sizeof (struct in_addr) * 2);
192 tmp = htons (IPPROTO_UDP); 192 tmp = htons (IPPROTO_UDP);
193 sum = GNUNET_CRYPTO_crc16_step (sum, 193 sum = GNUNET_CRYPTO_crc16_step (sum,
194 &tmp, 194 &tmp,
195 sizeof (uint16_t)); 195 sizeof (uint16_t));
196 tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length); 196 tmp = htons (sizeof (struct GNUNET_TUN_UdpHeader) + payload_length);
197 sum = GNUNET_CRYPTO_crc16_step (sum, 197 sum = GNUNET_CRYPTO_crc16_step (sum,
198 &tmp, 198 &tmp,
199 sizeof (uint16_t)); 199 sizeof (uint16_t));
200 sum = GNUNET_CRYPTO_crc16_step (sum, 200 sum = GNUNET_CRYPTO_crc16_step (sum,
201 udp, 201 udp,
202 sizeof (struct GNUNET_TUN_UdpHeader)); 202 sizeof (struct GNUNET_TUN_UdpHeader));
203 sum = GNUNET_CRYPTO_crc16_step (sum, 203 sum = GNUNET_CRYPTO_crc16_step (sum,
204 payload, 204 payload,
205 payload_length); 205 payload_length);
206 udp->crc = GNUNET_CRYPTO_crc16_finish (sum); 206 udp->crc = GNUNET_CRYPTO_crc16_finish (sum);