[PATCH 1/3] api: add MTU to bearer IP config properties

Aleksander Morgado aleksander at aleksander.es
Tue Mar 25 09:14:38 PDT 2014


On 25/03/14 08:18, Ben Chan wrote:
> This patch adds a 'mtu' value to the Ip4Config and Ip6Config property of
> a Bearer object, which indicates the value of the maximum transmission
> unit for the established connection when such information is available
> (e.g. via QMI_WDS_GET_RUNTIME_SETTINGS on a QMI modem or
> MBIM_CID_IP_CONFIGURATION on a MBIM modem).
> ---

Pushed, thanks.

BTW, also added a follow-up commit to include the new methods in the
gtk-doc documentation.


>  .../org.freedesktop.ModemManager1.Bearer.xml       | 18 ++++++++++
>  libmm-glib/mm-bearer-ip-config.c                   | 39 ++++++++++++++++++++++
>  libmm-glib/mm-bearer-ip-config.h                   |  3 ++
>  3 files changed, 60 insertions(+)
> 
> diff --git a/introspection/org.freedesktop.ModemManager1.Bearer.xml b/introspection/org.freedesktop.ModemManager1.Bearer.xml
> index 29e502d..1d2f287 100644
> --- a/introspection/org.freedesktop.ModemManager1.Bearer.xml
> +++ b/introspection/org.freedesktop.ModemManager1.Bearer.xml
> @@ -157,6 +157,15 @@
>              </listitem>
>            </varlistentry>
>          </variablelist>
> +
> +        This property may also include the following items when such information is available:
> +        <variablelist>
> +          <varlistentry><term><literal>"mtu"</literal></term>
> +            <listitem>
> +              Maximum transmission unit (MTU), given as an unsigned integer value (signature <literal>"u"</literal>).
> +            </listitem>
> +          </varlistentry>
> +        </variablelist>
>      -->
>      <property name="Ip4Config" type="a{sv}" access="read" />
>  
> @@ -215,6 +224,15 @@
>              </listitem>
>            </varlistentry>
>          </variablelist>
> +
> +        This property may also include the following items when such information is available:
> +        <variablelist>
> +          <varlistentry><term><literal>"mtu"</literal></term>
> +            <listitem>
> +              Maximum transmission unit (MTU), given as an unsigned integer value (signature <literal>"u"</literal>).
> +            </listitem>
> +          </varlistentry>
> +        </variablelist>
>      -->
>      <property name="Ip6Config" type="a{sv}" access="read" />
>  
> diff --git a/libmm-glib/mm-bearer-ip-config.c b/libmm-glib/mm-bearer-ip-config.c
> index e436c39..7ffd7ba 100644
> --- a/libmm-glib/mm-bearer-ip-config.c
> +++ b/libmm-glib/mm-bearer-ip-config.c
> @@ -40,6 +40,7 @@ G_DEFINE_TYPE (MMBearerIpConfig, mm_bearer_ip_config, G_TYPE_OBJECT);
>  #define PROPERTY_DNS2    "dns2"
>  #define PROPERTY_DNS3    "dns3"
>  #define PROPERTY_GATEWAY "gateway"
> +#define PROPERTY_MTU     "mtu"
>  
>  struct _MMBearerIpConfigPrivate {
>      MMBearerIpMethod method;
> @@ -47,6 +48,7 @@ struct _MMBearerIpConfigPrivate {
>      guint prefix;
>      gchar **dns;
>      gchar *gateway;
> +    guint mtu;
>  };
>  
>  /*****************************************************************************/
> @@ -189,6 +191,33 @@ mm_bearer_ip_config_set_gateway (MMBearerIpConfig *self,
>  
>  /*****************************************************************************/
>  
> +/**
> + * mm_bearer_ip_config_get_mtu:
> + * @self: a #MMBearerIpConfig.
> + *
> + * Gets the MTU to be used with this bearer.
> + *
> + * Returns: the MTU.
> + */
> +guint
> +mm_bearer_ip_config_get_mtu (MMBearerIpConfig *self)
> +{
> +    g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), 0);
> +
> +    return self->priv->mtu;
> +}
> +
> +void
> +mm_bearer_ip_config_set_mtu (MMBearerIpConfig *self,
> +                             guint mtu)
> +{
> +    g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self));
> +
> +    self->priv->mtu = mtu;
> +}
> +
> +/*****************************************************************************/
> +
>  GVariant *
>  mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self)
>  {
> @@ -246,6 +275,12 @@ mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self)
>                                     "{sv}",
>                                     PROPERTY_GATEWAY,
>                                     g_variant_new_string (self->priv->gateway));
> +
> +        if (self->priv->mtu)
> +            g_variant_builder_add (&builder,
> +                                   "{sv}",
> +                                   PROPERTY_MTU,
> +                                   g_variant_new_uint32 (self->priv->mtu));
>      }
>  
>      return g_variant_builder_end (&builder);
> @@ -306,6 +341,10 @@ mm_bearer_ip_config_new_from_dictionary (GVariant *dictionary,
>              mm_bearer_ip_config_set_gateway (
>                  self,
>                  g_variant_get_string (value, NULL));
> +        else if (g_str_equal (key, PROPERTY_MTU))
> +            mm_bearer_ip_config_set_mtu (
> +                self,
> +                g_variant_get_uint32 (value));
>  
>          g_free (key);
>          g_variant_unref (value);
> diff --git a/libmm-glib/mm-bearer-ip-config.h b/libmm-glib/mm-bearer-ip-config.h
> index bfd2ea7..898a405 100644
> --- a/libmm-glib/mm-bearer-ip-config.h
> +++ b/libmm-glib/mm-bearer-ip-config.h
> @@ -60,6 +60,7 @@ const gchar       *mm_bearer_ip_config_get_address (MMBearerIpConfig *self);
>  guint              mm_bearer_ip_config_get_prefix  (MMBearerIpConfig *self);
>  const gchar      **mm_bearer_ip_config_get_dns     (MMBearerIpConfig *self);
>  const gchar       *mm_bearer_ip_config_get_gateway (MMBearerIpConfig *self);
> +guint              mm_bearer_ip_config_get_mtu     (MMBearerIpConfig *self);
>  
>  /*****************************************************************************/
>  /* ModemManager/libmm-glib/mmcli specific methods */
> @@ -84,6 +85,8 @@ void mm_bearer_ip_config_set_dns     (MMBearerIpConfig *self,
>                                        const gchar **dns);
>  void mm_bearer_ip_config_set_gateway (MMBearerIpConfig *self,
>                                        const gchar *gateway);
> +void mm_bearer_ip_config_set_mtu     (MMBearerIpConfig *self,
> +                                      guint mtu);
>  
>  GVariant *mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self);
>  
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list