Subject: Re: ip_forward notification for driver

From: Ido Schimmel <[email-masked]>
Date: Thu, 10 Nov 2022 10:15:37 +0200

On Thu, Nov 10, 2022 at 09:51:35AM +0200, Leonid Komaryanskiy wrote:
> I'm working on L3 routing offload for switch device and have a
> question about ip_forwarding. I want to disable/enable forwarding on
> the hardware side according to changing value in
> /proc/sys/net/ipv4/ip_forward. As I see, inet_netconf_notify_devconf
> just sends rtnl_notify for userspace. Could I ask you for advice, on
> how can I handle updating value via some notifier or some other Linux
> mechanism in driver?

You can look into netevents. See NETEVENT_IPV4_MPATH_HASH_UPDATE and
NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, for example.