wpa_supplicant: Allow configuring the MACsec port for MKA
Previously, wpa_supplicant only supported hardcoded port == 1 in the SCI, but users may want to choose a different port. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
This commit is contained in:
parent
1d3d0666a6
commit
e0d9fd344d
8 changed files with 21 additions and 5 deletions
|
@ -3071,7 +3071,7 @@ static void kay_l2_receive(void *ctx, const u8 *src_addr, const u8 *buf,
|
|||
*/
|
||||
struct ieee802_1x_kay *
|
||||
ieee802_1x_kay_init(struct ieee802_1x_kay_ctx *ctx, enum macsec_policy policy,
|
||||
const char *ifname, const u8 *addr)
|
||||
u16 port, const char *ifname, const u8 *addr)
|
||||
{
|
||||
struct ieee802_1x_kay *kay;
|
||||
|
||||
|
@ -3093,7 +3093,7 @@ ieee802_1x_kay_init(struct ieee802_1x_kay_ctx *ctx, enum macsec_policy policy,
|
|||
|
||||
os_strlcpy(kay->if_name, ifname, IFNAMSIZ);
|
||||
os_memcpy(kay->actor_sci.addr, addr, ETH_ALEN);
|
||||
kay->actor_sci.port = host_to_be16(0x0001);
|
||||
kay->actor_sci.port = host_to_be16(port ? port : 0x0001);
|
||||
kay->actor_priority = DEFAULT_PRIO_NOT_KEY_SERVER;
|
||||
|
||||
/* While actor acts as a key server, shall distribute sakey */
|
||||
|
|
|
@ -233,7 +233,7 @@ struct ieee802_1x_kay {
|
|||
|
||||
struct ieee802_1x_kay *
|
||||
ieee802_1x_kay_init(struct ieee802_1x_kay_ctx *ctx, enum macsec_policy policy,
|
||||
const char *ifname, const u8 *addr);
|
||||
u16 port, const char *ifname, const u8 *addr);
|
||||
void ieee802_1x_kay_deinit(struct ieee802_1x_kay *kay);
|
||||
|
||||
struct ieee802_1x_mka_participant *
|
||||
|
|
|
@ -2126,6 +2126,7 @@ static const struct parse_data ssid_fields[] = {
|
|||
#ifdef CONFIG_MACSEC
|
||||
{ INT_RANGE(macsec_policy, 0, 1) },
|
||||
{ INT_RANGE(macsec_integ_only, 0, 1) },
|
||||
{ INT_RANGE(macsec_port, 1, 65534) },
|
||||
{ FUNC_KEY(mka_cak) },
|
||||
{ FUNC_KEY(mka_ckn) },
|
||||
#endif /* CONFIG_MACSEC */
|
||||
|
|
|
@ -809,6 +809,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
|
|||
write_mka_cak(f, ssid);
|
||||
write_mka_ckn(f, ssid);
|
||||
INT(macsec_integ_only);
|
||||
INT(macsec_port);
|
||||
#endif /* CONFIG_MACSEC */
|
||||
#ifdef CONFIG_HS20
|
||||
INT(update_identifier);
|
||||
|
|
|
@ -741,6 +741,15 @@ struct wpa_ssid {
|
|||
*/
|
||||
int macsec_integ_only;
|
||||
|
||||
/**
|
||||
* macsec_port - MACsec port (in SCI)
|
||||
*
|
||||
* Port component of the SCI.
|
||||
*
|
||||
* Range: 1-65534 (default: 1)
|
||||
*/
|
||||
int macsec_port;
|
||||
|
||||
/**
|
||||
* mka_ckn - MKA pre-shared CKN
|
||||
*/
|
||||
|
|
|
@ -1391,6 +1391,7 @@ static const char *network_fields[] = {
|
|||
#ifdef CONFIG_MACSEC
|
||||
"macsec_policy",
|
||||
"macsec_integ_only",
|
||||
"macsec_port",
|
||||
#endif /* CONFIG_MACSEC */
|
||||
#ifdef CONFIG_HS20
|
||||
"update_identifier",
|
||||
|
|
|
@ -899,6 +899,10 @@ fast_reauth=1
|
|||
# 0: Encrypt traffic (default)
|
||||
# 1: Integrity only
|
||||
#
|
||||
# macsec_port: IEEE 802.1X/MACsec port
|
||||
# Port component of the SCI
|
||||
# Range: 1-65534 (default: 1)
|
||||
#
|
||||
# mka_cak and mka_ckn: IEEE 802.1X/MACsec pre-shared authentication mode
|
||||
# This allows to configure MACsec with a pre-shared key using a (CAK,CKN) pair.
|
||||
# In this mode, instances of wpa_supplicant can act as peers, one of
|
||||
|
|
|
@ -232,8 +232,8 @@ int ieee802_1x_alloc_kay_sm(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
|
|||
kay_ctx->enable_transmit_sa = wpas_enable_transmit_sa;
|
||||
kay_ctx->disable_transmit_sa = wpas_disable_transmit_sa;
|
||||
|
||||
res = ieee802_1x_kay_init(kay_ctx, policy, wpa_s->ifname,
|
||||
wpa_s->own_addr);
|
||||
res = ieee802_1x_kay_init(kay_ctx, policy, ssid->macsec_port,
|
||||
wpa_s->ifname, wpa_s->own_addr);
|
||||
if (res == NULL) {
|
||||
os_free(kay_ctx);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue