Subject: bin/15693: racoon misses RTM_NEWADDR by rtsol (patch)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <lha@stacken.kth.se>
List: netbsd-bugs
Date: 02/22/2002 04:00:43
>Number:         15693
>Category:       bin
>Synopsis:       racoon misses RTM_NEWADDR (patch)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 21 19:02:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Love
>Release:        NetBSD 1.5ZA
>Organization:
	Stacken Computer Club
>Environment:
System: NetBSD never-again.e.kth.se 1.5ZA NetBSD 1.5ZA (NEVER-AGAIN) #3: Mon Jan  7 07:11:38 CET 2002     root@never-again.e.kth.se:/local/netbsd/src/sys/arch/alpha/compile/NEVER-AGAIN alpha
Architecture: alpha
Machine: alpha
>Description:
	
	Racoon misses RTM_NEWADDR

	I think there is a timer that catches this, but I'm too
	impatient to wait for that (and I might have misread the code).

	The message isn't too short, its just not a struct rtm_msghdr
	coming up, its a struct ifa_msghdr.

	I just replaced it with the same comparison as ``route
	monitor'' is using.

	KAME seem still to have be bug (just checked their cvsweb).

>How-To-Repeat:

: root@never-again ; racoon -F &
[1] 1210
: root@never-again ; Foreground mode.
2002-02-22 03:37:15: INFO: main.c:163:main(): @(#)package version netbsd-20010802
2002-02-22 03:37:15: INFO: main.c:165:main(): @(#)internal version 20001216 sakane@ydc.co.jp
2002-02-22 03:37:15: INFO: main.c:166:main(): @(#)This product linked OpenSSL 0.9.6b 9 Jul 2001 (http://www.openssl.org/)
2002-02-22 03:37:15: INFO: isakmp.c:1387:isakmp_open(): 127.0.0.1[500] used as isakmp port (fd=6)
2002-02-22 03:37:15: INFO: isakmp.c:1387:isakmp_open(): ::1[500] used as isakmp port (fd=7)
2002-02-22 03:37:15: INFO: isakmp.c:1387:isakmp_open(): fe80::1%lo0[500] used as isakmp port (fd=8)
2002-02-22 03:37:15: INFO: isakmp.c:1387:isakmp_open(): fe80::200:f8ff:fe76:2abf%tlp0[500] used as isakmp port (fd=9)
2002-02-22 03:37:15: INFO: isakmp.c:1387:isakmp_open(): 130.237.48.126[500] used as isakmp port (fd=10)
: root@never-again ;
: root@never-again ;
: root@never-again ;
: root@never-again ; rtsol tlp0
2002-02-22 03:37:38: ERROR: grabmyaddr.c:421:update_myaddrs(): read(PF_ROUTE) short read
: root@never-again ; ifconfig tlp0
tlp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:00:f8:76:2a:bf
        media: Ethernet 100baseTX full-duplex instance 1
        status: active
        inet 130.237.48.126 netmask 0xffff0000 broadcast 130.237.255.255
        inet6 fe80::200:f8ff:fe76:2abf%tlp0 prefixlen 64 scopeid 0x1
        inet6 2001:6b0:1:30:200:f8ff:fe76:2abf prefixlen 64

>Fix:


Index: grabmyaddr.c
===================================================================
RCS file: /cvsroot/basesrc/crypto/dist/kame/racoon/grabmyaddr.c,v
retrieving revision 1.1.1.3
diff -w -u -r1.1.1.3 grabmyaddr.c
--- grabmyaddr.c        2001/08/31 09:59:56     1.1.1.3
+++ grabmyaddr.c        2002/02/22 02:56:11
@@ -416,12 +416,12 @@
                        strerror(errno));
                return 0;
        }
-       if (len < sizeof(*rtm)) {
+       rtm = (struct rt_msghdr *)msg;
+       if (len < rtm->rtm_msglen) {
                plog(LLV_ERROR, LOCATION, NULL,
                        "read(PF_ROUTE) short read\n");
                return 0;
        }
-       rtm = (struct rt_msghdr *)msg;
        if (rtm->rtm_version != RTM_VERSION) {
                plog(LLV_ERROR, LOCATION, NULL,
                        "routing socket version mismatch\n");
>Release-Note:
>Audit-Trail:
>Unformatted: