Skip to content

Commit 6fc498b

Browse files
logostdavem330
authored andcommitted
net: macsec: update SCI upon MAC address change.
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 <[email protected]> Signed-off-by: Mark Starovoytov <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d7195a commit 6fc498b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/macsec.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ static struct macsec_eth_header *macsec_ethhdr(struct sk_buff *skb)
424424
return (struct macsec_eth_header *)skb_mac_header(skb);
425425
}
426426

427+
static sci_t dev_to_sci(struct net_device *dev, __be16 port)
428+
{
429+
return make_sci(dev->dev_addr, port);
430+
}
431+
427432
static void __macsec_pn_wrapped(struct macsec_secy *secy,
428433
struct macsec_tx_sa *tx_sa)
429434
{
@@ -3268,6 +3273,7 @@ static int macsec_set_mac_address(struct net_device *dev, void *p)
32683273

32693274
out:
32703275
ether_addr_copy(dev->dev_addr, addr->sa_data);
3276+
macsec->secy.sci = dev_to_sci(dev, MACSEC_PORT_ES);
32713277
return 0;
32723278
}
32733279

@@ -3593,11 +3599,6 @@ static bool sci_exists(struct net_device *dev, sci_t sci)
35933599
return false;
35943600
}
35953601

3596-
static sci_t dev_to_sci(struct net_device *dev, __be16 port)
3597-
{
3598-
return make_sci(dev->dev_addr, port);
3599-
}
3600-
36013602
static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len)
36023603
{
36033604
struct macsec_dev *macsec = macsec_priv(dev);

0 commit comments

Comments
 (0)