Skip to content

Commit a171722

Browse files
charlesgoyardDimitriPapadopoulos
authored andcommitted
Add dns suffix information to informative message
1 parent c81fde1 commit a171722

5 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ static void *ssl_read(void *arg)
473473

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

478478
set_tunnel_ips(tunnel, packet);
479479
strcpy(line, "[");
@@ -482,6 +482,8 @@ static void *ssl_read(void *arg)
482482
strncat(line, inet_ntoa(tunnel->ipv4.ns1_addr), 15);
483483
strcat(line, ", ");
484484
strncat(line, inet_ntoa(tunnel->ipv4.ns2_addr), 15);
485+
strcat(line, "], ns_suffix [");
486+
strncat(line, tunnel->ipv4.dns_suffix, MAX_DOMAIN_LENGTH);
485487
strcat(line, "]");
486488
log_info("Got addresses: %s\n", line);
487489
}

src/ipv4.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ struct rtentry {
6464
#define MAX_SPLIT_ROUTES 65535
6565
#define STEP_SPLIT_ROUTES 32
6666

67+
// see https://unix.stackexchange.com/questions/245849
68+
// ... /resolv-conf-limited-to-six-domains-with-a-total-of-256-characters
69+
#define MAX_DOMAIN_LENGTH 256
70+
6771
struct ipv4_config {
6872
struct in_addr ip_addr;
6973

src/xml.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
#include "xml.h"
19+
#include "ipv4.h"
1920
#include "log.h"
2021

2122
#include <string.h>

src/xml.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
#ifndef OPENFORTIVPN_XML_H
1919
#define OPENFORTIVPN_XML_H
2020

21-
#define MAX_DOMAIN_LENGTH 256
22-
// see https://unix.stackexchange.com/questions/245849
23-
// ... /resolv-conf-limited-to-six-domains-with-a-total-of-256-characters
24-
2521
const char *xml_find(char t, const char *tag, const char *buf, int nest);
2622
char *xml_get(const char *buf);
2723

tests/lint/line_length.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def endswithstring(line):
3939
True if line ends with string, False otherwise.
4040
4141
"""
42-
for end in ('"', '",', '");', '";', '" \\', ')];'):
42+
for end in ('"', '",', '");', '";', '" \\', '];'):
4343
if line.endswith(end):
4444
return True
4545
return False

0 commit comments

Comments
 (0)