cvs commit: hints iana_protocols+services.txt

timothy at linuxfromscratch.org timothy at linuxfromscratch.org
Sun Sep 22 16:26:34 PDT 2002


timothy     02/09/22 16:26:34

  Added:       .        iana_protocols+services.txt
  Log:
  Initial commit.
  
  Revision  Changes    Path
  1.1                  hints/iana_protocols+services.txt
  
  Index: iana_protocols+services.txt
  ===================================================================
  TITLE:		IANA /etc/{protocols,services}
  LFS VERSION:	All
  AUTHOR:		Seth W. Klein <sk at sethwklein.net>
  
  SYNOPSIS:
  	How to get the protocols and services assigned numbers lists from
  	the IANA and install them in /etc.
  
  HINT:
  
  Purpose Of This Hint
  
  This hint documents using the IANA[1] lists for /etc/services and
  /etc/protocols.
  
  This is useful this because the samples from netkit-base[2] are rather
  incomplete and GNU inetutils[3] doesn't include any. Also, the services
  list is updated frequently.
  
  
  Required Software
  
  These instructions may need to be adapted for older LFS versions which used
  mawk instead of gawk.
  
  A HTTP client is also required. The instructins assume wget[4] but can
  effortlessly be adapted for any web browser or URL fetching software.
  
  
  Bugs
  
  No
  
  
  Instructions
  
  cd /var/tmp
  wget http://www.iana.org/assignments/protocol-numbers
  cp /etc/protocols protocols.orig
  echo "See protocols(5) for more information." > /etc/protocols
  cat protocol-numbers | tr -d '\r' | awk --re-interval \
    '{
      if (match($0, \
          "^[[:space:]]+([[:digit:]]+)[[:space:]]{1,5}([^[:space:]]+)(.*)", \
  	field)) {
        sub("^[[:space:]]*", "", field[3])
        printf "%-16s%-5s%-16s# %s\n", \
               tolower(field[2]), field[1], field[2], field[3]
      } else {
        printf "# " $0 "\n"
      }
    }' > /etc/protocols
  
  wget http://www.iana.org/assignments/port-numbers
  cp /etc/services services.orig
  echo "See services(5) for more information." > /etc/services
  cat port-numbers | tr -d '\r' | awk \
    'BEGIN { inlist=0 } 
    /^$/ { inlist=0 }
    {
      if (inlist) {
        sub("^ ", "#")
        if ( index($0, "#")!=1 ) {
          # comment the description field
          sub("(^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+)", "&# ")
        }
      } else {
        printf "# "
      }
      print $0
    }
    /^-------/ { inlist=1 }' \
    > /etc/services
  
  
  [1] IANA: Internet Assigned Numbers Authority, http://www.iana.org/
  [2] netkit-base: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/
  [3] GNU inetutils: http://www.gnu.org/software/inetutils/inetutils.html
  [4] wget: http://beyond.linuxfromscratch.org/view/cvs/basicnet/wget.html
  
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list