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 gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device); NMSettingVlan *s_vlan; const char *parent, *iface = NULL; if (!NM_DEVICE_CLASS (nm_device_vlan_parent_class)->check_connection_compatible (device, connection)) return FALSE; s_vlan = nm_connection_get_setting_vlan (connection); if (!s_vlan) return FALSE; if (nm_setting_vlan_get_id (s_vlan) != priv->vlan_id) return FALSE; /* Check parent interface; could be an interface name or a UUID */ parent = nm_setting_vlan_get_parent (s_vlan); if (parent) { if (!match_parent (NM_DEVICE_VLAN (device), parent)) return FALSE; } else { /* Parent could be a MAC address in an NMSettingWired */ if (!match_hwaddr (device, connection, TRUE)) return FALSE; } /* Ensure the interface name matches. If not specified we assume a match * since both the parent interface and the VLAN ID matched by the time we * get here. */ iface = nm_connection_get_interface_name (connection); if (iface) { if (g_strcmp0 (nm_device_get_ip_iface (device), iface) != 0) return FALSE; } return TRUE; }
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) { 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; }