Re: Invalid IP-assignment if assigned within pushed route



Which repository am I supposed to check out to modify
nm-openvpn-service-openvpn-helper.c?

Thanks

/Jonathan

On Fri, Jan 9, 2009 at 9:45 AM, Dan Williams <dcbw redhat com> wrote:
> On Fri, 2009-01-09 at 08:51 -0800, Jonathan Petersson wrote:
>> Please see first part och the log-file:, OpenVPN pushes it:
>>
>> Jan  8 22:59:39 jpetersson-desk1 nm-openvpn[14982]: TUN/TAP device tap0 opened
>> Jan  8 22:59:39 jpetersson-desk1 nm-openvpn[14982]: /sbin/ifconfig
>> tap0 10.100.40.5 netmask 255.255.255.0 mtu 1500 broadcast
>> 10.100.40.255
>> Jan  8 22:59:39 jpetersson-desk1 vmnetBridge: RTM_NEWLINK: name:tap0
>> index:14 flags:0x00011043
>> Jan  8 22:59:39 jpetersson-desk1 avahi-daemon[6615]: Joining mDNS
>> multicast group on interface tap0.IPv4 with address 10.100.40.5.
>
> Ok, it *does* send it for TAP devices, but not TUN devices (obviously,
> since TUN is point-to-point it uses 255.255.255.255).  Can you try the
> patch below?
>
> Dan
>
> Index: src/nm-openvpn-service-openvpn-helper.c
> ===================================================================
> --- src/nm-openvpn-service-openvpn-helper.c     (revision 11)
> +++ src/nm-openvpn-service-openvpn-helper.c     (working copy)
> @@ -287,6 +287,7 @@
>        GValue *nbns_list = NULL;
>        GValue *dns_domain = NULL;
>        struct in_addr temp_addr;
> +       gboolean tapdev = FALSE;
>
>        g_type_init ();
>
> @@ -310,13 +311,17 @@
>        if (val)
>                g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY, val);
>
> -       /* Tunnel device */
> -       val = str_to_gvalue (getenv ("dev"), FALSE);
> +       /* VPN device */
> +       tmp = getenv ("dev");
> +       val = str_to_gvalue (tmp, FALSE);
>        if (val)
>                g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, val);
>        else
>                helper_failed (connection, "Tunnel Device");
>
> +       if (strncmp (tmp, "tap", 3) == 0)
> +               tapdev = TRUE;
> +
>        /* IP address */
>        val = addr_to_gvalue (getenv ("ifconfig_local"));
>        if (val)
> @@ -329,15 +334,28 @@
>        if (val)
>                g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PTP, val);
>
> -       /* Netmask */
> -       tmp = getenv ("route_netmask_1");
> -       if (tmp && inet_pton (AF_INET, tmp, &temp_addr) > 0) {
> +       /* Netmask
> +        *
> +        * TAP devices pass back the netmask, while TUN devices always use /32
> +        * since they are point-to-point.
> +        */
> +       if (tapdev) {
> +               tmp = getenv ("ifconfig_netmask");
> +               if (tmp && inet_pton (AF_INET, tmp, &temp_addr) > 0) {
> +                       GValue *val;
> +
> +                       val = g_slice_new0 (GValue);
> +                       g_value_init (val, G_TYPE_UINT);
> +                       g_value_set_uint (val, nm_utils_ip4_netmask_to_prefix (temp_addr.s_addr));
> +
> +                       g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
> +               }
> +       } else {
>                GValue *val;
>
>                val = g_slice_new0 (GValue);
>                g_value_init (val, G_TYPE_UINT);
> -               g_value_set_uint (val, nm_utils_ip4_netmask_to_prefix (temp_addr.s_addr));
> -
> +               g_value_set_uint (val, 32);
>                g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
>        }
>
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]