From 3f166bcbd7f0e1060eecdce643c025db425ae81d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 5 Jun 2020 18:38:03 -0600 Subject: syntax: update to latest from wireguard-tools, for dns search domains Signed-off-by: Jason A. Donenfeld --- ui/syntax/highlighter.c | 12 ++++++------ ui/syntax/highlighter.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ui/syntax') diff --git a/ui/syntax/highlighter.c b/ui/syntax/highlighter.c index e0d4e04e..d89feda1 100644 --- a/ui/syntax/highlighter.c +++ b/ui/syntax/highlighter.c @@ -337,11 +337,6 @@ static bool is_valid_network(string_span_t s) return is_valid_ipv4(s) || is_valid_ipv6(s); } -static bool is_valid_dns(string_span_t s) -{ - return is_valid_ipv4(s) || is_valid_ipv6(s); -} - enum field { InterfaceSection, PrivateKey, @@ -451,7 +446,12 @@ static void highlight_multivalue_value(struct highlight_span_array *ret, const s { switch (section) { case DNS: - append_highlight_span(ret, parent.s, s, is_valid_dns(s) ? HighlightIP : HighlightError); + if (is_valid_ipv4(s) || is_valid_ipv6(s)) + append_highlight_span(ret, parent.s, s, HighlightIP); + else if (is_valid_hostname(s)) + append_highlight_span(ret, parent.s, s, HighlightHost); + else + append_highlight_span(ret, parent.s, s, HighlightError); break; case Address: case AllowedIPs: { diff --git a/ui/syntax/highlighter.h b/ui/syntax/highlighter.h index c6c8b5d5..0a86de78 100644 --- a/ui/syntax/highlighter.h +++ b/ui/syntax/highlighter.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved. + * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. */ #include -- cgit v1.2.3-59-g8ed1b