Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Jiri Benc <jbenc@suse.cz>,
	linux-wireless@vger.kernel.org, Jouni Malinen <j@w1.fi>
Subject: [PATCH] hostapd: use eapol frames from ethernet device
Date: Sat, 11 Aug 2007 01:53:32 +0200	[thread overview]
Message-ID: <1186790012.4862.8.camel@johannes.berg> (raw)
In-Reply-To: <1186789737.4862.3.camel@johannes.berg>

Now that the kernel no longer sends them to the management device, grab
them from ethernet instead.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
Maybe the ieee802_1x_receive there should be commented out completely? I
had it commented out for testing but then only added the comment...

 hostapd/driver_devicescape.c |    1 +
 hostapd/hostapd.c            |   30 ++++++++++++++++++++++++------
 hostapd/hostapd.h            |    3 ++-
 3 files changed, 27 insertions(+), 7 deletions(-)

--- hostap.orig/hostapd/driver_devicescape.c	2007-08-11 01:06:26.000000000 +0200
+++ hostap/hostapd/driver_devicescape.c	2007-08-11 01:52:46.000000000 +0200
@@ -1224,6 +1224,7 @@ static void handle_data(struct hostapd_d
 	pos += 2;
 	left -= 2;
 	switch (ethertype) {
+	/* when we run on older wireless-dev kernels we might get this */
 	case ETH_P_PAE:
 		ieee802_1x_receive(hapd, sa, pos, left);
 		break;
--- hostap.orig/hostapd/hostapd.c	2007-08-11 01:20:03.000000000 +0200
+++ hostap/hostapd/hostapd.c	2007-08-11 01:39:00.000000000 +0200
@@ -574,8 +574,10 @@ static void hostapd_cleanup(struct hosta
 	radius_server_deinit(hapd->radius_srv);
 	hapd->radius_srv = NULL;
 
+	l2_packet_deinit(hapd->l2_eapol);
+
 #ifdef CONFIG_IEEE80211R
-	l2_packet_deinit(hapd->l2);
+	l2_packet_deinit(hapd->l2_rrb);
 #endif /* CONFIG_IEEE80211R */
 
 	hostapd_wireless_event_deinit(hapd);
@@ -906,9 +908,9 @@ static int hostapd_wpa_auth_send_ether(v
 		return hapd->driver->send_ether(hapd->drv_priv, dst,
 						hapd->own_addr, proto,
 						data, data_len);
-	if (hapd->l2 == NULL)
+	if (hapd->l2_rrb == NULL)
 		return -1;
-	return l2_packet_send(hapd->l2, dst, proto, data, data_len);
+	return l2_packet_send(hapd->l2_rrb, dst, proto, data, data_len);
 }
 
 
@@ -1080,6 +1082,13 @@ static int mac_in_conf(struct hostapd_co
 	return 0;
 }
 
+static void hostapd_eapol_receive(void *ctx, const u8 *src_addr,
+				  const u8 *buf, size_t len)
+{
+	struct hostapd_data *hapd = ctx;
+
+	ieee802_1x_receive(hapd, src_addr, buf, len);
+}
 
 /**
  * hostapd_setup_bss - Per-BSS setup (initialization)
@@ -1252,6 +1261,15 @@ static int hostapd_setup_bss(struct host
 			       "failed.\n");
 			return -1;
 		}
+
+		hapd->l2_eapol = l2_packet_init(hapd->conf->iface, NULL,
+						ETH_P_EAPOL,
+						hostapd_eapol_receive,
+						hapd, 0);
+		if (!hapd->l2_eapol) {
+			printf("Failed to open l2_packet interface\n");
+			return -1;
+		}
 	}
 
 	if (accounting_init(hapd)) {
@@ -1278,9 +1296,9 @@ static int hostapd_setup_bss(struct host
 	}
 
 #ifdef CONFIG_IEEE80211R
-	hapd->l2 = l2_packet_init(hapd->conf->iface, NULL, ETH_P_RRB,
-				  hostapd_rrb_receive, hapd, 0);
-	if (hapd->l2 == NULL &&
+	hapd->l2_rrb = l2_packet_init(hapd->conf->iface, NULL, ETH_P_RRB,
+				      hostapd_rrb_receive, hapd, 0);
+	if (hapd->l2_rrb == NULL &&
 	    (hapd->driver == NULL || hapd->driver->send_ether == NULL)) {
 		printf("Failed to open l2_packet interface\n");
 		return -1;
--- hostap.orig/hostapd/hostapd.h	2007-08-11 01:19:29.000000000 +0200
+++ hostap/hostapd/hostapd.h	2007-08-11 01:19:56.000000000 +0200
@@ -167,7 +167,8 @@ struct hostapd_data {
 	struct full_dynamic_vlan *full_dynamic_vlan;
 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
 
-	struct l2_packet_data *l2;
+	struct l2_packet_data *l2_rrb;
+	struct l2_packet_data *l2_eapol;
 };
 
 



  reply	other threads:[~2007-08-10 23:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10 23:48 [PATCH] mac80211: remove special casing of EAPOL on mgmt interface Johannes Berg
2007-08-10 23:53 ` Johannes Berg [this message]
2007-08-12 10:58   ` [PATCH] hostapd: use eapol frames from ethernet device Tomas Winkler
2007-08-13  8:51     ` Johannes Berg
2007-08-13 10:46       ` Tomas Winkler
2007-08-13 11:02         ` Johannes Berg
2007-08-14 22:46           ` Tomas Winkler
2007-08-15 10:58             ` Johannes Berg
2007-08-15  4:16           ` Jouni Malinen
2007-08-20 11:57             ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1186790012.4862.8.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=j@w1.fi \
    --cc=jbenc@suse.cz \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox