summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-macsec.c
blob: 17b20cb8487c0f540e0cb6136135cb78502ee7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
// SPDX-License-Identifier: LGPL-2.1+
/*
 * Copyright 2017 Red Hat, Inc.
 */

#include "nm-default.h"

#include "nm-setting-macsec.h"

#include <stdlib.h>

#include "nm-glib-aux/nm-secret-utils.h"

#include "nm-utils.h"
#include "nm-core-types-internal.h"
#include "nm-setting-connection.h"
#include "nm-setting-private.h"
#include "nm-setting-wired.h"
#include "nm-connection-private.h"

/**
 * SECTION:nm-setting-macsec
 * @short_description: Describes connection properties for MACSEC interfaces
 *
 * The #NMSettingMacsec object is a #NMSetting subclass that describes properties
 * necessary for connection to MACsec (IEEE 802.1AE) interfaces.
 **/

/*****************************************************************************/

NM_GOBJECT_PROPERTIES_DEFINE_BASE (
	PROP_PARENT,
	PROP_MODE,
	PROP_ENCRYPT,
	PROP_MKA_CAK,
	PROP_MKA_CAK_FLAGS,
	PROP_MKA_CKN,
	PROP_PORT,
	PROP_VALIDATION,
	PROP_SEND_SCI,
);

typedef struct {
	char *parent;
	NMSettingMacsecMode mode;
	bool encrypt:1;
	bool send_sci:1;
	char *mka_cak;
	NMSettingSecretFlags mka_cak_flags;
	char *mka_ckn;
	int port;
	NMSettingMacsecValidation validation;
} NMSettingMacsecPrivate;

G_DEFINE_TYPE (NMSettingMacsec, nm_setting_macsec, NM_TYPE_SETTING)

#define NM_SETTING_MACSEC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_MACSEC, NMSettingMacsecPrivate))

/*****************************************************************************/

/**
 * nm_setting_macsec_get_parent:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:parent property of the setting
 *
 * Since: 1.6
 **/
const char *
nm_setting_macsec_get_parent (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), NULL);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->parent;
}

/**
 * nm_setting_macsec_get_mode:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:mode property of the setting
 *
 * Since: 1.6
 **/
NMSettingMacsecMode
nm_setting_macsec_get_mode (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), NM_SETTING_MACSEC_MODE_PSK);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->mode;
}

/**
 * nm_setting_macsec_get_encrypt:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:encrypt property of the setting
 *
 * Since: 1.6
 **/
gboolean
nm_setting_macsec_get_encrypt (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), TRUE);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->encrypt;
}

/**
 * nm_setting_macsec_get_mka_cak
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:mka-cak property of the setting
 *
 * Since: 1.6
 **/
const char *
nm_setting_macsec_get_mka_cak (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), NULL);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->mka_cak;
}

/**
 * nm_setting_macsec_get_mka_cak_flags:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingSecretFlags pertaining to the #NMSettingMacsec:mka-cak
 *
 * Since: 1.6
 **/
NMSettingSecretFlags
nm_setting_macsec_get_mka_cak_flags (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), NM_SETTING_SECRET_FLAG_NONE);

	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->mka_cak_flags;
}

/**
 * nm_setting_macsec_get_mka_ckn:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:mka-ckn property of the setting
 *
 * Since: 1.6
 **/
const char *
nm_setting_macsec_get_mka_ckn (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), NULL);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->mka_ckn;
}

/**
 * nm_setting_macsec_get_port:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:port property of the setting
 *
 * Since: 1.6
 **/
int
nm_setting_macsec_get_port (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), 1);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->port;
}

/**
 * nm_setting_macsec_get_validation:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:validation property of the setting
 *
 * Since: 1.6
 **/
NMSettingMacsecValidation
nm_setting_macsec_get_validation (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), NM_SETTING_MACSEC_VALIDATION_DISABLE);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->validation;
}

/**
 * nm_setting_macsec_get_send_sci:
 * @setting: the #NMSettingMacsec
 *
 * Returns: the #NMSettingMacsec:send-sci property of the setting
 *
 * Since: 1.12
 **/
gboolean
nm_setting_macsec_get_send_sci (NMSettingMacsec *setting)
{
	g_return_val_if_fail (NM_IS_SETTING_MACSEC (setting), TRUE);
	return NM_SETTING_MACSEC_GET_PRIVATE (setting)->send_sci;
}

