diff --git a/CHANGES b/CHANGES index 74cef71149..e9345630e1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ + 657. [bug] When a listen-on statement in an lwres block does not + specifiy a port, use 921, not 53. Also update the + listen-on documentation. [RT #616] + 656. [func] Treat an unescaped newline in a quoted string as an error. This means that TXT records with missing close quotes should have meaningful errors printed. diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index fd59f88ea5..25c23e809b 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -2,7 +2,7 @@ - + @@ -2461,7 +2461,7 @@ lookups performed on behalf of clients by a caching name server. This is the grammar of the lwres statement in the named.conf file: lwres { - listen-on { address_match_list }; + listen-on { ip_addr port ip_port ; ip_addr port ip_port ; ... }; view view_name; search { domain_name ; ip_addr ; ... }; ndots number; diff --git a/lib/dns/config/confparser.y.dirty b/lib/dns/config/confparser.y.dirty index 13b4e8f7a2..5ff100e3f6 100644 --- a/lib/dns/config/confparser.y.dirty +++ b/lib/dns/config/confparser.y.dirty @@ -33,7 +33,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confparser.y.dirty,v 1.44 2000/12/20 03:36:19 marka Exp $ */ +/* $Id: confparser.y.dirty,v 1.45 2001/01/05 22:12:50 bwelling Exp $ */ #include @@ -113,9 +113,12 @@ static isc_lexspecials_t specials; /* * XXXJAB The #define for the default OMAPI port is not available * to us, so we make our own. + * + * XXXBEW Same goes for the default LWRES port. */ #define OMAPI_DEFAULT_PORT 953 +#define LWRES_DEFAULT_PORT 921 #define CONF_MAX_IDENT 1024 @@ -157,6 +160,8 @@ static dns_peerlist_t *currentpeerlist(dns_c_ctx_t *cfg, isc_boolean_t createIfNeeded); static isc_boolean_t keydefinedinscope(dns_c_ctx_t *cfg, const char *name); +static void replace_zero_ports(dns_c_iplist_t *list, + in_port_t val); @@ -1272,6 +1277,7 @@ option: /* Empty */ } | L_ALSO_NOTIFY port_ip_list { + replace_zero_ports($2, default_port); tmpres = dns_c_ctx_setalsonotify(currcfg, $2); dns_c_iplist_detach(&$2); @@ -2013,16 +2019,9 @@ port_ip_list: maybe_zero_port L_LBRACE ip_and_port_list L_RBRACE { in_port_t port = $1; dns_c_iplist_t *list = $3; - unsigned int i; - if (port == 0) - port = default_port; - - for (i = 0 ; i < list->nextidx ; i++) { - if (isc_sockaddr_getport(&list->ips[i]) == 0) { - isc_sockaddr_setport(&list->ips[i], port); - } - } + if (port != 0) + replace_zero_ports(list, port); $$ = list; }; @@ -4519,6 +4518,8 @@ view_option: L_FORWARD zone_forward_opt { dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg); + replace_zero_ports($2, default_port); + INSIST(view != NULL); tmpres = dns_c_view_setalsonotify(view, $2); @@ -5098,6 +5099,8 @@ zone_option: L_FILE L_QSTRING INSIST(zone != NULL); + replace_zero_ports($2, default_port); + tmpres = dns_c_zone_setmasterips(zone, $2, ISC_FALSE); if (tmpres == ISC_R_EXISTS) { parser_error(ISC_FALSE, @@ -5708,6 +5711,8 @@ zone_option: L_FILE L_QSTRING INSIST(zone != NULL); + replace_zero_ports($2, default_port); + tmpres = dns_c_zone_setalsonotify(zone, $2, ISC_FALSE); if (tmpres == ISC_R_EXISTS) { parser_error(ISC_FALSE, @@ -6018,6 +6023,9 @@ lwres_options_list: lwres_option L_EOS lwres_option: L_LISTEN_ON port_ip_list { dns_c_lwres_t *lwres; + + replace_zero_ports($2, LWRES_DEFAULT_PORT); + lwres = ISC_LIST_TAIL(currcfg->lwres->lwreslist); tmpres = dns_c_lwres_setlistenon(lwres, $2); dns_c_iplist_detach(&$2); @@ -7106,3 +7114,13 @@ keydefinedinscope(dns_c_ctx_t *cfg, const char *name) return (rval); } + +static void +replace_zero_ports(dns_c_iplist_t *list, in_port_t val) { + unsigned int i; + + for (i = 0 ; i < list->nextidx ; i++) { + if (isc_sockaddr_getport(&list->ips[i]) == 0) + isc_sockaddr_setport(&list->ips[i], val); + } +}