Bug 282870 - rtnl_handle_iflink() has a type mismatch for ifnet_link_event
Summary: rtnl_handle_iflink() has a type mismatch for ifnet_link_event
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-20 05:28 UTC by nakayamakenjiro
Modified: 2024-11-28 14:48 UTC (History)
1 user (show)

See Also:
linimon: mfc-stable14?
linimon: mfc-stable13?


Attachments
patch for rtnl_handle_iflink type mismatch (472 bytes, patch)
2024-11-20 05:28 UTC, nakayamakenjiro
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nakayamakenjiro 2024-11-20 05:28:53 UTC
Created attachment 255318 [details]
patch for rtnl_handle_iflink type mismatch

In sys/net/if_var.h, the type for ifnet_link_event is defined as:

```
/* Interface link state change event */
typedef void (*ifnet_link_event_handler_t)(void *, if_t, int);
EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t);
```

However, in sys/netlink/route/iface.c, the rtnl_handle_iflink() function, which only takes two arguments, is registered as a handler for ifnet_link_event.


```
static void
rtnl_handle_iflink(void *arg, if_t ifp)
{
        NL_LOG(LOG_DEBUG2, "ifnet %s", if_name(ifp));
        rtnl_handle_ifevent(ifp, NL_RTM_NEWLINK, 0);
}
   ...
        iflink_event = EVENTHANDLER_REGISTER(
            ifnet_link_event, rtnl_handle_iflink, NULL,
            EVENTHANDLER_PRI_ANY);
```
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-11-22 14:06:07 UTC
A commit in branch main references this bug:

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

commit 0289db3259532d51ebe58bc0b2647a0d9e6cae66
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-22 13:52:57 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-22 14:03:40 +0000

    netlink/route: Fix the argument list for rtnl_handle_iflink()

    This function is registered as a ifnet_link_event and so should have the
    corresponding argument list.

    PR:             282870
    Reported by:    nakayamakenjiro@gmail.com
    MFC after:      1 week

 sys/netlink/route/iface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-11-28 14:47:44 UTC
A commit in branch stable/14 references this bug:

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

commit a2f54460e39a915a72df095a3de52a844335024b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-22 13:52:57 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-28 14:41:52 +0000

    netlink/route: Fix the argument list for rtnl_handle_iflink()

    This function is registered as a ifnet_link_event and so should have the
    corresponding argument list.

    PR:             282870
    Reported by:    nakayamakenjiro@gmail.com
    MFC after:      1 week

    (cherry picked from commit 0289db3259532d51ebe58bc0b2647a0d9e6cae66)

 sys/netlink/route/iface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)