[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18940 - gnunet/src/dns
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18940 - gnunet/src/dns |
Date: |
Mon, 2 Jan 2012 13:46:53 +0100 |
Author: grothoff
Date: 2012-01-02 13:46:53 +0100 (Mon, 02 Jan 2012)
New Revision: 18940
Modified:
gnunet/src/dns/gnunet-helper-dns.c
Log:
-fix shutdown order
Modified: gnunet/src/dns/gnunet-helper-dns.c
===================================================================
--- gnunet/src/dns/gnunet-helper-dns.c 2012-01-02 12:24:56 UTC (rev 18939)
+++ gnunet/src/dns/gnunet-helper-dns.c 2012-01-02 12:46:53 UTC (rev 18940)
@@ -662,7 +662,7 @@
* 5 failed to initialize tunnel interface
* 6 failed to initialize control pipe
* 8 failed to change routing table, cleanup successful
- * 9-23 failed to undo some changes to routing table
+ * 9-23 failed to change routing table and failed to undo some changes
to routing table
* 24 failed to drop privs
* 25-39 failed to drop privs and then failed to undo some changes to
routing table
* 40 failed to regain privs
@@ -760,7 +760,7 @@
return 6;
}
}
- if (SIG_ERR == signal (SIGINT, &signal_handler))
+ if (SIG_ERR == signal (SIGTERM, &signal_handler))
{
fprintf (stderr,
"Fatal: could not initialize signal handler: %s\n",
@@ -820,18 +820,18 @@
"ACCEPT", NULL
};
if (0 != fork_and_exec (SBIN_IPTABLES, mangle_args))
- goto cleanup_mangle_1;
+ goto cleanup_rest;
}
/* Mark all of the other DNS traffic using our mark DNS_MARK */
{
char *const mark_args[] =
{
- "iptables", "-t", "mangle", "-I", "OUTPUT", DNS_TABLE, "-p",
+ "iptables", "-t", "mangle", "-I", "OUTPUT", "2", "-p",
"udp", "--dport", DNS_PORT, "-j", "MARK", "--set-mark", DNS_MARK,
NULL
};
if (0 != fork_and_exec (SBIN_IPTABLES, mark_args))
- goto cleanup_mark_2;
+ goto cleanup_mangle_1;
}
/* Forward all marked DNS traffic to our DNS_TABLE */
{
@@ -840,17 +840,17 @@
"ip", "rule", "add", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (SBIN_IP, forward_args))
- goto cleanup_forward_3;
+ goto cleanup_mark_2;
}
/* Finally, add rule in our forwarding table to pass to our virtual
interface */
{
char *const route_args[] =
{
- "ip", "route", "add", "default", "via", dev,
+ "ip", "route", "add", "default", "dev", dev,
"table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (SBIN_IP, route_args))
- goto cleanup_route_4;
+ goto cleanup_forward_3;
}
/* drop privs *except* for the saved UID; this is not perfect, but better
@@ -877,7 +877,6 @@
/* now forward until we hit a problem */
run (fd_tun);
- (void) close (fd_tun);
/* now need to regain privs so we can remove the firewall rules we added! */
#ifdef HAVE_SETRESUID
@@ -902,7 +901,7 @@
{
char *const route_clean_args[] =
{
- "ip", "route", "del", "default", "via", dev,
+ "ip", "route", "del", "default", "dev", dev,
"table", DNS_TABLE, NULL
};
if (0 != fork_and_exec (SBIN_IP, route_clean_args))
@@ -939,6 +938,9 @@
r += 8;
}
+ cleanup_rest:
+ /* close virtual interface */
+ (void) close (fd_tun);
/* remove SIGINT handler so we can close the pipes */
(void) signal (SIGINT, SIG_IGN);
(void) close (cpipe[0]);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18940 - gnunet/src/dns,
gnunet <=