static GPtrArray *
need_secrets (NMSetting *setting)
{
	NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE (setting);
	GPtrArray *secrets = NULL;

	if (priv->mode == NM_SETTING_MACSEC_MODE_PSK) {
		if (   !priv->mka_cak
		    && !NM_FLAGS_HAS (priv->mka_cak_flags, NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) {
			secrets = g_ptr_array_sized_new (1);
			g_ptr_array_add (secrets, NM_SETTING_MACSEC_MKA_CAK);
		}
	}

	return secrets;
}

/*********************************************************************/

static gboolean
verify_macsec_key (const char *key, gboolean cak, GError **error)
{
	int req_len;

	/* CAK is a connection secret and can be NULL for various
	 * reasons (agent-owned, no permissions to get secrets, etc.)
	 */
	if (cak && !key)
		return TRUE;

	if (!key || !key[0]) {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_INVALID_PROPERTY,
		                     _("the key is empty"));
		return FALSE;
	}

	req_len = cak ?
	    NM_SETTING_MACSEC_MKA_CAK_LENGTH :
	    NM_SETTING_MACSEC_MKA_CKN_LENGTH;
	if (strlen (key) != (gsize) req_len) {
		g_set_error (error,
		             NM_CONNECTION_ERROR,
		             NM_CONNECTION_ERROR_INVALID_PROPERTY,
		             _("the key must be %d characters"), req_len);
		return FALSE;
	}

	if (!NM_STRCHAR_ALL (key, ch, g_ascii_isxdigit (ch))) {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_INVALID_PROPERTY,
		                     _("the key contains non-hexadecimal characters"));
		return FALSE;
	}

	return TRUE;
}

static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
	NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE (setting);
	NMSettingConnection *s_con = NULL;
	NMSettingWired *s_wired = NULL;
	NMSetting8021x *s_8021x = NULL;

	if (connection) {
		s_con = nm_connection_get_setting_connection (connection);
		s_wired = nm_connection_get_setting_wired (connection);
		s_8021x = nm_connection_get_setting_802_1x (connection);
	}

	if (priv->parent) {
		if (nm_utils_is_uuid (priv->parent)) {
			/* If we have an NMSettingConnection:master with slave-type="macsec",
			 * then it must be the same UUID.
			 */
			if (s_con) {
				const char *master = NULL, *slave_type = NULL;

				slave_type = nm_setting_connection_get_slave_type (s_con);
				if (!g_strcmp0 (slave_type, NM_SETTING_MACSEC_SETTING_NAME))
					master = nm_setting_connection_get_master (s_con);

				if (master && g_strcmp0 (priv->parent, master) != 0) {
					g_set_error (error,
					             NM_CONNECTION_ERROR,
					             NM_CONNECTION_ERROR_INVALID_PROPERTY,
					             _("'%s' value doesn't match '%s=%s'"),
					             priv->parent, NM_SETTING_CONNECTION_MASTER, master);
					g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_PARENT);
					return FALSE;
				}
			}
		} else if (!nm_utils_iface_valid_name (priv->parent)) {
			/* parent must be either a UUID or an interface name */
			g_set_error (error,
			             NM_CONNECTION_ERROR,
			             NM_CONNECTION_ERROR_INVALID_PROPERTY,
			             _("'%s' is neither an UUID nor an interface name"),
			             priv->parent);
			g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_PARENT);
			return FALSE;
		}
	} else {
		/* If parent is NULL, the parent must be specified via
		 * NMSettingWired:mac-address.
		 */
		if (   connection
		    && (!s_wired || !nm_setting_wired_get_mac_address (s_wired))) {
			g_set_error (error,
			             NM_CONNECTION_ERROR,
			             NM_CONNECTION_ERROR_MISSING_PROPERTY,
			             _("property is not specified and neither is '%s:%s'"),
			             NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_MAC_ADDRESS);
			g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_PARENT);
			return FALSE;
		}
	}

	if (priv->mode == NM_SETTING_MACSEC_MODE_PSK) {
		if (!verify_macsec_key (priv->mka_ckn, FALSE, error)) {
			g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_MKA_CKN);
			return FALSE;
		}
		if (!verify_macsec_key (priv->mka_cak, TRUE, error)) {
			g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_MKA_CAK);
			return FALSE;
		}
	} else if (priv->mode == NM_SETTING_MACSEC_MODE_EAP) {
		if (!s_8021x) {
			g_set_error (error,
			             NM_CONNECTION_ERROR,
			             NM_CONNECTION_ERROR_MISSING_SETTING,
			             _("EAP key management requires '%s' setting presence"),
			             NM_SETTING_802_1X_SETTING_NAME);
			g_prefix_error (error, "%s: ", NM_SETTING_MACSEC_SETTING_NAME);
			return FALSE;
		}
	} else {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_INVALID_PROPERTY,
		                     _("must be either psk (0) or eap (1)"));
		g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_MODE);
		return FALSE;
	}

	if (priv->port <= 0 || priv->port > 65534) {
		g_set_error (error,
		             NM_CONNECTION_ERROR,
		             NM_CONNECTION_ERROR_MISSING_PROPERTY,
		             _("invalid port %d"),
		             priv->port);
		g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_PORT);
		return FALSE;
	}

	if (   priv->mode != NM_SETTING_MACSEC_MODE_PSK
	    && (priv->mka_cak || priv->mka_ckn)) {
		g_set_error_literal (error,
		                     NM_CONNECTION_ERROR,
		                     NM_CONNECTION_ERROR_INVALID_PROPERTY,
		                     _("only valid for psk mode"));
		g_prefix_error (error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME,
		                priv->mka_cak ? NM_SETTING_MACSEC_MKA_CAK : NM_SETTING_MACSEC_MKA_CKN);
		return NM_SETTING_VERIFY_NORMALIZABLE;
	}

	return TRUE;
}

