[PATCH 4/6] Add vendor cmd for the eapol Tx/Rx handle for Intel Lantiq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Implement sending and receiving eapol frames via nl80211
vendor commands for Intel Ltq vendor.

Signed-off-by: Sarada Prasanna Garnayak <sarada.prasanna.garnayak@xxxxxxxxx>
---
 src/common/intel-ltq-vendor.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/src/common/intel-ltq-vendor.h b/src/common/intel-ltq-vendor.h
index 7b1b39398..6b9fac849 100644
--- a/src/common/intel-ltq-vendor.h
+++ b/src/common/intel-ltq-vendor.h
@@ -169,5 +169,45 @@ static inline int nl80211_free_aid(void *priv, u16 *aid)
 
 	return res;
 }
+
+static inline void
+intel_ltq_nl80211_handle_eapol(struct wpa_driver_nl80211_data *drv,
+			       const u8 *data, size_t len)
+{
+	struct l2_ethhdr *eth = (struct l2_ethhdr *)data;
+	int ethhdr_len = sizeof(struct l2_ethhdr);
+
+	drv_event_eapol_rx(drv->ctx, eth->h_source,
+			   data + ethhdr_len, len - ethhdr_len);
+}
+
+static inline int
+nl80211_vendor_send_eapol_data(void *priv, const u8 *addr, const u8 *own_addr,
+			       const u8 *data, size_t data_len)
+{
+        int ret;
+        struct l2_ethhdr *eth;
+        int eth_len = sizeof(struct l2_ethhdr) + data_len;
+
+        eth = os_zalloc(eth_len);
+        if (!eth) {
+                wpa_printf(MSG_DEBUG,
+                           "nl80211: No memory to allocate EAPOL buffer");
+                return -1;
+        }
+
+        os_memcpy(eth->h_dest, addr, ETH_ALEN);
+        os_memcpy(eth->h_source, own_addr, ETH_ALEN);
+        eth->h_proto = htons(ETH_P_PAE);
+        os_memcpy(eth + 1, data, data_len);
+        ret = nl80211_vendor_cmd(priv, OUI_INTEL_LTQ,
+                                 INTEL_LTQ_NL80211_VENDOR_SUBCMD_TX_EAPOL,
+                                 (const u8 *) eth, eth_len, NULL);
+        if (ret < 0)
+                wpa_printf(MSG_ERROR, "nl80211: EAPOL TX: %s", strerror(errno));
+        os_free(eth);
+
+        return ret;
+}
 #endif /* CONFIG_DRIVER_NL80211_INTEL_LTQ */
 #endif /* INTEL_LTQ_VENDOR_H */
-- 
2.11.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux