Skip to content

Commit 3d1b6e7

Browse files
committed
Add note about IPv6 and RTM_GETNEIGH
1 parent 6245a9b commit 3d1b6e7

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

README.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,35 @@ any platform that supports the ``SIOCGARP`` ioctl, which is virtually
8484
every BSD and Linux. MacOS X does not work anymore, because Apple has
8585
removed the interface.
8686

87+
IPv6-Support and Alternatives
88+
-----------------------------
89+
90+
The ``SIOCGARP`` ioctl interface described in `arp(7)`_ and used by this
91+
module is a fairly old mechanism and as the name suggests, works only for ARP
92+
and therefore only for IPv4. For IPv6 the Linux Kernel uses the modern and
93+
extensible `rtnetlink(7)`_ interface based on `netlink(7)`_ to manage
94+
link-layer neighbor information.
95+
96+
Until Linux 5.0 however only whole tables could be dumped via `rtnetlink(7)`_
97+
``RTM_GETNEIGH`` messages and it was not possible to query for specific IP
98+
addresses. If entries need to be queried often or there are a lot of entries,
99+
this might be too inefficient. As an optimization querying the tables only
100+
once and subscribing to change events afterwards was possible, albeit more
101+
complicated. Since
102+
`Linux 5.0 <https://github.com/torvalds/linux/commit/24894bc6eabc43f55f5470767780ac07db18e797>`_
103+
``RTM_GETNEIGH`` messages can be used to query specific addresses on specific
104+
interfaces.
105+
106+
The pure-python netlink implementation `pyroute2`_ can be used to access the
107+
`rtnetlink(7)`_ and other `netlink(7)`_ interfaces.
108+
`Since version 0.5.14 <https://github.com/svinota/pyroute2/commit/b1f2af00689e17a50eb09b1560acfd0dc96b1a7a>`_
109+
specific addresses can be queried.
110+
111+
.. _arp(7): https://manpages.debian.org/stable/manpages/arp.7.en.html
112+
.. _netlink(7): https://manpages.debian.org/stable/manpages/netlink.7.en.html
113+
.. _rtnetlink(7): https://manpages.debian.org/stable/manpages/rtnetlink.7.en.html
114+
.. _pyroute2: https://pyroute2.org/
115+
87116
Changelog
88117
---------
89118

0 commit comments

Comments
 (0)