Skip to content

Commit 84dc68c

Browse files
qsngregkh
authored andcommitted
Revert "net: macsec: update SCI upon MAC address change."
[ Upstream commit e82c649 ] This reverts commit 6fc498b. Commit 6fc498b states: SCI should be updated, because it contains MAC in its first 6 octets. That's not entirely correct. The SCI can be based on the MAC address, but doesn't have to be. We can also use any 64-bit number as the SCI. When the SCI based on the MAC address, it uses a 16-bit "port number" provided by userspace, which commit 6fc498b overwrites with 1. In addition, changing the SCI after macsec has been setup can just confuse the receiver. If we configure the RXSC on the peer based on the original SCI, we should keep the same SCI on TX. When the macsec device is being managed by a userspace key negotiation daemon such as wpa_supplicant, commit 6fc498b would also overwrite the SCI defined by userspace. Fixes: 6fc498b ("net: macsec: update SCI upon MAC address change.") Signed-off-by: Sabrina Dubroca <[email protected]> Link: https://lore.kernel.org/r/9b1a9d28327e7eb54550a92eebda45d25e54dd0d.1660667033.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent c3f4f07 commit 84dc68c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/net/macsec.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,6 @@ static struct macsec_eth_header *macsec_ethhdr(struct sk_buff *skb)
447447
return (struct macsec_eth_header *)skb_mac_header(skb);
448448
}
449449

450-
static sci_t dev_to_sci(struct net_device *dev, __be16 port)
451-
{
452-
return make_sci(dev->dev_addr, port);
453-
}
454-
455450
static void __macsec_pn_wrapped(struct macsec_secy *secy,
456451
struct macsec_tx_sa *tx_sa)
457452
{
@@ -3617,7 +3612,6 @@ static int macsec_set_mac_address(struct net_device *dev, void *p)
36173612

36183613
out:
36193614
eth_hw_addr_set(dev, addr->sa_data);
3620-
macsec->secy.sci = dev_to_sci(dev, MACSEC_PORT_ES);
36213615

36223616
/* If h/w offloading is available, propagate to the device */
36233617
if (macsec_is_offloaded(macsec)) {
@@ -3953,6 +3947,11 @@ static bool sci_exists(struct net_device *dev, sci_t sci)
39533947
return false;
39543948
}
39553949

3950+
static sci_t dev_to_sci(struct net_device *dev, __be16 port)
3951+
{
3952+
return make_sci(dev->dev_addr, port);
3953+
}
3954+
39563955
static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len)
39573956
{
39583957
struct macsec_dev *macsec = macsec_priv(dev);

0 commit comments

Comments
 (0)