static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL (device); NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE (self); NMSettingIPTunnel *s_ip_tunnel; const char *parent; if (!NM_DEVICE_CLASS (nm_device_ip_tunnel_parent_class)->check_connection_compatible (device, connection)) return FALSE; s_ip_tunnel = nm_connection_get_setting_ip_tunnel (connection); if (!s_ip_tunnel) return FALSE; if (nm_setting_ip_tunnel_get_mode (s_ip_tunnel) != priv->mode) return FALSE; if (nm_device_is_real (device)) { /* Check parent interface; could be an interface name or a UUID */ parent = nm_setting_ip_tunnel_get_parent (s_ip_tunnel); if (parent) { if (!match_parent (priv->parent, parent)) return FALSE; } if (!address_equal_pp (priv->addr_family, nm_setting_ip_tunnel_get_local (s_ip_tunnel), priv->local)) return FALSE; if (!address_equal_pp (priv->addr_family, nm_setting_ip_tunnel_get_remote (s_ip_tunnel), priv->remote)) return FALSE; if (nm_setting_ip_tunnel_get_ttl (s_ip_tunnel) != priv->ttl) return FALSE; if (nm_setting_ip_tunnel_get_tos (s_ip_tunnel) != priv->tos) return FALSE; if (priv->addr_family == AF_INET) { if (nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel) != priv->path_mtu_discovery) return FALSE; } else { if (nm_setting_ip_tunnel_get_encapsulation_limit (s_ip_tunnel) != priv->encap_limit) return FALSE; if (nm_setting_ip_tunnel_get_flow_label (s_ip_tunnel) != priv->flow_label) return FALSE; } } return TRUE; }
static void master_state_cb (NMActiveConnection *master, GParamSpec *pspec, gpointer user_data) { NMActiveConnection *self = NM_ACTIVE_CONNECTION (user_data); NMActiveConnectionState master_state = nm_active_connection_get_state (master); NMDevice *master_device = nm_active_connection_get_device (master); check_master_ready (self); if ( master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING && (!master_device || !nm_device_is_real (master_device))) { /* Master failed without ever creating or realizing its device */ if (NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed) NM_ACTIVE_CONNECTION_GET_CLASS (self)->master_failed (self); } }
static void notify_new_device_added (NMDevice *device, NMDevice *new_device) { NMDeviceMacvlan *self = NM_DEVICE_MACVLAN (device); NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (self); if (priv->parent) return; if (!nm_device_is_real (device)) return; update_properties (device); if ( priv->parent_ifindex <= 0 || nm_device_get_ifindex (new_device) != priv->parent_ifindex) return; priv->parent_ifindex = nm_device_get_ifindex (new_device); nm_device_macvlan_set_parent (self, new_device); }
static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (device); NMSettingMacvlan *s_macvlan; const char *parent = NULL; if (!NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->check_connection_compatible (device, connection)) return FALSE; s_macvlan = nm_connection_get_setting_macvlan (connection); if (!s_macvlan) return FALSE; if (nm_setting_macvlan_get_tap (s_macvlan) != priv->props.tap) return FALSE; /* Before the device is realized some properties will not be set */ if (nm_device_is_real (device)) { if (setting_mode_to_platform (nm_setting_macvlan_get_mode (s_macvlan)) != priv->props.mode) return FALSE; if (nm_setting_macvlan_get_promiscuous (s_macvlan) == priv->props.no_promisc) return FALSE; /* Check parent interface; could be an interface name or a UUID */ parent = nm_setting_macvlan_get_parent (s_macvlan); if (parent) { if (!match_parent (NM_DEVICE_MACVLAN (device), parent)) return FALSE; } else { /* Parent could be a MAC address in an NMSettingWired */ if (!match_hwaddr (device, connection, TRUE)) return FALSE; } } return TRUE; }
static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { NMDeviceTun *self = NM_DEVICE_TUN (device); NMDeviceTunPrivate *priv = NM_DEVICE_TUN_GET_PRIVATE (self); NMSettingTunMode mode; NMSettingTun *s_tun; gint64 user, group; if (!NM_DEVICE_CLASS (nm_device_tun_parent_class)->check_connection_compatible (device, connection)) return FALSE; s_tun = nm_connection_get_setting_tun (connection); if (!s_tun) return FALSE; if (nm_device_is_real (device)) { mode = tun_mode_from_string (priv->mode); if (mode != nm_setting_tun_get_mode (s_tun)) return FALSE; user = _nm_utils_ascii_str_to_int64 (nm_setting_tun_get_owner (s_tun), 10, 0, G_MAXINT32, -1); group = _nm_utils_ascii_str_to_int64 (nm_setting_tun_get_group (s_tun), 10, 0, G_MAXINT32, -1); if (user != priv->props.owner) return FALSE; if (group != priv->props.group) return FALSE; if (nm_setting_tun_get_pi (s_tun) == priv->props.no_pi) return FALSE; if (nm_setting_tun_get_vnet_hdr (s_tun) != priv->props.vnet_hdr) return FALSE; if (nm_setting_tun_get_multi_queue (s_tun) != priv->props.multi_queue) return FALSE; } return TRUE; }
static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { NMSettingBridge *s_bridge; const char *mac_address; if (!NM_DEVICE_CLASS (nm_device_bridge_parent_class)->check_connection_compatible (device, connection)) return FALSE; s_bridge = nm_connection_get_setting_bridge (connection); if (!s_bridge || !nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) return FALSE; mac_address = nm_setting_bridge_get_mac_address (s_bridge); if (mac_address && nm_device_is_real (device)) { const char *hw_addr; hw_addr = nm_device_get_hw_address (device); if (!hw_addr || !nm_utils_hwaddr_matches (hw_addr, -1, mac_address, -1)) return FALSE; } return TRUE; }
static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { NMDeviceVxlanPrivate *priv = NM_DEVICE_VXLAN_GET_PRIVATE (device); NMSettingVxlan *s_vxlan; const char *parent; if (!NM_DEVICE_CLASS (nm_device_vxlan_parent_class)->check_connection_compatible (device, connection)) return FALSE; s_vxlan = nm_connection_get_setting_vxlan (connection); if (!s_vxlan) return FALSE; if (nm_device_is_real (device)) { parent = nm_setting_vxlan_get_parent (s_vxlan); if ( parent && !match_parent (NM_DEVICE_VXLAN (device), parent)) return FALSE; if (priv->props.id != nm_setting_vxlan_get_id (s_vxlan)) return FALSE; if (!address_matches (nm_setting_vxlan_get_local (s_vxlan), priv->props.local, &priv->props.local6)) return FALSE; if (!address_matches (nm_setting_vxlan_get_remote (s_vxlan), priv->props.group, &priv->props.group6)) return FALSE; if (priv->props.src_port_min != nm_setting_vxlan_get_source_port_min (s_vxlan)) return FALSE; if (priv->props.src_port_max != nm_setting_vxlan_get_source_port_max (s_vxlan)) return FALSE; if (priv->props.dst_port != nm_setting_vxlan_get_destination_port (s_vxlan)) return FALSE; if (priv->props.tos != nm_setting_vxlan_get_tos (s_vxlan)) return FALSE; if (priv->props.ttl != nm_setting_vxlan_get_ttl (s_vxlan)) return FALSE; if (priv->props.learning != nm_setting_vxlan_get_learning (s_vxlan)) return FALSE; if (priv->props.ageing != nm_setting_vxlan_get_ageing (s_vxlan)) return FALSE; if (priv->props.proxy != nm_setting_vxlan_get_proxy (s_vxlan)) return FALSE; if (priv->props.rsc != nm_setting_vxlan_get_rsc (s_vxlan)) return FALSE; if (priv->props.l2miss != nm_setting_vxlan_get_l2_miss (s_vxlan)) return FALSE; if (priv->props.l3miss != nm_setting_vxlan_get_l3_miss (s_vxlan)) return FALSE; } return TRUE; }