Skip to content

Commit

Permalink
Add dns suffix information to informative message
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesgoyard authored and DimitriPapadopoulos committed Apr 16, 2020
1 parent c81fde1 commit d00c041
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static void *ssl_read(void *arg)

if (tunnel->state == STATE_CONNECTING) {
if (packet_is_ip_plus_dns(packet)) {
char line[ARRAY_SIZE("[xxx.xxx.xxx.xxx], ns [xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx]")];
char line[ARRAY_SIZE("[xxx.xxx.xxx.xxx], ns [xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx], ns_suffix []") + MAX_DOMAIN_LENGTH];

set_tunnel_ips(tunnel, packet);
strcpy(line, "[");
Expand All @@ -482,6 +482,8 @@ static void *ssl_read(void *arg)
strncat(line, inet_ntoa(tunnel->ipv4.ns1_addr), 15);
strcat(line, ", ");
strncat(line, inet_ntoa(tunnel->ipv4.ns2_addr), 15);
strcat(line, "], ns_suffix [");
strncat(line, tunnel->ipv4.dns_suffix, MAX_DOMAIN_LENGTH);
strcat(line, "]");
log_info("Got addresses: %s\n", line);
}
Expand Down
4 changes: 4 additions & 0 deletions src/ipv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ struct rtentry {
#define MAX_SPLIT_ROUTES 65535
#define STEP_SPLIT_ROUTES 32

// see https://unix.stackexchange.com/questions/245849
// ... /resolv-conf-limited-to-six-domains-with-a-total-of-256-characters
#define MAX_DOMAIN_LENGTH 256

struct ipv4_config {
struct in_addr ip_addr;

Expand Down
1 change: 1 addition & 0 deletions src/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "xml.h"
#include "ipv4.h"
#include "log.h"

#include <string.h>
Expand Down
4 changes: 0 additions & 4 deletions src/xml.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
#ifndef OPENFORTIVPN_XML_H
#define OPENFORTIVPN_XML_H

#define MAX_DOMAIN_LENGTH 256
// see https://unix.stackexchange.com/questions/245849
// ... /resolv-conf-limited-to-six-domains-with-a-total-of-256-characters

const char *xml_find(char t, const char *tag, const char *buf, int nest);
char *xml_get(const char *buf);

Expand Down

0 comments on commit d00c041

Please sign in to comment.