kernel: adjust bridge port isolate patch to match upstream attribute naming

Newer kernels have a patch that implements compatible functionality
directly. Adjust the attribute of our own patch in preparation for
dropping it later

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2018-07-04 19:49:32 +02:00
parent e07ad61aec
commit 41a1c1af4b
3 changed files with 9 additions and 24 deletions

View file

@ -62,7 +62,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI);
BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD);
BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD); BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD);
+BRPORT_ATTR_FLAG(isolate_mode, BR_ISOLATE_MODE); +BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE);
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
&brport_attr_proxyarp_wifi, &brport_attr_proxyarp_wifi,
&brport_attr_multicast_flood, &brport_attr_multicast_flood,
&brport_attr_broadcast_flood, &brport_attr_broadcast_flood,
+ &brport_attr_isolate_mode, + &brport_attr_isolated,
NULL NULL
}; };

View file

@ -62,7 +62,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP);
BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI);
BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD);
+BRPORT_ATTR_FLAG(isolate_mode, BR_ISOLATE_MODE); +BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE);
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
&brport_attr_proxyarp, &brport_attr_proxyarp,
&brport_attr_proxyarp_wifi, &brport_attr_proxyarp_wifi,
&brport_attr_multicast_flood, &brport_attr_multicast_flood,
+ &brport_attr_isolate_mode, + &brport_attr_isolated,
NULL NULL
}; };

View file

@ -15,34 +15,19 @@ Isolating individual bridge ports
struct bridge_mcast_own_query ip4_own_query; struct bridge_mcast_own_query ip4_own_query;
--- a/net/bridge/br_sysfs_if.c --- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c
@@ -171,6 +171,22 @@ BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLO @@ -170,6 +170,7 @@ BRPORT_ATTR_FLAG(bpdu_guard, BR_BPDU_GUA
BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLOCK);
BRPORT_ATTR_FLAG(learning, BR_LEARNING); BRPORT_ATTR_FLAG(learning, BR_LEARNING);
BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD); BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD);
+BRPORT_ATTR_FLAG(isolated, BR_ISOLATE_MODE);
+static ssize_t show_isolate_mode(struct net_bridge_port *p, char *buf)
+{
+ int isolate_mode = (p->flags & BR_ISOLATE_MODE) ? 1 : 0;
+ return sprintf(buf, "%d\n", isolate_mode);
+}
+static ssize_t store_isolate_mode(struct net_bridge_port *p, unsigned long v)
+{
+ if (v)
+ p->flags |= BR_ISOLATE_MODE;
+ else
+ p->flags &= ~BR_ISOLATE_MODE;
+ return 0;
+}
+static BRPORT_ATTR(isolate_mode, S_IRUGO | S_IWUSR,
+ show_isolate_mode, store_isolate_mode);
+
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
{ @@ -213,6 +214,7 @@ static const struct brport_attribute *br
@@ -213,6 +229,7 @@ static const struct brport_attribute *br
&brport_attr_multicast_router, &brport_attr_multicast_router,
&brport_attr_multicast_fast_leave, &brport_attr_multicast_fast_leave,
#endif #endif
+ &brport_attr_isolate_mode, + &brport_attr_isolated,
NULL NULL
}; };