File 2131-Support-URI-and-CAA-resource-records.patch of Package erlang

From fe92cecc1f721d862578b3889fe2e5f364bc79df Mon Sep 17 00:00:00 2001
From: Ruud Kamphuis <ruudk@users.noreply.github.com>
Date: Tue, 27 Oct 2020 08:22:05 +0100
Subject: [PATCH 1/6] Support URI and CAA resource records

---
 lib/kernel/src/inet_dns.erl | 10 ++++++++++
 lib/kernel/src/inet_dns.hrl |  8 ++++++++
 lib/kernel/src/inet_res.erl |  8 ++++----
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lib/kernel/src/inet_dns.erl b/lib/kernel/src/inet_dns.erl
index e03f124fe6..5c5ef20d41 100644
--- a/lib/kernel/src/inet_dns.erl
+++ b/lib/kernel/src/inet_dns.erl
@@ -336,6 +336,8 @@ decode_type(Type) ->
 	?T_MAILB -> ?S_MAILB;
 	?T_MAILA -> ?S_MAILA;
 	?T_ANY  -> ?S_ANY;
+	?T_URI  -> ?S_URI;
+	?T_CAA  -> ?S_CAA;
 	_ -> Type    %% raw unknown type
     end.
 
@@ -375,6 +377,8 @@ encode_type(Type) ->
 	?S_MAILB -> ?T_MAILB;
 	?S_MAILA -> ?T_MAILA;
 	?S_ANY -> ?T_ANY;
+	?S_URI -> ?T_URI;
+	?S_CAA -> ?T_CAA;
 	Type when is_integer(Type) -> Type    %% raw unknown type
     end.
 
@@ -480,6 +484,10 @@ decode_data(Data, _, ?S_TXT, _) ->
     decode_txt(Data);
 decode_data(Data, _, ?S_SPF, _) ->
     decode_txt(Data);
+decode_data(Data, _, ?S_URI, _) ->
+    decode_txt(Data);
+decode_data(Data, _, ?S_CAA, _) ->
+    decode_txt(Data);
 %% sofar unknown or non standard
 decode_data(Data, _, _, _) ->
     Data.
@@ -630,6 +638,8 @@ encode_data(Comp, Pos, ?S_NAPTR, in,
 %% ?S_OPT falls through to default
 encode_data(Comp, _, ?S_TXT, in, Data) -> {encode_txt(Data),Comp};
 encode_data(Comp, _, ?S_SPF, in, Data) -> {encode_txt(Data),Comp};
+encode_data(Comp, _, ?S_URI, in, Data) -> {encode_txt(Data),Comp};
+encode_data(Comp, _, ?S_CAA, in, Data) -> {encode_txt(Data),Comp};
 encode_data(Comp, _Pos, _Type, _Class, Data) -> {iolist_to_binary(Data),Comp}.
 
 %% Array of strings
diff --git a/lib/kernel/src/inet_dns.hrl b/lib/kernel/src/inet_dns.hrl
index 07226bbf5c..76e079c134 100644
--- a/lib/kernel/src/inet_dns.hrl
+++ b/lib/kernel/src/inet_dns.hrl
@@ -89,6 +89,10 @@
 -define(T_MAILB,	253).		%% transfer mailbox records
 -define(T_MAILA,	254).		%% transfer mail agent records
 -define(T_ANY,		255).		%% wildcard match
+%% URI (RFC 7553)
+-define(T_URI,		256).		%% uniform resource identifier
+%% CAA (RFC 6844)
+-define(T_CAA,		257).		%% certification authority authorization
 
 %%
 %% Symbolic Type values for resources and queries
@@ -127,6 +131,10 @@
 -define(S_MAILB,	mailb).		%% transfer mailbox records
 -define(S_MAILA,	maila).		%% transfer mail agent records
 -define(S_ANY,		any).		%% wildcard match
+%% URI (RFC 7553)
+-define(S_URI,		uri).		%% uniform resource identifier
+%% CAA (RFC 6844)
+-define(S_CAA,		caa).		%% certification authority authorization
 
 %%
 %% Values for class field
diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl
index 7886ef83ac..a357f1d919 100644
--- a/lib/kernel/src/inet_res.erl
+++ b/lib/kernel/src/inet_res.erl
@@ -66,9 +66,9 @@
 
 -type dns_name() :: string().
 
--type rr_type() :: a | aaaa | cname | gid | hinfo | ns | mb | md | mg | mf
-                 | minfo | mx | naptr | null | ptr | soa | spf | srv | txt
-                 | uid | uinfo | unspec | wks.
+-type rr_type() :: a | aaaa | caa | cname | gid | hinfo | ns | mb | md | mg
+                 | mf | minfo | mx | naptr | null | ptr | soa | spf | srv
+                 | txt | uid | uinfo | unspec | uri | wks.
 
 -type dns_class() :: in | chaos | hs | any.
 
@@ -487,7 +487,7 @@ type_p(Type) ->
 		        ?S_MD, ?S_MF, ?S_CNAME, ?S_SOA,
 		        ?S_MB, ?S_MG, ?S_MR, ?S_NULL,
 		        ?S_WKS, ?S_HINFO, ?S_TXT, ?S_SRV, ?S_NAPTR, ?S_SPF,
-		        ?S_UINFO, ?S_UID, ?S_GID]).
+		        ?S_UINFO, ?S_UID, ?S_GID, ?S_URI, ?S_CAA]).
 
 
 
-- 
2.26.2

openSUSE Build Service is sponsored by