[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15608 - in gnunet/src: mesh vpn
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15608 - in gnunet/src: mesh vpn |
Date: |
Wed, 15 Jun 2011 09:15:39 +0200 |
Author: toelke
Date: 2011-06-15 09:15:39 +0200 (Wed, 15 Jun 2011)
New Revision: 15608
Modified:
gnunet/src/mesh/mesh_api.c
gnunet/src/vpn/gnunet-daemon-exit.c
gnunet/src/vpn/gnunet-daemon-vpn-helper.c
gnunet/src/vpn/gnunet-daemon-vpn.c
gnunet/src/vpn/gnunet-helper-vpn-api.c
gnunet/src/vpn/gnunet-helper-vpn-api.h
gnunet/src/vpn/gnunet-service-dns.c
Log:
fix bugs found by compiling with -Wextra
Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c 2011-06-15 07:15:39 UTC (rev 15607)
+++ gnunet/src/mesh/mesh_api.c 2011-06-15 07:15:39 UTC (rev 15608)
@@ -127,6 +127,9 @@
send_end_connect(void* cls,
const struct GNUNET_SCHEDULER_TaskContext* tc)
{
+ if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
+ return;
+
struct GNUNET_MESH_Tunnel* tunnel = cls;
tunnel->connect_handler(tunnel->handler_cls, NULL, NULL);
@@ -136,6 +139,9 @@
send_self_connect(void* cls,
const struct GNUNET_SCHEDULER_TaskContext* tc)
{
+ if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
+ return;
+
struct GNUNET_MESH_Tunnel* tunnel = cls;
tunnel->connect_handler(tunnel->handler_cls, &tunnel->handle->myself, NULL);
@@ -146,6 +152,9 @@
call_connect_handler (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
+ return;
+
struct GNUNET_MESH_Tunnel *tunnel = cls;
tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer,
@@ -689,7 +698,7 @@
build_hello_message(ret, stypes);
- const static struct GNUNET_CORE_MessageHandler core_handlers[] = {
+ static const struct GNUNET_CORE_MessageHandler core_handlers[] = {
{&core_receive, GNUNET_MESSAGE_TYPE_MESH, 0},
{&receive_hello, GNUNET_MESSAGE_TYPE_MESH_HELLO, 0},
{NULL, 0, 0}
Modified: gnunet/src/vpn/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-exit.c 2011-06-15 07:15:39 UTC (rev 15607)
+++ gnunet/src/vpn/gnunet-daemon-exit.c 2011-06-15 07:15:39 UTC (rev 15608)
@@ -243,8 +243,7 @@
* @param version 4 or 6
*/
static void
-udp_from_helper (struct udp_pkt *udp, unsigned char *dadr, size_t addrlen,
- unsigned int version)
+udp_from_helper (struct udp_pkt *udp, unsigned char *dadr, size_t addrlen)
{
struct redirect_info u_i;
struct GNUNET_MESH_Tunnel *tunnel;
@@ -337,7 +336,7 @@
*/
static void
tcp_from_helper (struct tcp_pkt *tcp, unsigned char *dadr, size_t addrlen,
- unsigned int version, size_t pktlen)
+ size_t pktlen)
{
struct redirect_info u_i;
struct GNUNET_MESH_Tunnel *tunnel;
@@ -421,10 +420,10 @@
struct ip6_pkt *pkt6 = (struct ip6_pkt *) pkt_tun;
if (0x11 == pkt6->ip6_hdr.nxthdr)
udp_from_helper (&((struct ip6_udp *) pkt6)->udp_hdr,
- (unsigned char *) &pkt6->ip6_hdr.dadr, 16, 6);
+ (unsigned char *) &pkt6->ip6_hdr.dadr, 16);
else if (0x06 == pkt6->ip6_hdr.nxthdr)
tcp_from_helper (&((struct ip6_tcp *) pkt6)->tcp_hdr,
- (unsigned char *) &pkt6->ip6_hdr.dadr, 16, 6,
+ (unsigned char *) &pkt6->ip6_hdr.dadr, 16,
ntohs (pkt6->ip6_hdr.paylgth));
}
else if (ntohs (pkt_tun->tun.type) == 0x0800)
@@ -433,7 +432,7 @@
uint32_t tmp = pkt4->ip_hdr.dadr;
if (0x11 == pkt4->ip_hdr.proto)
udp_from_helper (&((struct ip_udp *) pkt4)->udp_hdr,
- (unsigned char *) &tmp, 4, 4);
+ (unsigned char *) &tmp, 4);
else if (0x06 == pkt4->ip_hdr.proto)
{
size_t pktlen = ntohs(pkt4->ip_hdr.tot_lngth);
@@ -441,7 +440,7 @@
pktlen -= 4*pkt4->ip_hdr.hdr_lngth;
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "-hdr: %d\n", pktlen);
tcp_from_helper (&((struct ip_tcp *) pkt4)->tcp_hdr,
- (unsigned char *) &tmp, 4, 4, pktlen);
+ (unsigned char *) &tmp, 4, pktlen);
}
}
else
@@ -634,7 +633,6 @@
"exit-gnunet",
start_helper_and_schedule,
message_token,
- NULL,
NULL);
GNUNET_free(ipv6addr);
@@ -1189,7 +1187,7 @@
char *const *args,
const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg_)
{
- const static struct GNUNET_MESH_MessageHandler handlers[] = {
+ static const struct GNUNET_MESH_MessageHandler handlers[] = {
{receive_udp_service, GNUNET_MESSAGE_TYPE_SERVICE_UDP, 0},
{receive_tcp_service, GNUNET_MESSAGE_TYPE_SERVICE_TCP, 0},
{receive_udp_remote, GNUNET_MESSAGE_TYPE_REMOTE_UDP, 0},
@@ -1197,7 +1195,7 @@
{NULL, 0, 0}
};
- const static GNUNET_MESH_ApplicationType apptypes[] =
+ static const GNUNET_MESH_ApplicationType apptypes[] =
{
GNUNET_APPLICATION_TYPE_INTERNET_TCP_GATEWAY,
GNUNET_APPLICATION_TYPE_INTERNET_UDP_GATEWAY,
Modified: gnunet/src/vpn/gnunet-daemon-vpn-helper.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn-helper.c 2011-06-15 07:15:39 UTC (rev
15607)
+++ gnunet/src/vpn/gnunet-daemon-vpn-helper.c 2011-06-15 07:15:39 UTC (rev
15608)
@@ -111,7 +111,6 @@
"vpn-gnunet",
start_helper_and_schedule,
message_token,
- NULL,
NULL);
GNUNET_free(ipv6addr);
Modified: gnunet/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn.c 2011-06-15 07:15:39 UTC (rev 15607)
+++ gnunet/src/vpn/gnunet-daemon-vpn.c 2011-06-15 07:15:39 UTC (rev 15608)
@@ -275,6 +275,9 @@
*/
void
process_answer(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tc) {
+ if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
+ return;
+
struct answer_packet* pkt = cls;
struct answer_packet_list* list;
@@ -701,7 +704,7 @@
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg_)
{
- const static struct GNUNET_MESH_MessageHandler handlers[] = {
+ static const struct GNUNET_MESH_MessageHandler handlers[] = {
{receive_udp_back, GNUNET_MESSAGE_TYPE_SERVICE_UDP_BACK, 0},
{receive_tcp_back, GNUNET_MESSAGE_TYPE_SERVICE_TCP_BACK, 0},
{receive_udp_back, GNUNET_MESSAGE_TYPE_REMOTE_UDP_BACK, 0},
Modified: gnunet/src/vpn/gnunet-helper-vpn-api.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn-api.c 2011-06-15 07:15:39 UTC (rev
15607)
+++ gnunet/src/vpn/gnunet-helper-vpn-api.c 2011-06-15 07:15:39 UTC (rev
15608)
@@ -109,8 +109,7 @@
const char *ipv4addr,
const char *ipv4mask, const char *process_name,
GNUNET_SCHEDULER_Task restart_task,
- GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls,
- void *client)
+ GNUNET_SERVER_MessageTokenizerCallback cb, void *cb_cls)
{
struct GNUNET_VPN_HELPER_Handle *handle =
GNUNET_malloc (sizeof (struct GNUNET_VPN_HELPER_Handle));
Modified: gnunet/src/vpn/gnunet-helper-vpn-api.h
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn-api.h 2011-06-15 07:15:39 UTC (rev
15607)
+++ gnunet/src/vpn/gnunet-helper-vpn-api.h 2011-06-15 07:15:39 UTC (rev
15608)
@@ -92,7 +92,6 @@
* @param restart_task The task called when the helper dies. Will be called
with the handle as cls
* @param cb A callback for messages from the helper
* @param cb_cls Closure for the callback
- * @param client client_name for the callback
*
* @return A pointer to the new Handle, NULL on error
*/
@@ -105,8 +104,7 @@
GNUNET_SCHEDULER_Task
restart_task,
GNUNET_SERVER_MessageTokenizerCallback
- cb, void *cb_cls,
- void *client);
+ cb, void *cb_cls);
/**
* @brief Kills the helper, closes the pipe and free()s the handle
Modified: gnunet/src/vpn/gnunet-service-dns.c
===================================================================
--- gnunet/src/vpn/gnunet-service-dns.c 2011-06-15 07:15:39 UTC (rev 15607)
+++ gnunet/src/vpn/gnunet-service-dns.c 2011-06-15 07:15:39 UTC (rev 15608)
@@ -113,6 +113,9 @@
static void
hijack (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ return;
+
char port_s[6];
char *virt_dns;
struct GNUNET_OS_Process *proc;
@@ -197,8 +200,8 @@
struct tunnel_cls {
struct GNUNET_MESH_Tunnel *tunnel GNUNET_PACKED;
- struct GNUNET_MessageHeader hdr GNUNET_PACKED;
- struct dns_pkt dns GNUNET_PACKED;
+ struct GNUNET_MessageHeader hdr;
+ struct dns_pkt dns;
};
struct tunnel_cls *remote_pending[UINT16_MAX];
@@ -704,7 +707,7 @@
}
char* virt_dns;
- int virt_dns_bytes;
+ unsigned int virt_dns_bytes;
if (GNUNET_SYSERR ==
GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", "VIRTDNS",
&virt_dns))
@@ -899,6 +902,8 @@
cleanup_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
+ GNUNET_assert(0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN));
+
unhijack(dnsoutport);
GNUNET_DHT_disconnect(dht);
}
@@ -1156,7 +1161,7 @@
{NULL, 0, 0}
};
- const static GNUNET_MESH_ApplicationType apptypes[] =
+ static const GNUNET_MESH_ApplicationType apptypes[] =
{ GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
GNUNET_APPLICATION_TYPE_END
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15608 - in gnunet/src: mesh vpn,
gnunet <=