/* stop the helper */
if (helper_proc != NULL)
{
- GNUNET_OS_process_kill (helper_proc, SIGTERM);
+ if (0 != GNUNET_OS_process_kill (helper_proc, SIGTERM))
+ GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (helper_proc);
GNUNET_OS_process_close (helper_proc);
helper_proc = NULL;
size_t pkt_len = sizeof(struct GNUNET_MessageHeader) + sizeof(struct pkt_tun) + net_len;
struct ip_udp_dns* pkt = alloca(pkt_len);
+ GNUNET_assert(pkt != NULL);
memset(pkt, 0, pkt_len);
/* set the gnunet-header */
struct ip6_icmp* request = cls;
struct ip6_icmp* response = alloca(ntohs(request->shdr.size));
+ GNUNET_assert(response != NULL);
memset(response, 0, ntohs(request->shdr.size));
response->shdr.size = request->shdr.size;
if ((key = address_mapping_exists(pkt6->ip6_hdr.dadr)) != NULL)
{
struct map_entry* me = GNUNET_CONTAINER_multihashmap_get(hashmap, key);
+ GNUNET_assert(me != NULL);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Mapping exists; type: %d; UDP is %d; port: %x/%x!\n", me->desc.service_type, htonl(GNUNET_DNS_SERVICE_TYPE_UDP), pkt6_udp->udp_hdr.dpt, me->desc.ports);
GNUNET_free(key);
if (me->desc.service_type & htonl(GNUNET_DNS_SERVICE_TYPE_UDP) &&
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting to service-dns\n");
GNUNET_assert (dns_connection == NULL);
dns_connection = GNUNET_CLIENT_connect ("dns", cfg);
+ /* This would most likely be a misconfiguration */
+ GNUNET_assert(dns_connection != NULL);
GNUNET_CLIENT_receive(dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL);
/* If a packet is already in the list, schedule to send it */
struct ip6_udp* pkt6 = alloca(size);
+ GNUNET_assert(pkt6 != NULL);
+
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Relaying calc:%d gnu:%d udp:%d bytes!\n", size, ntohs(message->size), ntohs(pkt->len));
pkt6->shdr.type = htons(GNUNET_MESSAGE_TYPE_VPN_HELPER);
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating new Socket!\n");
sock = GNUNET_NETWORK_socket_create (AF_INET, SOCK_DGRAM, 0);
+ GNUNET_assert(sock != NULL);
new = GNUNET_YES;
}
static void set_address6(char* dev, char* address, unsigned long prefix_len) { /* {{{ */
int fd = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (fd < 0)
+ {
+ fprintf(stderr, "error creating socket: %m\n");
+ exit(1);
+ }
+
struct ifreq ifr;
struct in6_ifreq ifr6;
sa6.sin6_family = AF_INET6;
- /* FIXME */ inet_pton(AF_INET6, address, sa6.sin6_addr.s6_addr);
+ int r = inet_pton(AF_INET6, address, sa6.sin6_addr.s6_addr);
+ if (r < 0)
+ {
+ fprintf(stderr, "error at inet_pton: %m\n");
+ exit(1);
+ }
memcpy((char *) &ifr6.ifr6_addr, (char *) &sa6.sin6_addr, sizeof(struct in6_addr));
perror("SIOCSIFADDR");
}
- /* FIXME */ ioctl(fd, SIOCGIFFLAGS, &ifr);
+ (void)ioctl(fd, SIOCGIFFLAGS, &ifr);
ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
- /* FIXME */ ioctl(fd, SIOCSIFFLAGS, &ifr);
+ (void)ioctl(fd, SIOCSIFFLAGS, &ifr);
close(fd);
} /* }}} */
addr->sin_family = AF_INET;
addr->sin_addr.s_addr = inet_addr(address);
- /* FIXME */ inet_pton(AF_INET, address, &addr->sin_addr.s_addr);
+ int r = inet_pton(AF_INET, address, &addr->sin_addr.s_addr);
+ if (r < 0)
+ {
+ fprintf(stderr, "error at inet_pton: %m\n");
+ exit(1);
+ }
fd = socket(PF_INET, SOCK_DGRAM, 0);
if(fd < 0) {
}
addr = (struct sockaddr_in*)&(ifr.ifr_netmask);
- /* FIXME */ inet_pton(AF_INET, mask, &addr->sin_addr.s_addr);
+ r = inet_pton(AF_INET, mask, &addr->sin_addr.s_addr);
+ if (r < 0)
+ {
+ fprintf(stderr, "error at inet_pton: %m\n");
+ exit(1);
+ }
if(ioctl(fd, SIOCSIFNETMASK, &ifr) != 0 ) {
perror("SIOCSIFNETMASK");
return;
}
- /* FIXME */ ioctl(fd, SIOCGIFFLAGS, &ifr);
+ (void)ioctl(fd, SIOCGIFFLAGS, &ifr);
ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
- /* FIXME */ ioctl(fd, SIOCSIFFLAGS, &ifr);
+ (void)ioctl(fd, SIOCSIFFLAGS, &ifr);
close(fd);
} /* }}} */