diff --git a/CHANGES b/CHANGES index 2375c981b..2c9b605f6 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ * Name.for_reverse has been replaced by Name.of_ipaddr * Name.of_ipaddr accepts a Ipaddr.t and produces a name suitable for reverse DNS * We now require >= ipaddr.2.6.0 to support Name.of_ipaddr +* Uri 1.9.0+ is now required for its uri.services_full service registry 0.14.1 (2015-03-29): * Reduce namespace pollution in `name.ml` to avoid breaking with Cstruct 1.6.0+. diff --git a/_oasis b/_oasis index 01a648ebd..484009290 100644 --- a/_oasis +++ b/_oasis @@ -1,6 +1,6 @@ OASISFormat: 0.4 Name: dns -Version: 0.14.1 +Version: 0.15.0 Authors: Anil Madhavapeddy, Tim Deegan, Richard Mortier, Haris Rotsos, David Sheets, Thomas Gazagnaire, Luke Dunstan Maintainers: Anil Madhavapeddy License: ISC @@ -35,8 +35,8 @@ Library dns Modules: Hashcons, Loader, Name, Operators, Packet, Query, RR, Trie, Zone, Zone_lexer, Zone_parser, Resolvconf, Buf, Protocol - BuildDepends: cstruct (>= 0.7.1), cstruct.syntax, re, re.str, ipaddr (>= 2.2.0), base64 (>= 2.0.0), bytes - XMetaRequires: cstruct, re, re.str, ipaddr, base64, bytes + BuildDepends: cstruct (>= 0.7.1), cstruct.syntax, re, re.str, ipaddr (>= 2.2.0), base64 (>= 2.0.0), bytes, uri.services_full + XMetaRequires: cstruct, re, re.str, ipaddr, base64, bytes, uri.services_full Library "dns-lwt" Path: lwt diff --git a/lib/zone_parser.mly b/lib/zone_parser.mly index 444e9d9fa..97c37cd0b 100644 --- a/lib/zone_parser.mly +++ b/lib/zone_parser.mly @@ -85,11 +85,16 @@ let parse_wks proto services = (* try (getservbyname s (getprotobynumber proto).p_name).s_port *) - try raise Not_found - with Not_found -> - parse_error ("unknown service \"" ^ s ^ "\" for protocol " - ^ (string_of_int (Cstruct.byte_to_int proto))); - raise Parsing.Parse_error + let proto, ports = match Cstruct.byte_to_int proto with + | 6 -> "tcp", Uri_services_full.tcp_port_of_service s + | 17 -> "udp", Uri_services_full.udp_port_of_service s + | n -> string_of_int n, [] + in + match ports with + | port::_ -> port + | [] -> + parse_error ("unknown service \"" ^ s ^ "\" for protocol " ^ proto); + raise Parsing.Parse_error in let addport bitmap n = let byte = n/8 in let bit = 128 lsr (n mod 8) in @@ -303,8 +308,8 @@ proto: charstring /* { try (getprotobyname $1).p_proto */ - { try raise Not_found - with Not_found -> try parse_byte $1 + { match $1 with "tcp" -> char_of_int 6 | "udp" -> char_of_int 17 | _ -> + try parse_byte $1 with Parsing.Parse_error -> parse_error ($1 ^ " is not a known IP protocol"); raise Parsing.Parse_error } diff --git a/opam b/opam index dc3b5ee40..18e0a32df 100644 --- a/opam +++ b/opam @@ -31,6 +31,7 @@ depends: [ "re" "cmdliner" "ipaddr" {>= "2.6.0"} + "uri" {>= "1.9.0"} "base64" {>= "2.0.0"} "ounit" "pcap-format" {test}