diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2007-08-23 18:44:01 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2007-08-23 18:44:01 +0000 |
commit | 551f0dbe88009339f608ed931e0257456bd53c10 (patch) | |
tree | 54bba0fb9f7b6286934172c4929a157cfdfe77ce /sys | |
parent | ec2abfcab406c3cde7bb626c18e18f38838d533e (diff) |
add a new ieee80211_save_ie() function to make a copy of an
information element in a management frame.
the authenticator has to make a copy of the RSN/WPA1 IE from
(Re)Association requests so that it can be compared with the
one included in message 2/4 of the 4-way handshake.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net80211/ieee80211_input.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 69d97a98df8..0ce2059e7d1 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */ -/* $OpenBSD: ieee80211_input.c,v 1.66 2007/08/23 16:59:32 damien Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.67 2007/08/23 18:44:00 damien Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting @@ -81,6 +81,7 @@ int ieee80211_parse_rsn(struct ieee80211com *, struct ieee80211_node *, const u_int8_t *); int ieee80211_parse_wpa1(struct ieee80211com *, struct ieee80211_node *, const u_int8_t *); +int ieee80211_save_ie(const u_int8_t *, u_int8_t **); void ieee80211_recv_pspoll(struct ieee80211com *, struct mbuf *, int, u_int32_t); int ieee80211_do_slow_print(struct ieee80211com *, int *); @@ -1082,6 +1083,23 @@ ieee80211_parse_wpa1(struct ieee80211com *ic, struct ieee80211_node *ni, return ieee80211_parse_rsn_body(ic, ni, frm + 6, frm[1] - 4); } +/* + * Create a copy of an information element. + */ +int +ieee80211_save_ie(const u_int8_t *frm, u_int8_t **ie) +{ + if (*ie == NULL || (*ie)[1] != frm[1]) { + if (*ie != NULL) + FREE(*ie, M_DEVBUF); + MALLOC(*ie, u_int8_t *, 2 + frm[1], M_DEVBUF, M_NOWAIT); + if (*ie == NULL) + return ENOMEM; + } + memcpy(*ie, frm, 2 + frm[1]); + return 0; +} + /*- * Beacon/Probe response frame format: * [8] Timestamp |