dispatcher: introduce new env variables for gateway address (bgo #740363)
authorJiří Klimeš <jklimes@redhat.com>
Wed, 19 Nov 2014 12:03:38 +0000 (13:03 +0100)
committerJiří Klimeš <jklimes@redhat.com>
Wed, 19 Nov 2014 15:52:25 +0000 (16:52 +0100)
IP4_GATEWAY
VPN_IP4_GATEWAY
IP6_GATEWAY
VPN_IP6_GATEWAY

We still put gateway into IP[46]_ADDRESS_N for backward compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=740363

callouts/nm-dispatcher-utils.c
man/NetworkManager.xml

index ab7fda6..5b1419d 100644 (file)
@@ -123,6 +123,10 @@ construct_ip4_items (GSList *items, GVariant *ip4_config, const char *prefix)
                }
                if (addresses->len)
                        items = g_slist_prepend (items, g_strdup_printf ("%sIP4_NUM_ADDRESSES=%d", prefix, addresses->len));
+
+               /* Write gateway to a separate variable, too. */
+               items = g_slist_prepend (items, g_strdup_printf ("%sIP4_GATEWAY=%s", prefix, gateway));
+
                g_ptr_array_unref (addresses);
                g_free (gateway);
                g_variant_unref (val);
@@ -257,6 +261,10 @@ construct_ip6_items (GSList *items, GVariant *ip6_config, const char *prefix)
                }
                if (addresses->len)
                        items = g_slist_prepend (items, g_strdup_printf ("%sIP6_NUM_ADDRESSES=%d", prefix, addresses->len));
+
+               /* Write gateway to a separate variable, too. */
+               items = g_slist_prepend (items, g_strdup_printf ("%sIP6_GATEWAY=%s", prefix, gateway));
+
                g_ptr_array_unref (addresses);
                g_free (gateway);
                g_variant_unref (val);
index 229c390..78b52e3 100644 (file)
           <term><varname>IP4_ADDRESS_N</varname></term>
           <listitem><para>
             The IPv4 address in the format "address/prefix gateway", where N is a number
-            from 0 to (# IPv4 address \- 1).
+            from 0 to (# IPv4 address \- 1). gateway item in this variable is deprecated,
+            use IP4_GATEWAY instead.
           </para></listitem>
         </varlistentry>
         <varlistentry>
             The variable contains the number of IPv4 addresses the script may expect.
           </para></listitem>
         </varlistentry>
+        <varlistentry>
+          <term><varname>IP4_GATEWAY</varname></term>
+          <listitem><para>
+            The gateway IPv4 address in traditional numbers-and-dots notation.
+          </para></listitem>
+        </varlistentry>
         <varlistentry>
           <term><varname>IP4_ROUTE_N</varname></term>
           <listitem><para>