;;; -*- Mode:Lisp; Readtable:CL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 123.195
;;; Reason:
;;;  (ip:setup-ip) tried to do inappropriate things when the host has no
;;;  Internet Address.
;;; Written 26-Jan-88 17:31:57 by pld at site Gigamos Cambridge
;;; while running on Jack Flanders from band 2
;;; with Experimental System 123.194, Experimental Local-File 73.3, Experimental FILE-Server 22.1, Experimental Unix-Interface 11.0, Experimental Tape 18.0, Experimental KERMIT 34.3, Experimental ZMail 71.0, Experimental Lambda-Diag 15.0, microcode 1754, SDU Boot Tape 3.12, SDU ROM 8.



; From modified file DJ: L.NETWORK.IP-TCP.KERNEL; IP.LISP#283 at 26-Jan-88 17:31:57
#10R INTERNET#: 
(COMPILER-LET ((*PACKAGE* (GLOBAL:PKG-FIND-PACKAGE "INTERNET")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; IP-TCP; KERNEL; IP  "

(defun setup-ip ()
  (multiple-value-bind (internet-address-list subnet-mask-list)
      (setup-my-internet-address)
    (when internet-address-list
      (let ((my-internet-address (first internet-address-list))
	    (my-subnet-mask (first subnet-mask-list)))
	;;;***Ideally, there should be a way to match multiple internet addresses with
	;;;***multiple network interfaces -- Internet Gateway functions!
	(setq *ip-stream*
	      (make-ip-network-protocol :keyword :internet
					:address-length 4
					:big-endian-address-p t
					:interrupt-function 'receive-ip-packet
					:address-printer 'canonical-ip
					:get-header-function 'make-ip-header
					:free-header-function 'free-ip-header
					:send-packet-function 'send-ip-packet
					:broadcast-packet-function 'broadcast-ip-packet
					:special-address-function 'ip-special-addresses
					:packet-length-function 'ip-length
					:gauge-name "IP"
					:default-address my-internet-address
					))
	(send *ip-stream* :open my-internet-address my-subnet-mask))
      (initialize-route-table internet-address-list)
      (initialize-ip-background-process)
      (send *ip-stream* :enable)
      t)))

))
