[PATCH 3/8] mka: pass full structures down to macsec drivers' transmit SC ops

Jouni Malinen j at w1.fi
Mon Oct 3 03:11:26 PDT 2016


On Tue, Sep 20, 2016 at 09:43:06AM +0200, Sabrina Dubroca wrote:
> Clean up the driver interface by passing pointers to struct transmit_sc
> down the stack to the {create,delete}_transmit_sc ops, instead of passing the
> individual arguments.

> diff --git a/src/drivers/driver.h b/src/drivers/driver.h

> -	int (*create_transmit_sc)(void *priv, u32 channel, const u8 *sci_addr,
> -				  u16 sci_port, unsigned int conf_offset);
> +	int (*create_transmit_sc)(void *priv, struct transmit_sc *sc,
> +				  enum confidentiality_offset conf_offset);

This changes conf_offset to an enum that has values 0..3.

> diff --git a/src/drivers/driver_macsec_qca.c b/src/drivers/driver_macsec_qca.c
> -static int macsec_qca_create_transmit_sc(void *priv, u32 channel,
> -					 const u8 *sci_addr, u16 sci_port,
> +static int macsec_qca_create_transmit_sc(void *priv, struct transmit_sc *sc,
>  					 unsigned int conf_offset)

However, the driver wrapper implementation here is not updated to match
that change in type. Nor was there any change on how the values are
handled.

> diff --git a/wpa_supplicant/wpas_kay.c b/wpa_supplicant/wpas_kay.c

>  static int
> -wpas_create_transmit_sc(void *wpa_s, u32 channel,
> -			const struct ieee802_1x_mka_sci *sci,
> +wpas_create_transmit_sc(void *wpa_s, struct transmit_sc *sc,
>  			enum confidentiality_offset co)
>  {
> -	return wpa_drv_create_transmit_sc(wpa_s, channel, sci->addr,
> -					  be_to_host16(sci->port),
> +	return wpa_drv_create_transmit_sc(wpa_s, sc,
>  					  conf_offset_val(co));
>  }

And this function is still converting that enum (values 0..3) to values
0, 30, or 50.

This cannot be correct.. Was the driver ops API really supposed to
change to the enum? If so, this conf_offset_val() in
wpas_create_transmit_sc() needs to be moved into
macsec_qca_create_transmit_sc().

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list