From 5746309cb4be2073d550ad7a6885e918631dbc38 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 15 Aug 2011 21:54:06 +0000 Subject: indentation --- src/nat/gnunet-helper-nat-client.c | 55 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'src/nat/gnunet-helper-nat-client.c') diff --git a/src/nat/gnunet-helper-nat-client.c b/src/nat/gnunet-helper-nat-client.c index 76f405bf1..fbebdbc0f 100644 --- a/src/nat/gnunet-helper-nat-client.c +++ b/src/nat/gnunet-helper-nat-client.c @@ -235,8 +235,8 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) ip_pkt.checksum = 0; ip_pkt.src_ip = my_ip->s_addr; ip_pkt.dst_ip = other->s_addr; - ip_pkt.checksum = htons (calc_checksum ((uint16_t *) & ip_pkt, - sizeof (struct ip_header))); + ip_pkt.checksum = + htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); off += sizeof (struct ip_header); @@ -250,8 +250,8 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) /* ip header of the presumably 'lost' udp packet */ ip_pkt.vers_ihl = 0x45; ip_pkt.tos = 0; - ip_pkt.pkt_len = htons (sizeof (struct ip_header) + - sizeof (struct udp_header)); + ip_pkt.pkt_len = + htons (sizeof (struct ip_header) + sizeof (struct udp_header)); ip_pkt.id = htons (0); ip_pkt.flags_frag_offset = 0; ip_pkt.ttl = 128; @@ -259,8 +259,8 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) ip_pkt.checksum = 0; ip_pkt.src_ip = other->s_addr; ip_pkt.dst_ip = dummy.s_addr; - ip_pkt.checksum = htons (calc_checksum ((uint16_t *) & ip_pkt, - sizeof (struct ip_header))); + ip_pkt.checksum = + htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); off += sizeof (struct ip_header); @@ -287,9 +287,9 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) dst.sin_len = sizeof (struct sockaddr_in); #endif dst.sin_addr = *other; - err = sendto (rawsock, - packet, - sizeof (packet), 0, (struct sockaddr *) &dst, sizeof (dst)); + err = + sendto (rawsock, packet, sizeof (packet), 0, (struct sockaddr *) &dst, + sizeof (dst)); if (err < 0) { fprintf (stderr, "sendto failed: %s\n", strerror (errno)); @@ -332,8 +332,8 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) ip_pkt.checksum = 0; ip_pkt.src_ip = my_ip->s_addr; ip_pkt.dst_ip = other->s_addr; - ip_pkt.checksum = htons (calc_checksum ((uint16_t *) & ip_pkt, - sizeof (struct ip_header))); + ip_pkt.checksum = + htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); off = sizeof (ip_pkt); @@ -357,8 +357,8 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) ip_pkt.src_ip = other->s_addr; ip_pkt.dst_ip = dummy.s_addr; ip_pkt.checksum = 0; - ip_pkt.checksum = htons (calc_checksum ((uint16_t *) & ip_pkt, - sizeof (struct ip_header))); + ip_pkt.checksum = + htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); off += sizeof (struct ip_header); @@ -366,17 +366,18 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) icmp_echo.code = 0; icmp_echo.reserved = htonl (port); icmp_echo.checksum = 0; - icmp_echo.checksum = htons (calc_checksum ((uint16_t *) & icmp_echo, - sizeof (struct icmp_echo_header))); + icmp_echo.checksum = + htons (calc_checksum + ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header))); memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header)); /* no go back to calculate ICMP packet checksum */ off = sizeof (struct ip_header); - icmp_ttl.checksum = htons (calc_checksum ((uint16_t *) & packet[off], - sizeof (struct - icmp_ttl_exceeded_header) + - sizeof (struct ip_header) + - sizeof (struct icmp_echo_header))); + icmp_ttl.checksum = + htons (calc_checksum + ((uint16_t *) & packet[off], + sizeof (struct icmp_ttl_exceeded_header) + + sizeof (struct ip_header) + sizeof (struct icmp_echo_header))); memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); /* prepare for transmission */ @@ -386,9 +387,9 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) dst.sin_len = sizeof (struct sockaddr_in); #endif dst.sin_addr = *other; - err = sendto (rawsock, - packet, - sizeof (packet), 0, (struct sockaddr *) &dst, sizeof (dst)); + err = + sendto (rawsock, packet, sizeof (packet), 0, (struct sockaddr *) &dst, + sizeof (dst)); if (err < 0) { fprintf (stderr, "sendto failed: %s\n", strerror (errno)); @@ -417,15 +418,15 @@ make_raw_socket () fprintf (stderr, "Error opening RAW socket: %s\n", strerror (errno)); return -1; } - if (0 != setsockopt (ret, SOL_SOCKET, SO_BROADCAST, - (char *) &one, sizeof (one))) + if (0 != + setsockopt (ret, SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof (one))) { fprintf (stderr, "setsockopt failed: %s\n", strerror (errno)); close (ret); return -1; } - if (0 != setsockopt (ret, IPPROTO_IP, IP_HDRINCL, - (char *) &one, sizeof (one))) + if (0 != + setsockopt (ret, IPPROTO_IP, IP_HDRINCL, (char *) &one, sizeof (one))) { fprintf (stderr, "setsockopt failed: %s\n", strerror (errno)); close (ret); -- cgit v1.2.3