Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 4/8] ft: add ft_parse_action_response
Date: Thu, 15 Apr 2021 15:45:04 -0700	[thread overview]
Message-ID: <20210415224508.1823614-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20210415224508.1823614-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]

Parses the APs response to the initial FT-over-DS action
frame. This sets up the handshake passed in to get it
ready for re-association.
---
 src/ft.c | 34 ++++++++++++++++++++++++++++++++++
 src/ft.h |  4 ++++
 2 files changed, 38 insertions(+)

diff --git a/src/ft.c b/src/ft.c
index 9e6935e8..7826653f 100644
--- a/src/ft.c
+++ b/src/ft.c
@@ -478,6 +478,40 @@ ft_error:
 	return -EBADMSG;
 }
 
+int ft_parse_action_response(struct handshake_state *hs,
+				struct handshake_state *old,
+				const uint8_t *frame, size_t frame_len)
+{
+	uint16_t status = 0;
+
+	if (frame_len < 16)
+		goto parse_error;
+
+	/* Category FT */
+	if (frame[0] != 6)
+		goto parse_error;
+
+	/* FT Action */
+	if (frame[1] != 2)
+		goto parse_error;
+
+	if (memcmp(frame + 2, hs->spa, 6))
+		goto parse_error;
+
+	if (memcmp(frame + 8, hs->aa, 6))
+		goto parse_error;
+
+	status = l_get_le16(frame + 14);
+
+	if (status != 0)
+		return (int)status;
+
+	return ft_process_ies(hs, frame + 16, frame_len - 16);
+
+parse_error:
+	return -EBADMSG;
+}
+
 static int ft_rx_action(struct auth_proto *ap, const uint8_t *frame,
 				size_t frame_len)
 {
diff --git a/src/ft.h b/src/ft.h
index 50090a03..a22196b6 100644
--- a/src/ft.h
+++ b/src/ft.h
@@ -36,6 +36,10 @@ bool ft_build_authenticate_ies(struct handshake_state *hs,
 struct handshake_state *ft_over_ds_handshake_new(struct netdev *netdev,
 						struct scan_bss *target);
 
+int ft_parse_action_response(struct handshake_state *hs,
+				struct handshake_state *old,
+				const uint8_t *frame, size_t frame_len);
+
 struct auth_proto *ft_over_air_sm_new(struct handshake_state *hs,
 				ft_tx_authenticate_func_t tx_auth,
 				ft_tx_associate_func_t tx_assoc,
-- 
2.26.2

  parent reply	other threads:[~2021-04-15 22:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 22:45 [PATCH 1/8] ft: separate ft_sm from ft_process_ies James Prestwood
2021-04-15 22:45 ` [PATCH 2/8] ft: expose ft_build_authenticate_ies James Prestwood
2021-04-16 16:32   ` Denis Kenzior
2021-04-15 22:45 ` [PATCH 3/8] ft: add ft_over_ds_handshake_new James Prestwood
2021-04-15 22:45 ` James Prestwood [this message]
2021-04-15 22:45 ` [PATCH 5/8] netdev: factor out FT handshake preparation James Prestwood
2021-04-16 16:33   ` Denis Kenzior
2021-04-15 22:45 ` [PATCH 6/8] ft: netdev: refactor FT-over-DS to properly handle Auth failures James Prestwood
2021-04-16 17:37   ` Denis Kenzior
2021-04-15 22:45 ` [PATCH 7/8] station: specially handle FT-over-DS failure James Prestwood
2021-04-15 22:45 ` [PATCH 8/8] ft: netdev: add return value to tx_associate James Prestwood
2021-04-16 16:31 ` [PATCH 1/8] ft: separate ft_sm from ft_process_ies Denis Kenzior

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=20210415224508.1823614-4-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /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