[Bug 272144] netlink sets ifi_type to FreeBSD if_type instead of ARPHRD_*

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 22 Jun 2023 11:24:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272144

            Bug ID: 272144
           Summary: netlink sets ifi_type to FreeBSD if_type instead of
                    ARPHRD_*
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: misha@freebsd.org

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?

-- 
You are receiving this mail because:
You are the assignee for the bug.