IPv6 link-local addr && %interfacename
Matthias Apitz
guru at unixarea.de
Fri Nov 7 12:33:57 UTC 2014
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<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
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<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
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 at 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
More information about the freebsd-net
mailing list