Add support for locked bridge ports (for 802.1X)
Subsystems (2)
cover Add support for locked bridge ports (for 802.1X)
This patch set is to complement the kernel locked port patches, such that iproute2 can be used to lock/unlock a port and check if a port is locked or not. To lock or unlock a port use the command:
bridge link set dev DEV locked {on | off}
To show the detailed setting of a port, including if the locked flag is enabled for the port(s), use the command:
bridge -d link show [dev DEV]
Hans Schultz (1):
bridge: link: Add command to set port in locked mode
bridge/link.c | 13 +++++++++++++ include/uapi/linux/if_link.h | 1 + 2 files changed, 14 insertions(+)
Signature · 1 line
2.30.2
PATCH 1/1 bridge: link: Add command to set port in locked mode
Add support for setting a bridge port in locked mode to use with 802.1X, so that only authorized clients are allowed access through the port.
Syntax: bridge link set dev DEV locked {on, off}
--- bridge/link.c | 13 +++++++++++++ include/uapi/linux/if_link.h | 1 + 2 files changed, 14 insertions(+)
bridge/link.c +13 -0
@@ -175,6 +175,9 @@ static void print_protinfo(FILE *fp, struct rtattr *attr)if (prtb[IFLA_BRPORT_ISOLATED ])print_on_off (PRINT_ANY ,"isolated" ,"isolated %s " ,rta_getattr_u8 (prtb[IFLA_BRPORT_ISOLATED ])); +if (prtb[IFLA_BRPORT_LOCKED ]) +print_on_off (PRINT_ANY ,"locked" ,"locked %s " , +rta_getattr_u8 (prtb[IFLA_BRPORT_LOCKED ])); }else print_stp_state (rta_getattr_u8 (attr)); }
@@ -275,6 +278,7 @@ static void usage(void)" [ neigh_suppress {on | off} ]\n" " [ vlan_tunnel {on | off} ]\n" " [ isolated {on | off} ]\n" +" [ locked {on | off} ]\n" " [ hwmode {vepa | veb} ]\n" " [ backup_port DEVICE ] [ nobackup_port ]\n" " [ self ] [ master ]\n"
@@ -303,6 +307,7 @@ static int brlink_modify(int argc, char **argv)__s8 vlan_tunnel =-1 ;__s8 mcast_flood =-1 ;__s8 mcast_to_unicast =-1 ; +__s8 locked =-1 ;__s8 isolated =-1 ;__s8 hairpin =-1 ;__s8 bpdu_guard =-1 ;
@@ -415,6 +420,11 @@ static int brlink_modify(int argc, char **argv) isolated =parse_on_off ("isolated" , *argv, &ret);if (ret)return ret; + }else if (strcmp (*argv,"locked" ) ==0 ) { +NEXT_ARG (); + locked =parse_on_off ("locked" , *argv, &ret); +if (ret) +return ret; }else if (strcmp (*argv,"backup_port" ) ==0 ) {NEXT_ARG (); backup_port_idx =ll_name_to_index (*argv);
@@ -489,6 +499,9 @@ static int brlink_modify(int argc, char **argv)if (isolated !=-1 )addattr8 (&req.n,sizeof (req),IFLA_BRPORT_ISOLATED , isolated); +if (locked >=0 ) +addattr8 (&req.n,sizeof (req),IFLA_BRPORT_LOCKED , locked); +if (backup_port_idx !=-1 )addattr32 (&req.n,sizeof (req),IFLA_BRPORT_BACKUP_PORT , backup_port_idx);
include/uapi/linux/if_link.h +1 -0
@@ -534,6 +534,7 @@ enum {IFLA_BRPORT_MRP_IN_OPEN ,IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT ,IFLA_BRPORT_MCAST_EHT_HOSTS_CNT , +IFLA_BRPORT_LOCKED , __IFLA_BRPORT_MAX };#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
Signature · 1 line
2.30.2
Re: [PATCH iproute2-next 1/1] bridge: link: Add command to set port in locked mode
Quoted 11 lines · Hans Schultz
Add support for setting a bridge port in locked mode to use with 802.1X, so that only authorized clients are allowed access through the port.
Syntax: bridge link set dev DEV locked {on, off}
Signed-off-by Hans Schultz <[email protected]>--- bridge/link.c | 13 +++++++++++++ include/uapi/linux/if_link.h | 1 + 2 files changed, 14 insertions(+)
You should add man page documentation and update iplink_bridge_slave.c with the new option as well.
Cheers,
Nik