P2P: Add Device Name into WPS IE in Probe Request frames
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 18 Jul 2010 21:30:24 +0000 (14:30 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:16 +0000 (07:17 -0700)
src/wps/wps.c
src/wps/wps.h
src/wps/wps_dev_attr.h
src/wps/wps_registrar.c

index 4436e83..3b6bf19 100644 (file)
@@ -488,6 +488,11 @@ struct wpabuf * wps_build_probe_req_ie(int pbc, struct wps_device_data *dev,
                return NULL;
        }
 
+       if (dev->p2p && wps_build_dev_name(dev, ie)) {
+               wpabuf_free(ie);
+               return NULL;
+       }
+
        return wps_ie_encapsulate(ie);
 }
 
index b8fb4e9..432dcc5 100644 (file)
@@ -75,6 +75,7 @@ struct wps_credential {
  * @pri_dev_type: Primary Device Type
  * @os_version: OS Version
  * @rf_bands: RF bands (WPS_RF_24GHZ, WPS_RF_50GHZ flags)
+ * @p2p: Whether the device is a P2P device
  */
 struct wps_device_data {
        u8 mac_addr[ETH_ALEN];
@@ -86,6 +87,8 @@ struct wps_device_data {
        u8 pri_dev_type[WPS_DEV_TYPE_LEN];
        u32 os_version;
        u8 rf_bands;
+
+       int p2p;
 };
 
 struct oob_conf_data {
index 1c80df1..e3cdf0d 100644 (file)
@@ -26,6 +26,7 @@ int wps_build_os_version(struct wps_device_data *dev, struct wpabuf *msg);
 int wps_build_rf_bands(struct wps_device_data *dev, struct wpabuf *msg);
 int wps_build_primary_dev_type(struct wps_device_data *dev,
                               struct wpabuf *msg);
+int wps_build_dev_name(struct wps_device_data *dev, struct wpabuf *msg);
 int wps_process_device_attrs(struct wps_device_data *dev,
                             struct wps_parse_attr *attr);
 int wps_process_os_version(struct wps_device_data *dev, const u8 *ver);
index 7f26306..03023b0 100644 (file)
@@ -1056,6 +1056,15 @@ static int wps_set_ie(struct wps_registrar *reg)
                return -1;
        }
 
+#ifdef CONFIG_P2P
+       if (wps_build_dev_name(&reg->wps->dev, beacon) ||
+           wps_build_primary_dev_type(&reg->wps->dev, beacon)) {
+               wpabuf_free(beacon);
+               wpabuf_free(probe);
+               return -1;
+       }
+#endif /* CONFIG_P2P */
+
        beacon = wps_ie_encapsulate(beacon);
        probe = wps_ie_encapsulate(probe);