INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT Network Working Group T. Maginnis, A. Madapoosi INTERNET-DRAFT University of Mississippi Category: Experimental August 1996 The PORT Resource Record Status of This Memo This document is an Internet Draft. Internet Drafts are working documents of the Internet Engineering Task Force (IETF), its Areas, and its Working Groups. Note that other groups may also distribute working documents as Internet Drafts. Internet Drafts are draft documents valid for a maximum of six months. Internet Drafts may be updated, replaced, or obsoleted by other documents at any time. It is not appropriate to use Internet Drafts as reference material or to cite them other than as a "working draft" or "work in progress." To learn the current status of any Internet-Draft, please check the "1id-abstracts.txt" listing contained in the internet-drafts Shadow Directories on: ftp.is.co.za (Africa) nic.nordu.net (Europe) ds.internic.net (US East Coast) ftp.isi.edu (US West Coast) munnari.oz.au (Pacific Rim) Overview A contributing factor to the explosive growth in IP address alloca- tion is the coming together of two seeming unrelated factors. One factor is arbitrary relationship within the Domain Name Server that requires an unique IP address to be associated with a Domain Name. The second factor is the public's desire to have short Domain Names unique to their enterprise. We believe a small modification to the Domain Name Server will break this relationship and lessen pressure on IP address allocation. This modification should also make system configuration easier than deal- ing with IP addresses for each Domain Name supported on a given host. One difficulty with the proposed modification is that similar "small" changes are required in the WWW browsers to pick up the port number and append it to the URL. Introduction The growth rate of the Internet has exacerbated the well-recognized problem with the limited (fixed) 32-bit IP address space. Although the new IP V6 specification will overcome this limitation, it is not clear how well or how fast the new IP software will migrate through the Internet. Furthermore, growth in "portable" Class C Internet IP address alloca- tion has had a large effect on the size of key routing tables and the resulting routing table search time. Currently, the Domain Name Server requires each unique domain name resolve to an unique IP address. As a result of this requirement, it is typical to find that an Internet Service Provider (ISP) will Maginnis, Madapoosi [Page 1] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT configure their system so that there are many "instances" of a WWW server executing on one host and each instance is configured to wait for a connection from a specific IP address and therefore, a specific Domain Name. It not unusual to find a WWW server which may be con- suming a a complete Class C address for its web pages. Suggested Solution One solution for this problem would be to allow a new resource record in the Named database that would break the requirement of an IP address for each Domain Name. We have created a new resource record called "PORT." It takes the same arguments as the port record in the /etc/services file and looks like this in the named database. company.com IN PORT 4567 TCP WWW Where "company.com" is the Domain Name, "IN" specifies the Internet address family, "PORT" is the resource record name, "4567" is the port number upon which a server waiting for connections, "TCP" is protocol that the server is employing, and "WWW" is the service. Name resolution requires that the PORT resource record be associated with an instance of the "A" record. For example, an ISP might con- figure its name server as follows: isp.net IN A 192.168.1.10 IN MX host.isp.net IN HOSTINFO LINUX redhat company1.com IN PORT 4568 TCP WWW company2.com IN PORT 4569 TCP WWW company3.com IN PORT 4570 TCP WWW company4.com IN PORT 4571 TCP WWW Configuring multiple domain names onto a single host would also be easier since the PORT resource record would remove the need to alias multiple IP addresses to a network interface. Thus, a new client could be set up by adding the new domain name to the named data base, configuring an instance of the WWW server to wait on an unique port, and finally, to register the new name. PORT resource records also remove the "need" for well-known ports since ports could now be discovered through the Domain Name Server. In other words, instead of assuming that FTP is on port 21, one could just lookup "ftp.host.org.domain" for an IP address and port number. Maginnis, Madapoosi [Page 2] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT Named Implementation The following is an overview of the Internet Domain Name Server and modifications to the code. Though the package comes with documenta- tion, considerable time was spent understanding the code and working with the name server. The modifications are in pseudocode. A) Startup Control Flow 1) Set appropriate values depending on commandline options. 2) Disable signal handlers till initialization is complete and all the databases are read. 3) a) Read /etc/services file into a linked list. b) Read /etc/protocols file into a linked list. 4) Initialization phase. a) Read the boot file (usually /etc/named.boot) and set the options. b) Initialize the hash table. c) If maintenance is required, transfer and update named database(s). i) Load Database from file - db_load() is called. Define a new type of resource record called "PORT" to be 113 (113 was unused and hence chosen.). ii) Add lines of code in db_load(). The database file is read line by line and the format- ting is done by the type of resource record. The format of the PORT record in the database file is host/domain IN PORT port# Protocol Service The data segment in the resource record is charac- ter(Unsigned). The port is stored as two character(2 bytes), followed by the protocol which is character string terminated by a '\0' . The service is also a character string terminated by '\0'. Maginnis, Madapoosi [Page 3] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT [7][f][T][C][P][\0][T][E][L][N][E][T][\0] |___| |__________| |__________________| | | | port # protocol Service In the switch statement pertaining to the type of resource record Add a case statement: case T_PORT: a) Convert port number from integer to 2 byte string. b) The port number is followed by the protocol as a string terminated by '\0'. c) The service is next as a string terminated by '\0'. d) Set the length of the data segment in a global (to the function) variable and break from the switch statement. This data is then copied over to a data structure and stored. d) Return to main block 5) Set up signal handlers 6) Wait for requests and handle them 7) Handle signals appropriately B) Signal Handling Control Flow 1) SIGINT - dump database db_dump() is called and here the database in memory is dumped to file. Depending on the type of resource record the data is printed. Add a case statement: Maginnis, Madapoosi [Page 4] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT case T_PORT: i) convert the 2 byte character to port number and print it ii) Print the next string (protocol). iii) The next string is the service. 2) SIGHUP - reload database The actions performed culminate in a call to db_load(). [described earlier] C) Request Handling - TCP or UDP Control Flow A queue is set up for each of them (TCP, UDP) and ns_req() is called. ns_req() 1) Check to see if the qr (Query Response) field in the header is set. If qr is 1 then it is a query response. Call ns_resp(). a) qr = 0 Check to see if the query type is QUERY or IQUERY (inverse query) and appropriate lookup is done. The resource record is made depending on the type. Call function make_rr(). Add a case statement: case T_PORT: i) Copy the entire data region as a contiguous block (port number, protocol, service). (Here there are no modifications required to the data, unlike MX record where the domain name needs to compressed.) b) qr = 1 ns_resp() is called which in turn calls Maginnis, Madapoosi [Page 5] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT db_update(). db_update() - Here the database is stored into internal database format. Depending upon the type of resource record, data is copied if the new one is distinct from the old one. Here db_cmp() is called which compares the data depending on the type. For T_PORT the entire data segment is compared as strings (expansion/compression need not be taken into account). Then update the database: case T_PORT: i) copy entire data segment NOTE : db_update() is called from 1) ns_req.c from InitDynUpdate(). This function is valid only if ALLOW_UPDATE is defined at Compile time - for dynamic update. InitDynUpdate() allows for dynamic updates. If the opcode in the header is update then update the database and try and forward to primary server. 2) ns_resp.c from ns_resp(). This portion of code is valid only if ALLOW_UPDATE is defined at Compile time - for dynamic update. If the server is not primary, and the primary has been updated, update the database here. 3) ns_ncache.c from cache_n_resp() db_update() is called with new and old resource records identical. Maginnis, Madapoosi [Page 6] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT Miscellaneous 1) named-xfer - This is an independent executable and is used for transferring databases from another server. It is exec'ed by named to get the database. It can be executed independently. Here (named-xfer.c) code needs to added to handle the PORT type resource record which is obtained from the server. For T_PORT, the entire data segment is copied over ( no expansion is required ) into local pointer first and then written to file. While writing to a file, the following needs to be done - case T_PORT: i) convert port number to printable string from a number stored as a string and print. ii) Print the protocol which is '\0' terminated string. iii) Print the service as a string terminated by '\0'. NSLookup Implementation 1) Set appropriate values depending on commandline options. 2) Check to see if the session is interactive or not. 3) If it is non-interactive then perform the query and quit. 4) If it is an interactive session get the inputs, parse them, per- form the query, display the results and quit. Maginnis, Madapoosi [Page 7] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT Modifications to the code 1) Define a constant to associate with the new resource record. 2) Add an if statement to return a lexical category when "PORT" appears as a query type during an interactive session. 3) Add a case statements to print the responses based on type. In the data field the port number is the first two bytes followed by the protocol as a string terminated by '\0' and then is the ser- vice which is also a string terminated by '\0'. 4) Add case statement in routines used for debugging. Print the resource record by the type. Source Code The modifications were done on the BIND version 4.9.3 BETA33 ftp ftp.vix.com cd pub/bind/release get bind.tar.gz ----- 4.9.3 BETA33 - December, 1995 - paul@vix.com Patches are available form ftp pix.cs.olemiss.edu cd pub/portrr get patch-PORTRR-BIND4.9.3.tar.gz References [1] Mockapetris, P., "Domain Names - Concepts and Facilities", STD 13, RFC 1034, USC/Information Sciences Institute, November 1987. [2] Mockapetris, P., "Domain Names - Implementation and Speci- fication", STD 13, RFC 1035, USC/Information Sciences Insti- tute, November 1987. [3] Hinden, R., and S. Deering, Editors, "IP Version 6 Addressing Architecture", RFC 1884, Ipsilon Networks, Xerox Maginnis, Madapoosi [Page 8] INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT PARC, December 1995. Authors' Address Dr. P. Tobin Maginnis Department of Computer and Information Science, 302, Weir Hall, University of Mississippi, University, MS 38677 USA. Phone: +1 (601) 232 - 5357 Email: ptm@cs.olemiss.edu Anesh S. Madapoosi, P.O Box 5581, University, MS 38677 USA. Phone: +1 (601) 236 - 1143 Email: anesh@olemiss.edu INTERNET-DRAFT Expires February 1997 INTERNET-DRAFT Maginnis, Madapoosi [Page 9]