linux/net/bridge/br_sysfs_br.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *	Sysfs attributes of bridge
 *	Linux ethernet bridge
 *
 *	Authors:
 *	Stephen Hemminger		<[email protected]>
 */

#include <linux/capability.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_bridge.h>
#include <linux/rtnetlink.h>
#include <linux/spinlock.h>
#include <linux/times.h>
#include <linux/sched/signal.h>

#include "br_private.h"

/* IMPORTANT: new bridge options must be added with netlink support only
 *            please do not add new sysfs entries
 */

#define to_bridge(cd)

/*
 * Common code for storing bridge parameters.
 */
static ssize_t store_bridge_parm(struct device *d,
				 const char *buf, size_t len,
				 int (*set)(struct net_bridge *br, unsigned long val,
					    struct netlink_ext_ack *extack))
{}


static ssize_t forward_delay_show(struct device *d,
				  struct device_attribute *attr, char *buf)
{}

static int set_forward_delay(struct net_bridge *br, unsigned long val,
			     struct netlink_ext_ack *extack)
{}

static ssize_t forward_delay_store(struct device *d,
				   struct device_attribute *attr,
				   const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(forward_delay);

static ssize_t hello_time_show(struct device *d, struct device_attribute *attr,
			       char *buf)
{}

static int set_hello_time(struct net_bridge *br, unsigned long val,
			  struct netlink_ext_ack *extack)
{}

static ssize_t hello_time_store(struct device *d,
				struct device_attribute *attr, const char *buf,
				size_t len)
{}
static DEVICE_ATTR_RW(hello_time);

static ssize_t max_age_show(struct device *d, struct device_attribute *attr,
			    char *buf)
{}

static int set_max_age(struct net_bridge *br, unsigned long val,
		       struct netlink_ext_ack *extack)
{}

static ssize_t max_age_store(struct device *d, struct device_attribute *attr,
			     const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(max_age);

static ssize_t ageing_time_show(struct device *d,
				struct device_attribute *attr, char *buf)
{}

static int set_ageing_time(struct net_bridge *br, unsigned long val,
			   struct netlink_ext_ack *extack)
{}

static ssize_t ageing_time_store(struct device *d,
				 struct device_attribute *attr,
				 const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(ageing_time);

static ssize_t stp_state_show(struct device *d,
			      struct device_attribute *attr, char *buf)
{}


static int set_stp_state(struct net_bridge *br, unsigned long val,
			 struct netlink_ext_ack *extack)
{}

static ssize_t stp_state_store(struct device *d,
			       struct device_attribute *attr, const char *buf,
			       size_t len)
{}
static DEVICE_ATTR_RW(stp_state);

static ssize_t group_fwd_mask_show(struct device *d,
				   struct device_attribute *attr,
				   char *buf)
{}

static int set_group_fwd_mask(struct net_bridge *br, unsigned long val,
			      struct netlink_ext_ack *extack)
{}

static ssize_t group_fwd_mask_store(struct device *d,
				    struct device_attribute *attr,
				    const char *buf,
				    size_t len)
{}
static DEVICE_ATTR_RW(group_fwd_mask);

static ssize_t priority_show(struct device *d, struct device_attribute *attr,
			     char *buf)
{}

static int set_priority(struct net_bridge *br, unsigned long val,
			struct netlink_ext_ack *extack)
{}

static ssize_t priority_store(struct device *d, struct device_attribute *attr,
			      const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(priority);

static ssize_t root_id_show(struct device *d, struct device_attribute *attr,
			    char *buf)
{}
static DEVICE_ATTR_RO(root_id);

static ssize_t bridge_id_show(struct device *d, struct device_attribute *attr,
			      char *buf)
{}
static DEVICE_ATTR_RO(bridge_id);

static ssize_t root_port_show(struct device *d, struct device_attribute *attr,
			      char *buf)
{}
static DEVICE_ATTR_RO(root_port);

static ssize_t root_path_cost_show(struct device *d,
				   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(root_path_cost);

static ssize_t topology_change_show(struct device *d,
				    struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(topology_change);

static ssize_t topology_change_detected_show(struct device *d,
					     struct device_attribute *attr,
					     char *buf)
{}
static DEVICE_ATTR_RO(topology_change_detected);

static ssize_t hello_timer_show(struct device *d,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(hello_timer);

static ssize_t tcn_timer_show(struct device *d, struct device_attribute *attr,
			      char *buf)
{}
static DEVICE_ATTR_RO(tcn_timer);

static ssize_t topology_change_timer_show(struct device *d,
					  struct device_attribute *attr,
					  char *buf)
{}
static DEVICE_ATTR_RO(topology_change_timer);

static ssize_t gc_timer_show(struct device *d, struct device_attribute *attr,
			     char *buf)
{}
static DEVICE_ATTR_RO(gc_timer);

static ssize_t group_addr_show(struct device *d,
			       struct device_attribute *attr, char *buf)
{}

static ssize_t group_addr_store(struct device *d,
				struct device_attribute *attr,
				const char *buf, size_t len)
{}

static DEVICE_ATTR_RW(group_addr);

static int set_flush(struct net_bridge *br, unsigned long val,
		     struct netlink_ext_ack *extack)
{}

static ssize_t flush_store(struct device *d,
			   struct device_attribute *attr,
			   const char *buf, size_t len)
{}
static DEVICE_ATTR_WO(flush);

static ssize_t no_linklocal_learn_show(struct device *d,
				       struct device_attribute *attr,
				       char *buf)
{}

static int set_no_linklocal_learn(struct net_bridge *br, unsigned long val,
				  struct netlink_ext_ack *extack)
{}

static ssize_t no_linklocal_learn_store(struct device *d,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(no_linklocal_learn);

#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
static ssize_t multicast_router_show(struct device *d,
				     struct device_attribute *attr, char *buf)
{}

static int set_multicast_router(struct net_bridge *br, unsigned long val,
				struct netlink_ext_ack *extack)
{}

static ssize_t multicast_router_store(struct device *d,
				      struct device_attribute *attr,
				      const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_router);

static ssize_t multicast_snooping_show(struct device *d,
				       struct device_attribute *attr,
				       char *buf)
{}

static ssize_t multicast_snooping_store(struct device *d,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_snooping);

static ssize_t multicast_query_use_ifaddr_show(struct device *d,
					       struct device_attribute *attr,
					       char *buf)
{}

static int set_query_use_ifaddr(struct net_bridge *br, unsigned long val,
				struct netlink_ext_ack *extack)
{}

static ssize_t
multicast_query_use_ifaddr_store(struct device *d,
				 struct device_attribute *attr,
				 const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_query_use_ifaddr);

static ssize_t multicast_querier_show(struct device *d,
				      struct device_attribute *attr,
				      char *buf)
{}

static int set_multicast_querier(struct net_bridge *br, unsigned long val,
				 struct netlink_ext_ack *extack)
{}

static ssize_t multicast_querier_store(struct device *d,
				       struct device_attribute *attr,
				       const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_querier);

static ssize_t hash_elasticity_show(struct device *d,
				    struct device_attribute *attr, char *buf)
{}

static int set_elasticity(struct net_bridge *br, unsigned long val,
			  struct netlink_ext_ack *extack)
{}

static ssize_t hash_elasticity_store(struct device *d,
				     struct device_attribute *attr,
				     const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(hash_elasticity);

static ssize_t hash_max_show(struct device *d, struct device_attribute *attr,
			     char *buf)
{}

static int set_hash_max(struct net_bridge *br, unsigned long val,
			struct netlink_ext_ack *extack)
{}

static ssize_t hash_max_store(struct device *d, struct device_attribute *attr,
			      const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(hash_max);

static ssize_t multicast_igmp_version_show(struct device *d,
					   struct device_attribute *attr,
					   char *buf)
{}

static int set_multicast_igmp_version(struct net_bridge *br, unsigned long val,
				      struct netlink_ext_ack *extack)
{}

static ssize_t multicast_igmp_version_store(struct device *d,
					    struct device_attribute *attr,
					    const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_igmp_version);

static ssize_t multicast_last_member_count_show(struct device *d,
						struct device_attribute *attr,
						char *buf)
{}

static int set_last_member_count(struct net_bridge *br, unsigned long val,
				 struct netlink_ext_ack *extack)
{}

static ssize_t multicast_last_member_count_store(struct device *d,
						 struct device_attribute *attr,
						 const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_last_member_count);

static ssize_t multicast_startup_query_count_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_startup_query_count(struct net_bridge *br, unsigned long val,
				   struct netlink_ext_ack *extack)
{}

static ssize_t multicast_startup_query_count_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(multicast_startup_query_count);

static ssize_t multicast_last_member_interval_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_last_member_interval(struct net_bridge *br, unsigned long val,
				    struct netlink_ext_ack *extack)
{}

static ssize_t multicast_last_member_interval_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(multicast_last_member_interval);

static ssize_t multicast_membership_interval_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_membership_interval(struct net_bridge *br, unsigned long val,
				   struct netlink_ext_ack *extack)
{}

static ssize_t multicast_membership_interval_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(multicast_membership_interval);

static ssize_t multicast_querier_interval_show(struct device *d,
					       struct device_attribute *attr,
					       char *buf)
{}

static int set_querier_interval(struct net_bridge *br, unsigned long val,
				struct netlink_ext_ack *extack)
{}

static ssize_t multicast_querier_interval_store(struct device *d,
						struct device_attribute *attr,
						const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_querier_interval);

static ssize_t multicast_query_interval_show(struct device *d,
					     struct device_attribute *attr,
					     char *buf)
{}

static int set_query_interval(struct net_bridge *br, unsigned long val,
			      struct netlink_ext_ack *extack)
{}

static ssize_t multicast_query_interval_store(struct device *d,
					      struct device_attribute *attr,
					      const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_query_interval);

static ssize_t multicast_query_response_interval_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_query_response_interval(struct net_bridge *br, unsigned long val,
				       struct netlink_ext_ack *extack)
{}

static ssize_t multicast_query_response_interval_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(multicast_query_response_interval);

static ssize_t multicast_startup_query_interval_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_startup_query_interval(struct net_bridge *br, unsigned long val,
				      struct netlink_ext_ack *extack)
{}

static ssize_t multicast_startup_query_interval_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(multicast_startup_query_interval);

static ssize_t multicast_stats_enabled_show(struct device *d,
					    struct device_attribute *attr,
					    char *buf)
{}

static int set_stats_enabled(struct net_bridge *br, unsigned long val,
			     struct netlink_ext_ack *extack)
{}

static ssize_t multicast_stats_enabled_store(struct device *d,
					     struct device_attribute *attr,
					     const char *buf,
					     size_t len)
{}
static DEVICE_ATTR_RW(multicast_stats_enabled);

#if IS_ENABLED(CONFIG_IPV6)
static ssize_t multicast_mld_version_show(struct device *d,
					  struct device_attribute *attr,
					  char *buf)
{}

static int set_multicast_mld_version(struct net_bridge *br, unsigned long val,
				     struct netlink_ext_ack *extack)
{}

static ssize_t multicast_mld_version_store(struct device *d,
					   struct device_attribute *attr,
					   const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(multicast_mld_version);
#endif
#endif
#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
static ssize_t nf_call_iptables_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_nf_call_iptables(struct net_bridge *br, unsigned long val,
				struct netlink_ext_ack *extack)
{}

static ssize_t nf_call_iptables_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(nf_call_iptables);

static ssize_t nf_call_ip6tables_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_nf_call_ip6tables(struct net_bridge *br, unsigned long val,
				 struct netlink_ext_ack *extack)
{}

static ssize_t nf_call_ip6tables_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(nf_call_ip6tables);

static ssize_t nf_call_arptables_show(
	struct device *d, struct device_attribute *attr, char *buf)
{}

static int set_nf_call_arptables(struct net_bridge *br, unsigned long val,
				 struct netlink_ext_ack *extack)
{}

static ssize_t nf_call_arptables_store(
	struct device *d, struct device_attribute *attr, const char *buf,
	size_t len)
{}
static DEVICE_ATTR_RW(nf_call_arptables);
#endif
#ifdef CONFIG_BRIDGE_VLAN_FILTERING
static ssize_t vlan_filtering_show(struct device *d,
				   struct device_attribute *attr,
				   char *buf)
{}

static ssize_t vlan_filtering_store(struct device *d,
				    struct device_attribute *attr,
				    const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(vlan_filtering);

static ssize_t vlan_protocol_show(struct device *d,
				  struct device_attribute *attr,
				  char *buf)
{}

static ssize_t vlan_protocol_store(struct device *d,
				   struct device_attribute *attr,
				   const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(vlan_protocol);

static ssize_t default_pvid_show(struct device *d,
				 struct device_attribute *attr,
				 char *buf)
{}

static ssize_t default_pvid_store(struct device *d,
				  struct device_attribute *attr,
				  const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(default_pvid);

static ssize_t vlan_stats_enabled_show(struct device *d,
				       struct device_attribute *attr,
				       char *buf)
{}

static int set_vlan_stats_enabled(struct net_bridge *br, unsigned long val,
				  struct netlink_ext_ack *extack)
{}

static ssize_t vlan_stats_enabled_store(struct device *d,
					struct device_attribute *attr,
					const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(vlan_stats_enabled);

static ssize_t vlan_stats_per_port_show(struct device *d,
					struct device_attribute *attr,
					char *buf)
{}

static int set_vlan_stats_per_port(struct net_bridge *br, unsigned long val,
				   struct netlink_ext_ack *extack)
{}

static ssize_t vlan_stats_per_port_store(struct device *d,
					 struct device_attribute *attr,
					 const char *buf, size_t len)
{}
static DEVICE_ATTR_RW(vlan_stats_per_port);
#endif

static struct attribute *bridge_attrs[] =;

static const struct attribute_group bridge_group =;

/*
 * Export the forwarding information table as a binary file
 * The records are struct __fdb_entry.
 *
 * Returns the number of bytes read.
 */
static ssize_t brforward_read(struct file *filp, struct kobject *kobj,
			      struct bin_attribute *bin_attr,
			      char *buf, loff_t off, size_t count)
{}

static struct bin_attribute bridge_forward =;

/*
 * Add entries in sysfs onto the existing network class device
 * for the bridge.
 *   Adds a attribute group "bridge" containing tuning parameters.
 *   Binary attribute containing the forward table
 *   Sub directory to hold links to interfaces.
 *
 * Note: the ifobj exists only to be a subdirectory
 *   to hold links.  The ifobj exists in same data structure
 *   as it's parent the bridge so reference counting works.
 */
int br_sysfs_addbr(struct net_device *dev)
{}

void br_sysfs_delbr(struct net_device *dev)
{}