Bug 272144 - netlink sets ifi_type to FreeBSD if_type instead of ARPHRD_*
Summary: netlink sets ifi_type to FreeBSD if_type instead of ARPHRD_*
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Alexander V. Chernikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-22 11:24 UTC by Mikhail Pchelin
Modified: 2026-06-19 13:53 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Pchelin freebsd_committer freebsd_triage 2023-06-22 11:24:08 UTC
Netlink software which uses ifi_type from ifinfomsg structure expects it to be set to ARPHRD_* values, but currently it's getting set to if_type (from net/if_types.h).

sys/netlink/route/iface.c:259

ifinfo->ifi_type = ifp->if_type

ifinfomsg defenition is in sys/netlink/route/interface.h

struct ifinfomsg {
...
unsigned short ifi_type /* ARPHRD_* */
...
}

Because of this software receives 0x6 (IFT_ETHER) instead of 0x1 (ARPHRD_ETHER) for wireless interfaces and 0x18 (IFT_LOOP) instead of 772 (ARPHRD_LOOPBACK).

Same assignment happens in 14-current.

Is this difference from Linux intentional?
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2026-05-21 21:33:59 UTC
^Triage: is this still a problem on recent versions of FreeBSD?
Comment 2 Ed Maste freebsd_committer freebsd_triage 2026-05-29 15:55:08 UTC
There are no FreeBSD changes related to this. I don't know if this was considered and is intentional, or just ended up this way; it does warrant consideration.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2026-05-29 16:31:05 UTC
Header update in https://reviews.freebsd.org/D57334. Regardless of whether we would change this to follow the Linux values or not the header should reflect reality.
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-06-15 12:37:05 UTC
A commit in branch main references this bug:

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

commit 21a75a85f0e0cc328b6e9b437d783ef0c25dc52e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-05-29 16:23:17 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-06-15 12:36:16 +0000

    netlink: Indicate that ifinfomsg uses IFT_* types

    On Linux struct ifinfomsg uses ARPHRD_* values, while we used IFT_*
    types (which derive from SNMP ifType definitions in RFC 1573).
    Update the header to reflect this.

    PR:             272144
    Reviewed by:    pouria
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D57334

 share/man/man4/rtnetlink.4    | 17 +++++++++++++++--
 sys/netlink/route/interface.h |  4 ++--
 2 files changed, 17 insertions(+), 4 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-06-19 13:47:14 UTC
A commit in branch stable/15 references this bug:

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

commit 76f29211f0dde8907250b77def3e58082e03afe1
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-05-29 16:23:17 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-06-19 13:46:55 +0000

    netlink: Indicate that ifinfomsg uses IFT_* types

    On Linux struct ifinfomsg uses ARPHRD_* values, while we used IFT_*
    types (which derive from SNMP ifType definitions in RFC 1573).
    Update the header to reflect this.

    PR:             272144
    Reviewed by:    pouria
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D57334

    (cherry picked from commit 21a75a85f0e0cc328b6e9b437d783ef0c25dc52e)

 share/man/man4/rtnetlink.4    | 17 +++++++++++++++--
 sys/netlink/route/interface.h |  4 ++--
 2 files changed, 17 insertions(+), 4 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-06-19 13:53:16 UTC
A commit in branch stable/14 references this bug:

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

commit d7356667931edf880d80ea9a0cbd2fd3604077db
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-05-29 16:23:17 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-06-19 13:51:52 +0000

    netlink: Indicate that ifinfomsg uses IFT_* types

    On Linux struct ifinfomsg uses ARPHRD_* values, while we used IFT_*
    types (which derive from SNMP ifType definitions in RFC 1573).
    Update the header to reflect this.

    PR:             272144
    Reviewed by:    pouria
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D57334

    (cherry picked from commit 21a75a85f0e0cc328b6e9b437d783ef0c25dc52e)
    (cherry picked from commit 76f29211f0dde8907250b77def3e58082e03afe1)

 share/man/man4/rtnetlink.4    | 19 ++++++++++++++++---
 sys/netlink/route/interface.h |  4 ++--
 2 files changed, 18 insertions(+), 5 deletions(-)