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);
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);
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,
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}
* @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;
*/
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;
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)
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);
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
"exit-gnunet",
start_helper_and_schedule,
message_token,
- NULL,
NULL);
GNUNET_free(ipv6addr);
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},
{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,
"vpn-gnunet",
start_helper_and_schedule,
message_token,
- NULL,
NULL);
GNUNET_free(ipv6addr);
*/
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;
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},
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));
* @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
*/
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
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;
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];
}
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))
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);
}
{NULL, 0, 0}
};
- const static GNUNET_MESH_ApplicationType apptypes[] =
+ static const GNUNET_MESH_ApplicationType apptypes[] =
{ GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
GNUNET_APPLICATION_TYPE_END
};