1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
19 * Copyright 2011 - 2014 Red Hat, Inc.
22 #include "nm-default.h"
26 #include <dbus/dbus-glib.h>
28 #include "nm-setting-vlan.h"
29 #include "nm-param-spec-specialized.h"
31 #include "nm-dbus-glib-types.h"
32 #include "nm-setting-connection.h"
33 #include "nm-setting-private.h"
36 * SECTION:nm-setting-vlan
37 * @short_description: Describes connection properties for VLAN interfaces
38 * @include: nm-setting-vlan.h
40 * The #NMSettingVlan object is a #NMSetting subclass that describes properties
41 * necessary for connection to VLAN interfaces.
45 * nm_setting_vlan_error_quark:
47 * Registers an error quark for #NMSettingVlan if necessary.
49 * Returns: the error quark used for #NMSettingVlan errors.
52 nm_setting_vlan_error_quark (void)
56 if (G_UNLIKELY (!quark))
57 quark = g_quark_from_static_string ("nm-setting-vlan-error-quark");
61 G_DEFINE_TYPE_WITH_CODE (NMSettingVlan, nm_setting_vlan, NM_TYPE_SETTING,
62 _nm_register_setting (NM_SETTING_VLAN_SETTING_NAME,
65 NM_SETTING_VLAN_ERROR))
66 NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_VLAN)
68 #define NM_SETTING_VLAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_VLAN, NMSettingVlanPrivate))
75 GSList *ingress_priority_map;
76 GSList *egress_priority_map;
77 } NMSettingVlanPrivate;
85 PROP_INGRESS_PRIORITY_MAP,
86 PROP_EGRESS_PRIORITY_MAP,
90 #define MAX_SKB_PRIO G_MAXUINT32
91 #define MAX_8021P_PRIO 7 /* Max 802.1p priority */
99 * nm_setting_vlan_new:
101 * Creates a new #NMSettingVlan object with default values.
103 * Returns: (transfer full): the new empty #NMSettingVlan object
106 nm_setting_vlan_new (void)
108 return (NMSetting *) g_object_new (NM_TYPE_SETTING_VLAN, NULL);
112 * nm_setting_vlan_get_interface_name:
113 * @setting: the #NMSettingVlan
115 * Returns: the #NMSettingVlan:interface_name property of the setting
118 nm_setting_vlan_get_interface_name (NMSettingVlan *setting)
120 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), NULL);
121 return NM_SETTING_VLAN_GET_PRIVATE (setting)->interface_name;
125 * nm_setting_vlan_get_parent:
126 * @setting: the #NMSettingVlan
128 * Returns: the #NMSettingVlan:parent property of the setting
131 nm_setting_vlan_get_parent (NMSettingVlan *setting)
133 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), NULL);
134 return NM_SETTING_VLAN_GET_PRIVATE (setting)->parent;
138 * nm_setting_vlan_get_id:
139 * @setting: the #NMSettingVlan
141 * Returns: the #NMSettingVlan:id property of the setting
144 nm_setting_vlan_get_id (NMSettingVlan *setting)
146 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), 0);
147 return NM_SETTING_VLAN_GET_PRIVATE (setting)->id;
151 * nm_setting_vlan_get_flags:
152 * @setting: the #NMSettingVlan
154 * Returns: the #NMSettingVlan:flags property of the setting
157 nm_setting_vlan_get_flags (NMSettingVlan *setting)
159 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), 0);
160 return NM_SETTING_VLAN_GET_PRIVATE (setting)->flags;
164 get_max_prio (NMVlanPriorityMap map, gboolean from)
166 if (map == NM_VLAN_INGRESS_MAP)
167 return from ? MAX_8021P_PRIO : MAX_SKB_PRIO;
168 else if (map == NM_VLAN_EGRESS_MAP)
169 return from ? MAX_SKB_PRIO : MAX_8021P_PRIO;
170 g_assert_not_reached ();
174 priority_map_new_from_str (NMVlanPriorityMap map, const char *str)
176 PriorityMap *p = NULL;
181 g_return_val_if_fail (str && str[0], NULL);
183 t = g_strsplit (str, ":", 0);
184 len = g_strv_length (t);
186 from = g_ascii_strtoull (t[0], NULL, 10);
187 to = g_ascii_strtoull (t[1], NULL, 10);
189 if ((from <= get_max_prio (map, TRUE)) && (to <= get_max_prio (map, FALSE))) {
190 p = g_malloc0 (sizeof (PriorityMap));
196 g_warn_if_fail (len == 2);
204 priority_map_free (PriorityMap *map)
206 g_return_if_fail (map != NULL);
211 get_map (NMSettingVlan *self, NMVlanPriorityMap map)
213 if (map == NM_VLAN_INGRESS_MAP)
214 return NM_SETTING_VLAN_GET_PRIVATE (self)->ingress_priority_map;
215 else if (map == NM_VLAN_EGRESS_MAP)
216 return NM_SETTING_VLAN_GET_PRIVATE (self)->egress_priority_map;
217 g_assert_not_reached ();
222 set_map (NMSettingVlan *self, NMVlanPriorityMap map, GSList *list)
224 if (map == NM_VLAN_INGRESS_MAP) {
225 NM_SETTING_VLAN_GET_PRIVATE (self)->ingress_priority_map = list;
226 g_object_notify (G_OBJECT (self), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
227 } else if (map == NM_VLAN_EGRESS_MAP) {
228 NM_SETTING_VLAN_GET_PRIVATE (self)->egress_priority_map = list;
229 g_object_notify (G_OBJECT (self), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
231 g_assert_not_reached ();
235 * nm_setting_vlan_add_priority_str:
236 * @setting: the #NMSettingVlan
237 * @map: the type of priority map
238 * @str: the string which contains a priority map, like "3:7"
240 * Adds a priority map entry into either the #NMSettingVlan:ingress_priority_map
241 * or the #NMSettingVlan:egress_priority_map properties. The priority map maps
242 * the Linux SKB priorities to 802.1p priorities.
244 * Returns: %TRUE if the entry was successfully added to the list, or it
245 * overwrote the old value, %FALSE if error
248 nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
249 NMVlanPriorityMap map,
252 GSList *list = NULL, *iter = NULL;
253 PriorityMap *item = NULL;
255 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
256 g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
257 g_return_val_if_fail (str && str[0], FALSE);
259 list = get_map (setting, map);
261 item = priority_map_new_from_str (map, str);
263 g_return_val_if_reached (FALSE);
265 /* Duplicates get replaced */
266 for (iter = list; iter; iter = g_slist_next (iter)) {
267 PriorityMap *p = iter->data;
269 if (p->from == item->from) {
272 if (map == NM_VLAN_INGRESS_MAP)
273 g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
275 g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
280 set_map (setting, map, g_slist_append (list, item));
285 * nm_setting_vlan_get_num_priorities:
286 * @setting: the #NMSettingVlan
287 * @map: the type of priority map
289 * Returns the number of entires in the
290 * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
291 * properties of this setting.
293 * Returns: return the number of ingress/egress priority entries, -1 if error
296 nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
298 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), -1);
299 g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, -1);
301 return g_slist_length (get_map (setting, map));
305 * nm_setting_vlan_get_priority:
306 * @setting: the #NMSettingVlan
307 * @map: the type of priority map
308 * @idx: the zero-based index of the ingress/egress priority map entry
309 * @out_from: (out): on return the value of the priority map's 'from' item
310 * @out_to: (out): on return the value of priority map's 'to' item
312 * Retrieve one of the entries of the #NMSettingVlan:ingress_priority_map
313 * or #NMSettingVlan:egress_priority_map properties of this setting.
315 * Returns: %TRUE if a priority map was returned, %FALSE if error
318 nm_setting_vlan_get_priority (NMSettingVlan *setting,
319 NMVlanPriorityMap map,
325 PriorityMap *item = NULL;
327 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
328 g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
329 g_return_val_if_fail (out_from != NULL, FALSE);
330 g_return_val_if_fail (out_to != NULL, FALSE);
332 list = get_map (setting, map);
333 g_return_val_if_fail (idx < g_slist_length (list), FALSE);
335 item = g_slist_nth_data (list, idx);
337 *out_from = item->from;
343 * nm_setting_vlan_add_priority:
344 * @setting: the #NMSettingVlan
345 * @map: the type of priority map
346 * @from: the priority to map to @to
347 * @to: the priority to map @from to
349 * Adds a priority mapping to the #NMSettingVlan:ingress_priority_map or
350 * #NMSettingVlan:egress_priority_map properties of the setting. If @from is
351 * already in the given priority map, this function will overwrite the
352 * existing entry with the new @to.
354 * If @map is #NM_VLAN_INGRESS_MAP then @from is the incoming 802.1q VLAN
355 * Priority Code Point (PCP) value, and @to is the Linux SKB priority value.
357 * If @map is #NM_VLAN_EGRESS_MAP then @from is the Linux SKB priority value and
358 * @to is the outgoing 802.1q VLAN Priority Code Point (PCP) value.
360 * Returns: %TRUE if the new priority mapping was successfully added to the
361 * list, %FALSE if error
364 nm_setting_vlan_add_priority (NMSettingVlan *setting,
365 NMVlanPriorityMap map,
369 GSList *list = NULL, *iter = NULL;
372 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
373 g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
375 list = get_map (setting, map);
376 for (iter = list; iter; iter = g_slist_next (iter)) {
378 if (item->from == from) {
380 if (map == NM_VLAN_INGRESS_MAP)
381 g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_INGRESS_PRIORITY_MAP);
383 g_object_notify (G_OBJECT (setting), NM_SETTING_VLAN_EGRESS_PRIORITY_MAP);
388 item = g_malloc0 (sizeof (PriorityMap));
391 set_map (setting, map, g_slist_append (list, item));
397 * nm_setting_vlan_remove_priority:
398 * @setting: the #NMSettingVlan
399 * @map: the type of priority map
400 * @idx: the zero-based index of the priority map to remove
402 * Removes the priority map at index @idx from the
403 * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
407 nm_setting_vlan_remove_priority (NMSettingVlan *setting,
408 NMVlanPriorityMap map,
411 GSList *list = NULL, *item = NULL;
413 g_return_if_fail (NM_IS_SETTING_VLAN (setting));
414 g_return_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP);
416 list = get_map (setting, map);
417 g_return_if_fail (idx < g_slist_length (list));
419 item = g_slist_nth (list, idx);
420 priority_map_free ((PriorityMap *) (item->data));
421 set_map (setting, map, g_slist_delete_link (list, item));
425 * nm_setting_vlan_remove_priority_by_value:
426 * @setting: the #NMSettingVlan
427 * @map: the type of priority map
428 * @from: the priority to map to @to
429 * @to: the priority to map @from to
431 * Removes the priority map @form:@to from the #NMSettingVlan:ingress_priority_map
432 * or #NMSettingVlan:egress_priority_map (according to @map argument)
435 * Returns: %TRUE if the priority mapping was found and removed; %FALSE if it was not.
440 nm_setting_vlan_remove_priority_by_value (NMSettingVlan *setting,
441 NMVlanPriorityMap map,
445 GSList *list = NULL, *iter = NULL;
448 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
449 g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
451 list = get_map (setting, map);
452 for (iter = list; iter; iter = g_slist_next (iter)) {
454 if (item->from == from && item->to == to) {
455 priority_map_free ((PriorityMap *) (iter->data));
456 set_map (setting, map, g_slist_delete_link (list, iter));
464 * nm_setting_vlan_remove_priority_str_by_value:
465 * @setting: the #NMSettingVlan
466 * @map: the type of priority map
467 * @str: the string which contains a priority map, like "3:7"
469 * Removes the priority map @str from the #NMSettingVlan:ingress_priority_map
470 * or #NMSettingVlan:egress_priority_map (according to @map argument)
473 * Returns: %TRUE if the priority mapping was found and removed; %FALSE if it was not.
478 nm_setting_vlan_remove_priority_str_by_value (NMSettingVlan *setting,
479 NMVlanPriorityMap map,
485 g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
486 g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
488 item = priority_map_new_from_str (map, str);
492 found = nm_setting_vlan_remove_priority_by_value (setting, map, item->from, item->to);
498 * nm_setting_vlan_clear_priorities:
499 * @setting: the #NMSettingVlan
500 * @map: the type of priority map
502 * Clear all the entires from #NMSettingVlan:ingress_priority_map or
503 * #NMSettingVlan:egress_priority_map properties.
506 nm_setting_vlan_clear_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
510 g_return_if_fail (NM_IS_SETTING_VLAN (setting));
511 g_return_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP);
513 list = get_map (setting, map);
514 g_slist_free_full (list, g_free);
515 set_map (setting, map, NULL);
518 /*********************************************************************/
521 nm_setting_vlan_init (NMSettingVlan *setting)
526 verify (NMSetting *setting, GSList *all_settings, GError **error)
528 NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting);
529 NMSettingConnection *s_con = NULL;
530 NMSettingWired *s_wired = NULL;
533 for (iter = all_settings; iter; iter = iter->next) {
534 if (NM_IS_SETTING_CONNECTION (iter->data))
536 else if (NM_IS_SETTING_WIRED (iter->data))
537 s_wired = iter->data;
541 if (nm_utils_is_uuid (priv->parent)) {
542 /* If we have an NMSettingConnection:master with slave-type="vlan",
543 * then it must be the same UUID.
546 const char *master = NULL, *slave_type = NULL;
548 slave_type = nm_setting_connection_get_slave_type (s_con);
549 if (!g_strcmp0 (slave_type, NM_SETTING_VLAN_SETTING_NAME))
550 master = nm_setting_connection_get_master (s_con);
552 if (master && g_strcmp0 (priv->parent, master) != 0) {
554 NM_SETTING_VLAN_ERROR,
555 NM_SETTING_VLAN_ERROR_INVALID_PARENT,
556 _("'%s' value doesn't match '%s=%s'"),
557 priv->parent, NM_SETTING_CONNECTION_MASTER, master);
558 g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_PARENT);
562 } else if (!nm_utils_iface_valid_name (priv->parent)) {
563 /* parent must be either a UUID or an interface name */
565 NM_SETTING_VLAN_ERROR,
566 NM_SETTING_VLAN_ERROR_INVALID_PROPERTY,
567 _("'%s' is neither an UUID nor an interface name"),
569 g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_PARENT);
573 /* If parent is NULL, the parent must be specified via
574 * NMSettingWired:mac-address.
576 if (!s_wired || !nm_setting_wired_get_mac_address (s_wired)) {
578 NM_SETTING_VLAN_ERROR,
579 NM_SETTING_VLAN_ERROR_MISSING_PROPERTY,
580 _("property is not specified and neither is '%s:%s'"),
581 NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_MAC_ADDRESS);
582 g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_PARENT);
587 if (priv->flags & ~NM_VLAN_FLAGS_ALL) {
588 g_set_error_literal (error,
589 NM_SETTING_VLAN_ERROR,
590 NM_SETTING_VLAN_ERROR_INVALID_PROPERTY,
591 _("flags are invalid"));
592 g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_FLAGS);
596 if (priv->id >= 4095) {
598 NM_SETTING_VLAN_ERROR,
599 NM_SETTING_VLAN_ERROR_INVALID_PROPERTY,
600 _("the vlan id must be in range 0-4094 but is %u"),
602 g_prefix_error (error, "%s.%s: ", NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_ID);
606 /* If interface_name is specified, it must be a valid interface name. We
607 * don't check that it matches parent and/or id, because we allow
608 * renaming vlans to arbitrary names.
610 return _nm_setting_verify_deprecated_virtual_iface_name (
611 priv->interface_name, TRUE,
612 NM_SETTING_VLAN_SETTING_NAME, NM_SETTING_VLAN_INTERFACE_NAME,
613 NM_SETTING_VLAN_ERROR,
614 NM_SETTING_VLAN_ERROR_INVALID_PROPERTY,
615 NM_SETTING_VLAN_ERROR_MISSING_PROPERTY,
616 all_settings, error);
620 get_virtual_iface_name (NMSetting *setting)
622 return nm_setting_vlan_get_interface_name (NM_SETTING_VLAN (setting));
626 priority_stringlist_to_maplist (NMVlanPriorityMap map, GSList *strlist)
628 GSList *list = NULL, *iter;
630 for (iter = strlist; iter; iter = g_slist_next (iter)) {
633 item = priority_map_new_from_str (map, (const char *) iter->data);
635 list = g_slist_prepend (list, item);
637 return g_slist_reverse (list);
641 set_property (GObject *object, guint prop_id,
642 const GValue *value, GParamSpec *pspec)
644 NMSettingVlan *setting = NM_SETTING_VLAN (object);
645 NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting);
648 case PROP_INTERFACE_NAME:
649 g_free (priv->interface_name);
650 priv->interface_name = g_value_dup_string (value);
653 g_free (priv->parent);
654 priv->parent = g_value_dup_string (value);
657 priv->id = g_value_get_uint (value);
660 priv->flags = g_value_get_uint (value);
662 case PROP_INGRESS_PRIORITY_MAP:
663 g_slist_free_full (priv->ingress_priority_map, g_free);
664 priv->ingress_priority_map =
665 priority_stringlist_to_maplist (NM_VLAN_INGRESS_MAP, g_value_get_boxed (value));
667 case PROP_EGRESS_PRIORITY_MAP:
668 g_slist_free_full (priv->egress_priority_map, g_free);
669 priv->egress_priority_map =
670 priority_stringlist_to_maplist (NM_VLAN_EGRESS_MAP, g_value_get_boxed (value));
673 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
679 priority_maplist_to_stringlist (GSList *list)
681 GSList *strlist = NULL, *iter;
683 for (iter = list; iter; iter = g_slist_next (iter)) {
684 PriorityMap *item = iter->data;
686 strlist = g_slist_prepend (strlist, g_strdup_printf ("%d:%d", item->from, item->to));
688 return g_slist_reverse (strlist);
692 get_property (GObject *object, guint prop_id,
693 GValue *value, GParamSpec *pspec)
695 NMSettingVlan *setting = NM_SETTING_VLAN (object);
696 NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting);
699 case PROP_INTERFACE_NAME:
700 g_value_set_string (value, priv->interface_name);
703 g_value_set_string (value, priv->parent);
706 g_value_set_uint (value, priv->id);
709 g_value_set_uint (value, priv->flags);
711 case PROP_INGRESS_PRIORITY_MAP:
712 g_value_take_boxed (value, priority_maplist_to_stringlist (priv->ingress_priority_map));
714 case PROP_EGRESS_PRIORITY_MAP:
715 g_value_take_boxed (value, priority_maplist_to_stringlist (priv->egress_priority_map));
718 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
724 finalize (GObject *object)
726 NMSettingVlan *setting = NM_SETTING_VLAN (object);
727 NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting);
729 g_free (priv->interface_name);
730 g_free (priv->parent);
731 g_slist_free_full (priv->ingress_priority_map, g_free);
732 g_slist_free_full (priv->egress_priority_map, g_free);
734 G_OBJECT_CLASS (nm_setting_vlan_parent_class)->finalize (object);
738 nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
740 GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
741 NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
743 g_type_class_add_private (setting_class, sizeof (NMSettingVlanPrivate));
745 /* virtual methods */
746 object_class->set_property = set_property;
747 object_class->get_property = get_property;
748 object_class->finalize = finalize;
749 parent_class->verify = verify;
750 parent_class->get_virtual_iface_name = get_virtual_iface_name;
755 * NMSettingVlan:interface-name:
757 * If given, specifies the kernel name of the VLAN interface. If not given,
758 * a default name will be constructed from the interface described by the
759 * parent interface and the #NMSettingVlan:id property, eg "eth2.1". The
760 * parent interface may be given by the #NMSettingVlan:parent property or by
761 * the #NMSettingWired:mac-address property of an #NMSettingWired setting.
763 g_object_class_install_property
764 (object_class, PROP_INTERFACE_NAME,
765 g_param_spec_string (NM_SETTING_VLAN_INTERFACE_NAME, "", "",
769 NM_SETTING_PARAM_INFERRABLE |
770 G_PARAM_STATIC_STRINGS));
773 * NMSettingVlan:parent:
775 * If given, specifies the parent interface name or parent connection UUID
776 * from which this VLAN interface should be created. If this property is
777 * not specified, the connection must contain an #NMSettingWired setting
778 * with a #NMSettingWired:mac-address property.
780 g_object_class_install_property
781 (object_class, PROP_PARENT,
782 g_param_spec_string (NM_SETTING_VLAN_PARENT, "", "",
786 NM_SETTING_PARAM_INFERRABLE |
787 G_PARAM_STATIC_STRINGS));
792 * The VLAN identifier that the interface created by this connection should
795 g_object_class_install_property
796 (object_class, PROP_ID,
797 g_param_spec_uint (NM_SETTING_VLAN_ID, "", "",
801 NM_SETTING_PARAM_INFERRABLE |
802 G_PARAM_STATIC_STRINGS));
805 * NMSettingVlan:flags:
807 * One or more flags which control the behavior and features of the VLAN
808 * interface. Flags include %NM_VLAN_FLAG_REORDER_HEADERS (reordering of
809 * output packet headers), %NM_VLAN_FLAG_GVRP (use of the GVRP protocol),
810 * and %NM_VLAN_FLAG_LOOSE_BINDING (loose binding of the interface to its
811 * master device's operating state), %NM_VLAN_FLAG_MVRP (use of the MVRP
814 g_object_class_install_property
815 (object_class, PROP_FLAGS,
816 g_param_spec_uint (NM_SETTING_VLAN_FLAGS, "", "",
820 NM_SETTING_PARAM_INFERRABLE |
821 G_PARAM_STATIC_STRINGS));
824 * NMSettingVlan:ingress-priority-map:
826 * For incoming packets, a list of mappings from 802.1p priorities to Linux
827 * SKB priorities. The mapping is given in the format "from:to" where both
828 * "from" and "to" are unsigned integers, ie "7:3".
830 g_object_class_install_property
831 (object_class, PROP_INGRESS_PRIORITY_MAP,
832 _nm_param_spec_specialized (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP, "", "",
833 DBUS_TYPE_G_LIST_OF_STRING,
835 NM_SETTING_PARAM_INFERRABLE |
836 G_PARAM_STATIC_STRINGS));
839 * NMSettingVlan:egress-priority-map:
841 * For outgoing packets, a list of mappings from Linux SKB priorities to
842 * 802.1p priorities. The mapping is given in the format "from:to" where
843 * both "from" and "to" are unsigned integers, ie "7:3".
845 g_object_class_install_property
846 (object_class, PROP_EGRESS_PRIORITY_MAP,
847 _nm_param_spec_specialized (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP, "", "",
848 DBUS_TYPE_G_LIST_OF_STRING,
850 NM_SETTING_PARAM_INFERRABLE |
851 G_PARAM_STATIC_STRINGS));