[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18625 - gnunet/src/nat
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18625 - gnunet/src/nat |
Date: |
Fri, 16 Dec 2011 12:19:15 +0100 |
Author: grothoff
Date: 2011-12-16 12:19:15 +0100 (Fri, 16 Dec 2011)
New Revision: 18625
Modified:
gnunet/src/nat/gnunet-helper-nat-client.c
gnunet/src/nat/gnunet-helper-nat-server.c
Log:
additional stylistic changes to gnunet-helper-nat-client anticipating next
round of suggestions from Jacob Applebaum
Modified: gnunet/src/nat/gnunet-helper-nat-client.c
===================================================================
--- gnunet/src/nat/gnunet-helper-nat-client.c 2011-12-16 11:16:26 UTC (rev
18624)
+++ gnunet/src/nat/gnunet-helper-nat-client.c 2011-12-16 11:19:15 UTC (rev
18625)
@@ -69,6 +69,11 @@
#define NAT_TRAV_PORT 22225
/**
+ * Must match packet ID used by gnunet-helper-nat-server.c
+ */
+#define PACKET_ID 256
+
+/**
* IPv4 header.
*/
struct ip_header
@@ -228,7 +233,7 @@
ip_pkt.vers_ihl = 0x45;
ip_pkt.tos = 0;
ip_pkt.pkt_len = htons (sizeof (packet));
- ip_pkt.id = htons (256);
+ ip_pkt.id = htons (PACKET_ID);
ip_pkt.flags_frag_offset = 0;
ip_pkt.ttl = 128;
ip_pkt.proto = IPPROTO_ICMP;
@@ -325,7 +330,7 @@
ip_pkt.vers_ihl = 0x45;
ip_pkt.tos = 0;
ip_pkt.pkt_len = htons (sizeof (packet));
- ip_pkt.id = htons (256);
+ ip_pkt.id = htons (PACKET_ID);
ip_pkt.flags_frag_offset = 0;
ip_pkt.ttl = IPDEFTTL;
ip_pkt.proto = IPPROTO_ICMP;
@@ -350,7 +355,7 @@
ip_pkt.tos = 0;
ip_pkt.pkt_len =
htons (sizeof (struct ip_header) + sizeof (struct icmp_echo_header));
- ip_pkt.id = htons (256);
+ ip_pkt.id = htons (PACKET_ID);
ip_pkt.flags_frag_offset = 0;
ip_pkt.ttl = 1; /* real TTL would be 1 on a time exceeded
packet */
ip_pkt.proto = IPPROTO_ICMP;
@@ -470,11 +475,19 @@
if (-1 == (rawsock = make_raw_socket ()))
return 2;
uid = getuid ();
+#ifdef HAVE_SETRESUID
if (0 != setresuid (uid, uid, uid))
{
fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
- /* not critical, continue anyway */
+ return 3;
}
+#else
+ if (0 != (setuid (uid) | seteuid (uid)))
+ {
+ fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
+ return 6;
+ }
+#endif
send_icmp (&external, &target);
send_icmp_udp (&external, &target);
close (rawsock);
Modified: gnunet/src/nat/gnunet-helper-nat-server.c
===================================================================
--- gnunet/src/nat/gnunet-helper-nat-server.c 2011-12-16 11:16:26 UTC (rev
18624)
+++ gnunet/src/nat/gnunet-helper-nat-server.c 2011-12-16 11:19:15 UTC (rev
18625)
@@ -70,6 +70,11 @@
#define VERBOSE 0
/**
+ * Must match packet ID used by gnunet-helper-nat-client.c
+ */
+#define PACKET_ID 256
+
+/**
* Must match IP given in the client.
*/
#define DUMMY_IP "192.0.2.86"
@@ -245,7 +250,7 @@
ip_pkt.vers_ihl = 0x45;
ip_pkt.tos = 0;
ip_pkt.pkt_len = htons (sizeof (packet));
- ip_pkt.id = htons (256);
+ ip_pkt.id = htons (PACKET_ID);
ip_pkt.flags_frag_offset = 0;
ip_pkt.ttl = IPDEFTTL;
ip_pkt.proto = IPPROTO_ICMP;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18625 - gnunet/src/nat,
gnunet <=