/*****************************************************************************/

static void
get_property (GObject *object, guint prop_id,
              GValue *value, GParamSpec *pspec)
{
	NMSettingMacsec *setting = NM_SETTING_MACSEC (object);
	NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE (setting);

	switch (prop_id) {
	case PROP_PARENT:
		g_value_set_string (value, priv->parent);
		break;
	case PROP_MODE:
		g_value_set_int (value, priv->mode);
		break;
	case PROP_ENCRYPT:
		g_value_set_boolean (value, priv->encrypt);
		break;
	case PROP_MKA_CAK:
		g_value_set_string (value, priv->mka_cak);
		break;
	case PROP_MKA_CAK_FLAGS:
		g_value_set_flags (value, priv->mka_cak_flags);
		break;
	case PROP_MKA_CKN:
		g_value_set_string (value, priv->mka_ckn);
		break;
	case PROP_PORT:
		g_value_set_int (value, priv->port);
		break;
	case PROP_VALIDATION:
		g_value_set_int (value, priv->validation);
		break;
	case PROP_SEND_SCI:
		g_value_set_boolean (value, priv->send_sci);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}

static void
set_property (GObject *object, guint prop_id,
              const GValue *value, GParamSpec *pspec)
{
	NMSettingMacsec *setting = NM_SETTING_MACSEC (object);
	NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE (setting);

	switch (prop_id) {
	case PROP_PARENT:
		g_free (priv->parent);
		priv->parent = g_value_dup_string (value);
		break;
	case PROP_MODE:
		priv->mode = g_value_get_int (value);
		break;
	case PROP_ENCRYPT:
		priv->encrypt = g_value_get_boolean (value);
		break;
	case PROP_MKA_CAK:
		nm_free_secret (priv->mka_cak);
		priv->mka_cak = g_value_dup_string (value);
		break;
	case PROP_MKA_CAK_FLAGS:
		priv->mka_cak_flags = g_value_get_flags (value);
		break;
	case PROP_MKA_CKN:
		g_free (priv->mka_ckn);
		priv->mka_ckn = g_value_dup_string (value);
		break;
	case PROP_PORT:
		priv->port = g_value_get_int (value);
		break;
	case PROP_VALIDATION:
		priv->validation = g_value_get_int (value);
		break;
	case PROP_SEND_SCI:
		priv->send_sci = g_value_get_boolean (value);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}

/*****************************************************************************/

static void
nm_setting_macsec_init (NMSettingMacsec *setting)
{
}

/**
 * nm_setting_macsec_new:
 *
 * Creates a new #NMSettingMacsec object with default values.
 *
 * Returns: (transfer full): the new empty #NMSettingMacsec object
 *
 * Since: 1.6
 **/
NMSetting *
nm_setting_macsec_new (void)
{
	return (NMSetting *) g_object_new (NM_TYPE_SETTING_MACSEC, NULL);
}

static void
finalize (GObject *object)
{
	NMSettingMacsec *setting = NM_SETTING_MACSEC (object);
	NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE (setting);

	g_free (priv->parent);
	nm_free_secret (priv->mka_cak);
	g_free (priv->mka_ckn);

	G_OBJECT_CLASS (nm_setting_macsec_parent_class)->finalize (object);
}

static void
nm_setting_macsec_class_init (NMSettingMacsecClass *klass)
{
	GObjectClass *object_class = G_OBJECT_CLASS (klass);
	NMSettingClass *setting_class = NM_SETTING_CLASS (klass);

	g_type_class_add_private (klass, sizeof (NMSettingMacsecPrivate));

	object_class->get_property = get_property;
	object_class->set_property = set_property;
	object_class->finalize     = finalize;

	setting_class->verify       = verify;
	setting_class->need_secrets = need_secrets;

	/**
	 * NMSettingMacsec:parent:
	 *
	 * If given, specifies the parent interface name or parent connection UUID
	 * from which this MACSEC interface should be created.  If this property is
	 * not specified, the connection must contain an #NMSettingWired setting
	 * with a #NMSettingWired:mac-address property.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_PARENT] =
	    g_param_spec_string (NM_SETTING_MACSEC_PARENT, "", "",
	                         NULL,
	                         G_PARAM_READWRITE |
	                         G_PARAM_CONSTRUCT |
	                         NM_SETTING_PARAM_INFERRABLE |
	                         G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:mode:
	 *
	 * Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key
	 * Agreement) is obtained.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_MODE] =
	    g_param_spec_int (NM_SETTING_MACSEC_MODE, "", "",
	                      G_MININT, G_MAXINT, NM_SETTING_MACSEC_MODE_PSK,
	                      G_PARAM_READWRITE |
	                      G_PARAM_CONSTRUCT |
	                      NM_SETTING_PARAM_INFERRABLE |
	                      G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:encrypt:
	 *
	 * Whether the transmitted traffic must be encrypted.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_ENCRYPT] =
	    g_param_spec_boolean (NM_SETTING_MACSEC_ENCRYPT, "", "",
	                          TRUE,
	                          G_PARAM_READWRITE |
	                          G_PARAM_CONSTRUCT |
	                          G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:mka-cak:
	 *
	 * The pre-shared CAK (Connectivity Association Key) for MACsec
	 * Key Agreement.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_MKA_CAK] =
	    g_param_spec_string (NM_SETTING_MACSEC_MKA_CAK, "", "",
	                         NULL,
	                         G_PARAM_READWRITE |
	                         G_PARAM_CONSTRUCT |
	                         NM_SETTING_PARAM_SECRET |
	                         G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:mka-cak-flags:
	 *
	 * Flags indicating how to handle the #NMSettingMacsec:mka-cak
	 * property.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_MKA_CAK_FLAGS] =
	    g_param_spec_flags (NM_SETTING_MACSEC_MKA_CAK_FLAGS, "", "",
	                        NM_TYPE_SETTING_SECRET_FLAGS,
	                        NM_SETTING_SECRET_FLAG_NONE,
	                        G_PARAM_READWRITE |
	                        G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:mka-ckn:
	 *
	 * The pre-shared CKN (Connectivity-association Key Name) for
	 * MACsec Key Agreement.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_MKA_CKN] =
	    g_param_spec_string (NM_SETTING_MACSEC_MKA_CKN, "", "",
	                         NULL,
	                         G_PARAM_READWRITE |
	                         G_PARAM_CONSTRUCT |
	                         G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:port:
	 *
	 * The port component of the SCI (Secure Channel Identifier), between 1 and 65534.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_PORT] =
	    g_param_spec_int (NM_SETTING_MACSEC_PORT, "", "",
	                      1, 65534, 1,
	                      G_PARAM_READWRITE |
	                      G_PARAM_CONSTRUCT |
	                      NM_SETTING_PARAM_INFERRABLE |
	                      G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:validation:
	 *
	 * Specifies the validation mode for incoming frames.
	 *
	 * Since: 1.6
	 **/
	obj_properties[PROP_VALIDATION] =
	    g_param_spec_int (NM_SETTING_MACSEC_VALIDATION, "", "",
	                      G_MININT, G_MAXINT, NM_SETTING_MACSEC_VALIDATION_STRICT,
	                      G_PARAM_READWRITE |
	                      G_PARAM_CONSTRUCT |
	                      NM_SETTING_PARAM_INFERRABLE |
	                      G_PARAM_STATIC_STRINGS);

	/**
	 * NMSettingMacsec:send-sci:
	 *
	 * Specifies whether the SCI (Secure Channel Identifier) is included
	 * in every packet.
	 *
	 * Since: 1.12
	 **/
	obj_properties[PROP_SEND_SCI] =
	    g_param_spec_boolean (NM_SETTING_MACSEC_SEND_SCI, "", "",
	                          TRUE,
	                          G_PARAM_READWRITE |
	                          G_PARAM_CONSTRUCT |
	                          G_PARAM_STATIC_STRINGS);

	g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);

	_nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_MACSEC);
}