mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 19:40:19 +01:00
* Finally re-committing changes to allow the plugin to use the new
NetworkManager DBUS dict based VPN interface. (This allows the MTU
of a VPN connection to be passed back to NetworkManager)
- Currently disabled by default, need to add --enable-nm-vpn-dbus-dict
to configure.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2032 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
cb7ca51e0a
commit
21ef5bdb21
3 changed files with 79 additions and 4 deletions
|
|
@ -143,6 +143,10 @@ AS_AC_EXPAND(SBINDIR, $sbindir)
|
|||
AS_AC_EXPAND(LIBDIR, $libdir)
|
||||
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
|
||||
|
||||
AC_ARG_ENABLE(nm-vpn-dbus-dict, [ --enable-nm-vpn-dbus-dict Build Plugin to use newer DBUS Dict NetworkManager VPN interface [default=no]], enable_nm_vpn_dbus_dict="$enableval", enable_nm_vpn_dbus_dict=no)
|
||||
if test "x$enable_nm_vpn_dbus_dict" = "xyes" ; then
|
||||
NM_VPN_CFLAGS="NM_VPN_USE_DBUS_DICT_INTERFACE"
|
||||
fi
|
||||
AC_ARG_ENABLE(bluetooth, [ --enable-bluetooth Build Bluetooth bits [default=no]], enable_bluetooth="$enableval", enable_bluetooth=no)
|
||||
if test "x$enable_bluetooth" = "xyes" ; then
|
||||
BUILD_BLUETOOTH="yes"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ AM_CPPFLAGS = \
|
|||
$(GTHREAD_CFLAGS) \
|
||||
$(PPPD_CFLAGS) \
|
||||
-Wall \
|
||||
$(NM_VPN_CFLAGS) \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DBINDIR=\"$(bindir)\" \
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
#include "nm-ppp-starter.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
|
||||
static const char *pptp_binary_paths[] =
|
||||
{
|
||||
"/usr/sbin/pptp",
|
||||
|
|
@ -81,6 +80,7 @@ typedef struct NmPPPData
|
|||
GPid pid;
|
||||
guint quit_timer;
|
||||
guint helper_timer;
|
||||
guint32 mtu;
|
||||
char *str_ip4_vpn_gateway;
|
||||
char *connection_type;
|
||||
struct in_addr ip4_vpn_gateway;
|
||||
|
|
@ -694,6 +694,9 @@ static gint nm_ppp_get_cmdline_ppp (NmPPPData *data, char **data_items, const in
|
|||
(strlen( data_items[++i] ) > 0) ) {
|
||||
g_ptr_array_add (ppp_argv, (gpointer) "mtu");
|
||||
g_ptr_array_add (ppp_argv, (gpointer) data_items[i]);
|
||||
// Set the mtu value for return to NM.
|
||||
// (Subtract 4 for PPP header)
|
||||
data->mtu=atoi(data_items[i])-4;
|
||||
|
||||
} else if ( (strcmp( data_items[i], "lcp-echo-failure" ) == 0) &&
|
||||
(strlen( data_items[++i] ) > 0) ) {
|
||||
|
|
@ -1411,9 +1414,13 @@ static void nm_ppp_dbus_process_helper_ip4_config (DBusConnection *con, DBusMess
|
|||
guint32 ip4_nbns_len;
|
||||
guint32 ip4_nbns1;
|
||||
guint32 ip4_nbns2;
|
||||
guint32 mtu;
|
||||
guint32 mss;
|
||||
gboolean success = FALSE;
|
||||
char * empty = "";
|
||||
int i;
|
||||
DBusMessageIter iter, iter_dict;
|
||||
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (con != NULL);
|
||||
|
|
@ -1466,11 +1473,74 @@ static void nm_ppp_dbus_process_helper_ip4_config (DBusConnection *con, DBusMess
|
|||
nm_warning ("Not enough memory for new dbus message!");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* PPP does not care about the MSS */
|
||||
mss = 0;
|
||||
|
||||
if (data->mtu <= 0) data->mtu=1500-4;
|
||||
mtu = data->mtu;
|
||||
|
||||
ip4_vpn_gateway=data->ip4_vpn_gateway.s_addr;
|
||||
|
||||
#ifdef NM_VPN_USE_DBUS_DICT_INTERFACE
|
||||
dbus_message_iter_init_append (signal, &iter);
|
||||
if (!nmu_dbus_dict_open_write (&iter, &iter_dict)) {
|
||||
nm_warning ("dict open write failed!");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "gateway", ip4_vpn_gateway)) {
|
||||
nm_warning ("couldn't append gateway to dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!nmu_dbus_dict_append_string (&iter_dict, "tundev", tundev)) {
|
||||
nm_warning ("couldn't append tundev to dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "local_addr", ip4_address)) {
|
||||
nm_warning ("couldn't append local_address to dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "ptp_addr", ip4_ptp_address)) {
|
||||
nm_warning ("couldn't append ptp_address to dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i=0; i < ip4_dns_len; i++) {
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "dns_server", ip4_dns[i])) {
|
||||
nm_warning ("couldn't append dns_server (number %d) to dict",i);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i < ip4_nbns_len; i++) {
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "nbns_server", ip4_dns[i])) {
|
||||
nm_warning ("couldn't append nbns_server (number %d) to dict",i);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "mtu", mtu)) {
|
||||
nm_warning ("couldn't append mtu to dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!nmu_dbus_dict_close_write (&iter, &iter_dict)) {
|
||||
nm_warning ("dict close write failed!");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/* Don't bother setting anything that isn't needed!
|
||||
|
||||
if (!nmu_dbus_dict_append_uint32 (&iter_dict, "mss", mss)) {
|
||||
nm_warning ("couldn't append mss to dict");
|
||||
goto out;
|
||||
}
|
||||
*/
|
||||
#else
|
||||
dbus_message_append_args (signal,
|
||||
DBUS_TYPE_UINT32, &ip4_vpn_gateway,
|
||||
DBUS_TYPE_STRING, &tundev,
|
||||
|
|
@ -1483,7 +1553,7 @@ static void nm_ppp_dbus_process_helper_ip4_config (DBusConnection *con, DBusMess
|
|||
DBUS_TYPE_STRING, &empty,
|
||||
DBUS_TYPE_STRING, &empty,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
#endif
|
||||
if (!dbus_connection_send (data->con, signal, NULL))
|
||||
{
|
||||
nm_warning ("Could not raise the "NM_DBUS_VPN_SIGNAL_IP4_CONFIG" signal!");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue