From 3c3f1b42bbeb0932b13124ae3d3ef5aecc718a97 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 28 Aug 2017 13:00:45 +0000 Subject: [PATCH] - Fix WKS records on kvm autobuild host, with default protobyname entries for udp and tcp. git-svn-id: file:///svn/unbound/trunk@4314 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 2 ++ sldns/str2wire.c | 2 ++ sldns/wire2str.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index 1946a94a4..1333c8387 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -4,6 +4,8 @@ - Fix #1415: [dnscrypt] shared secret cache, patch from Manu Bretelle. - Small fixes for the shared secret cache patch. + - Fix WKS records on kvm autobuild host, with default protobyname + entries for udp and tcp. 23 August 2017: Wouter - Fix #1407: Add ECS options check to unbound-checkconf. diff --git a/sldns/str2wire.c b/sldns/str2wire.c index 0e5145888..9de94f3ac 100644 --- a/sldns/str2wire.c +++ b/sldns/str2wire.c @@ -1693,6 +1693,8 @@ int sldns_str2wire_wks_buf(const char* str, uint8_t* rd, size_t* len) struct protoent *p = getprotobyname(token); have_proto = 1; if(p) rd[0] = (uint8_t)p->p_proto; + else if(!p && strcasecmp(token, "tcp")==0) rd[0]=6; + else if(!p && strcasecmp(token, "udp")==0) rd[0]=17; else rd[0] = (uint8_t)atoi(token); (void)strlcpy(proto_str, token, sizeof(proto_str)); } else { diff --git a/sldns/wire2str.c b/sldns/wire2str.c index c1162e7ba..52b1ed0c2 100644 --- a/sldns/wire2str.c +++ b/sldns/wire2str.c @@ -1471,6 +1471,10 @@ int sldns_wire2str_wks_scan(uint8_t** d, size_t* dl, char** s, size_t* sl) if(protocol && (protocol->p_name != NULL)) { w += sldns_str_print(s, sl, "%s", protocol->p_name); proto_name = protocol->p_name; + } else if(protocol_nr == 6) { + w += sldns_str_print(s, sl, "tcp"); + } else if(protocol_nr == 17) { + w += sldns_str_print(s, sl, "udp"); } else { w += sldns_str_print(s, sl, "%u", (unsigned)protocol_nr); } -- 2.47.3