X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=arper.lsp;h=10ac3888b55bbb0f108301389c26ff1228dc917d;hb=71c270a6ecaed90fb3801c613f7314c00c4de07a;hp=caf763dac2db43321d48aebd7c05090edee75fa8;hpb=d1f15b6a825ff2c16d64fbdd7722135a11dbbb13;p=rrq%2Fnewlisp-ftw.git diff --git a/arper.lsp b/arper.lsp index caf763d..10ac388 100755 --- a/arper.lsp +++ b/arper.lsp @@ -1,4 +1,4 @@ -#!/usr/local/bin/newlisp +#!/usr/bin/newlisp # Copyright 2017, Ralph Ronnquist ;; This program iplements arp responding for selected IP and @@ -28,7 +28,7 @@ # Tell about usage and exit with error. (define (usage) (write-line 2 [text];; Usage: -t -;; where is the tap to service, and is the pathnmae fore +;; where is the tap to service, and is the pathname for ;; the configuration file. [/text] ) @@ -117,15 +117,15 @@ # handle, and then issues a corresponding response. (define (icmp-request-handler) (letn ((h (unpack "bbbb bbbb" (26 buffer))) - (n (ntohs((unpack "u" (16 buffer)) 0)))) - (println "ICMP request " (pack-ip (0 4 h)) " --> " (pack-ip (4 4 h))) - (when (member (4 4 h) MYIPS) + (n (ntohs((unpack "u" (16 buffer)) 0))) + (MYMAC (MAP (string (4 4 h)))) ) + (when MYMAC (write IFD (pack-bytes (flat (list # Ethernet header (14 bytes) (unpack "bbbbbb" (6 buffer)) - 2 (4 4 h) 2 + MYMAC (stonb 0x0800) ; Type = IPv4 # IPv4 header (20 bytes, with header checksum) (ipv4-header-checksum @@ -165,7 +165,7 @@ (when (> n 14) (case (ntohs ((unpack "u" (12 buffer)) 0)) ; Ethertype (0x0806 (and arp-handler (arp-handler))) - ;(0x0800 (and ipv4-handler (ipv4-handler))) + (0x0800 (and ipv4-handler (ipv4-handler))) ;(0x86DD (and ipv6-handler (ipv6-handler))) (true nil) ; ignore all else )))