Skip to content

Commit 860ead8

Browse files
Lior Nahmansondavem330
authored andcommitted
net/macsec: Add MACsec skb_metadata_dst Rx Data path support
Like in the Tx changes, if there are more than one MACsec device with the same MAC address as in the packet's destination MAC, the packet will be forward only to this device and not neccessarly to the desired one. Offloading device drivers will mark offloaded MACsec SKBs with the corresponding SCI in the skb_metadata_dst so the macsec rx handler will know to which port to divert those skbs, instead of wrongly solely relaying on dst MAC address comparison. Signed-off-by: Lior Nahmanson <[email protected]> Reviewed-by: Raed Salem <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0a28bfd commit 860ead8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/macsec.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,11 +1025,13 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
10251025
/* Deliver to the uncontrolled port by default */
10261026
enum rx_handler_result ret = RX_HANDLER_PASS;
10271027
struct ethhdr *hdr = eth_hdr(skb);
1028+
struct metadata_dst *md_dst;
10281029
struct macsec_rxh_data *rxd;
10291030
struct macsec_dev *macsec;
10301031

10311032
rcu_read_lock();
10321033
rxd = macsec_data_rcu(skb->dev);
1034+
md_dst = skb_metadata_dst(skb);
10331035

10341036
list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
10351037
struct sk_buff *nskb;
@@ -1040,6 +1042,10 @@ static enum rx_handler_result handle_not_macsec(struct sk_buff *skb)
10401042
* the SecTAG, so we have to deduce which port to deliver to.
10411043
*/
10421044
if (macsec_is_offloaded(macsec) && netif_running(ndev)) {
1045+
if (md_dst && md_dst->type == METADATA_MACSEC &&
1046+
(!find_rx_sc(&macsec->secy, md_dst->u.macsec_info.sci)))
1047+
continue;
1048+
10431049
if (ether_addr_equal_64bits(hdr->h_dest,
10441050
ndev->dev_addr)) {
10451051
/* exact match, divert skb to this port */

0 commit comments

Comments
 (0)