lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 26 Jun 2024 08:30:04 -0700
From: Jay Vosburgh <jay.vosburgh@...onical.com>
To: Hangbin Liu <liuhangbin@...il.com>
cc: netdev@...r.kernel.org, Andy Gospodarek <andy@...yhouse.net>,
    "David S. Miller" <davem@...emloft.net>,
    Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
    Paolo Abeni <pabeni@...hat.com>, Ido Schimmel <idosch@...dia.com>,
    Jiri Pirko <jiri@...nulli.us>, Amit Cohen <amcohen@...dia.com>,
    Nikolay Aleksandrov <razor@...ckwall.org>
Subject: Re: [PATCHv3 net-next] bonding: 3ad: send ifinfo notify when mux
 state changed

Hangbin Liu <liuhangbin@...il.com> wrote:

>Currently, administrators need to retrieve LACP mux state changes from
>the kernel DEBUG log using netdev_dbg and slave_dbg macros. To simplify
>this process, let's send the ifinfo notification whenever the mux state
>changes. This will enable users to directly access and monitor this
>information using the ip monitor command.
>
>Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
>---
>v3: forgot to use GFP_ATOMIC. (Nikolay Aleksandrov)
>    export symbol for rtmsg_ifinfo. It's weird that my build succeed with
>    tools/testing/selftests/drivers/net/bonding/config without export
>    the symbol, but build failed with tools/testing/selftests/net/config.

	I would hazard to guess that bonding/config works without export
because it has

CONFIG_BONDING=y

	which builds bonding into the main image (not as a module),
which wouldn't need the EXPORT_SYMBOL.

	I think the change is fine, the only question is whether it's
better to have a wrapper for rtmsg_ifinfo() in net/core/dev.c (where all
current callers are).  I don't see a particular need, but others might
want some consistency.

Acked-by: Jay Vosburgh <jay.vosburgh@...onical.com>

	-J


>v2: don't use call_netdevice_notifiers as it will case sleeping in atomic
>    context (Nikolay Aleksandrov)
>
>After this patch, we can see the following info with `ip -d monitor link`
>
>7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default
>    link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
>    veth
>    bond_slave state BACKUP mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 143 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,expired> ad_partner_oper_port_state 55 ad_partner_oper_port_state_str <active,short_timeout,aggregating,collecting,distributing> ...
>7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default
>    link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
>    veth
>    bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 79 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,defaulted> ad_partner_oper_port_state 1 ad_partner_oper_port_state_str <active> ...
>7: veth1@if6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc noqueue master bond0 state UP group default
>    link/ether 02:0a:04:c2:d6:21 brd ff:ff:ff:ff:ff:ff link-netns b promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
>    veth
>    bond_slave state ACTIVE mii_status UP ... ad_aggregator_id 1 ad_actor_oper_port_state 63 ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ad_partner_oper_port_state 63 ad_partner_oper_port_state_str <active,short_timeout,aggregating,in_sync,collecting,distributing> ...
>---
> drivers/net/bonding/bond_3ad.c | 3 +++
> net/core/rtnetlink.c           | 1 +
> 2 files changed, 4 insertions(+)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index c6807e473ab7..b57c5670b31a 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -11,6 +11,7 @@
> #include <linux/etherdevice.h>
> #include <linux/if_bonding.h>
> #include <linux/pkt_sched.h>
>+#include <linux/rtnetlink.h>
> #include <net/net_namespace.h>
> #include <net/bonding.h>
> #include <net/bond_3ad.h>
>@@ -1185,6 +1186,8 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 		default:
> 			break;
> 		}
>+
>+		rtmsg_ifinfo(RTM_NEWLINK, port->slave->dev, 0, GFP_ATOMIC, 0, NULL);
> 	}
> }
> 
>diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
>index eabfc8290f5e..4507bb8d5264 100644
>--- a/net/core/rtnetlink.c
>+++ b/net/core/rtnetlink.c
>@@ -4116,6 +4116,7 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change,
> 	rtmsg_ifinfo_event(type, dev, change, rtnl_get_event(0), flags,
> 			   NULL, 0, portid, nlh);
> }
>+EXPORT_SYMBOL(rtmsg_ifinfo);
> 
> void rtmsg_ifinfo_newnet(int type, struct net_device *dev, unsigned int change,
> 			 gfp_t flags, int *new_nsid, int new_ifindex)
>-- 
>2.45.0
>

---
	-Jay Vosburgh, jay.vosburgh@...onical.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