diff options
author | Javier Cardona <javier@cozybit.com> | 2011-04-07 18:08:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-12 16:57:37 -0400 |
commit | 15d5dda623139bbf6165030fc251bbd5798f4130 (patch) | |
tree | 3adb84ef7d65fd274008d950ad99434e1a3a28a7 | |
parent | 581a8b0feeed8877aab3a8ca4c972419790cd07f (diff) |
cfg80211/nl80211: Add userspace authentication flag to mesh setup
During mesh setup, use NL80211_MESH_SETUP_USERSPACE_AUTH flag to create
a secure mesh and route management frames to userspace.
Also, NL80211_CMD_GET_WIPHY now returns a flag NL80211_SUPPORT_MESH_AUTH
if the wiphy's mesh implementation supports routing of mesh auth frames
to userspace. This is useful for forward compatibility between old
kernels and new userspace tools.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 9 | ||||
-rw-r--r-- | include/net/cfg80211.h | 5 | ||||
-rw-r--r-- | net/wireless/mesh.c | 4 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 5 |
4 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index ecf6b68a96da..0e652d860819 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -887,6 +887,9 @@ enum nl80211_commands { | |||
887 | * changed once the mesh is active. | 887 | * changed once the mesh is active. |
888 | * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute | 888 | * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute |
889 | * containing attributes from &enum nl80211_meshconf_params. | 889 | * containing attributes from &enum nl80211_meshconf_params. |
890 | * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver | ||
891 | * allows auth frames in a mesh to be passed to userspace for processing via | ||
892 | * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. | ||
890 | * | 893 | * |
891 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 894 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
892 | * @__NL80211_ATTR_AFTER_LAST: internal use | 895 | * @__NL80211_ATTR_AFTER_LAST: internal use |
@@ -1075,6 +1078,8 @@ enum nl80211_attrs { | |||
1075 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, | 1078 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, |
1076 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, | 1079 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, |
1077 | 1080 | ||
1081 | NL80211_ATTR_SUPPORT_MESH_AUTH, | ||
1082 | |||
1078 | /* add attributes here, update the policy in nl80211.c */ | 1083 | /* add attributes here, update the policy in nl80211.c */ |
1079 | 1084 | ||
1080 | __NL80211_ATTR_AFTER_LAST, | 1085 | __NL80211_ATTR_AFTER_LAST, |
@@ -1724,6 +1729,9 @@ enum nl80211_meshconf_params { | |||
1724 | * robust security network ie, or a vendor specific information element that | 1729 | * robust security network ie, or a vendor specific information element that |
1725 | * vendors will use to identify the path selection methods and metrics in use. | 1730 | * vendors will use to identify the path selection methods and metrics in use. |
1726 | * | 1731 | * |
1732 | * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication | ||
1733 | * daemon will be authenticating mesh candidates. | ||
1734 | * | ||
1727 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number | 1735 | * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number |
1728 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use | 1736 | * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use |
1729 | */ | 1737 | */ |
@@ -1732,6 +1740,7 @@ enum nl80211_mesh_setup_params { | |||
1732 | NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, | 1740 | NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, |
1733 | NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, | 1741 | NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, |
1734 | NL80211_MESH_SETUP_IE, | 1742 | NL80211_MESH_SETUP_IE, |
1743 | NL80211_MESH_SETUP_USERSPACE_AUTH, | ||
1735 | 1744 | ||
1736 | /* keep last */ | 1745 | /* keep last */ |
1737 | __NL80211_MESH_SETUP_ATTR_AFTER_LAST, | 1746 | __NL80211_MESH_SETUP_ATTR_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1d02ddf5a8a3..e77603bd1630 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -691,6 +691,7 @@ struct mesh_config { | |||
691 | * @path_metric: which metric to use | 691 | * @path_metric: which metric to use |
692 | * @ie: vendor information elements (optional) | 692 | * @ie: vendor information elements (optional) |
693 | * @ie_len: length of vendor information elements | 693 | * @ie_len: length of vendor information elements |
694 | * @is_secure: or not | ||
694 | * | 695 | * |
695 | * These parameters are fixed when the mesh is created. | 696 | * These parameters are fixed when the mesh is created. |
696 | */ | 697 | */ |
@@ -701,6 +702,7 @@ struct mesh_setup { | |||
701 | u8 path_metric; | 702 | u8 path_metric; |
702 | const u8 *ie; | 703 | const u8 *ie; |
703 | u8 ie_len; | 704 | u8 ie_len; |
705 | bool is_secure; | ||
704 | }; | 706 | }; |
705 | 707 | ||
706 | /** | 708 | /** |
@@ -1451,6 +1453,8 @@ struct cfg80211_ops { | |||
1451 | * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. | 1453 | * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. |
1452 | * @WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS: The device supports separate | 1454 | * @WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS: The device supports separate |
1453 | * unicast and multicast TX keys. | 1455 | * unicast and multicast TX keys. |
1456 | * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing | ||
1457 | * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. | ||
1454 | */ | 1458 | */ |
1455 | enum wiphy_flags { | 1459 | enum wiphy_flags { |
1456 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1460 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
@@ -1463,6 +1467,7 @@ enum wiphy_flags { | |||
1463 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | 1467 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), |
1464 | WIPHY_FLAG_IBSS_RSN = BIT(8), | 1468 | WIPHY_FLAG_IBSS_RSN = BIT(8), |
1465 | WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS= BIT(9), | 1469 | WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS= BIT(9), |
1470 | WIPHY_FLAG_MESH_AUTH = BIT(10), | ||
1466 | }; | 1471 | }; |
1467 | 1472 | ||
1468 | struct mac_address { | 1473 | struct mac_address { |
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 0d4b2260f96f..0e5c122ce324 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -72,6 +72,10 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
72 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) | 72 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) |
73 | return -EOPNOTSUPP; | 73 | return -EOPNOTSUPP; |
74 | 74 | ||
75 | if (!(rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) && | ||
76 | setup->is_secure) | ||
77 | return -EOPNOTSUPP; | ||
78 | |||
75 | if (wdev->mesh_id_len) | 79 | if (wdev->mesh_id_len) |
76 | return -EALREADY; | 80 | return -EALREADY; |
77 | 81 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ccd825a5857e..cbedfc2a42a2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -124,6 +124,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
124 | [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 }, | 124 | [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 }, |
125 | 125 | ||
126 | [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, | 126 | [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, |
127 | [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG }, | ||
127 | 128 | ||
128 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, | 129 | [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY, |
129 | .len = NL80211_HT_CAPABILITY_LEN }, | 130 | .len = NL80211_HT_CAPABILITY_LEN }, |
@@ -594,6 +595,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
594 | 595 | ||
595 | if (dev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) | 596 | if (dev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) |
596 | NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_IBSS_RSN); | 597 | NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_IBSS_RSN); |
598 | if (dev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) | ||
599 | NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_MESH_AUTH); | ||
597 | 600 | ||
598 | NLA_PUT(msg, NL80211_ATTR_CIPHER_SUITES, | 601 | NLA_PUT(msg, NL80211_ATTR_CIPHER_SUITES, |
599 | sizeof(u32) * dev->wiphy.n_cipher_suites, | 602 | sizeof(u32) * dev->wiphy.n_cipher_suites, |
@@ -2823,6 +2826,7 @@ static const struct nla_policy | |||
2823 | nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { | 2826 | nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { |
2824 | [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, | 2827 | [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, |
2825 | [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, | 2828 | [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, |
2829 | [NL80211_MESH_SETUP_USERSPACE_AUTH] = { .type = NLA_FLAG }, | ||
2826 | [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY, | 2830 | [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY, |
2827 | .len = IEEE80211_MAX_DATA_LEN }, | 2831 | .len = IEEE80211_MAX_DATA_LEN }, |
2828 | }; | 2832 | }; |
@@ -2934,6 +2938,7 @@ static int nl80211_parse_mesh_setup(struct genl_info *info, | |||
2934 | setup->ie = nla_data(ieattr); | 2938 | setup->ie = nla_data(ieattr); |
2935 | setup->ie_len = nla_len(ieattr); | 2939 | setup->ie_len = nla_len(ieattr); |
2936 | } | 2940 | } |
2941 | setup->is_secure = nla_get_flag(tb[NL80211_MESH_SETUP_USERSPACE_AUTH]); | ||
2937 | 2942 | ||
2938 | return 0; | 2943 | return 0; |
2939 | } | 2944 | } |