Bug 290221 - [netlink] default build of /usr/sbin/arp is broken for proxyarp
Summary: [netlink] default build of /usr/sbin/arp is broken for proxyarp
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.3-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-net (Nobody)
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-10-14 05:46 UTC by Eugene Grosbein
Modified: 2025-10-27 10:30 UTC (History)
5 users (show)

See Also:
eugen: mfc-stable15?
eugen: mfc-stable14?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer freebsd_triage 2025-10-14 05:46:25 UTC
Arp proxying with /usr/sbin/arp is broken since it switched to NETLINK.
Here is "how to repeat":

# ifconfig tun0 create inet 10.0.0.1 10.11.0.1 netmask 255.255.255.255
# ifconfig tun0
tun0: flags=1008051<UP,POINTOPOINT,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=4080000<LINKSTATE,MEXTPG>
        inet 10.0.0.1 --> 10.11.0.1 netmask 0xffffffff
        groups: tun
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
# route add -host 10.0.0.233 -iface tun0
add host 10.0.0.233: gateway tun0
# /usr/sbin/arp -s 10.0.0.233 60:be:b4:4:94:65 pub
arp: set: 10.0.0.233: Invalid argument (NDA_LLADDR address length (6) is different from expected (0))

Here 60:be:b4:4:94:65 is MAC address of LAN igc0 interface having IP address 10.0.0.1/24

A workaround is to rebuild /usr/sbin/arp WITHOUT_NETLINK_SUPPORT so it uses rtsock instead. Then it works again.
Comment 1 Eugene Grosbein freebsd_committer freebsd_triage 2025-10-15 04:38:45 UTC
Real problem "in wild" occurs after upgrade of FreeBSD 13.5 running mpd5 with arp proxying to 14.3. mpd5 runs /usr/sbin/arp that fails. Rebuild of /usr/sbin/arp without netlink helps.
Comment 2 commit-hook freebsd_committer freebsd_triage 2025-10-17 08:23:29 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c26d6bf9da013e839d9a696746ea1741569e619e

commit c26d6bf9da013e839d9a696746ea1741569e619e
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2025-10-17 07:53:35 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2025-10-17 08:22:36 +0000

    arp: fix adding proxy entries for P2P interfaces

    The old rtsock implementation used in-kernel workaround to do so.
    When route to specified destination address used P2P interface, the
    kernel did the search with ifa_ifwithnet() for most suitable network
    and then add proxy entry to this interface.

    Use similar approach with netlink implementation. We already have
    get_ether_addr() function that does almost the same thing as
    ifa_ifwithnet(). Use it when we find that destination route uses
    P2P interface and then try to guess suitable interface. This should
    fix the use of netlink-based arp(8) in mpd5.

    Rename get_ether_addr() to get_ifinfo(), since now it is used to find
    only ifindex in case when hwaddr is specified by user.
    Also make set_nl() and delete_nl() prototype similar to rtsock.
    And allow '-i' to be used with '-S', since we already allow the same
    for '-s'.

    PR:             290221
    Reported by:    eugen
    Reviewed by:    eugen
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D53113

 usr.sbin/arp/arp.c         | 32 ++++++++++++++++++++------------
 usr.sbin/arp/arp.h         |  9 ++++-----
 usr.sbin/arp/arp_netlink.c | 20 ++++++++++++++++----
 3 files changed, 40 insertions(+), 21 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-10-26 11:20:40 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e829d0693a7c8e2ee82a8aefa59c0a5f2648da3

commit 9e829d0693a7c8e2ee82a8aefa59c0a5f2648da3
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2025-10-17 07:53:35 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2025-10-26 11:20:01 +0000

    arp: fix adding proxy entries for P2P interfaces

    The old rtsock implementation used in-kernel workaround to do so.
    When route to specified destination address used P2P interface, the
    kernel did the search with ifa_ifwithnet() for most suitable network
    and then add proxy entry to this interface.

    Use similar approach with netlink implementation. We already have
    get_ether_addr() function that does almost the same thing as
    ifa_ifwithnet(). Use it when we find that destination route uses
    P2P interface and then try to guess suitable interface. This should
    fix the use of netlink-based arp(8) in mpd5.

    Rename get_ether_addr() to get_ifinfo(), since now it is used to find
    only ifindex in case when hwaddr is specified by user.
    Also make set_nl() and delete_nl() prototype similar to rtsock.
    And allow '-i' to be used with '-S', since we already allow the same
    for '-s'.

    PR:             290221
    Reported by:    eugen
    Reviewed by:    eugen
    Differential Revision:  https://reviews.freebsd.org/D53113

    (cherry picked from commit c26d6bf9da013e839d9a696746ea1741569e619e)

 usr.sbin/arp/arp.c         | 32 ++++++++++++++++++++------------
 usr.sbin/arp/arp.h         |  9 ++++-----
 usr.sbin/arp/arp_netlink.c | 20 ++++++++++++++++----
 3 files changed, 40 insertions(+), 21 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-10-26 11:22:42 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f7937053fd0899e7b808bab3a0576ff16f3e943d

commit f7937053fd0899e7b808bab3a0576ff16f3e943d
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2025-10-17 07:53:35 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2025-10-26 11:21:14 +0000

    arp: fix adding proxy entries for P2P interfaces

    The old rtsock implementation used in-kernel workaround to do so.
    When route to specified destination address used P2P interface, the
    kernel did the search with ifa_ifwithnet() for most suitable network
    and then add proxy entry to this interface.

    Use similar approach with netlink implementation. We already have
    get_ether_addr() function that does almost the same thing as
    ifa_ifwithnet(). Use it when we find that destination route uses
    P2P interface and then try to guess suitable interface. This should
    fix the use of netlink-based arp(8) in mpd5.

    Rename get_ether_addr() to get_ifinfo(), since now it is used to find
    only ifindex in case when hwaddr is specified by user.
    Also make set_nl() and delete_nl() prototype similar to rtsock.
    And allow '-i' to be used with '-S', since we already allow the same
    for '-s'.

    PR:             290221
    Reported by:    eugen
    Reviewed by:    eugen
    Differential Revision:  https://reviews.freebsd.org/D53113

    (cherry picked from commit c26d6bf9da013e839d9a696746ea1741569e619e)

 usr.sbin/arp/arp.c         | 32 ++++++++++++++++++++------------
 usr.sbin/arp/arp.h         |  9 ++++-----
 usr.sbin/arp/arp_netlink.c | 20 ++++++++++++++++----
 3 files changed, 40 insertions(+), 21 deletions(-)