static void
update_properties (NMDevice *device)
{
	NMDeviceMacvlan *self = NM_DEVICE_MACVLAN (device);
	NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (device);
	GObject *object = G_OBJECT (device);
	NMPlatformMacvlanProperties props;

	if (!nm_platform_macvlan_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &props)) {
		_LOGW (LOGD_HW, "could not read macvlan properties");
		return;
	}

	g_object_freeze_notify (object);

	if (priv->props.parent_ifindex != props.parent_ifindex)
		g_object_notify (object, NM_DEVICE_MACVLAN_PARENT);
	if (g_strcmp0 (priv->props.mode, props.mode) != 0)
		g_object_notify (object, NM_DEVICE_MACVLAN_MODE);
	if (priv->props.no_promisc != props.no_promisc)
		g_object_notify (object, NM_DEVICE_MACVLAN_NO_PROMISC);

	memcpy (&priv->props, &props, sizeof (NMPlatformMacvlanProperties));

	g_object_thaw_notify (object);
}
Exemplo n.º 2
0
static gboolean
do_macvlan_get_properties (char **argv)
{
	int ifindex = parse_ifindex (*argv++);
	NMPlatformMacvlanProperties props;

	if (!nm_platform_macvlan_get_properties (NM_PLATFORM_GET, ifindex, &props))
		return FALSE;

	printf ("parent: %d\n", props.parent_ifindex);
	printf ("mode: %s\n", props.mode);
	printf ("no-promisc: ");
	print_boolean (props.no_promisc);
	return TRUE;
}