From owner-freebsd-net@FreeBSD.ORG Fri Nov 7 12:33:57 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D2BBE3C for ; Fri, 7 Nov 2014 12:33:57 +0000 (UTC) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1971C62 for ; Fri, 7 Nov 2014 12:33:56 +0000 (UTC) Received: from [89.204.138.158] (helo=unixarea.DDR.dd) by ms-10.1blu.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1Xmijc-0000WY-0D; Fri, 07 Nov 2014 13:33:48 +0100 Received: from unixarea.DDR.dd (localhost [127.0.0.1]) by unixarea.DDR.dd (8.14.9/8.14.3) with ESMTP id sA7CXjVV008784; Fri, 7 Nov 2014 13:33:46 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by unixarea.DDR.dd (8.14.9/8.14.3/Submit) id sA7CXhRL008780; Fri, 7 Nov 2014 13:33:43 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: unixarea.DDR.dd: guru set sender to guru@unixarea.de using -f Date: Fri, 7 Nov 2014 13:33:43 +0100 From: Matthias Apitz To: freebsd-net@freebsd.org Subject: IPv6 link-local addr && %interfacename Message-ID: <20141107123343.GA8713@unixarea.DDR.dd> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Operating-System: FreeBSD 11.0-CURRENT r269739 (i386) User-Agent: Mutt/1.5.23 (2014-03-12) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 89.204.138.158 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Nov 2014 12:33:57 -0000 Hi, I have a small question re/ the IPv6 link-local address; I configured IPv6 in my 11-CURRENT with: /etc/rc.conf: ifconfig_em0_ipv6="inet6 accept_rtadv" rtsold_enable="YES" The em0 interface now looks like this: # ifconfig em0 em0: flags=8843 metric 0 mtu 1500 options=9b ether 00:0c:29:47:a3:8d inet6 fe80::20c:29ff:fe47:a38d%em0 prefixlen 64 scopeid 0x1 inet 192.168.56.131 netmask 0xffffff00 broadcast 192.168.56.255 nd6 options=23 media: Ethernet autoselect (1000baseT ) status: active I have a small C-written test client which connects to port 22 to the addr given in argv1, reads one line (in our case the GM message of the sshd) and prints it: $ ./ipv6-client ::1 host: ::1 read: SSH-2.0-OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420 it does not work with the link-local addr: $ ./ipv6-client fe80::20c:29ff:fe47:a38d host: fe80::20c:29ff:fe47:a38d ssh: connect: Network is unreachable but with appending %em0 it does work: $ ./ipv6-client fe80::20c:29ff:fe47:a38d%em0 host: fe80::20c:29ff:fe47:a38d%em0 read: SSH-2.0-OpenSSH_6.6.1_hpn13v11 FreeBSD-20140420 My question is: What does the %em0 mean in the IPv6 addr and why it is not working without it? The failing sys call is the connect(2): ... socket(PF_INET6,SOCK_STREAM,6) = 3 (0x3) connect(3,{ AF_INET6 [fe80::20c:29ff:fe47:a38d]:22 },28) ERR#51 'Network is unreachable' I consulted the handbook and the RFC: https://www.freebsd.org/doc/handbook/network-ipv6.html http://www.ietf.org/rfc/rfc3513.txt Both do not give any explanation re/ the %interface value. Thanks matthias -- Matthias Apitz | /"\ ASCII Ribbon Campaign: E-mail: guru@unixarea.de | \ / - No HTML/RTF in E-mail WWW: http://www.unixarea.de/ | X - No proprietary attachments phone: +49-170-4527211 | / \ - Respect for open standards | en.wikipedia.org/wiki/ASCII_Ribbon_Campaign