Skip to content

Commit 78781ab

Browse files
MACSec SAI Attribute enhancements
Signed-off-by: rushanmu <rushanmu@cisco.com>
1 parent 4b4347b commit 78781ab

File tree

2 files changed

+361
-0
lines changed

2 files changed

+361
-0
lines changed
Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
2+
-------------------------------------------------------------------------------
3+
Title | MACsec Enhancements
4+
-------------|-----------------------------------------------------------------
5+
Authors | Ruthrapathy Shanmuganandam (Cisco Systems Inc.)
6+
Status | In review
7+
Type | Standards track
8+
Created | 2025-09-30
9+
SAI-Version | 1.18
10+
-------------------------------------------------------------------------------
11+
12+
# Introduction
13+
14+
This proposal introduces the following enhancements for MACsec configuration:
15+
16+
- **MACsec secure modes** Configuration of secure modes that define the behavior of MACsec protection on a given link when a MACsec Key Agreement (MKA) session is not established.
17+
18+
- **Confidentiality Offset** Configuration of Confidentiality Offset to allow bytes of the ethernet frame to be unencrypted.
19+
20+
- **Tag Control Information** Configuration to set End Station (ES) and Single Copy Broadcast (SCB) bits in Tag Control Information (TCI).
21+
22+
# MACsec Secure Modes
23+
24+
## Overview
25+
26+
Media Access Control Security (MACsec, IEEE 802.1AE) provides hop-by-hop security at Layer 2, ensuring data confidentiality, integrity, and origin authenticity on direct Ethernet links. The type of secure mode chosen dictates how the interface handles non-MACsec or unauthenticated traffic, balancing strict security requirements against operational resilience.
27+
28+
## Nomenclature
29+
30+
In deploying MACsec, organizations must decide how strictly security should be enforced on each port or link. The two standard operational modes are
31+
32+
- **Must Secure (Fail-Closed):** Only frames successfully encapsulated and authenticated with the MACsec Security Association Key (SAK) are forwarded; drop all traffic if a secure channel cannot be established.
33+
34+
- **Should Secure (Fail-Open):** Secure traffic is prioritized if MACsec Key Agreement(MKA) succeeds; but allow cleartext traffic if no secure channel is established.
35+
36+
### Must Secure (Fail-Closed)
37+
38+
Must Secure is the most stringent secure mode.
39+
40+
- The mode ensures only Ethernet frames that are successfully encapsulated and authenticated with the MACsec Security Association Key (SAK) to be forwarded, thus ensuring that no unprotected data flows over the secured link.
41+
42+
- If any issues are encountered during MKA negotiation (scenarios such as mismatches in key or configuration), it results in an immediate and complete connectivity loss.
43+
44+
- If MKA session remains down, only EAPoL (Extensible Authentication Protocol over LAN) packets are exchanged bidirectionally to attempt session establishment. All other traffic is dropped.
45+
46+
- If the peer does not support MACsec at all (no MKA capability), all traffic is dropped to maintain security.
47+
48+
### Should Secure (Fail-Open)
49+
50+
Should Secure is a less strict mode than Must Secure.
51+
52+
- This mode prioritizes service availability over link-layer confidentiality when the secure channel cannot be established.
53+
54+
- In case of MKA negotiation failure, the link reverts to an unsecured, clear-text state.
55+
56+
- The network continues to function, but the traffic on that specific link remains unencrypted.
57+
58+
- If the peer does not support MACsec, traffic passes unencrypted to maintain connectivity over availability.
59+
60+
## SAI Attribute Enhancement
61+
62+
The below MACsec port attribute is newly introduced to allow configuration of the MACsec secure mode. This attribute controls how the switch’s MACsec security engine enforces link protection. When set, the attribute instructs the hardware to apply the corresponding secure mode on the specified port.
63+
64+
```c
65+
typedef enum _sai_macsec_port_attr_t
66+
{
67+
...
68+
/**
69+
* @brief Secure mode configuration for MACsec port
70+
*
71+
* Attribute to set the type of secure mode for a MACsec port
72+
*
73+
* @type sai_macsec_port_security_mode_t
74+
* @flags CREATE_AND_SET
75+
* @default SAI_MACSEC_PORT_SECURITY_MODE_MUST_SECURE
76+
*/
77+
SAI_MACSEC_PORT_ATTR_SECURITY_MODE,
78+
...
79+
} sai_macsec_port_attr_t;
80+
```
81+
82+
The Secure Mode is defined to take values of the below enumeration.
83+
84+
```c
85+
/**
86+
* @brief Attribute Data for MACsec Security Mode
87+
*/
88+
typedef enum _sai_macsec_port_security_mode_t
89+
{
90+
/**
91+
* @brief Must Secure Mode: Only successfully validated
92+
* MACsec-protected frames are permitted. All unprotected
93+
* or invalid frames must be dropped.
94+
*/
95+
SAI_MACSEC_PORT_SECURITY_MODE_MUST_SECURE,
96+
97+
/**
98+
* @brief Should Secure Mode: Both MACsec-protected and
99+
* unprotected frames are permitted. MACsec-protected frames
100+
* are validated when present.
101+
*/
102+
SAI_MACSEC_PORT_SECURITY_MODE_SHOULD_SECURE,
103+
104+
} sai_macsec_port_security_mode_t;
105+
```
106+
107+
## API Workflow
108+
109+
- **Step 1** Create Switch.
110+
111+
- **Step 2** Create MACsec object.
112+
113+
- **Step 3** Set Secure Mode as part of Create MACsec Port.
114+
115+
```c
116+
sai_attribute_t attr;
117+
std::vector<sai_attribute_t> attr_list;
118+
sai_object_id_t macsec_port_id;
119+
120+
attr_list.clear();
121+
122+
/* Populate other port attributes */
123+
124+
/* If should secure, set secure mode */
125+
if (should_secure) {
126+
attr.id = SAI_MACSEC_PORT_ATTR_SECURITY_MODE;
127+
attr.value.s32 = SAI_MACSEC_PORT_SECURITY_MODE_SHOULD_SECURE;
128+
}
129+
attr_list.push_back(attr);
130+
131+
sai_create_macsec_port_fn(&macsec_port_id,
132+
switch_id,
133+
attr_list.size(),
134+
attr_list.data());
135+
```
136+
137+
# MACsec Confidentiality Offset
138+
139+
## Overview
140+
141+
The IEEE 802.1AE (MACsec) standard allows for the configuration of a Confidentiality Offset (CO), which defines how many bytes of the packet payload, following the MACsec Security Tag (SecTag), should remain unencrypted (sent in the clear). The rest of the payload is encrypted. Even though these bytes in MACsec protected Ethernet frames are not encrypted, they are still integrity-protected (authenticated).
142+
143+
Confidentiality offset can take values in the range of 0 - 63; Typical values includes:
144+
145+
- 0 bytes: Full confidentiality; entire payload remains encrypted.
146+
147+
- 30 bytes: Partial confidentiality; The first 30 bytes after SecTAG remain unencrypted.
148+
149+
- 50 bytes: Partial confidentiality; The first 50 bytes after SecTAG remain unencrypted.
150+
151+
The need for a configurable confidentiality offset primarily stems from requirements to leave certain protocol headers unencrypted since intermediate devices may require visibility into the packet in time-sensitive networks.
152+
153+
## SAI Attribute Enhancement
154+
155+
The below MACsec Secure Channel (SC) attribute is newly introduced to allow configuration of the confidentiality offset. This attribute controls the number of bytes of the payload to be left unencrypted.
156+
157+
```c
158+
/**
159+
* @brief Confidentiality Offset for this Secure Channel
160+
*
161+
* @type sai_uint32_t
162+
* @flags CREATE_AND_SET
163+
* @default 0
164+
* @validrange 0..63
165+
*/
166+
SAI_MACSEC_SC_ATTR_CONFIDENTIALITY_OFFSET,
167+
```
168+
169+
## API Workflow
170+
171+
During creation of Secure Channel, confidentiality offset can be configured as below:
172+
173+
```c
174+
sai_attribute_t attr;
175+
std::vector<sai_attribute_t> attr_list;
176+
sai_object_id_t macsec_sc_id;
177+
178+
attr_list.clear();
179+
180+
/* Populate other SC attributes */
181+
182+
/* Set conf offset */
183+
attr.id = SAI_MACSEC_SC_ATTR_CONFIDENTIALITY_OFFSET;
184+
attr.value.u32 = conf_offset;
185+
attr_list.push_back(attr);
186+
187+
sai_create_macsec_sc_fn(&macsec_sc_id,
188+
switch_id,
189+
attr_list.size(),
190+
attr_list.data());
191+
```
192+
193+
# Tag Control Information: ES and SCB
194+
195+
## Overview
196+
197+
The MACsec Security Tag (SecTag) contains the Tag Control Information (TCI) field, which holds critical flags defined by IEEE 802.1AE. Two specific flags, the End Station (ES) bit and the Single Copy Broadcast (SCB) bit, are essential for identifying the nature of the Secure Channel (SC) and its use case.
198+
199+
## Tag Control Information
200+
201+
The Tag Control Information (TCI) is an 8-bit field within the MACsec Security Tag (SecTag) that contains control information for the MACsec frame. The TCI field structure is defined as follows:
202+
203+
```
204+
TCI Octet Structure (8 bits):
205+
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
206+
│ V │ ES │ SC │ SCB │ E │ C │ AN │
207+
│ =0 │ │ │ │ │ │ │
208+
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
209+
│ 8 │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │
210+
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
211+
Bit Position
212+
```
213+
214+
**Field Descriptions:**
215+
216+
- **V (Version, Bit 8)**: Always set to 0 for current MACsec version
217+
- **ES (End Station, Bit 7)**: Indicates if the transmitting device is an end station
218+
- **SC (Secure Channel, Bit 6)**: Indicates presence of Secure Channel Identifier
219+
- **SCB (Single Copy Broadcast, Bit 5)**: Controls broadcast frame handling
220+
- **E (Encryption, Bit 4)**: Indicates if the payload is encrypted
221+
- **C (Changed Text, Bit 3)**: Indicates if the frame length has changed
222+
- **AN (Association Number, Bits 2-1)**: Identifies the Security Association used for frame protection
223+
224+
Currently SAI_MACSEC_SC_ATTR_MACSEC_EXPLICIT_SCI_ENABLE attribute is used to configure the Secure Channel(SC) bit in the TCI field. This proposal introduces attributes to configure ES and SCB bits.
225+
226+
### End Station (ES)
227+
228+
The ES bit helps the receiving MACsec entity understand the role of the sender in the network topology. Setting this bit allows receivers to identify traffic originating directly from an endpoint, distinguishing it from traffic that has passed through intermediate switches or other devices.
229+
230+
### Single Copy Broadcast (SCB)
231+
232+
The SCB is used to indicate if the ethernet frame belongs to a broadcast/multicast domain (hence its not re-encrypted by intermediate relays) vs a fully protected unicast domain (hence decrypted and re-encrypted hop-by-hop). When the bit is set, it indicates that the frame is associated with an SC that supports the Ethernet Passive Optical Network (EPON) Single Copy Broadcast capability, which is typically point-to-multipoint in nature.
233+
234+
## SAI Attribute Enhancement
235+
236+
The below MACsec Secure Channel (SC) attributes are newly introduced to allow configuration of the ES and SCB bits in the TCI. Both the attributes are configurable only when creating a Secure Channel in the Transmit (Egress) direction.
237+
238+
```c
239+
/**
240+
* @brief End Station bit in the Tag Control Information field of SecTAG
241+
*
242+
* @type bool
243+
* @flags CREATE_AND_SET
244+
* @default false
245+
* @validonly SAI_MACSEC_SC_ATTR_MACSEC_DIRECTION == SAI_MACSEC_DIRECTION_EGRESS
246+
*/
247+
SAI_MACSEC_SC_ATTR_USE_ES,
248+
249+
/**
250+
* @brief Single Copy Broadcast bit in the Tag Control Information field of SecTAG
251+
*
252+
* @type bool
253+
* @flags CREATE_AND_SET
254+
* @default false
255+
* @validonly SAI_MACSEC_SC_ATTR_MACSEC_DIRECTION == SAI_MACSEC_DIRECTION_EGRESS
256+
*/
257+
SAI_MACSEC_SC_ATTR_USE_SCB,
258+
```
259+
260+
## API Workflow
261+
262+
During creation of Secure Channel, the TCI bits for End Station (ES) and Single Copy Broadcast (SCB) can be configured as below:
263+
264+
```c
265+
sai_attribute_t attr;
266+
std::vector<sai_attribute_t> attr_list;
267+
sai_object_id_t macsec_sc_id;
268+
269+
attr_list.clear();
270+
271+
attr.id = SAI_MACSEC_SC_ATTR_MACSEC_DIRECTION;
272+
attr.value.s32 = SAI_MACSEC_DIRECTION_EGRESS;
273+
attr_list.push_back(attr);
274+
275+
/* Populate other SC attributes */
276+
277+
/* Populate TCI bits */
278+
if (use_es) {
279+
attr.id = SAI_MACSEC_SC_ATTR_USE_ES;
280+
attr.value.booldata = true;
281+
attr_list.push_back(attr);
282+
}
283+
284+
if (use_scb) {
285+
attr.id = SAI_MACSEC_SC_ATTR_USE_SCB;
286+
attr.value.booldata = true;
287+
attr_list.push_back(attr);
288+
}
289+
290+
sai_create_macsec_sc_fn(&macsec_sc_id,
291+
switch_id,
292+
attr_list.size(),
293+
attr_list.data());
294+
```
295+
# References
296+
297+
- IEEE 802.1AE (MACsec) Standard
298+
299+
- IEEE 802.1X-2010 (MKA)

