diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-12-22 10:24:25 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-01-05 18:25:08 +0100 |
commit | da4c9e51a038279e261b896e5156308adaea4572 (patch) | |
tree | 286713127adb28f63b41cd8ef47dc4579fe1e4ed /libnm | |
parent | 686afe531ab3774cd818feda8361de74101971f5 (diff) | |
download | NetworkManager-da4c9e51a038279e261b896e5156308adaea4572.tar.gz |
ip-tunnel: add support for tunnel flags
Implement support for IP tunnel flags. Currently only some IPv6 tunnel
flags are supported. Example:
# nmcli connection add type ip-tunnel mode ip6ip6 \
ip-tunnel.flags ip6-ign-encap-limit,ip6-use-orig-tclass \
ifname abc ip-tunnel.parent ens8 ipv4.method disabled \
ipv6.method manual ipv6.address ::8888 remote ::42
# ip -d l
61: abc@ens8: <NOARP,UP,LOWER_UP> mtu 1460 qdisc noqueue ...
link/tunnel6 :: brd ::42 promiscuity 0
ip6tnl ip6ip6 remote ::42 local :: dev ens8 encaplimit none
hoplimit 0 tclass inherit ...
https://bugzilla.gnome.org/show_bug.cgi?id=791846
Diffstat (limited to 'libnm')
-rw-r--r-- | libnm/libnm.ver | 3 | ||||
-rw-r--r-- | libnm/nm-device-ip-tunnel.c | 36 | ||||
-rw-r--r-- | libnm/nm-device-ip-tunnel.h | 4 |
3 files changed, 43 insertions, 0 deletions
diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 2014a30a52..e5ded29ac1 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1345,6 +1345,9 @@ global: nm_client_checkpoint_rollback_async; nm_client_checkpoint_rollback_finish; nm_client_get_checkpoints; + nm_device_ip_tunnel_get_flags; + nm_ip_tunnel_flags_get_type; + nm_setting_ip_tunnel_get_flags; nm_setting_vpn_get_data_keys; nm_setting_vpn_get_secret_keys; } libnm_1_10_0; diff --git a/libnm/nm-device-ip-tunnel.c b/libnm/nm-device-ip-tunnel.c index e0dfc0f4e0..2f7efe9d8d 100644 --- a/libnm/nm-device-ip-tunnel.c +++ b/libnm/nm-device-ip-tunnel.c @@ -46,6 +46,7 @@ typedef struct { char *output_key; guint8 encap_limit; guint32 flow_label; + guint32 flags; } NMDeviceIPTunnelPrivate; enum { @@ -61,6 +62,7 @@ enum { PROP_OUTPUT_KEY, PROP_ENCAPSULATION_LIMIT, PROP_FLOW_LABEL, + PROP_FLAGS, LAST_PROP }; @@ -242,6 +244,22 @@ nm_device_ip_tunnel_get_flow_label (NMDeviceIPTunnel *device) return NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->flow_label; } +/** + * nm_device_ip_tunnel_get_flags: + * @device: a #NMDeviceIPTunnel + * + * Returns: the tunnel flags + * + * Since: 1.12 + **/ +NMIPTunnelFlags +nm_device_ip_tunnel_get_flags (NMDeviceIPTunnel *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NM_IP_TUNNEL_FLAG_NONE); + + return NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->flags; +} + static gboolean connection_compatible (NMDevice *device, NMConnection *connection, GError **error) { @@ -286,6 +304,7 @@ init_dbus (NMObject *object) { NM_DEVICE_IP_TUNNEL_OUTPUT_KEY, &priv->output_key }, { NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT, &priv->encap_limit }, { NM_DEVICE_IP_TUNNEL_FLOW_LABEL, &priv->flow_label }, + { NM_DEVICE_IP_TUNNEL_FLAGS, &priv->flags }, { NULL }, }; @@ -352,6 +371,9 @@ get_property (GObject *object, case PROP_FLOW_LABEL: g_value_set_uint (value, nm_device_ip_tunnel_get_flow_label (device)); break; + case PROP_FLAGS: + g_value_set_uint (value, nm_device_ip_tunnel_get_flags (device)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -536,4 +558,18 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) 0, (1 << 20) - 1, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * NMDeviceIPTunnel:flags: + * + * Tunnel flags. + * + * Since: 1.12 + **/ + g_object_class_install_property + (object_class, PROP_FLAGS, + g_param_spec_uint (NM_DEVICE_IP_TUNNEL_FLAGS, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm/nm-device-ip-tunnel.h b/libnm/nm-device-ip-tunnel.h index 6d748d966b..92a83edc32 100644 --- a/libnm/nm-device-ip-tunnel.h +++ b/libnm/nm-device-ip-tunnel.h @@ -26,6 +26,7 @@ #endif #include "nm-device.h" +#include "nm-setting-ip-tunnel.h" G_BEGIN_DECLS @@ -47,6 +48,7 @@ G_BEGIN_DECLS #define NM_DEVICE_IP_TUNNEL_OUTPUT_KEY "output-key" #define NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT "encapsulation-limit" #define NM_DEVICE_IP_TUNNEL_FLOW_LABEL "flow-label" +#define NM_DEVICE_IP_TUNNEL_FLAGS "flags" /** * NMDeviceIPTunnel: @@ -87,6 +89,8 @@ NM_AVAILABLE_IN_1_2 guint8 nm_device_ip_tunnel_get_encapsulation_limit (NMDeviceIPTunnel *device); NM_AVAILABLE_IN_1_2 guint nm_device_ip_tunnel_get_flow_label (NMDeviceIPTunnel *device); +NM_AVAILABLE_IN_1_12 +NMIPTunnelFlags nm_device_ip_tunnel_get_flags (NMDeviceIPTunnel *device); G_END_DECLS |