Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2002 15:26:33 +0300 (MSK)
From:      Oleg Sharoiko <os@rsu.ru>
To:        freebsd-net@freebsd.org
Subject:   Patches to fix MD5 authentication in routed
Message-ID:  <20020227145812.F425-200000@brain.cc.rsu.ru>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hello!

Recently I've posted a patch on this list to fix the bug in the MD5
authentication in routed. I got no answers though :(
Wold you please be so kind as to check my patch and commit it if it's ok or
send me e-mail if this patch is wrong. The patch is attached to the message.

-- 
Oleg Sharoiko.
Software and Network Engineer
Computer Center of Rostov State University.

[-- Attachment #2 --]
--- include/protocols/routed.h	Sun Sep  5 17:43:31 1999
+++ include/protocols/routed.h	Wed Feb 27 11:58:16 2002
@@ -84,6 +84,7 @@
 
 /* RIPv2 authentication */
 struct netauth {
+#define     RIP_AUTH_HDR_LEN 4
 	u_int16_t   a_family;		/* always RIP_AF_AUTH */
 	u_int16_t   a_type;
 #define	    RIP_AUTH_NONE   0
--- sbin/routed.org/input.c	Wed Feb 20 10:48:56 2002
+++ sbin/routed/input.c	Wed Feb 20 11:15:21 2002
@@ -967,7 +967,7 @@
 			 */
 			if (TRACEPACKETS) {
 				if (NA->au.a_md5.md5_auth_len
-				    != RIP_AUTH_MD5_LEN)
+				    != RIP_AUTH_HDR_LEN + RIP_AUTH_MD5_LEN)
 					msglim(use_authp, from,
 					       "unknown MD5 RIPv2 auth len %#x"
 					       " instead of %#x from %s",
@@ -989,7 +989,7 @@
 			}
 
 			MD5Init(&md5_ctx);
-			MD5Update(&md5_ctx, (u_char *)rip, len);
+			MD5Update(&md5_ctx, (u_char *)rip, len+RIP_AUTH_HDR_LEN);
 			MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
 			MD5Final(hash, &md5_ctx);
 			if (!memcmp(hash, na2->au.au_pw, sizeof(hash)))
--- sbin/routed.org/output.c	Wed Feb 20 10:47:48 2002
+++ sbin/routed/output.c	Wed Feb 20 10:50:01 2002
@@ -303,7 +303,7 @@
 	na2->a_type = htons(1);
 	na->au.a_md5.md5_pkt_len = htons(len);
 	MD5Init(&md5_ctx);
-	MD5Update(&md5_ctx, (u_char *)wb->buf, len);
+	MD5Update(&md5_ctx, (u_char *)wb->buf, len + RIP_AUTH_HDR_LEN);
 	MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
 	MD5Final(na2->au.au_pw, &md5_ctx);
 	wb->n++;

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020227145812.F425-200000>