tool to allow IP traffic exit from the GNUnet cadet to the Internet More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_applications.h"
#include "gnunet_dht_service.h"
#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_regex_service.h"
#include "exit.h"
#include "block_dns.h"
Go to the source code of this file.
Data Structures | |
struct | SocketAddress |
Information about an address. More... | |
struct | LocalService |
This struct is saved into the services-hashmap to represent a service this peer is specifically offering an exit for (for a specific domain name). More... | |
struct | RedirectInformation |
Information we use to track a connection (the classical 6-tuple of IP-version, protocol, source-IP, destination-IP, source-port and destinatin-port. More... | |
struct | ChannelState |
This struct is saved into connections_map to allow finding the right channel given an IP packet from TUN. More... | |
struct | DnsResponseMessage |
Message with a DNS response. More... | |
Macros | |
#define | REGEX_MAX_PATH_LEN_IPV4 4 |
Maximum path compression length for cadet regex announcing for IPv4 address based regex. More... | |
#define | REGEX_MAX_PATH_LEN_IPV6 8 |
Maximum path compression length for cadet regex announcing for IPv6 address based regex. More... | |
#define | REGEX_REFRESH_FREQUENCY |
How frequently do we re-announce the regex for the exit? More... | |
#define | DHT_PUT_FREQUENCY |
How frequently do we re-announce the DNS exit in the DHT? More... | |
#define | DNS_ADVERTISEMENT_TIMEOUT |
How long do we typically sign the DNS exit advertisement for? More... | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "exit", __VA_ARGS__); |
Generic logging shorthand. More... | |
Functions | |
static GNUNET_NETWORK_STRUCT_END void | process_dns_result (void *cls, const struct GNUNET_TUN_DnsHeader *dns, size_t r) |
Callback called from DNSSTUB resolver when a resolution succeeded. More... | |
static int | check_dns_request (void *cls, const struct DnsResponseMessage *msg) |
Check a request via cadet to perform a DNS query. More... | |
static void | handle_dns_request (void *cls, const struct DnsResponseMessage *msg) |
Process a request via cadet to perform a DNS query. More... | |
static void | hash_redirect_info (struct GNUNET_HashCode *hash, const struct RedirectInformation *ri) |
Given IP information about a connection, calculate the respective hash we would use for the connections_map. More... | |
static struct ChannelState * | get_redirect_state (int af, int protocol, const void *destination_ip, uint16_t destination_port, const void *local_ip, uint16_t local_port, struct GNUNET_HashCode *state_key) |
Get our connection tracking state. More... | |
static int | check_tcp_service (void *cls, const struct GNUNET_EXIT_TcpServiceStartMessage *start) |
Check a request via cadet to send a request to a TCP service offered by this system. More... | |
static void | prepare_ipv4_packet (const void *payload, size_t payload_length, int protocol, const struct GNUNET_TUN_TcpHeader *tcp_header, const struct SocketAddress *src_address, const struct SocketAddress *dst_address, struct GNUNET_TUN_IPv4Header *pkt4) |
Prepare an IPv4 packet for transmission via the TUN interface. More... | |
static void | prepare_ipv6_packet (const void *payload, size_t payload_length, int protocol, const struct GNUNET_TUN_TcpHeader *tcp_header, const struct SocketAddress *src_address, const struct SocketAddress *dst_address, struct GNUNET_TUN_IPv6Header *pkt6) |
Prepare an IPv6 packet for transmission via the TUN interface. More... | |
static void | send_tcp_packet_via_tun (const struct SocketAddress *destination_address, const struct SocketAddress *source_address, const struct GNUNET_TUN_TcpHeader *tcp_header, const void *payload, size_t payload_length) |
Send a TCP packet via the TUN interface. More... | |
static void | send_icmp_packet_via_tun (const struct SocketAddress *destination_address, const struct SocketAddress *source_address, const struct GNUNET_TUN_IcmpHeader *icmp_header, const void *payload, size_t payload_length) |
Send an ICMP packet via the TUN interface. More... | |
static void | setup_fresh_address (int af, uint8_t proto, struct SocketAddress *local_address) |
We need to create a (unique) fresh local address (IP+port). More... | |
static void | setup_state_record (struct ChannelState *state) |
We are starting a fresh connection (TCP or UDP) and need to pick a source port and IP address (within the correct range and address family) to associate replies with the connection / correct cadet channel. More... | |
static void | send_udp_packet_via_tun (const struct SocketAddress *destination_address, const struct SocketAddress *source_address, const void *payload, size_t payload_length) |
Send a UDP packet via the TUN interface. More... | |
static int | check_udp_remote (void *cls, const struct GNUNET_EXIT_UdpInternetMessage *msg) |
Check a request to forward UDP data to the Internet via this peer. More... | |
static void | handle_udp_remote (void *cls, const struct GNUNET_EXIT_UdpInternetMessage *msg) |
Process a request to forward UDP data to the Internet via this peer. More... | |
static int | check_udp_service (void *cls, const struct GNUNET_EXIT_UdpServiceMessage *msg) |
Check a request via cadet to send a request to a UDP service offered by this system. More... | |
static void | handle_udp_service (void *cls, const struct GNUNET_EXIT_UdpServiceMessage *msg) |
Process a request via cadet to send a request to a UDP service offered by this system. More... | |
static void | handle_tcp_service (void *cls, const struct GNUNET_EXIT_TcpServiceStartMessage *start) |
Process a request via cadet to send a request to a TCP service offered by this system. More... | |
static int | check_tcp_remote (void *cls, const struct GNUNET_EXIT_TcpInternetStartMessage *start) |
Check a request to forward TCP data to the Internet via this peer. More... | |
static void | handle_tcp_remote (void *cls, const struct GNUNET_EXIT_TcpInternetStartMessage *start) |
Process a request to forward TCP data to the Internet via this peer. More... | |
static int | check_tcp_data (void *cls, const struct GNUNET_EXIT_TcpDataMessage *data) |
Check a request to forward TCP data on an established connection via this peer. More... | |
static void | handle_tcp_data (void *cls, const struct GNUNET_EXIT_TcpDataMessage *data) |
Process a request to forward TCP data on an established connection via this peer. More... | |
static void | make_up_icmpv4_payload (struct ChannelState *state, struct GNUNET_TUN_IPv4Header *ipp, struct GNUNET_TUN_UdpHeader *udp) |
Synthesize a plausible ICMP payload for an ICMPv4 error response on the given channel. More... | |
static void | make_up_icmpv6_payload (struct ChannelState *state, struct GNUNET_TUN_IPv6Header *ipp, struct GNUNET_TUN_UdpHeader *udp) |
Synthesize a plausible ICMP payload for an ICMPv6 error response on the given channel. More... | |
static int | check_icmp_remote (void *cls, const struct GNUNET_EXIT_IcmpInternetMessage *msg) |
Check a request to forward ICMP data to the Internet via this peer. More... | |
static void | handle_icmp_remote (void *cls, const struct GNUNET_EXIT_IcmpInternetMessage *msg) |
Process a request to forward ICMP data to the Internet via this peer. More... | |
static uint16_t | make_up_icmp_service_payload (struct ChannelState *state, char *buf) |
Setup ICMP payload for ICMP error messages. More... | |
static int | check_icmp_service (void *cls, const struct GNUNET_EXIT_IcmpServiceMessage *msg) |
Check a request via cadet to send ICMP data to a service offered by this system. More... | |
static void | handle_icmp_service (void *cls, const struct GNUNET_EXIT_IcmpServiceMessage *msg) |
Process a request via cadet to send ICMP data to a service offered by this system. More... | |
static int | free_service_record (void *cls, const struct GNUNET_HashCode *key, void *value) |
Free memory associated with a service record. More... | |
static void * | new_service_channel (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator) |
Callback from CADET for new channels. More... | |
static void | clean_channel (void *cls, const struct GNUNET_CADET_Channel *channel) |
Function called by cadet whenever an inbound channel is destroyed. More... | |
static void | store_service (int proto, const char *name, uint16_t destination_port, struct LocalService *service) |
Given a service descriptor and a destination port, find the respective service entry. More... | |
static void | send_packet_to_cadet_channel (struct ChannelState *s, struct GNUNET_MQ_Envelope *env) |
Send the given packet via the cadet channel. More... | |
static void | icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp, size_t pktlen, int af, const void *destination_ip, const void *source_ip) |
Handles an ICMP packet received from the helper. More... | |
static void | udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp, size_t pktlen, int af, const void *destination_ip, const void *source_ip) |
Handles an UDP packet received from the helper. More... | |
static void | tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp, size_t pktlen, int af, const void *destination_ip, const void *source_ip) |
Handles a TCP packet received from the helper. More... | |
static int | message_token (void *cls, const struct GNUNET_MessageHeader *message) |
Receive packets from the helper-process. More... | |
static void * | new_channel (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator) |
Callback from CADET for new channels. More... | |
static int | free_iterate (void *cls, const struct GNUNET_HashCode *hash, void *value) |
Function that frees everything from a hashmap. More... | |
static void | dummy_task (void *cls) |
Function scheduled as very last function if the service disabled itself because the helper is not installed properly. More... | |
static void | cleanup (void *cls) |
Function scheduled as very last function, cleans up after us. More... | |
static void | add_services (int proto, char *cpy, const char *name) |
Add services to the service map. More... | |
static void | read_service_conf (void *cls, const char *section) |
Reads the configuration and populates #udp_services and #tcp_services. More... | |
static void | do_dht_put (void *cls) |
We are running a DNS exit service, advertise it in the DHT. More... | |
static void | dht_put_cont (void *cls) |
Function called when the DHT PUT operation is complete. More... | |
static void | parse_ip_options () |
Figure out which IP versions we should support (and which are supported by the OS) according to our configuration. More... | |
static void | advertise_dns_exit () |
Helper function to open the CADET port for DNS exits and to advertise the DNS exit (if applicable). More... | |
static int | setup_exit_helper_args () |
Initialize exit_argv. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg_) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
The main function. More... | |
Variables | |
static int | global_ret |
Return value from 'main'. More... | |
static struct GNUNET_REGEX_Announcement * | regex4 |
Handle to our regex announcement for IPv4. More... | |
static struct GNUNET_REGEX_Announcement * | regex6 |
Handle to our regex announcement for IPv4. More... | |
static const struct GNUNET_CONFIGURATION_Handle * | cfg |
The handle to the configuration used throughout the process. More... | |
static struct GNUNET_HELPER_Handle * | helper_handle |
The handle to the helper. More... | |
static char * | exit_argv [8] |
Arguments to the exit helper. More... | |
static struct in6_addr | exit_ipv6addr |
IPv6 address of our TUN interface. More... | |
static unsigned long long | ipv6prefix |
IPv6 prefix (0..127) from configuration file. More... | |
static struct in_addr | exit_ipv4addr |
IPv4 address of our TUN interface. More... | |
static struct in_addr | exit_ipv4mask |
IPv4 netmask of our TUN interface. More... | |
static struct GNUNET_STATISTICS_Handle * | stats |
Statistics. More... | |
static struct GNUNET_CADET_Handle * | cadet_handle |
The handle to cadet. More... | |
static struct GNUNET_CONTAINER_MultiHashMap * | connections_map |
This hashmaps contains the mapping from peer, service-descriptor, source-port and destination-port to a struct ChannelState. More... | |
static struct GNUNET_CONTAINER_Heap * | connections_heap |
Heap so we can quickly find "old" connections. More... | |
static unsigned long long | max_connections |
If there are at least this many connections, old ones will be removed. More... | |
static struct GNUNET_CONTAINER_MultiHashMap * | services |
This hashmaps saves interesting things about the configured services. More... | |
static struct ChannelState * | channels [UINT16_MAX+1] |
Array of all open DNS requests from channels. More... | |
static struct GNUNET_DNSSTUB_Context * | dnsstub |
Handle to the DNS Stub resolver. More... | |
static struct GNUNET_DHT_PutHandle * | dht_put |
Handle for ongoing DHT PUT operations to advertise exit service. More... | |
static struct GNUNET_DHT_Handle * | dht |
Handle to the DHT. More... | |
static struct GNUNET_SCHEDULER_Task * | dht_task |
Task for doing DHT PUTs to advertise exit service. More... | |
static struct GNUNET_DNS_Advertisement | dns_advertisement |
Advertisement message we put into the DHT to advertise us as a DNS exit. More... | |
static struct GNUNET_HashCode | dht_put_key |
Key we store the DNS advertismenet under. More... | |
static struct GNUNET_CRYPTO_EddsaPrivateKey * | peer_key |
Private key for this peer. More... | |
static struct GNUNET_CADET_Port * | dns_port |
Port for DNS exit. More... | |
static struct GNUNET_CADET_Port * | cadet_port4 |
Port for IPv4 exit. More... | |
static struct GNUNET_CADET_Port * | cadet_port6 |
Port for IPv6 exit. More... | |
static int | ipv4_exit |
Are we an IPv4-exit? More... | |
static int | ipv6_exit |
Are we an IPv6-exit? More... | |
static int | ipv4_enabled |
Do we support IPv4 at all on the TUN interface? More... | |
static int | ipv6_enabled |
Do we support IPv6 at all on the TUN interface? More... | |
tool to allow IP traffic exit from the GNUnet cadet to the Internet
TODO:
Design:
Definition in file gnunet-daemon-exit.c.
#define REGEX_MAX_PATH_LEN_IPV4 4 |
Maximum path compression length for cadet regex announcing for IPv4 address based regex.
Definition at line 55 of file gnunet-daemon-exit.c.
#define REGEX_MAX_PATH_LEN_IPV6 8 |
Maximum path compression length for cadet regex announcing for IPv6 address based regex.
Definition at line 61 of file gnunet-daemon-exit.c.
#define REGEX_REFRESH_FREQUENCY |
How frequently do we re-announce the regex for the exit?
Definition at line 66 of file gnunet-daemon-exit.c.
#define DHT_PUT_FREQUENCY |
How frequently do we re-announce the DNS exit in the DHT?
Definition at line 72 of file gnunet-daemon-exit.c.
#define DNS_ADVERTISEMENT_TIMEOUT |
How long do we typically sign the DNS exit advertisement for?
Definition at line 78 of file gnunet-daemon-exit.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "exit", __VA_ARGS__); |
Generic logging shorthand.
Definition at line 85 of file gnunet-daemon-exit.c.
|
static |
Callback called from DNSSTUB resolver when a resolution succeeded.
cls | NULL |
dns | the response itself |
r | number of bytes in dns |
Definition at line 456 of file gnunet-daemon-exit.c.
References ChannelState::channel, channels, DnsResponseMessage::dns, ChannelState::dns, env, GNUNET_assert, GNUNET_CADET_get_mq(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TUN_DnsHeader::id, LOG, and ChannelState::specifics.
Referenced by handle_dns_request().
|
static |
Check a request via cadet to perform a DNS query.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 497 of file gnunet-daemon-exit.c.
References dnsstub, GNUNET_break, GNUNET_break_op, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, and ChannelState::is_dns.
|
static |
Process a request via cadet to perform a DNS query.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 523 of file gnunet-daemon-exit.c.
References buf, ChannelState::channel, channels, ChannelState::dns, dnsstub, GNUNET_ALIGN, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_DNSSTUB_resolve(), GNUNET_memcpy, GNUNET_SYSERR, GNUNET_YES, GNUNET_TUN_DnsHeader::id, ChannelState::is_dns, msg, process_dns_result(), GNUNET_MessageHeader::size, and ChannelState::specifics.
|
static |
Given IP information about a connection, calculate the respective hash we would use for the connections_map.
hash | resulting hash |
ri | information about the connection |
Definition at line 572 of file gnunet-daemon-exit.c.
References SocketAddress::address, SocketAddress::af, GNUNET_assert, GNUNET_memcpy, SocketAddress::ipv4, SocketAddress::ipv6, RedirectInformation::local_address, SocketAddress::port, SocketAddress::proto, and RedirectInformation::remote_address.
Referenced by get_redirect_state().
|
static |
Get our connection tracking state.
Warns if it does not exists, refreshes the timestamp if it does exist.
af | address family |
protocol | IPPROTO_UDP or IPPROTO_TCP |
destination_ip | target IP |
destination_port | target port |
local_ip | local IP |
local_port | local port |
state_key | set to hash's state if non-NULL |
Definition at line 650 of file gnunet-daemon-exit.c.
References SocketAddress::address, SocketAddress::af, ChannelState::af, connections_map, ChannelState::destination_port, GNUNET_CONTAINER_heap_update_cost(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_TIME_absolute_get(), hash_redirect_info(), SocketAddress::ipv4, SocketAddress::ipv6, key, RedirectInformation::local_address, SocketAddress::port, SocketAddress::proto, ChannelState::protocol, RedirectInformation::remote_address, ChannelState::ri, and state.
Referenced by icmp_from_helper(), setup_state_record(), tcp_from_helper(), and udp_from_helper().
|
static |
Check a request via cadet to send a request to a TCP service offered by this system.
cls | our struct ChannelState * |
start | the actual message |
Definition at line 709 of file gnunet-daemon-exit.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, start, and state.
|
static |
Prepare an IPv4 packet for transmission via the TUN interface.
Initializes the IP header and calculates checksums (IP+UDP/TCP). For UDP, the UDP header will be fully created, whereas for TCP only the ports and checksum will be filled in. So for TCP, a skeleton TCP header must be part of the provided payload.
payload | payload of the packet (starting with UDP payload or TCP header, depending on protocol) |
payload_length | number of bytes in payload |
protocol | IPPROTO_UDP or IPPROTO_TCP |
tcp_header | skeleton of the TCP header, NULL for UDP |
src_address | source address to use (IP and port) |
dst_address | destination address to use (IP and port) |
pkt4 | where to write the assembled packet; must contain enough space for the IP header, UDP/TCP header AND the payload |
Definition at line 762 of file gnunet-daemon-exit.c.
References SocketAddress::address, GNUNET_TUN_TcpHeader::destination_port, GNUNET_TUN_UdpHeader::destination_port, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcpy, GNUNET_TUN_calculate_tcp4_checksum(), GNUNET_TUN_calculate_udp4_checksum(), GNUNET_TUN_initialize_ipv4_header(), SocketAddress::ipv4, GNUNET_TUN_UdpHeader::len, len, payload, SocketAddress::port, ChannelState::protocol, GNUNET_TUN_TcpHeader::source_port, and GNUNET_TUN_UdpHeader::source_port.
Referenced by send_tcp_packet_via_tun(), and send_udp_packet_via_tun().
|
static |
Prepare an IPv6 packet for transmission via the TUN interface.
Initializes the IP header and calculates checksums (IP+UDP/TCP). For UDP, the UDP header will be fully created, whereas for TCP only the ports and checksum will be filled in. So for TCP, a skeleton TCP header must be part of the provided payload.
payload | payload of the packet (starting with UDP payload or TCP header, depending on protocol) |
payload_length | number of bytes in payload |
protocol | IPPROTO_UDP or IPPROTO_TCP |
tcp_header | skeleton TCP header data to send, NULL for UDP |
src_address | source address to use (IP and port) |
dst_address | destination address to use (IP and port) |
pkt6 | where to write the assembled packet; must contain enough space for the IP header, UDP/TCP header AND the payload |
Definition at line 866 of file gnunet-daemon-exit.c.
References SocketAddress::address, GNUNET_TUN_TcpHeader::destination_port, GNUNET_TUN_UdpHeader::destination_port, GNUNET_assert, GNUNET_break, GNUNET_memcpy, GNUNET_TUN_calculate_tcp6_checksum(), GNUNET_TUN_calculate_udp6_checksum(), GNUNET_TUN_initialize_ipv6_header(), SocketAddress::ipv6, GNUNET_TUN_UdpHeader::len, len, payload, SocketAddress::port, GNUNET_TUN_TcpHeader::source_port, and GNUNET_TUN_UdpHeader::source_port.
Referenced by send_tcp_packet_via_tun(), and send_udp_packet_via_tun().
|
static |
Send a TCP packet via the TUN interface.
destination_address | IP and port to use for the TCP packet's destination |
source_address | IP and port to use for the TCP packet's source |
tcp_header | header template to use |
payload | payload of the TCP packet |
payload_length | number of bytes in payload |
Definition at line 959 of file gnunet-daemon-exit.c.
References SocketAddress::af, buf, GNUNET_TUN_IPv4Header::destination_address, GNUNET_TUN_IPv6Header::destination_address, ETH_P_IPV4, ETH_P_IPV6, GNUNET_TUN_Layer2PacketHeader::flags, gettext_noop, GNUNET_ALIGN, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELPER_send(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_MESSAGE_TYPE_VPN_HELPER, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, helper_handle, ipv4, ipv6, len, payload, GNUNET_TUN_IPv6Header::payload_length, prepare_ipv4_packet(), prepare_ipv6_packet(), GNUNET_TUN_Layer2PacketHeader::proto, GNUNET_MessageHeader::size, GNUNET_TUN_IPv4Header::source_address, GNUNET_TUN_IPv6Header::source_address, stats, and GNUNET_MessageHeader::type.
Referenced by handle_tcp_data(), handle_tcp_remote(), and handle_tcp_service().
|
static |
Send an ICMP packet via the TUN interface.
destination_address | IP to use for the ICMP packet's destination |
source_address | IP to use for the ICMP packet's source |
icmp_header | ICMP header to send |
payload | payload of the ICMP packet (does NOT include ICMP header) |
payload_length | number of bytes of data in payload |
Definition at line 1065 of file gnunet-daemon-exit.c.
References SocketAddress::af, buf, GNUNET_TUN_IPv4Header::destination_address, GNUNET_TUN_IPv6Header::destination_address, ETH_P_IPV4, ETH_P_IPV6, GNUNET_TUN_Layer2PacketHeader::flags, gettext_noop, GNUNET_ALIGN, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELPER_send(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_VPN_HELPER, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TUN_calculate_icmp_checksum(), GNUNET_TUN_initialize_ipv4_header(), GNUNET_TUN_initialize_ipv6_header(), GNUNET_YES, helper_handle, ipv4, ipv6, len, payload, GNUNET_TUN_IPv6Header::payload_length, GNUNET_TUN_Layer2PacketHeader::proto, GNUNET_MessageHeader::size, GNUNET_TUN_IPv4Header::source_address, GNUNET_TUN_IPv6Header::source_address, stats, and GNUNET_MessageHeader::type.
Referenced by handle_icmp_remote(), and handle_icmp_service().
|
static |
We need to create a (unique) fresh local address (IP+port).
Fill one in.
af | desired address family |
proto | desired protocol (IPPROTO_UDP or IPPROTO_TCP) |
local_address | address to initialize |
Definition at line 1177 of file gnunet-daemon-exit.c.
References SocketAddress::address, SocketAddress::af, exit_ipv4addr, exit_ipv4mask, exit_ipv6addr, GNUNET_assert, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_memcmp, SocketAddress::ipv4, SocketAddress::ipv6, ipv6prefix, SocketAddress::port, SocketAddress::proto, and proto.
Referenced by setup_state_record().
|
static |
We are starting a fresh connection (TCP or UDP) and need to pick a source port and IP address (within the correct range and address family) to associate replies with the connection / correct cadet channel.
This function generates a "fresh" source IP and source port number for a connection After picking a good source address, this function sets up the state in the 'connections_map' and 'connections_heap' to allow finding the state when needed later. The function also makes sure that we remain within memory limits by cleaning up 'old' states.
state | skeleton state to setup a record for; should 'state->specifics.tcp_udp.ri.remote_address' filled in so that this code can determine which AF/protocol is going to be used (the 'channel' should also already be set); after calling this function, heap_node and the local_address will be also initialized (heap_node != NULL can be used to test if a state has been fully setup). |
Definition at line 1292 of file gnunet-daemon-exit.c.
References buf, ChannelState::channel, connections_heap, connections_map, get_redirect_state(), GNUNET_assert, GNUNET_CADET_channel_destroy(), GNUNET_CONTAINER_heap_get_size(), GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_TIME_absolute_get(), key, max_connections, setup_fresh_address(), ChannelState::specifics, state, ChannelState::state_key, and ChannelState::tcp_udp.
Referenced by handle_icmp_remote(), handle_icmp_service(), handle_tcp_remote(), handle_tcp_service(), handle_udp_remote(), and handle_udp_service().
|
static |
Send a UDP packet via the TUN interface.
destination_address | IP and port to use for the UDP packet's destination |
source_address | IP and port to use for the UDP packet's source |
payload | payload of the UDP packet (does NOT include UDP header) |
payload_length | number of bytes of data in payload |
Definition at line 1361 of file gnunet-daemon-exit.c.
References SocketAddress::af, buf, GNUNET_TUN_IPv4Header::destination_address, GNUNET_TUN_IPv6Header::destination_address, ETH_P_IPV4, ETH_P_IPV6, GNUNET_TUN_Layer2PacketHeader::flags, gettext_noop, GNUNET_ALIGN, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELPER_send(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_MESSAGE_TYPE_VPN_HELPER, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, helper_handle, ipv4, ipv6, len, payload, GNUNET_TUN_IPv6Header::payload_length, prepare_ipv4_packet(), prepare_ipv6_packet(), GNUNET_TUN_Layer2PacketHeader::proto, GNUNET_MessageHeader::size, GNUNET_TUN_IPv4Header::source_address, GNUNET_TUN_IPv6Header::source_address, stats, and GNUNET_MessageHeader::type.
Referenced by handle_udp_remote(), and handle_udp_service().
|
static |
Check a request to forward UDP data to the Internet via this peer.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 1462 of file gnunet-daemon-exit.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and state.
|
static |
Process a request to forward UDP data to the Internet via this peer.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 1483 of file gnunet-daemon-exit.c.
References buf, gettext_noop, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, consensus-simulation::int, ipv4_exit, ipv6_exit, msg, payload, send_udp_packet_via_tun(), setup_state_record(), GNUNET_MessageHeader::size, state, and stats.
|
static |
Check a request via cadet to send a request to a UDP service offered by this system.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 1582 of file gnunet-daemon-exit.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and state.
|
static |
Process a request via cadet to send a request to a UDP service offered by this system.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 1604 of file gnunet-daemon-exit.c.
References gettext_noop, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_NO, GNUNET_STATISTICS_update(), LOG, msg, send_udp_packet_via_tun(), setup_state_record(), GNUNET_MessageHeader::size, state, and stats.
|
static |
Process a request via cadet to send a request to a TCP service offered by this system.
cls | our struct ChannelState * |
start | the actual message |
Definition at line 1644 of file gnunet-daemon-exit.c.
References gettext_noop, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, send_tcp_packet_via_tun(), setup_state_record(), start, state, and stats.
|
static |
Check a request to forward TCP data to the Internet via this peer.
cls | our struct ChannelState * |
start | the actual message |
Definition at line 1691 of file gnunet-daemon-exit.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, start, and state.
|
static |
Process a request to forward TCP data to the Internet via this peer.
cls | our struct ChannelState * |
start | the actual message |
Definition at line 1728 of file gnunet-daemon-exit.c.
References buf, gettext_noop, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, consensus-simulation::int, ipv4_exit, ipv6_exit, payload, send_tcp_packet_via_tun(), setup_state_record(), start, state, and stats.
|
static |
Check a request to forward TCP data on an established connection via this peer.
cls | our struct ChannelState * |
data | the actual message |
Definition at line 1826 of file gnunet-daemon-exit.c.
References data, gettext_noop, GNUNET_break_op, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_SYSERR, GNUNET_YES, state, and stats.
|
static |
Process a request to forward TCP data on an established connection via this peer.
cls | our struct ChannelState * |
data | the actual message |
Definition at line 1864 of file gnunet-daemon-exit.c.
References buf, data, gettext_noop, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, send_tcp_packet_via_tun(), state, and stats.
|
static |
Synthesize a plausible ICMP payload for an ICMPv4 error response on the given channel.
state | channel information |
ipp | IPv6 header to fill in (ICMP payload) |
udp | "UDP" header to fill in (ICMP payload); might actually also be the first 8 bytes of the TCP header |
Definition at line 1915 of file gnunet-daemon-exit.c.
References address, GNUNET_TUN_initialize_ipv4_header(), proto, state, and udp.
Referenced by handle_icmp_remote(), and make_up_icmp_service_payload().
|
static |
Synthesize a plausible ICMP payload for an ICMPv6 error response on the given channel.
state | channel information |
ipp | IPv6 header to fill in (ICMP payload) |
udp | "UDP" header to fill in (ICMP payload); might actually also be the first 8 bytes of the TCP header |
Definition at line 1945 of file gnunet-daemon-exit.c.
References address, GNUNET_TUN_initialize_ipv6_header(), proto, state, and udp.
Referenced by handle_icmp_remote(), and make_up_icmp_service_payload().
|
static |
Check a request to forward ICMP data to the Internet via this peer.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 1974 of file gnunet-daemon-exit.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and state.
|
static |
Process a request to forward ICMP data to the Internet via this peer.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 1995 of file gnunet-daemon-exit.c.
References buf, gettext_noop, GNUNET_ALIGN, GNUNET_assert, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, GNUNET_TUN_ICMPTYPE6_DESTINATION_UNREACHABLE, GNUNET_TUN_ICMPTYPE6_ECHO_REPLY, GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST, GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG, GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM, GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED, GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE, GNUNET_TUN_ICMPTYPE_ECHO_REPLY, GNUNET_TUN_ICMPTYPE_ECHO_REQUEST, GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH, GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED, consensus-simulation::int, ipv4_exit, ipv6_exit, make_up_icmpv4_payload(), make_up_icmpv6_payload(), msg, payload, send_icmp_packet_via_tun(), setup_state_record(), GNUNET_MessageHeader::size, state, stats, GNUNET_MessageHeader::type, and udp.
|
static |
Setup ICMP payload for ICMP error messages.
Called for both IPv4 and IPv6 addresses.
state | context for creating the IP Packet |
buf | where to create the payload, has at least sizeof (struct GNUNET_TUN_IPv6Header) + 8 bytes |
Definition at line 2193 of file gnunet-daemon-exit.c.
References buf, GNUNET_assert, GNUNET_break, ipv4, ipv6, make_up_icmpv4_payload(), make_up_icmpv6_payload(), state, and udp.
Referenced by handle_icmp_service().
|
static |
Check a request via cadet to send ICMP data to a service offered by this system.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 2245 of file gnunet-daemon-exit.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and state.
|
static |
Process a request via cadet to send ICMP data to a service offered by this system.
cls | our struct ChannelState * |
msg | the actual message |
Definition at line 2272 of file gnunet-daemon-exit.c.
References buf, gettext_noop, GNUNET_ALIGN, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TUN_ICMPTYPE6_DESTINATION_UNREACHABLE, GNUNET_TUN_ICMPTYPE6_ECHO_REPLY, GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST, GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG, GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM, GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED, GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE, GNUNET_TUN_ICMPTYPE_ECHO_REPLY, GNUNET_TUN_ICMPTYPE_ECHO_REQUEST, GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH, GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED, make_up_icmp_service_payload(), msg, payload, send_icmp_packet_via_tun(), setup_state_record(), GNUNET_MessageHeader::size, state, stats, GNUNET_MessageHeader::type, and GNUNET_TUN_IcmpHeader::type.
|
static |
Free memory associated with a service record.
cls | unused |
key | service descriptor |
value | service record to free |
Definition at line 2460 of file gnunet-daemon-exit.c.
References GNUNET_assert, GNUNET_CADET_close_port(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_OK, GNUNET_YES, key, service, services, and value.
Referenced by cleanup().
|
static |
Callback from CADET for new channels.
cls | closure |
channel | new handle to the channel |
initiator | peer that started the channel |
Definition at line 2486 of file gnunet-daemon-exit.c.
References ChannelState::channel, gettext_noop, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_STATISTICS_update(), ls, ChannelState::peer, ChannelState::specifics, stats, and ChannelState::tcp_udp.
Referenced by store_service().
|
static |
Function called by cadet whenever an inbound channel is destroyed.
Should clean up any associated state.
cls | our struct ChannelState * |
channel | connection to the other end (henceforth invalid) |
Definition at line 2516 of file gnunet-daemon-exit.c.
References channels, connections_map, ChannelState::dns, GNUNET_assert, GNUNET_CONTAINER_heap_remove_node(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_SYSERR, GNUNET_YES, ChannelState::is_dns, LOG, ChannelState::specifics, and ChannelState::tcp_udp.
Referenced by advertise_dns_exit(), run(), and store_service().
|
static |
Given a service descriptor and a destination port, find the respective service entry.
proto | IPPROTO_TCP or IPPROTO_UDP |
name | name of the service |
destination_port | destination port |
service | service information record to store (service->name will be set). |
Definition at line 2560 of file gnunet-daemon-exit.c.
References _, cadet_handle, cadet_port, clean_channel(), GNUNET_CADET_close_port(), GNUNET_CADET_open_port(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT, GNUNET_MESSAGE_TYPE_VPN_TCP_TO_SERVICE_START, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_strdup, GNUNET_TUN_compute_service_cadet_port(), GNUNET_TUN_service_name_to_hash(), handlers, name, new_service_channel(), proto, service, and services.
Referenced by add_services().
|
static |
Send the given packet via the cadet channel.
s | channel destination |
env | message to queue |
Definition at line 2630 of file gnunet-daemon-exit.c.
References ChannelState::channel, env, gettext_noop, GNUNET_assert, GNUNET_CADET_get_mq(), GNUNET_MQ_send(), GNUNET_NO, GNUNET_STATISTICS_update(), and stats.
Referenced by icmp_from_helper(), tcp_from_helper(), and udp_from_helper().
|
static |
Handles an ICMP packet received from the helper.
icmp | A pointer to the Packet |
pktlen | number of bytes in icmp |
af | address family (AFINET or AF_INET6) |
destination_ip | destination IP-address of the IP packet (should be our local address) |
source_ip | original source IP-address of the IP packet (should be the original destination address) |
Definition at line 2656 of file gnunet-daemon-exit.c.
References _, GNUNET_EXIT_IcmpToVPNMessage::af, GNUNET_TUN_UdpHeader::destination_port, env, get_redirect_state(), gettext_noop, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN, GNUNET_MQ_msg_extra, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_TUN_ICMPTYPE6_DESTINATION_UNREACHABLE, GNUNET_TUN_ICMPTYPE6_ECHO_REPLY, GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST, GNUNET_TUN_ICMPTYPE6_PACKET_TOO_BIG, GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM, GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED, GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE, GNUNET_TUN_ICMPTYPE_ECHO_REPLY, GNUNET_TUN_ICMPTYPE_ECHO_REQUEST, GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH, GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED, GNUNET_EXIT_IcmpToVPNMessage::icmp_header, ipv4, ipv6, GNUNET_TUN_IPv4Header::protocol, send_packet_to_cadet_channel(), GNUNET_TUN_UdpHeader::source_port, state, stats, GNUNET_TUN_IcmpHeader::type, and udp.
Referenced by message_token().
|
static |
Handles an UDP packet received from the helper.
udp | A pointer to the Packet |
pktlen | number of bytes in 'udp' |
af | address family (AFINET or AF_INET6) |
destination_ip | destination IP-address of the IP packet (should be our local address) |
source_ip | original source IP-address of the IP packet (should be the original destination address) |
Definition at line 2864 of file gnunet-daemon-exit.c.
References _, GNUNET_EXIT_UdpReplyMessage::destination_port, env, get_redirect_state(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, GNUNET_MQ_msg_extra, send_packet_to_cadet_channel(), GNUNET_EXIT_UdpReplyMessage::source_port, state, and udp.
Referenced by message_token().
|
static |
Handles a TCP packet received from the helper.
tcp | A pointer to the Packet |
pktlen | the length of the packet, including its TCP header |
af | address family (AFINET or AF_INET6) |
destination_ip | destination IP-address of the IP packet (should be our local address) |
source_ip | original source IP-address of the IP packet (should be the original destination address) |
Definition at line 2941 of file gnunet-daemon-exit.c.
References _, buf, GNUNET_TUN_TcpHeader::crc, GNUNET_TUN_TcpHeader::destination_port, env, get_redirect_state(), GNUNET_ALIGN, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN, GNUNET_MQ_msg_extra, GNUNET_EXIT_TcpDataMessage::reserved, send_packet_to_cadet_channel(), GNUNET_TUN_TcpHeader::source_port, state, tcp, and GNUNET_EXIT_TcpDataMessage::tcp_header.
Referenced by message_token().
|
static |
Receive packets from the helper-process.
cls | unused |
message | message received from helper |
Definition at line 3025 of file gnunet-daemon-exit.c.
References _, ETH_P_IPV4, ETH_P_IPV6, gettext_noop, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_MESSAGE_TYPE_VPN_HELPER, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_TUN_IPv4Header::header_length, icmp_from_helper(), GNUNET_TUN_IPv6Header::next_header, GNUNET_TUN_IPv6Header::payload_length, GNUNET_TUN_Layer2PacketHeader::proto, GNUNET_TUN_IPv4Header::protocol, GNUNET_MessageHeader::size, size, stats, tcp_from_helper(), GNUNET_TUN_IPv4Header::total_length, GNUNET_MessageHeader::type, and udp_from_helper().
Referenced by run().
|
static |
Callback from CADET for new channels.
cls | closure |
channel | new handle to the channel |
initiator | peer that started the channel |
Definition at line 3187 of file gnunet-daemon-exit.c.
References ChannelState::channel, gettext_noop, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, ChannelState::is_dns, ChannelState::peer, and stats.
Referenced by advertise_dns_exit(), and run().
|
static |
Function that frees everything from a hashmap.
cls | unused |
hash | key |
value | value to free |
Definition at line 3215 of file gnunet-daemon-exit.c.
References GNUNET_free, GNUNET_YES, and value.
Referenced by cleanup().
|
static |
Function scheduled as very last function if the service disabled itself because the helper is not installed properly.
Does nothing, except for keeping the service process alive by virtue of being scheduled.
cls | NULL |
Definition at line 3233 of file gnunet-daemon-exit.c.
Referenced by run().
|
static |
Function scheduled as very last function, cleans up after us.
cls | NULL |
Definition at line 3245 of file gnunet-daemon-exit.c.
References cadet_handle, cadet_port4, cadet_port6, connections_heap, connections_map, dht, dht_put, dht_task, dns_port, dnsstub, exit_argv, free_iterate(), free_service_record(), GNUNET_CADET_close_port(), GNUNET_CADET_disconnect(), GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_DHT_disconnect(), GNUNET_DHT_put_cancel(), GNUNET_DNSSTUB_stop(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_HELPER_stop(), GNUNET_log, GNUNET_NO, GNUNET_REGEX_announce_cancel(), GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_destroy(), helper_handle, peer_key, regex4, regex6, services, and stats.
Referenced by curl_check_hdr(), decrypt_new_element(), deserialize_download(), deserialize_fi_node(), deserialize_publish_file(), deserialize_search(), deserialize_search_result(), deserialize_unindex_file(), GNUNET_ATS_solver_logging_write_to_disk(), GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_search_sync_(), GNUNET_FS_unindex_sync_(), handle_barrier_status(), main(), prc_stop_cb(), read_download_request(), run(), switch_address_bl_check_cont(), and verify_fair().
|
static |
Add services to the service map.
proto | IPPROTO_TCP or IPPROTO_UDP |
cpy | copy of the service descriptor (can be mutilated) |
name | DNS name of the service |
Definition at line 3351 of file gnunet-daemon-exit.c.
References _, SocketAddress::address, LocalService::address, SocketAddress::af, exit_argv, GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_strndup, hostname, SocketAddress::ipv4, ipv4_enabled, SocketAddress::ipv6, ipv6_enabled, name, SocketAddress::port, SocketAddress::proto, proto, remote_port, res, ret, and store_service().
Referenced by read_service_conf().
|
static |
Reads the configuration and populates #udp_services and #tcp_services.
cls | unused |
section | name of section in config |
Definition at line 3516 of file gnunet-daemon-exit.c.
References add_services(), cfg, GNUNET_CONFIGURATION_get_value_string(), GNUNET_free, and GNUNET_OK.
Referenced by run().
|
static |
We are running a DNS exit service, advertise it in the DHT.
This task is run periodically to do the DHT PUT.
cls | closure |
Definition at line 3579 of file gnunet-daemon-exit.c.
References dht, dht_put, dht_put_cont(), DHT_PUT_FREQUENCY, dht_put_key, dht_task, dns_advertisement, DNS_ADVERTISEMENT_TIMEOUT, expiration, GNUNET_DNS_Advertisement::expiration_time, GNUNET_assert, GNUNET_BLOCK_TYPE_DNS, GNUNET_CRYPTO_eddsa_sign_(), GNUNET_DHT_put(), GNUNET_DHT_put_cancel(), GNUNET_DHT_RO_NONE, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_absolute_hton(), GNUNET_TIME_absolute_ntoh(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_HOURS, peer_key, GNUNET_DNS_Advertisement::purpose, and GNUNET_DNS_Advertisement::signature.
Referenced by advertise_dns_exit().
|
static |
Function called when the DHT PUT operation is complete.
Schedules the next PUT.
cls | closure, NULL |
Definition at line 3566 of file gnunet-daemon-exit.c.
References dht_put.
Referenced by do_dht_put().
|
static |
Figure out which IP versions we should support (and which are supported by the OS) according to our configuration.
Definition at line 3618 of file gnunet-daemon-exit.c.
References _, cfg, GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NETWORK_test_pf(), GNUNET_NO, GNUNET_OK, GNUNET_YES, ipv4_enabled, ipv4_exit, ipv6_enabled, and ipv6_exit.
Referenced by run().
|
static |
Helper function to open the CADET port for DNS exits and to advertise the DNS exit (if applicable).
Definition at line 3672 of file gnunet-daemon-exit.c.
References _, cadet_handle, cfg, clean_channel(), dht, dht_put_key, dht_task, dns_advertisement, dns_port, dnsstub, do_dht_put(), GNUNET_APPLICATION_PORT_INTERNET_RESOLVER, GNUNET_assert, GNUNET_CADET_open_port(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CRYPTO_eddsa_key_create_from_configuration(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_hash(), GNUNET_DHT_connect(), GNUNET_DNSSTUB_add_dns_ip(), GNUNET_DNSSTUB_start(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_log_config_invalid(), GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SIGNATURE_PURPOSE_DNS_RECORD, GNUNET_YES, handlers, new_channel(), GNUNET_DNS_Advertisement::peer, peer_key, port, GNUNET_PeerIdentity::public_key, GNUNET_DNS_Advertisement::purpose, GNUNET_CRYPTO_EccSignaturePurpose::purpose, and GNUNET_CRYPTO_EccSignaturePurpose::size.
Referenced by run().
|
static |
Initialize exit_argv.
Definition at line 3749 of file gnunet-daemon-exit.c.
References _, cfg, exit_argv, exit_ipv4addr, exit_ipv4mask, exit_ipv6addr, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_config_invalid(), GNUNET_log_config_missing(), GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, GNUNET_YES, ipv4_enabled, ipv6_enabled, and ipv6prefix.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg_ | configuration |
Definition at line 3899 of file gnunet-daemon-exit.c.