aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_bsd.c
diff options
context:
space:
mode:
authorMasashi Honma <honma@ictec.co.jp>2010-02-08 19:28:59 (GMT)
committerJouni Malinen <j@w1.fi>2010-02-08 19:28:59 (GMT)
commitd37372568674a8dba78cbcfc0e443f452c308aa5 (patch)
tree7ec62e9b52b680b9b4a0e0e7bb23753b815259e0 /src/drivers/driver_bsd.c
parent719196b1598e3c6545e8d3f6b6cfa2bc59f22a0f (diff)
downloadhostap-d37372568674a8dba78cbcfc0e443f452c308aa5.zip
hostap-d37372568674a8dba78cbcfc0e443f452c308aa5.tar.gz
hostap-d37372568674a8dba78cbcfc0e443f452c308aa5.tar.bz2
driver_bsd: Clean up EAPOL frame transmission code
The bsd_send_eapol() adds Ethernet header by itself. This patch changes it to use l2_packet functionality. I have tested on NetBSD 5.0.1 with WPA-PSK(TKIP).
Diffstat (limited to 'src/drivers/driver_bsd.c')
-rw-r--r--src/drivers/driver_bsd.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index a023a11..663800e 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -758,44 +758,16 @@ bsd_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
int encrypt, const u8 *own_addr)
{
struct bsd_driver_data *drv = priv;
- unsigned char *bp;
- struct l2_ethhdr *eth;
- size_t len;
- int status;
-
- /*
- * Prepend the Ethernet header. If the caller left us
- * space at the front we could just insert it but since
- * we don't know we copy to a local buffer. Given the frequency
- * and size of frames this probably doesn't matter.
- */
- len = data_len + sizeof(struct l2_ethhdr);
- bp = os_zalloc(len);
- if (bp == NULL) {
- wpa_printf(MSG_ERROR, "malloc() failed for bsd_send_eapol"
- "(len=%lu)", (unsigned long) len);
- return -1;
- }
- eth = (struct l2_ethhdr *) bp;
- os_memcpy(eth->h_dest, addr, ETH_ALEN);
- os_memcpy(eth->h_source, own_addr, ETH_ALEN);
- eth->h_proto = htons(ETH_P_EAPOL);
- os_memcpy(eth + 1, data, data_len);
-
- wpa_hexdump(MSG_MSGDUMP, "TX EAPOL", bp, len);
-
- status = l2_packet_send(drv->sock_xmit, addr, ETH_P_EAPOL, bp, len);
-
- os_free(bp);
- return status;
+ wpa_hexdump(MSG_MSGDUMP, "TX EAPOL", data, data_len);
+ return l2_packet_send(drv->sock_xmit, addr, ETH_P_EAPOL, data,
+ data_len);
}
static void
handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
{
struct bsd_driver_data *drv = ctx;
- drv_event_eapol_rx(drv->hapd, src_addr, buf + sizeof(struct l2_ethhdr),
- len - sizeof(struct l2_ethhdr));
+ drv_event_eapol_rx(drv->hapd, src_addr, buf, len);
}
static int
@@ -866,7 +838,7 @@ bsd_init(struct hostapd_data *hapd, struct wpa_init_params *params)
memcpy(drv->iface, params->ifname, sizeof(drv->iface));
drv->sock_xmit = l2_packet_init(drv->iface, NULL, ETH_P_EAPOL,
- handle_read, drv, 1);
+ handle_read, drv, 0);
if (drv->sock_xmit == NULL)
goto bad;
if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr))