Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dns suffix information to informative message #636

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion tests/lint/line_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def endswithstring(line):
True if line ends with string, False otherwise.

"""
for end in ('"', '",', '");', '";', '" \\', ')];'):
for end in ('"', '",', '");', '";', '" \\', '];'):
if line.endswith(end):
return True
return False
Expand Down