diff options
Diffstat (limited to 'src/ppp-manager')
| -rw-r--r-- | src/ppp-manager/Makefile.am | 4 | ||||
| -rw-r--r-- | src/ppp-manager/Makefile.in | 16 | ||||
| -rw-r--r-- | src/ppp-manager/nm-ppp-manager.c | 63 |
3 files changed, 73 insertions, 10 deletions
diff --git a/src/ppp-manager/Makefile.am b/src/ppp-manager/Makefile.am index 8df2f584..36e54ec9 100644 --- a/src/ppp-manager/Makefile.am +++ b/src/ppp-manager/Makefile.am @@ -7,7 +7,8 @@ INCLUDES = \ -I${top_srcdir}/src \ -I${top_srcdir}/src/generated \ -I${top_builddir}/src/generated \ - -I${top_srcdir}/src/logging + -I${top_srcdir}/src/logging \ + -I${top_srcdir}/src/posix-signals noinst_LTLIBRARIES = libppp-manager.la @@ -33,6 +34,7 @@ libppp_manager_la_CPPFLAGS = \ libppp_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ $(top_builddir)/src/logging/libnm-logging.la \ + $(top_builddir)/src/posix-signals/libnm-posix-signals.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) diff --git a/src/ppp-manager/Makefile.in b/src/ppp-manager/Makefile.in index 55355a7d..c9ff095a 100644 --- a/src/ppp-manager/Makefile.in +++ b/src/ppp-manager/Makefile.in @@ -47,7 +47,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -81,6 +81,7 @@ am__DEPENDENCIES_1 = libppp_manager_la_DEPENDENCIES = \ $(top_builddir)/src/generated/libnm-generated.la \ $(top_builddir)/src/logging/libnm-logging.la \ + $(top_builddir)/src/posix-signals/libnm-posix-signals.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libppp_manager_la_OBJECTS = libppp_manager_la-nm-ppp-manager.lo libppp_manager_la_OBJECTS = $(am_libppp_manager_la_OBJECTS) @@ -204,6 +205,10 @@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ @@ -299,6 +304,9 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VAPIGEN = @VAPIGEN@ +VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ +VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ @@ -337,6 +345,8 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -366,7 +376,8 @@ INCLUDES = \ -I${top_srcdir}/src \ -I${top_srcdir}/src/generated \ -I${top_builddir}/src/generated \ - -I${top_srcdir}/src/logging + -I${top_srcdir}/src/logging \ + -I${top_srcdir}/src/posix-signals noinst_LTLIBRARIES = libppp-manager.la libppp_manager_la_SOURCES = \ @@ -385,6 +396,7 @@ libppp_manager_la_CPPFLAGS = \ libppp_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ $(top_builddir)/src/logging/libnm-logging.la \ + $(top_builddir)/src/posix-signals/libnm-posix-signals.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index 59698c34..73cc566f 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2011 Red Hat, Inc. + * Copyright (C) 2008 - 2012 Red Hat, Inc. */ #include <config.h> @@ -47,11 +47,13 @@ #include "nm-setting-connection.h" #include "nm-setting-ppp.h" #include "nm-setting-pppoe.h" +#include "nm-setting-adsl.h" #include "nm-setting-gsm.h" #include "nm-setting-cdma.h" #include "nm-dbus-manager.h" #include "nm-logging.h" #include "nm-marshal.h" +#include "nm-posix-signals.h" static void impl_ppp_manager_need_secrets (NMPPPManager *manager, DBusGMethodInvocation *context); @@ -304,18 +306,20 @@ monitor_cb (gpointer user_data) { NMPPPManager *manager = NM_PPP_MANAGER (user_data); NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - struct ifpppstatsreq req; + struct ifreq req; + struct ppp_stats stats; memset (&req, 0, sizeof (req)); - req.stats_ptr = (caddr_t) &req.stats; + memset (&stats, 0, sizeof (stats)); + req.ifr_data = (caddr_t) &stats; - strncpy (req.ifr__name, priv->ip_iface, sizeof (req.ifr__name)); + strncpy (req.ifr_name, priv->ip_iface, sizeof (req.ifr_name)); if (ioctl (priv->monitor_fd, SIOCGPPPSTATS, &req) < 0) { nm_log_warn (LOGD_PPP, "could not read ppp stats: %s", strerror (errno)); } else { g_signal_emit (manager, signals[STATS], 0, - req.stats.p.ppp_ibytes, - req.stats.p.ppp_obytes); + stats.p.ppp_ibytes, + stats.p.ppp_obytes); } return TRUE; @@ -391,6 +395,9 @@ extract_details_from_connection (NMConnection *connection, if (NM_IS_SETTING_PPPOE (setting)) { *username = nm_setting_pppoe_get_username (NM_SETTING_PPPOE (setting)); *password = nm_setting_pppoe_get_password (NM_SETTING_PPPOE (setting)); + } else if (NM_IS_SETTING_ADSL (setting)) { + *username = nm_setting_adsl_get_username (NM_SETTING_ADSL (setting)); + *password = nm_setting_adsl_get_password (NM_SETTING_ADSL (setting)); } else if (NM_IS_SETTING_GSM (setting)) { *username = nm_setting_gsm_get_username (NM_SETTING_GSM (setting)); *password = nm_setting_gsm_get_password (NM_SETTING_GSM (setting)); @@ -792,6 +799,7 @@ static NMCmdLine * create_pppd_cmd_line (NMPPPManager *self, NMSettingPPP *setting, NMSettingPPPOE *pppoe, + NMSettingAdsl *adsl, const char *ppp_name, GError **err) { @@ -819,6 +827,10 @@ create_pppd_cmd_line (NMPPPManager *self, /* NM handles setting the default route */ nm_cmd_line_add_string (cmd, "nodefaultroute"); + /* Allow IPv6 to be configured by IPV6CP */ + nm_cmd_line_add_string (cmd, "ipv6"); + nm_cmd_line_add_string (cmd, ","); + ppp_debug = !!getenv ("NM_PPP_DEBUG"); if ( nm_logging_level_enabled (LOGL_DEBUG) && nm_logging_domain_enabled (LOGD_PPP)) @@ -848,6 +860,34 @@ create_pppd_cmd_line (NMPPPManager *self, nm_cmd_line_add_string (cmd, "rp_pppoe_service"); nm_cmd_line_add_string (cmd, pppoe_service); } + } else if (adsl) { + const gchar *protocol = nm_setting_adsl_get_protocol (adsl); + + if (!strcmp (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA)) { + guint32 vpi = nm_setting_adsl_get_vpi (adsl); + guint32 vci = nm_setting_adsl_get_vci (adsl); + const char *encaps = nm_setting_adsl_get_encapsulation (adsl); + gchar *vpivci; + + nm_cmd_line_add_string (cmd, "plugin"); + nm_cmd_line_add_string (cmd, "pppoatm.so"); + + vpivci = g_strdup_printf("%d.%d", vpi, vci); + nm_cmd_line_add_string (cmd, vpivci); + g_free (vpivci); + + if (g_strcmp0 (encaps, NM_SETTING_ADSL_ENCAPSULATION_LLC) == 0) + nm_cmd_line_add_string (cmd, "llc-encaps"); + else if (g_strcmp0 (encaps, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) == 0) + nm_cmd_line_add_string (cmd, "vc-encaps"); + + } else if (!strcmp (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE)) { + nm_cmd_line_add_string (cmd, "plugin"); + nm_cmd_line_add_string (cmd, "rp-pppoe.so"); + nm_cmd_line_add_string (cmd, priv->parent_iface); + } + + nm_cmd_line_add_string (cmd, "noipdefault"); } else { nm_cmd_line_add_string (cmd, priv->parent_iface); /* Don't send some random address as the local address */ @@ -924,6 +964,12 @@ pppd_child_setup (gpointer user_data G_GNUC_UNUSED) /* We are in the child process at this point */ pid_t pid = getpid (); setpgid (pid, pid); + + /* + * We blocked signals in main(). We need to restore original signal + * mask for pppd here so that it can receive signals. + */ + nm_unblock_posix_signals (NULL); } static void @@ -965,6 +1011,7 @@ nm_ppp_manager_start (NMPPPManager *manager, NMSettingPPP *s_ppp; gboolean s_ppp_created = FALSE; NMSettingPPPOE *pppoe_setting; + NMSettingAdsl *adsl_setting; NMCmdLine *ppp_cmd; char *cmd_str; struct stat st; @@ -1006,7 +1053,9 @@ nm_ppp_manager_start (NMPPPManager *manager, if (pppoe_setting) pppoe_fill_defaults (s_ppp); - ppp_cmd = create_pppd_cmd_line (manager, s_ppp, pppoe_setting, ppp_name, err); + adsl_setting = (NMSettingAdsl *) nm_connection_get_setting (connection, NM_TYPE_SETTING_ADSL); + + ppp_cmd = create_pppd_cmd_line (manager, s_ppp, pppoe_setting, adsl_setting, ppp_name, err); if (!ppp_cmd) goto out; |