From 29c5ddea6ef803a78ec2dc030d7abcea7c7aabc2 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sat, 13 Nov 2021 22:35:48 +1100 Subject: [PATCH] debug the icmp responding --- arper.lsp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 ))) -- 2.39.2