inc/saimacsec.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,27 @@ typedef enum _sai_macsec_port_post_status_t
374374

375375
} sai_macsec_port_post_status_t;
376376

377+
/**
378+
* @brief Attribute Data for MACsec Security Mode
379+
*/
380+
typedef enum _sai_macsec_port_security_mode_t
381+
{
382+
/**
383+
* @brief Must Secure Mode: Only successfully validated
384+
* MACsec-protected frames are permitted. All unprotected
385+
* or invalid frames must be dropped.
386+
*/
387+
SAI_MACSEC_PORT_SECURITY_MODE_MUST_SECURE,
388+
389+
/**
390+
* @brief Should Secure Mode: Both MACsec-protected and
391+
* unprotected frames are permitted. MACsec-protected frames
392+
* are validated when present.
393+
*/
394+
SAI_MACSEC_PORT_SECURITY_MODE_SHOULD_SECURE,
395+
396+
} sai_macsec_port_security_mode_t;
397+
377398
/**
378399
* @brief Attribute Id for sai_macsec_port
379400
*/
@@ -462,6 +483,17 @@ typedef enum _sai_macsec_port_attr_t
462483
*/
463484
SAI_MACSEC_PORT_ATTR_POST_STATUS,
464485

486+
/**
487+
* @brief Secure mode configuration for MACsec port
488+
*
489+
* Attribute to set the type of secure mode for a MACSEC port
490+
*
491+
* @type sai_macsec_port_security_mode_t
492+
* @flags CREATE_AND_SET
493+
* @default SAI_MACSEC_PORT_SECURITY_MODE_MUST_SECURE
494+
*/
495+
SAI_MACSEC_PORT_ATTR_SECURITY_MODE,
496+
465497
/**
466498
* @brief End of MACsec Port attributes
467499
*/
@@ -805,6 +837,36 @@ typedef enum _sai_macsec_sc_attr_t
805837
*/
806838
SAI_MACSEC_SC_ATTR_MACSEC_PORT_ID,
807839

