From owner-freebsd-net@FreeBSD.ORG Wed Feb 9 15:28:26 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E6AB106566B for ; Wed, 9 Feb 2011 15:28:26 +0000 (UTC) (envelope-from sem@FreeBSD.org) Received: from sunner.semmy.ru (sunner.semmy.ru [195.54.209.159]) by mx1.freebsd.org (Postfix) with ESMTP id 25D6A8FC17 for ; Wed, 9 Feb 2011 15:28:25 +0000 (UTC) Received: from dhcp170-205-red.yandex.net ([95.108.170.205]) by sunner.semmy.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.74 (FreeBSD)) (envelope-from ) id 1PnBSs-000Akv-D8 for freebsd-net@freebsd.org; Wed, 09 Feb 2011 17:56:18 +0300 Message-ID: <4D52AB12.6050506@FreeBSD.org> Date: Wed, 09 Feb 2011 17:56:18 +0300 From: Sergey Matveychuk User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: route messages from NDP X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Feb 2011 15:28:26 -0000 Hello. In my routing table I see entries after Neighbor Discovery Protocol processed: ... 2a02:6b8:0:401:51:4809:8158:1dcd 00:22:fb:3d:82:fe UHLW vlan438 ... I'd like to catch them via a routing socket when they appear. First, try to add a static entry: ndp -s 2a02:6b8:0:403::1:1 00:0e:0c:09:2e:7b and look at route -n monitor output: got message of size 240 on Wed Feb 9 17:26:50 2011 RTM_ADD: Add Route: len 240, pid: 82741, seq 2, errno 0, flags: locks: inits: sockaddrs: 2a02:6b8:0:403::1:1 0.e.c.9.2e.7b We have two sections here - DST and GATEWAY. DST is a IPv6 address (sa_family == AF_INET6) and GATEWAY is a MAC (sa_family == AF_LINK). Just for info sockaddr_dl looks like this: $1 = {sdl_len = 54 '6', sdl_family = 18 '\022', sdl_index = 24, sdl_type = 135 '\207', sdl_nlen = 0 '\0', sdl_alen = 6 '\006', sdl_slen = 0 '\0', sdl_data = "\000\016\f\t.{", '\0' } Looks good. Lets wait for NDP entry... Here is it: got message of size 328 on Wed Feb 9 17:27:11 2011 RTM_ADD: Add Route: len 328, pid: 0, seq 0, errno 0, flags: locks: inits: sockaddrs: 2a02:6b8:0:40c:daa2:5eff:fe8c:139 vlan438:0.30.48.33.4.92 fe80::230:48ff:fe33:492%vlan438 We have four section here DST, GATEWAY, IFP, IFA. DST is IPv6 address, IFP and IFA I don't care and GATEWAY section is empty. Let's see why: $1 = {sdl_len = 54 '6', sdl_family = 18 '\022', sdl_index = 8, sdl_type = 135 '\207', sdl_nlen = 0 '\0', sdl_alen = 0 '\0', sdl_slen = 0 '\0', sdl_data = '\0' } family is AF_LINK (18), it's a correct one. But sdl_alen, sdl_data are zeros. I see this for all routing messages from NDP. All created routing table entries are good (no problems here). Why sockaddr_dl in GATEWAY section has a zero address? Is it a bug? -- Sem.