diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e11291eb..915c722e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,7 +177,6 @@ set(LIB_SRC llarp/address_info.cpp llarp/bencode.cpp llarp/buffer.cpp - llarp/base64.cpp llarp/config.cpp llarp/context.cpp llarp/crypto_async.cpp diff --git a/daemon/dns.cpp b/daemon/dns.cpp index 13ac50e60..a04724c38 100644 --- a/daemon/dns.cpp +++ b/daemon/dns.cpp @@ -1,19 +1,20 @@ -#include #include -#include /* fprintf, printf */ +#include +#include /* fprintf, printf */ +#include -#include +#include /* getaddrinfo, getnameinfo */ +#include /* exit */ +#include /* memset */ #include -#include /* getaddrinfo, getnameinfo */ -#include /* exit */ -#include /* memset */ +#include -#include #include +#include #include -#include "net.hpp" #include "logger.hpp" +#include "net.hpp" bool done = false; @@ -26,9 +27,10 @@ handle_signal(int sig) #define BUF_SIZE 512 -struct query { +struct query +{ uint16_t length; - char * url; + char *url; unsigned char request[BUF_SIZE]; uint16_t reqType; }; @@ -36,173 +38,198 @@ struct query { #define SERVER "8.8.8.8" #define PORT 53 -struct sockaddr *resolveHost(char *url) { +struct sockaddr * +resolveHost(char *url) +{ struct query dnsQuery; dnsQuery.length = 12; dnsQuery.url = url; dnsQuery.reqType = 0x01; - // dnsQuery.request = { 0xDB, 0x42, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - dnsQuery.request[ 0] = 0xDB; - dnsQuery.request[ 1] = 0x42; - dnsQuery.request[ 2] = 0x01; - dnsQuery.request[ 3] = 0x00; - dnsQuery.request[ 4] = 0x00; - dnsQuery.request[ 5] = 0x01; - dnsQuery.request[ 6] = 0x00; - dnsQuery.request[ 7] = 0x00; - dnsQuery.request[ 8] = 0x00; - dnsQuery.request[ 9] = 0x00; + // dnsQuery.request = { 0xDB, 0x42, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + // 0x00, 0x00, 0x00 }; + dnsQuery.request[0] = 0xDB; + dnsQuery.request[1] = 0x42; + dnsQuery.request[2] = 0x01; + dnsQuery.request[3] = 0x00; + dnsQuery.request[4] = 0x00; + dnsQuery.request[5] = 0x01; + dnsQuery.request[6] = 0x00; + dnsQuery.request[7] = 0x00; + dnsQuery.request[8] = 0x00; + dnsQuery.request[9] = 0x00; dnsQuery.request[10] = 0x00; dnsQuery.request[11] = 0x00; - - char * word; + + char *word; unsigned int i; llarp::LogDebug("Asking DNS server %s about %s\n", SERVER, url); - dnsQuery.url = strdup(url); + dnsQuery.url = strdup(url); dnsQuery.reqType = 0x01; word = strtok(url, "."); - while (word) { - llarp::LogDebug("parsing hostname: \"%s\" is %zu characters\n", word, strlen(word)); + while(word) + { + llarp::LogDebug("parsing hostname: \"%s\" is %zu characters\n", word, + strlen(word)); dnsQuery.request[dnsQuery.length++] = strlen(word); - for (i = 0; i < strlen(word); i++) { + for(i = 0; i < strlen(word); i++) + { dnsQuery.request[dnsQuery.length++] = word[i]; } word = strtok(NULL, "."); } - dnsQuery.request[dnsQuery.length++] = 0x00; // End of the host name - dnsQuery.request[dnsQuery.length++] = 0x00; // 0x0001 - Query is a Type A query (host address) + dnsQuery.request[dnsQuery.length++] = 0x00; // End of the host name + dnsQuery.request[dnsQuery.length++] = + 0x00; // 0x0001 - Query is a Type A query (host address) dnsQuery.request[dnsQuery.length++] = dnsQuery.reqType; - dnsQuery.request[dnsQuery.length++] = 0x00; // 0x0001 - Query is class IN (Internet address) + dnsQuery.request[dnsQuery.length++] = + 0x00; // 0x0001 - Query is class IN (Internet address) dnsQuery.request[dnsQuery.length++] = 0x01; struct sockaddr_in addr; - //int socket; + // int socket; ssize_t ret; int rcode; socklen_t size; int ip = 0; int length; unsigned char buffer[BUF_SIZE]; - //unsigned char tempBuf[3]; - uint16_t QDCOUNT; //No. of items in Question Section - uint16_t ANCOUNT; //No. of items in Answer Section - uint16_t NSCOUNT; //No. of items in Authority Section - uint16_t ARCOUNT; //No. of items in Additional Section - uint16_t QCLASS; //Specifies the class of the query - uint16_t ATYPE; //Specifies the meaning of the data in the RDATA field - uint16_t ACLASS; //Specifies the class of the data in the RDATA field - uint32_t TTL; //The number of seconds the results can be cached - uint16_t RDLENGTH; //The length of the RDATA field + // unsigned char tempBuf[3]; + uint16_t QDCOUNT; // No. of items in Question Section + uint16_t ANCOUNT; // No. of items in Answer Section + uint16_t NSCOUNT; // No. of items in Authority Section + uint16_t ARCOUNT; // No. of items in Additional Section + uint16_t QCLASS; // Specifies the class of the query + uint16_t ATYPE; // Specifies the meaning of the data in the RDATA field + uint16_t ACLASS; // Specifies the class of the data in the RDATA field + uint32_t TTL; // The number of seconds the results can be cached + uint16_t RDLENGTH; // The length of the RDATA field uint16_t MSGID; int sockfd; sockfd = socket(AF_INET, SOCK_DGRAM, 0); - if (sockfd < 0) { + if(sockfd < 0) + { llarp::LogWarn("Error creating socket!\n"); return nullptr; } - //socket = sockfd; + // socket = sockfd; memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; + addr.sin_family = AF_INET; addr.sin_addr.s_addr = inet_addr(SERVER); - addr.sin_port = htons(PORT); - size = sizeof(addr); + addr.sin_port = htons(PORT); + size = sizeof(addr); - //hexdump("sending packet", &dnsQuery.request, dnsQuery.length); - ret = sendto(sockfd, dnsQuery.request, dnsQuery.length, 0, (struct sockaddr*)&addr, size); - if (ret < 0) { + // hexdump("sending packet", &dnsQuery.request, dnsQuery.length); + ret = sendto(sockfd, dnsQuery.request, dnsQuery.length, 0, + (struct sockaddr *)&addr, size); + if(ret < 0) + { llarp::LogWarn("Error Sending Request"); return nullptr; } - //printf("Sent\n"); + // printf("Sent\n"); memset(&buffer, 0, BUF_SIZE); - ret = recvfrom(sockfd, buffer, BUF_SIZE, 0, (struct sockaddr*)&addr, &size); - if (ret < 0) { + ret = recvfrom(sockfd, buffer, BUF_SIZE, 0, (struct sockaddr *)&addr, &size); + if(ret < 0) + { llarp::LogWarn("Error Receiving Response"); return nullptr; } - //hexdump("received packet", &buffer, ret); + // hexdump("received packet", &buffer, ret); close(sockfd); rcode = (buffer[3] & 0x0F); - //tempBuf[0] = buffer[4]; - //tempBuf[1] = buffer[5]; - //tempBuf[2] = '\0'; + // tempBuf[0] = buffer[4]; + // tempBuf[1] = buffer[5]; + // tempBuf[2] = '\0'; - //printf("%0x %0x %0x %0x\n", buffer[4], buffer[5], tempBuf[0], tempBuf[1]); + // printf("%0x %0x %0x %0x\n", buffer[4], buffer[5], tempBuf[0], tempBuf[1]); - //QDCOUNT = (uint16_t) strtol(tempBuf, NULL, 16); - QDCOUNT = (uint16_t) buffer[4] * 0x100 + buffer[5]; + // QDCOUNT = (uint16_t) strtol(tempBuf, NULL, 16); + QDCOUNT = (uint16_t)buffer[4] * 0x100 + buffer[5]; llarp::LogDebug("entries in question section: %u\n", QDCOUNT); - ANCOUNT = (uint16_t) buffer[6] * 0x100 + buffer[7]; + ANCOUNT = (uint16_t)buffer[6] * 0x100 + buffer[7]; llarp::LogDebug("records in answer section: %u\n", ANCOUNT); - NSCOUNT = (uint16_t) buffer[8] * 0x100 + buffer[9]; + NSCOUNT = (uint16_t)buffer[8] * 0x100 + buffer[9]; llarp::LogDebug("name server resource record count: %u\n", NSCOUNT); - ARCOUNT = (uint16_t) buffer[10] * 0x100 + buffer[11]; + ARCOUNT = (uint16_t)buffer[10] * 0x100 + buffer[11]; llarp::LogDebug("additional records count: %u\n", ARCOUNT); llarp::LogDebug("query type: %u\n", dnsQuery.reqType); - QCLASS = (uint16_t) dnsQuery.request[dnsQuery.length - 2] * 0x100 + dnsQuery.request[dnsQuery.length - 1]; + QCLASS = (uint16_t)dnsQuery.request[dnsQuery.length - 2] * 0x100 + + dnsQuery.request[dnsQuery.length - 1]; llarp::LogDebug("query class: %u\n", QCLASS); - length = dnsQuery.length + 1; // to skip 0xc00c - ATYPE = (uint16_t) buffer[length + 1] * 0x100 + buffer[length + 2]; + length = dnsQuery.length + 1; // to skip 0xc00c + ATYPE = (uint16_t)buffer[length + 1] * 0x100 + buffer[length + 2]; llarp::LogDebug("answer type: %u\n", ATYPE); - ACLASS = (uint16_t) buffer[length + 3] * 0x100 + buffer[length + 4]; + ACLASS = (uint16_t)buffer[length + 3] * 0x100 + buffer[length + 4]; llarp::LogDebug("answer class: %u\n", ACLASS); - TTL = (uint32_t) buffer[length + 5] * 0x1000000 + buffer[length + 6] * 0x10000 + buffer[length + 7] * 0x100 + buffer[length + 8]; + TTL = (uint32_t)buffer[length + 5] * 0x1000000 + buffer[length + 6] * 0x10000 + + buffer[length + 7] * 0x100 + buffer[length + 8]; llarp::LogDebug("seconds to cache: %u\n", TTL); - RDLENGTH = (uint16_t) buffer[length + 9] * 0x100 + buffer[length + 10]; + RDLENGTH = (uint16_t)buffer[length + 9] * 0x100 + buffer[length + 10]; llarp::LogDebug("bytes in answer: %u\n", RDLENGTH); - MSGID = (uint16_t) buffer[0] * 0x100 + buffer[1]; + MSGID = (uint16_t)buffer[0] * 0x100 + buffer[1]; llarp::LogDebug("answer msg id: %u\n", MSGID); - - - if (rcode == 2) { + if(rcode == 2) + { llarp::LogWarn("nameserver %s returned SERVFAIL:\n", SERVER); - llarp::LogWarn(" the name server was unable to process this query due to a\n problem with the name server.\n"); + llarp::LogWarn( + " the name server was unable to process this query due to a\n " + "problem with the name server.\n"); return nullptr; - } else if (rcode == 3) { - llarp::LogWarn("nameserver %s returned NXDOMAIN for %s:\n", SERVER, dnsQuery.url); - llarp::LogWarn(" the domain name referenced in the query does not exist\n"); + } + else if(rcode == 3) + { + llarp::LogWarn("nameserver %s returned NXDOMAIN for %s:\n", SERVER, + dnsQuery.url); + llarp::LogWarn( + " the domain name referenced in the query does not exist\n"); return nullptr; } /* search for and print IPv4 addresses */ - if (dnsQuery.reqType == 0x01) { + if(dnsQuery.reqType == 0x01) + { llarp::LogDebug("DNS server's answer is: (type#=%u):", ATYPE); - //printf("IPv4 address(es) for %s:\n", dnsQuery.url); - for (i = 0 ; i < ret ; i++) { - if (buffer[i] == 0xC0 && buffer[i+3] == 0x01) { - ip++; i += 12; /* ! += buf[i+1]; */ - llarp::LogDebug(" %u.%u.%u.%u\n", buffer[i], buffer[i+1], buffer[i+2], buffer[i+3]); + // printf("IPv4 address(es) for %s:\n", dnsQuery.url); + for(i = 0; i < ret; i++) + { + if(buffer[i] == 0xC0 && buffer[i + 3] == 0x01) + { + ip++; + i += 12; /* ! += buf[i+1]; */ + llarp::LogDebug(" %u.%u.%u.%u\n", buffer[i], buffer[i + 1], + buffer[i + 2], buffer[i + 3]); struct sockaddr *g_addr = new sockaddr; - g_addr->sa_family = AF_INET; - g_addr->sa_len = sizeof(in_addr); + g_addr->sa_family = AF_INET; + // g_addr->sa_len = sizeof(in_addr); struct in_addr *addr = &((struct sockaddr_in *)g_addr)->sin_addr; - unsigned char * ip; - - //have ip point to s_addr - ip = (unsigned char *) &(addr->s_addr); - - ip[0]=buffer[i + 0]; - ip[1]=buffer[i + 1]; - ip[2]=buffer[i + 2]; - ip[3]=buffer[i + 3]; - + unsigned char *ip; + + // have ip point to s_addr + ip = (unsigned char *)&(addr->s_addr); + + ip[0] = buffer[i + 0]; + ip[1] = buffer[i + 1]; + ip[2] = buffer[i + 2]; + ip[3] = buffer[i + 3]; + return g_addr; } } - if (!ip) { + if(!ip) + { llarp::LogWarn(" No IPv4 address found in the DNS response!\n"); return nullptr; } @@ -210,23 +237,26 @@ struct sockaddr *resolveHost(char *url) { return nullptr; } -int get16bits(const char*& buffer) throw () +int +get16bits(const char *&buffer) throw() { - int value = static_cast (buffer[0]); - value = value << 8; - value += static_cast (buffer[1]); + int value = static_cast< unsigned char >(buffer[0]); + value = value << 8; + value += static_cast< unsigned char >(buffer[1]); buffer += 2; return value; } -void put16bits(char*& buffer, uint value) throw () +void +put16bits(char *&buffer, uint value) throw() { buffer[0] = (value & 0xFF00) >> 8; buffer[1] = value & 0xFF; buffer += 2; } -void put32bits(char*& buffer, unsigned long value) throw () +void +put32bits(char *&buffer, unsigned long value) throw() { buffer[0] = (value & 0xFF000000) >> 24; buffer[1] = (value & 0xFF0000) >> 16; @@ -245,25 +275,26 @@ struct dns_msg uint rd; uint ra; uint rcode; - + uint qdCount; uint anCount; uint nsCount; uint arCount; }; -dns_msg *decode_hdr(const char *buffer) +dns_msg * +decode_hdr(const char *buffer) { dns_msg *hdr = new dns_msg; - hdr->id = get16bits(buffer); - uint fields = get16bits(buffer); - hdr->qr = fields & 0x8000; - hdr->opcode = fields & 0x7800; - hdr->aa = fields & 0x0400; - hdr->tc = fields & 0x0200; - hdr->rd = fields & 0x0100; - hdr->ra = fields & 0x8000; - + hdr->id = get16bits(buffer); + uint fields = get16bits(buffer); + hdr->qr = fields & 0x8000; + hdr->opcode = fields & 0x7800; + hdr->aa = fields & 0x0400; + hdr->tc = fields & 0x0200; + hdr->rd = fields & 0x0100; + hdr->ra = fields & 0x8000; + hdr->qdCount = get16bits(buffer); hdr->anCount = get16bits(buffer); hdr->nsCount = get16bits(buffer); @@ -271,32 +302,31 @@ dns_msg *decode_hdr(const char *buffer) return hdr; } -void code_domain(char*& buffer, const std::string& domain) throw() +void +code_domain(char *&buffer, const std::string &domain) throw() { - - int start(0), end; // indexes + int start(0), end; // indexes llarp::LogInfo("domain [", domain, "]"); - while ((end = domain.find('.', start)) != std::string::npos) + while((end = domain.find('.', start)) != std::string::npos) { - - *buffer++ = end - start; // label length octet - for (int i=start; iid); - int fields = (1 << 15); // QR => message type, 1 = response - fields += (0 << 14); // I think opcode is always 0 - fields += 3; // response code (3 => not found, 0 = Ok) + int fields = (1 << 15); // QR => message type, 1 = response + fields += (0 << 14); // I think opcode is always 0 + fields += 3; // response code (3 => not found, 0 = Ok) put16bits(write_buffer, fields); - - put16bits(write_buffer, 1); // QD (number of questions) - put16bits(write_buffer, 1); // AN (number of answers) - put16bits(write_buffer, 0); // NS (number of auth RRs) - put16bits(write_buffer, 0); // AR (number of Additional RRs) + + put16bits(write_buffer, 1); // QD (number of questions) + put16bits(write_buffer, 1); // AN (number of answers) + put16bits(write_buffer, 0); // NS (number of auth RRs) + put16bits(write_buffer, 0); // AR (number of Additional RRs) write_buffer += HDR_OFFSET; - + // code question llarp::LogInfo("qName2 ", m_qName); printf("at0 [%d]\n", write_buffer); @@ -409,20 +443,21 @@ main(int argc, char *argv[]) put16bits(write_buffer, m_qType); put16bits(write_buffer, m_qClass); printf("at3 [%d]\n", write_buffer); - + // code answer std::string resp_str(inet_ntoa(*anIp.addr4())); code_domain(write_buffer, ""); put16bits(write_buffer, m_qType); put16bits(write_buffer, m_qClass); - put32bits(write_buffer, 0); // ttl - put16bits(write_buffer, 1); // rdLength + put32bits(write_buffer, 0); // ttl + put16bits(write_buffer, 1); // rdLength uint out_bytes = write_buffer - bufferBegin; llarp::LogInfo("Sending ", out_bytes, " bytes"); - - //nbytes = m_response.code(buffer); - - sendto(m_sockfd, buffer, out_bytes, 0, (struct sockaddr *) &clientAddress, addrLen); + + // nbytes = m_response.code(buffer); + + sendto(m_sockfd, buffer, out_bytes, 0, (struct sockaddr *)&clientAddress, + addrLen); } /* std::string host("www.google.com"); @@ -436,5 +471,4 @@ main(int argc, char *argv[]) */ return code; - } diff --git a/daemon/main.cpp b/daemon/main.cpp index 462f8f3a7..d2197afed 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -1,8 +1,8 @@ +#include #include -#include #include -#include -#include // for MIN +#include +#include // for MIN struct llarp_main *ctx = 0; @@ -25,9 +25,9 @@ main(int argc, char *argv[]) while(1) { static struct option long_options[] = { - {"config", required_argument, 0, 'c'}, - {"logLevel", required_argument, 0, 'o'}, - {0, 0, 0, 0}}; + {"config", required_argument, 0, 'c'}, + {"logLevel", required_argument, 0, 'o'}, + {0, 0, 0, 0}}; int option_index = 0; c = getopt_long(argc, argv, "c:o:", long_options, &option_index); if(c == -1) @@ -40,22 +40,22 @@ main(int argc, char *argv[]) conffname = optarg; break; case 'o': - if (strncmp(optarg, "debug", MIN(strlen(optarg), (unsigned long)5))==0) + if(strncmp(optarg, "debug", MIN(strlen(optarg), (unsigned long)5)) == 0) { cSetLogLevel(eLogDebug); } - else - if (strncmp(optarg, "info", MIN(strlen(optarg), (unsigned long)4))==0) + else if(strncmp(optarg, "info", MIN(strlen(optarg), (unsigned long)4)) + == 0) { cSetLogLevel(eLogInfo); } - else - if (strncmp(optarg, "warn", MIN(strlen(optarg), (unsigned long)4))==0) + else if(strncmp(optarg, "warn", MIN(strlen(optarg), (unsigned long)4)) + == 0) { cSetLogLevel(eLogWarn); } - else - if (strncmp(optarg, "error", MIN(strlen(optarg), (unsigned long)5))==0) + else if(strncmp(optarg, "error", MIN(strlen(optarg), (unsigned long)5)) + == 0) { cSetLogLevel(eLogError); } @@ -64,14 +64,14 @@ main(int argc, char *argv[]) abort(); } } - + ctx = llarp_main_init(conffname, !TESTNET); int code = 1; if(ctx) { signal(SIGINT, handle_signal); code = llarp_main_run(ctx); - //llarp_main_free(ctx); + // llarp_main_free(ctx); } return code; } diff --git a/daemon/rcutil.cpp b/daemon/rcutil.cpp index 481566b63..d4626b0c9 100644 --- a/daemon/rcutil.cpp +++ b/daemon/rcutil.cpp @@ -48,11 +48,12 @@ aiLister(struct llarp_ai_list_iter *request, struct llarp_ai *addr) return true; } -void displayRC(llarp_rc *rc) +void +displayRC(llarp_rc *rc) { char ftmp[68] = {0}; const char *hexPubSigKey = - llarp::HexEncode< llarp::PubKey, decltype(ftmp) >(rc->pubkey, ftmp); + llarp::HexEncode< llarp::PubKey, decltype(ftmp) >(rc->pubkey, ftmp); printf("PubSigKey [%s]\n", hexPubSigKey); struct llarp_ai_list_iter iter; @@ -68,20 +69,21 @@ void HandleDHTLocate(llarp_router_lookup_job *job) { llarp::LogInfo("DHT result: ", job->found ? "found" : "not found"); - if (job->found) + if(job->found) { // save to nodedb? displayRC(&job->result); } // shutdown router - // well because we're in the gotroutermessage, we can't sigint because we'll deadlock because we're session locked - //llarp_main_signal(ctx, SIGINT); + // well because we're in the gotroutermessage, we can't sigint because we'll + // deadlock because we're session locked + // llarp_main_signal(ctx, SIGINT); // llarp_timer_run(logic->timer, logic->thread); // we'll we don't want logic thread // but we want to switch back to the main thread - //llarp_logic_stop(); + // llarp_logic_stop(); // still need to exit this logic thread... llarp_main_abort(ctx); } @@ -146,7 +148,8 @@ main(int argc, char *argv[]) {"read", required_argument, 0, 'r'}, {0, 0, 0, 0}}; int option_index = 0; - c = getopt_long(argc, argv, "c:o:g:lu:i:e:q:nr:", long_options, &option_index); + c = getopt_long(argc, argv, "c:o:g:lu:i:e:q:nr:", long_options, + &option_index); if(c == -1) break; switch(c) @@ -157,22 +160,30 @@ main(int argc, char *argv[]) conffname = optarg; break; case 'o': - if (strncmp(optarg, "debug", std::min(strlen(optarg), static_cast(5)))==0) + if(strncmp(optarg, "debug", + std::min(strlen(optarg), static_cast< unsigned long >(5))) + == 0) { llarp::SetLogLevel(llarp::eLogDebug); } - else - if (strncmp(optarg, "info", std::min(strlen(optarg), static_cast(4)))==0) + else if(strncmp( + optarg, "info", + std::min(strlen(optarg), static_cast< unsigned long >(4))) + == 0) { - llarp::SetLogLevel(llarp::eLogInfo); + llarp::SetLogLevel(llarp::eLogInfo); } - else - if (strncmp(optarg, "warn", std::min(strlen(optarg), static_cast(4)))==0) + else if(strncmp( + optarg, "warn", + std::min(strlen(optarg), static_cast< unsigned long >(4))) + == 0) { llarp::SetLogLevel(llarp::eLogWarn); } - else - if (strncmp(optarg, "error", std::min(strlen(optarg), static_cast(5)))==0) + else if(strncmp( + optarg, "error", + std::min(strlen(optarg), static_cast< unsigned long >(5))) + == 0) { llarp::SetLogLevel(llarp::eLogError); } @@ -378,7 +389,7 @@ main(int argc, char *argv[]) } if(localMode) { - llarp_rc *rc = llarp_main_getLocalRC(ctx); + llarp_rc *rc = llarp_main_getLocalRC(ctx); displayRC(rc); } if(readMode) @@ -387,6 +398,6 @@ main(int argc, char *argv[]) displayRC(rc); } // it's a unique_ptr, should clean up itself - //llarp_main_free(ctx); + // llarp_main_free(ctx); return 1; // success } diff --git a/include/llarp/iwp/server.hpp b/include/llarp/iwp/server.hpp index a54cffd80..75961918e 100644 --- a/include/llarp/iwp/server.hpp +++ b/include/llarp/iwp/server.hpp @@ -421,7 +421,7 @@ struct llarp_link // give link implementations // link->parent = l; timeout_job_id = 0; - this->logic = pLogic; + this->logic = pLogic; // start cleanup timer issue_cleanup_timer(500); return true; diff --git a/include/llarp/router_contact.h b/include/llarp/router_contact.h index ecada1960..33ffd6556 100644 --- a/include/llarp/router_contact.h +++ b/include/llarp/router_contact.h @@ -45,7 +45,6 @@ llarp_rc_free(struct llarp_rc *rc); bool llarp_rc_new(struct llarp_rc *rc); - bool llarp_rc_verify_sig(struct llarp_crypto *crypto, struct llarp_rc *rc); diff --git a/llarp/dht/context.cpp b/llarp/dht/context.cpp index 8beb46ee9..0e57af9ef 100644 --- a/llarp/dht/context.cpp +++ b/llarp/dht/context.cpp @@ -67,8 +67,8 @@ namespace llarp { // yeah, ask neighboor recursively // FIXME: we may need to pass a job here... - //auto sj = FindPendingTX(requester, txid); - //LookupRouter(target, requester, txid, next, sj->job); + // auto sj = FindPendingTX(requester, txid); + // LookupRouter(target, requester, txid, next, sj->job); LookupRouter(target, requester, txid, next); } } @@ -200,7 +200,8 @@ namespace llarp } */ llarp::LogInfo("LookupRouterViaJob node count: ", nodes->nodes.size()); - llarp::LogInfo("LookupRouterViaJob recursive: ", job->iterative?"yes":"no"); + llarp::LogInfo("LookupRouterViaJob recursive: ", + job->iterative ? "yes" : "no"); if(nodes->FindClosest(job->target, peer)) LookupRouter(job->target, ourKey, 0, peer, job, job->iterative); diff --git a/llarp/dht/got_router.cpp b/llarp/dht/got_router.cpp index 08537e482..44e56034f 100644 --- a/llarp/dht/got_router.cpp +++ b/llarp/dht/got_router.cpp @@ -87,10 +87,11 @@ namespace llarp " iterating to next peer ", nextPeer, " already asked ", pending->exclude.size(), " other peers"); - // REVIEW: is this ok to relay the pending->job as the current job (seems to make things work) + // REVIEW: is this ok to relay the pending->job as the current job + // (seems to make things work) dht.LookupRouter(pending->target, pending->requester, - pending->requesterTX, nextPeer, pending->job, - true, pending->exclude); + pending->requesterTX, nextPeer, pending->job, true, + pending->exclude); } else { diff --git a/llarp/router.cpp b/llarp/router.cpp index be53b236d..e698419ea 100644 --- a/llarp/router.cpp +++ b/llarp/router.cpp @@ -167,7 +167,7 @@ llarp_router::try_connect(fs::path rcfile) llarp_rc *remote = new llarp_rc; llarp_rc_new(remote); remote = llarp_rc_read(rcfile.c_str()); - if (!remote) + if(!remote) { llarp::LogError("failure to decode or verify of remote RC"); return; @@ -357,7 +357,7 @@ llarp_router::HandleExploritoryPathBuildStarted(llarp_pathbuild_job *job) void llarp_router::Tick() { - //llarp::LogDebug("tick router"); + // llarp::LogDebug("tick router"); paths.ExpirePaths(); // TODO: don't do this if we have enough paths already @@ -616,7 +616,7 @@ llarp_router::Run() } if(a.isPrivate()) { - if (!this->publicOverride) + if(!this->publicOverride) { llarp::LogWarn("Skipping private network link: ", a); continue;