840+
/**
841+
* @brief Confidentiality Offset for this Secure Channel
842+
*
843+
* @type sai_uint32_t
844+
* @flags CREATE_AND_SET
845+
* @default 0
846+
* @validrange 0..63
847+
*/
848+
SAI_MACSEC_SC_ATTR_CONFIDENTIALITY_OFFSET,
849+
850+
/**
851+
* @brief End Station bit in the Tag Control Information field of SecTAG
852+
*
853+
* @type bool
854+
* @flags CREATE_AND_SET
855+
* @default false
856+
* @validonly SAI_MACSEC_SC_ATTR_MACSEC_DIRECTION == SAI_MACSEC_DIRECTION_EGRESS
857+
*/
858+
SAI_MACSEC_SC_ATTR_USE_ES,
859+
860+
/**
861+
* @brief Single Copy Broadcast bit in the Tag Control Information field of SecTAG
862+
*
863+
* @type bool
864+
* @flags CREATE_AND_SET
865+
* @default false
866+
* @validonly SAI_MACSEC_SC_ATTR_MACSEC_DIRECTION == SAI_MACSEC_DIRECTION_EGRESS
867+
*/
868+
SAI_MACSEC_SC_ATTR_USE_SCB,
869+
808870
/**
809871
* @brief End of MACsec Secure Channel attributes
810872
*/

0 commit comments

Comments
 (0)