diff mbox series

iw: add support for setting the multiple bssid transmitting flag

Message ID 20200604072451.25427-1-john@phrozen.org (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show
Series iw: add support for setting the multiple bssid transmitting flag | expand

Commit Message

John Crispin June 4, 2020, 7:24 a.m. UTC
When we want to use multiple bssid, we need to indicate that the primary
AP is transmitting at time of creation. This patch adds a new parameter
to achieve this.

Signed-off-by: John Crispin <john@phrozen.org>
---
Hi Johannes,
the patch requires the new nl80211.h from after applying the multiple bssid
kernel series.
        John

 interface.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/interface.c b/interface.c
index 6a44304..ac86259 100644
--- a/interface.c
+++ b/interface.c
@@ -237,6 +237,7 @@  static int handle_interface_add(struct nl80211_state *state,
 	int tpset;
 	unsigned char mac_addr[ETH_ALEN];
 	int found_mac = 0;
+	int multiple_bssid = 0;
 
 	if (argc < 1)
 		return 1;
@@ -287,6 +288,10 @@  try_another:
 				fprintf(stderr, "flags error\n");
 				return 2;
 			}
+		} else if (strcmp(argv[0], "multiple_bssid") == 0) {
+			argc--;
+			argv++;
+			multiple_bssid = 1;
 		} else {
 			return 1;
 		}
@@ -301,18 +306,23 @@  try_another:
 		NLA_PUT(msg, NL80211_ATTR_MESH_ID, strlen(mesh_id), mesh_id);
 	if (found_mac)
 		NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+	if (multiple_bssid)
+		NLA_PUT_U8(msg, NL80211_ATTR_MULTI_BSSID_MODE,
+			   NL80211_MULTIPLE_BSSID_TRANSMITTED);
 
 	return 0;
  nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>] "
+	"[multiple_bssid]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add,
 	"Add a new virtual interface with the given configuration.\n"
 	IFACE_TYPES "\n\n"
 	"The flags are only used for monitor interfaces, valid flags are:\n"
 	VALID_FLAGS "\n\n"
-	"The mesh_id is used only for mesh mode.");
+	"The mesh_id is used only for mesh mode.\n"
+	"The multiple_bssid is used only for AP mode.");
 COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);