From owner-freebsd-net Mon Nov 5 13:25:10 2001 Delivered-To: freebsd-net@freebsd.org Received: from rose.niw.com.au (cerberus.apdata.com.au [202.14.95.17]) by hub.freebsd.org (Postfix) with ESMTP id 7B91437B417 for ; Mon, 5 Nov 2001 13:24:55 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by rose.niw.com.au (Postfix) with ESMTP id 2E2E89721C for ; Tue, 6 Nov 2001 07:54:53 +1030 (CST) Received: by rose.niw.com.au (Postfix, from userid 1000) id B9DAD97215; Tue, 6 Nov 2001 07:54:51 +1030 (CST) Date: Tue, 6 Nov 2001 07:54:51 +1030 From: Ian West To: freebsd-net@freebsd.org Subject: Results from RTM_GET on route socket ? Message-ID: <20011106075451.E34308@rose.niw.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Virus-Scanned: by AMaViS perl-10 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org I am a bit confused about the results of RTM_GET. Below is a hexdump of the response I am getting, The response rtm_addrs field is 0x37 which I believe indicates I should have values for the following in top down order. #define RTA_DST 0x1 /* destination sockaddr present */ #define RTA_GATEWAY 0x2 /* gateway sockaddr present */ #define RTA_NETMASK 0x4 /* netmask sockaddr present */ #define RTA_IFP 0x10 /* interface name sockaddr present */ #define RTA_IFA 0x20 /* interface addr sockaddr present */ Starting at the * (Offset 5c, sizeof(struct rt_msghdr) I have 16 bytes for RTA_DST, 16 bytes for RTA_GATEWAY, and then 4 null bytes. After this there seems to be a valid RTA_IFP, and RTA_IFA. My understanding is that the items should be sockaddr's, what is the correct way to interpret the null bytes ? (I don't want to write iffy code that breaks later :-) 0x0000: c8 00 05 04 02 00 00 00 43 08 01 00 37 00 00 00 H C 7 0x0010: ef 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 o 0x0020: 00 00 00 00 00 00 00 00 dc 05 00 00 00 00 00 00 \ 0x0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0040: 00 00 00 00 00 00 00 00 d5 17 00 00 00 00 00 00 U 0x0050: 00 00 00 00 00 00 00 00 00 00 00 00*10 02 00 00 0x0060: 00 00 00 00 00 00 00 00 00 00 00 00 10 02 00 00 0x0070: c0 a8 01 0a 00 00 00 00 00 00 00 00 00 00 00 00 @( 0x0080: 38 12 02 00 06 03 06 00 64 63 30 00 80 c8 cd 23 8 dc0 HM# 0x0090: fd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 } 0x00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x00b0: 00 00 00 00 00 00 00 00 10 02 00 00 c0 a8 01 09 @( 0x00c0: 00 00 00 00 00 00 00 00 -- -- -- -- -- -- -- -- Thanks for any feedback.. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message