Skip to content

Commit

Permalink
net: macsec: update SCI upon MAC address change.
Browse files Browse the repository at this point in the history
SCI should be updated, because it contains MAC in its first 6 octets.

Fixes: c09440f ("macsec: introduce IEEE 802.1AE driver")
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dmitry Bogdanov authored and David S. Miller committed Mar 10, 2020
1 parent 7d7195a commit 6fc498b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/net/macsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ static struct macsec_eth_header *macsec_ethhdr(struct sk_buff *skb)
return (struct macsec_eth_header *)skb_mac_header(skb);
}

static sci_t dev_to_sci(struct net_device *dev, __be16 port)
{
return make_sci(dev->dev_addr, port);
}

static void __macsec_pn_wrapped(struct macsec_secy *secy,
struct macsec_tx_sa *tx_sa)
{
Expand Down Expand Up @@ -3268,6 +3273,7 @@ static int macsec_set_mac_address(struct net_device *dev, void *p)

out:
ether_addr_copy(dev->dev_addr, addr->sa_data);
macsec->secy.sci = dev_to_sci(dev, MACSEC_PORT_ES);
return 0;
}

Expand Down Expand Up @@ -3593,11 +3599,6 @@ static bool sci_exists(struct net_device *dev, sci_t sci)
return false;
}

static sci_t dev_to_sci(struct net_device *dev, __be16 port)
{
return make_sci(dev->dev_addr, port);
}

static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len)
{
struct macsec_dev *macsec = macsec_priv(dev);
Expand Down

0 comments on commit 6fc498b

Please sign in to comment.