From 222f5c5052272b403fd4272a31dd3e33a3c383c1 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Wed, 24 Mar 2004 20:52:12 +0000 Subject: [PATCH] Return 'unsupported-message-type if message type is unknown, return 'unsupported-message-class if message class is unknown. This makes it possible to parse replies that contain IP6 addresses in the additional section. --- scheme/lib/dns.scm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scheme/lib/dns.scm b/scheme/lib/dns.scm index 1218658..eeab0c4 100644 --- a/scheme/lib/dns.scm +++ b/scheme/lib/dns.scm @@ -565,15 +565,26 @@ (values (make-question name type class) start)))))) ;; parses a resourcerecord in a message. returns the rr and the rest of the message. + +(define (type-number->type type-number) + (if (>= type-number (vector-length the-message-types)) + 'unsupported-message-type + (vector-ref the-message-types type-number))) + +(define (class-number->class class-number) + (if (>= class-number (vector-length the-message-classes)) + 'unsupported-message-class + (vector-ref the-message-classes class-number))) + (define (parse-rr start message) (call-with-values (lambda () (parse-name start message)) (lambda (name start) - (let ((type (vector-ref the-message-types - (octet-pair->number (car start) (cadr start)))) + (let ((type (type-number->type + (octet-pair->number (car start) (cadr start)))) (start (cddr start))) - (let ((class (vector-ref the-message-classes - (octet-pair->number (car start) (cadr start)))) + (let ((class (class-number->class + (octet-pair->number (car start) (cadr start)))) (start (cddr start))) (let ((ttl (octet-quad->number (car start) (cadr start) (caddr start) (cadddr start)))