diff options
Diffstat (limited to 'src/ppp-manager')
| -rw-r--r-- | src/ppp-manager/Makefile.am | 28 | ||||
| -rw-r--r-- | src/ppp-manager/Makefile.in | 835 | ||||
| -rw-r--r-- | src/ppp-manager/nm-ppp-manager.c | 1245 | ||||
| -rw-r--r-- | src/ppp-manager/nm-ppp-manager.h | 83 | ||||
| -rw-r--r-- | src/ppp-manager/nm-ppp-status.h | 43 | ||||
| -rw-r--r-- | src/ppp-manager/nm-pppd-plugin.c | 417 | ||||
| -rw-r--r-- | src/ppp-manager/nm-pppd-plugin.h | 34 |
7 files changed, 0 insertions, 2685 deletions
diff --git a/src/ppp-manager/Makefile.am b/src/ppp-manager/Makefile.am deleted file mode 100644 index 3026dab4..00000000 --- a/src/ppp-manager/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -if WITH_PPP - -AM_CPPFLAGS = \ - -I${top_srcdir}/shared \ - -I${top_builddir}/shared \ - -I${top_srcdir}/libnm-core \ - -I${top_srcdir}/src \ - -I${top_builddir}/libnm-core \ - -DG_LOG_DOMAIN=\""nm-pppd-plugin"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \ - $(GLIB_CFLAGS) - -pppd_plugindir = $(PPPD_PLUGIN_DIR) -pppd_plugin_LTLIBRARIES = nm-pppd-plugin.la - -nm_pppd_plugin_la_SOURCES = \ - nm-pppd-plugin.c \ - nm-pppd-plugin.h \ - nm-ppp-status.h - -nm_pppd_plugin_la_LDFLAGS = -module -avoid-version - -nm_pppd_plugin_la_LIBADD = \ - $(GLIB_LIBS) \ - $(DL_LIBS) \ - $(NULL) - -endif diff --git a/src/ppp-manager/Makefile.in b/src/ppp-manager/Makefile.in deleted file mode 100644 index 656bdd6c..00000000 --- a/src/ppp-manager/Makefile.in +++ /dev/null @@ -1,835 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/ppp-manager -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/ax_lib_readline.m4 \ - $(top_srcdir)/m4/compiler_options.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/git-sha-record.m4 \ - $(top_srcdir)/m4/gnome-code-coverage.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.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)/m4/vapigen.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(pppd_plugindir)" -LTLIBRARIES = $(pppd_plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -@WITH_PPP_TRUE@nm_pppd_plugin_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@WITH_PPP_TRUE@ $(am__DEPENDENCIES_1) -am__nm_pppd_plugin_la_SOURCES_DIST = nm-pppd-plugin.c nm-pppd-plugin.h \ - nm-ppp-status.h -@WITH_PPP_TRUE@am_nm_pppd_plugin_la_OBJECTS = nm-pppd-plugin.lo -nm_pppd_plugin_la_OBJECTS = $(am_nm_pppd_plugin_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -nm_pppd_plugin_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(AM_CFLAGS) $(CFLAGS) $(nm_pppd_plugin_la_LDFLAGS) $(LDFLAGS) \ - -o $@ -@WITH_PPP_TRUE@am_nm_pppd_plugin_la_rpath = -rpath $(pppd_plugindir) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(nm_pppd_plugin_la_SOURCES) -DIST_SOURCES = $(am__nm_pppd_plugin_la_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ -BLUEZ5_LIBS = @BLUEZ5_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ -DLLTOOL = @DLLTOOL@ -DL_LIBS = @DL_LIBS@ -DNSMASQ_PATH = @DNSMASQ_PATH@ -DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -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@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -IPTABLES_PATH = @IPTABLES_PATH@ -JANSSON_CFLAGS = @JANSSON_CFLAGS@ -JANSSON_LIBS = @JANSSON_LIBS@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@ -LIBAUDIT_LIBS = @LIBAUDIT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ -LIBNDP_LIBS = @LIBNDP_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ -LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ -LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ -LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LOG_DRIVER = @LOG_DRIVER@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ -MM_GLIB_LIBS = @MM_GLIB_LIBS@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NEWT_CFLAGS = @NEWT_CFLAGS@ -NEWT_LIBS = @NEWT_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ -NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ -NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ -NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PPPD_PATH = @PPPD_PATH@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -SANITIZERS = @SANITIZERS@ -SANITIZER_ENV = @SANITIZER_ENV@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ -SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@ -SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ -SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ -SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@ -SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@ -SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ -SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_DIR = @UDEV_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VALGRIND_RULES = @VALGRIND_RULES@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -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@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -nmbinary = @nmbinary@ -nmconfdir = @nmconfdir@ -nmdatadir = @nmdatadir@ -nmlibdir = @nmlibdir@ -nmrundir = @nmrundir@ -nmstatedir = @nmstatedir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_dhclient = @with_dhclient@ -with_dhcpcd = @with_dhcpcd@ -with_netconfig = @with_netconfig@ -with_resolvconf = @with_resolvconf@ -with_valgrind = @with_valgrind@ -@WITH_PPP_TRUE@AM_CPPFLAGS = \ -@WITH_PPP_TRUE@ -I${top_srcdir}/shared \ -@WITH_PPP_TRUE@ -I${top_builddir}/shared \ -@WITH_PPP_TRUE@ -I${top_srcdir}/libnm-core \ -@WITH_PPP_TRUE@ -I${top_srcdir}/src \ -@WITH_PPP_TRUE@ -I${top_builddir}/libnm-core \ -@WITH_PPP_TRUE@ -DG_LOG_DOMAIN=\""nm-pppd-plugin"\" \ -@WITH_PPP_TRUE@ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \ -@WITH_PPP_TRUE@ $(GLIB_CFLAGS) - -@WITH_PPP_TRUE@pppd_plugindir = $(PPPD_PLUGIN_DIR) -@WITH_PPP_TRUE@pppd_plugin_LTLIBRARIES = nm-pppd-plugin.la -@WITH_PPP_TRUE@nm_pppd_plugin_la_SOURCES = \ -@WITH_PPP_TRUE@ nm-pppd-plugin.c \ -@WITH_PPP_TRUE@ nm-pppd-plugin.h \ -@WITH_PPP_TRUE@ nm-ppp-status.h - -@WITH_PPP_TRUE@nm_pppd_plugin_la_LDFLAGS = -module -avoid-version -@WITH_PPP_TRUE@nm_pppd_plugin_la_LIBADD = \ -@WITH_PPP_TRUE@ $(GLIB_LIBS) \ -@WITH_PPP_TRUE@ $(DL_LIBS) \ -@WITH_PPP_TRUE@ $(NULL) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/ppp-manager/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/ppp-manager/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -install-pppd_pluginLTLIBRARIES: $(pppd_plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(pppd_plugin_LTLIBRARIES)'; test -n "$(pppd_plugindir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(pppd_plugindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pppd_plugindir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pppd_plugindir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pppd_plugindir)"; \ - } - -uninstall-pppd_pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(pppd_plugin_LTLIBRARIES)'; test -n "$(pppd_plugindir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pppd_plugindir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pppd_plugindir)/$$f"; \ - done - -clean-pppd_pluginLTLIBRARIES: - -test -z "$(pppd_plugin_LTLIBRARIES)" || rm -f $(pppd_plugin_LTLIBRARIES) - @list='$(pppd_plugin_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -nm-pppd-plugin.la: $(nm_pppd_plugin_la_OBJECTS) $(nm_pppd_plugin_la_DEPENDENCIES) $(EXTRA_nm_pppd_plugin_la_DEPENDENCIES) - $(AM_V_CCLD)$(nm_pppd_plugin_la_LINK) $(am_nm_pppd_plugin_la_rpath) $(nm_pppd_plugin_la_OBJECTS) $(nm_pppd_plugin_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-pppd-plugin.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pppd_plugindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pppd_pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-pppd_pluginLTLIBRARIES - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-pppd_pluginLTLIBRARIES - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pppd_pluginLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-pppd_pluginLTLIBRARIES install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-pppd_pluginLTLIBRARIES - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c deleted file mode 100644 index 34c550fa..00000000 --- a/src/ppp-manager/nm-ppp-manager.c +++ /dev/null @@ -1,1245 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2012 Red Hat, Inc. - */ - -#include "nm-default.h" - -#include <sys/types.h> -#include <sys/wait.h> -#include <signal.h> -#include <string.h> -#include <unistd.h> -#include <arpa/inet.h> -#include <stdlib.h> - -#include <errno.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <asm/types.h> -#include <sys/stat.h> - -#include <linux/ppp_defs.h> -#ifndef aligned_u64 -#define aligned_u64 unsigned long long __attribute__((aligned(8))) -#endif -#include <linux/if.h> -#include <linux/if_ppp.h> - -#include "NetworkManagerUtils.h" -#include "nm-ppp-manager.h" -#include "nm-platform.h" -#include "nm-core-internal.h" - -#include "nmdbus-ppp-manager.h" - -#define _NMLOG_DOMAIN LOGD_PPP -#define _NMLOG_PREFIX_NAME "ppp-manager" -#define _NMLOG(level, ...) \ - G_STMT_START { \ - nm_log ((level), _NMLOG_DOMAIN, \ - "%s" _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \ - _NMLOG_PREFIX_NAME": " \ - _NM_UTILS_MACRO_REST(__VA_ARGS__)); \ - } G_STMT_END - -static void _ppp_cleanup (NMPPPManager *manager); -static void _ppp_kill (NMPPPManager *manager); - -#define NM_PPPD_PLUGIN PPPD_PLUGIN_DIR "/nm-pppd-plugin.so" -#define PPP_MANAGER_SECRET_TRIES "ppp-manager-secret-tries" - -typedef struct { - GPid pid; - - char *parent_iface; - - NMActRequest *act_req; - GDBusMethodInvocation *pending_secrets_context; - NMActRequestGetSecretsCallId secrets_id; - const char *secrets_setting_name; - - guint ppp_watch_id; - guint ppp_timeout_handler; - - /* Monitoring */ - char *ip_iface; - int monitor_fd; - guint monitor_id; -} NMPPPManagerPrivate; - -#define NM_PPP_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_PPP_MANAGER, NMPPPManagerPrivate)) - -G_DEFINE_TYPE (NMPPPManager, nm_ppp_manager, NM_TYPE_EXPORTED_OBJECT) - -enum { - STATE_CHANGED, - IP4_CONFIG, - IP6_CONFIG, - STATS, - - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -enum { - PROP_0, - PROP_PARENT_IFACE, - LAST_PROP -}; - -static void -nm_ppp_manager_init (NMPPPManager *manager) -{ - NM_PPP_MANAGER_GET_PRIVATE (manager)->monitor_fd = -1; -} - -static void -dispose (GObject *object) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object); - - _ppp_cleanup (NM_PPP_MANAGER (object)); - _ppp_kill (NM_PPP_MANAGER (object)); - - g_clear_object (&priv->act_req); - - G_OBJECT_CLASS (nm_ppp_manager_parent_class)->dispose (object); -} - -static void -finalize (GObject *object) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object); - - g_free (priv->ip_iface); - g_free (priv->parent_iface); - - G_OBJECT_CLASS (nm_ppp_manager_parent_class)->finalize (object); -} - -static void -set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object); - - switch (prop_id) { - case PROP_PARENT_IFACE: - g_free (priv->parent_iface); - priv->parent_iface = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object); - - switch (prop_id) { - case PROP_PARENT_IFACE: - g_value_set_string (value, priv->parent_iface); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -NMPPPManager * -nm_ppp_manager_new (const char *iface) -{ - g_return_val_if_fail (iface != NULL, NULL); - - return (NMPPPManager *) g_object_new (NM_TYPE_PPP_MANAGER, - NM_PPP_MANAGER_PARENT_IFACE, iface, - NULL); -} - -/*******************************************/ - -static gboolean -monitor_cb (gpointer user_data) -{ - NMPPPManager *manager = NM_PPP_MANAGER (user_data); - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - struct ifreq req; - struct ppp_stats stats; - - memset (&req, 0, sizeof (req)); - memset (&stats, 0, sizeof (stats)); - req.ifr_data = (caddr_t) &stats; - - strncpy (req.ifr_name, priv->ip_iface, sizeof (req.ifr_name)); - if (ioctl (priv->monitor_fd, SIOCGPPPSTATS, &req) < 0) { - if (errno != ENODEV) - _LOGW ("could not read ppp stats: %s", strerror (errno)); - } else { - g_signal_emit (manager, signals[STATS], 0, - stats.p.ppp_ibytes, - stats.p.ppp_obytes); - } - - return TRUE; -} - -static void -monitor_stats (NMPPPManager *manager) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - - /* already monitoring */ - if (priv->monitor_fd >= 0) - return; - - priv->monitor_fd = socket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); - if (priv->monitor_fd >= 0) { - g_warn_if_fail (priv->monitor_id == 0); - if (priv->monitor_id) - g_source_remove (priv->monitor_id); - priv->monitor_id = g_timeout_add_seconds (5, monitor_cb, manager); - } else - _LOGW ("could not monitor PPP stats: %s", strerror (errno)); -} - -/*******************************************/ - -static void -remove_timeout_handler (NMPPPManager *manager) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - - nm_clear_g_source (&priv->ppp_timeout_handler); -} - -static void -cancel_get_secrets (NMPPPManager *self) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self); - - if (priv->secrets_id) - nm_act_request_cancel_secrets (priv->act_req, priv->secrets_id); - - g_return_if_fail (!priv->secrets_id && !priv->secrets_setting_name); -} - -static gboolean -extract_details_from_connection (NMConnection *connection, - const char *secrets_setting_name, - const char **username, - const char **password, - GError **error) -{ - NMSettingConnection *s_con; - NMSetting *setting; - const char *setting_name; - - g_return_val_if_fail (connection != NULL, FALSE); - g_return_val_if_fail (username != NULL, FALSE); - g_return_val_if_fail (password != NULL, FALSE); - - if (secrets_setting_name) - setting_name = secrets_setting_name; - else { - /* Get the setting matching the connection type */ - s_con = nm_connection_get_setting_connection (connection); - g_assert (s_con); - - setting_name = nm_setting_connection_get_connection_type (s_con); - g_assert (setting_name); - - /* In case of bluetooth connection, use GSM or CDMA setting */ - if (strcmp (setting_name, NM_SETTING_BLUETOOTH_SETTING_NAME) == 0) { - if (nm_connection_get_setting_gsm (connection)) - setting_name = NM_SETTING_GSM_SETTING_NAME; - else - setting_name = NM_SETTING_CDMA_SETTING_NAME; - } - } - - setting = nm_connection_get_setting_by_name (connection, setting_name); - if (!setting) { - /* This shouldn't ever happen */ - g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, - "Missing type-specific setting; no secrets could be found."); - return FALSE; - } - - 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)); - } else if (NM_IS_SETTING_CDMA (setting)) { - *username = nm_setting_cdma_get_username (NM_SETTING_CDMA (setting)); - *password = nm_setting_cdma_get_password (NM_SETTING_CDMA (setting)); - } - - return TRUE; -} - -static void -ppp_secrets_cb (NMActRequest *req, - NMActRequestGetSecretsCallId call_id, - NMSettingsConnection *settings_connection, /* unused (we pass NULL here) */ - GError *error, - gpointer user_data) -{ - NMPPPManager *self = NM_PPP_MANAGER (user_data); - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self); - const char *username = NULL; - const char *password = NULL; - GError *local = NULL; - NMConnection *applied_connection; - - g_return_if_fail (priv->pending_secrets_context != NULL); - g_return_if_fail (req == priv->act_req); - g_return_if_fail (call_id == priv->secrets_id); - - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - goto out; - - if (error) { - _LOGW ("%s", error->message); - g_dbus_method_invocation_return_gerror (priv->pending_secrets_context, error); - goto out; - } - - applied_connection = nm_act_request_get_applied_connection (req); - - if (!extract_details_from_connection (applied_connection, priv->secrets_setting_name, &username, &password, &local)) { - _LOGW ("%s", local->message); - g_dbus_method_invocation_take_error (priv->pending_secrets_context, local); - goto out; - } - - /* This is sort of a hack but... - * pppd plugin only ever needs username and password. Passing the full - * connection there would mean some bloat: the plugin would need to link - * against libnm just to parse this. So instead, let's just send what - * it needs. - */ - g_dbus_method_invocation_return_value ( - priv->pending_secrets_context, - g_variant_new ("(ss)", username ? username : "", password ? password : "")); - - out: - priv->pending_secrets_context = NULL; - priv->secrets_id = NULL; - priv->secrets_setting_name = NULL; -} - -static void -impl_ppp_manager_need_secrets (NMPPPManager *manager, - GDBusMethodInvocation *context) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - NMConnection *applied_connection; - const char *username = NULL; - const char *password = NULL; - guint32 tries; - GPtrArray *hints = NULL; - GError *error = NULL; - NMSecretAgentGetSecretsFlags flags = NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION; - - nm_active_connection_clear_secrets (NM_ACTIVE_CONNECTION (priv->act_req)); - - applied_connection = nm_act_request_get_applied_connection (priv->act_req); - - priv->secrets_setting_name = nm_connection_need_secrets (applied_connection, &hints); - if (!priv->secrets_setting_name) { - /* Use existing secrets from the connection */ - if (extract_details_from_connection (applied_connection, NULL, &username, &password, &error)) { - /* Send existing secrets to the PPP plugin */ - priv->pending_secrets_context = context; - ppp_secrets_cb (priv->act_req, priv->secrets_id, NULL, NULL, manager); - } else { - _LOGW ("%s", error->message); - g_dbus_method_invocation_take_error (priv->pending_secrets_context, error); - } - return; - } - - /* Only ask for completely new secrets after retrying them once; some devices - * appear to ask a few times when they actually don't even care what you - * pass back. - */ - tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (applied_connection), PPP_MANAGER_SECRET_TRIES)); - if (tries > 1) - flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW; - - priv->secrets_id = nm_act_request_get_secrets (priv->act_req, - priv->secrets_setting_name, - flags, - hints ? g_ptr_array_index (hints, 0) : NULL, - ppp_secrets_cb, - manager); - g_object_set_data (G_OBJECT (applied_connection), PPP_MANAGER_SECRET_TRIES, GUINT_TO_POINTER (++tries)); - priv->pending_secrets_context = context; - - if (hints) - g_ptr_array_free (hints, TRUE); -} - -static void -impl_ppp_manager_set_state (NMPPPManager *manager, - GDBusMethodInvocation *context, - guint32 state) -{ - g_signal_emit (manager, signals[STATE_CHANGED], 0, state); - - g_dbus_method_invocation_return_value (context, NULL); -} - -static gboolean -set_ip_config_common (NMPPPManager *self, - GVariant *config_dict, - const char *iface_prop, - guint32 *out_mtu) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self); - NMConnection *applied_connection; - NMSettingPpp *s_ppp; - const char *iface; - - if (!g_variant_lookup (config_dict, iface_prop, "&s", &iface)) { - _LOGE ("no interface received!"); - return FALSE; - } - if (priv->ip_iface == NULL) - priv->ip_iface = g_strdup (iface); - - /* Got successful IP config; obviously the secrets worked */ - applied_connection = nm_act_request_get_applied_connection (priv->act_req); - g_object_set_data (G_OBJECT (applied_connection), PPP_MANAGER_SECRET_TRIES, NULL); - - if (out_mtu) { - /* Get any custom MTU */ - s_ppp = nm_connection_get_setting_ppp (applied_connection); - *out_mtu = s_ppp ? nm_setting_ppp_get_mtu (s_ppp) : 0; - } - - monitor_stats (self); - return TRUE; -} - -static void -impl_ppp_manager_set_ip4_config (NMPPPManager *manager, - GDBusMethodInvocation *context, - GVariant *config_dict) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - NMIP4Config *config; - NMPlatformIP4Address address; - guint32 u32; - GVariantIter *iter; - - _LOGI ("(IPv4 Config Get) reply received."); - - remove_timeout_handler (manager); - - config = nm_ip4_config_new (nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface)); - - memset (&address, 0, sizeof (address)); - address.plen = 32; - - if (g_variant_lookup (config_dict, NM_PPP_IP4_CONFIG_ADDRESS, "u", &u32)) - address.address = u32; - - if (g_variant_lookup (config_dict, NM_PPP_IP4_CONFIG_GATEWAY, "u", &u32)) { - nm_ip4_config_set_gateway (config, u32); - address.peer_address = u32; - } else - address.peer_address = address.address; - - if (g_variant_lookup (config_dict, NM_PPP_IP4_CONFIG_PREFIX, "u", &u32)) - address.plen = u32; - - if (address.address && address.plen && address.plen <= 32) { - address.addr_source = NM_IP_CONFIG_SOURCE_PPP; - nm_ip4_config_add_address (config, &address); - } else { - _LOGE ("invalid IPv4 address received!"); - goto out; - } - - if (g_variant_lookup (config_dict, NM_PPP_IP4_CONFIG_DNS, "au", &iter)) { - while (g_variant_iter_next (iter, "u", &u32)) - nm_ip4_config_add_nameserver (config, u32); - g_variant_iter_free (iter); - } - - if (g_variant_lookup (config_dict, NM_PPP_IP4_CONFIG_WINS, "au", &iter)) { - while (g_variant_iter_next (iter, "u", &u32)) - nm_ip4_config_add_wins (config, u32); - g_variant_iter_free (iter); - } - - if (!set_ip_config_common (manager, config_dict, NM_PPP_IP4_CONFIG_INTERFACE, &u32)) - goto out; - - if (u32) - nm_ip4_config_set_mtu (config, u32, NM_IP_CONFIG_SOURCE_PPP); - - /* Push the IP4 config up to the device */ - g_signal_emit (manager, signals[IP4_CONFIG], 0, priv->ip_iface, config); - -out: - g_object_unref (config); - g_dbus_method_invocation_return_value (context, NULL); -} - -/* Converts the named Interface Identifier item to an IPv6 LL address and - * returns the IID. - */ -static gboolean -iid_value_to_ll6_addr (GVariant *dict, - const char *prop, - struct in6_addr *out_addr, - NMUtilsIPv6IfaceId *out_iid) -{ - guint64 iid; - - if (!g_variant_lookup (dict, prop, "t", &iid)) { - _LOGD ("pppd plugin property '%s' missing or not a uint64", prop); - return FALSE; - } - g_return_val_if_fail (iid != 0, FALSE); - - /* Construct an IPv6 LL address from the interface identifier. See - * http://tools.ietf.org/html/rfc4291#section-2.5.1 (IPv6) and - * http://tools.ietf.org/html/rfc5072#section-4.1 (IPv6 over PPP). - */ - memset (out_addr->s6_addr, 0, sizeof (out_addr->s6_addr)); - out_addr->s6_addr16[0] = htons (0xfe80); - memcpy (out_addr->s6_addr + 8, &iid, sizeof (iid)); - if (out_iid) - nm_utils_ipv6_interface_identifier_get_from_addr (out_iid, out_addr); - return TRUE; -} - -static void -impl_ppp_manager_set_ip6_config (NMPPPManager *manager, - GDBusMethodInvocation *context, - GVariant *config_dict) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - NMIP6Config *config; - NMPlatformIP6Address addr; - struct in6_addr a; - NMUtilsIPv6IfaceId iid = NM_UTILS_IPV6_IFACE_ID_INIT; - gboolean has_peer = FALSE; - - _LOGI ("(IPv6 Config Get) reply received."); - - remove_timeout_handler (manager); - - config = nm_ip6_config_new (nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface)); - - memset (&addr, 0, sizeof (addr)); - addr.plen = 64; - - if (iid_value_to_ll6_addr (config_dict, NM_PPP_IP6_CONFIG_PEER_IID, &a, NULL)) { - nm_ip6_config_set_gateway (config, &a); - addr.peer_address = a; - has_peer = TRUE; - } - - if (iid_value_to_ll6_addr (config_dict, NM_PPP_IP6_CONFIG_OUR_IID, &addr.address, &iid)) { - if (!has_peer) - addr.peer_address = addr.address; - nm_ip6_config_add_address (config, &addr); - - if (set_ip_config_common (manager, config_dict, NM_PPP_IP6_CONFIG_INTERFACE, NULL)) { - /* Push the IPv6 config and interface identifier up to the device */ - g_signal_emit (manager, signals[IP6_CONFIG], 0, priv->ip_iface, &iid, config); - } - } else - _LOGE ("invalid IPv6 address received!"); - - g_object_unref (config); - g_dbus_method_invocation_return_value (context, NULL); -} - -static void -nm_ppp_manager_class_init (NMPPPManagerClass *manager_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (manager_class); - NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (manager_class); - - g_type_class_add_private (manager_class, sizeof (NMPPPManagerPrivate)); - - exported_object_class->export_path = NM_DBUS_PATH "/PPP/%u"; - exported_object_class->export_on_construction = TRUE; - - object_class->dispose = dispose; - object_class->finalize = finalize; - object_class->get_property = get_property; - object_class->set_property = set_property; - - /* Properties */ - g_object_class_install_property - (object_class, PROP_PARENT_IFACE, - g_param_spec_string (NM_PPP_MANAGER_PARENT_IFACE, "", "", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - /* signals */ - signals[STATE_CHANGED] = - g_signal_new (NM_PPP_MANAGER_STATE_CHANGED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, state_changed), - NULL, NULL, NULL, - G_TYPE_NONE, 1, - G_TYPE_UINT); - - signals[IP4_CONFIG] = - g_signal_new ("ip4-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, ip4_config), - NULL, NULL, NULL, - G_TYPE_NONE, 2, - G_TYPE_STRING, - G_TYPE_OBJECT); - - signals[IP6_CONFIG] = - g_signal_new ("ip6-config", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, ip6_config), - NULL, NULL, NULL, - G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_OBJECT); - - signals[STATS] = - g_signal_new ("stats", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMPPPManagerClass, stats), - NULL, NULL, NULL, - G_TYPE_NONE, 2, - G_TYPE_UINT, G_TYPE_UINT); - - nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class), - NMDBUS_TYPE_PPP_MANAGER_SKELETON, - "NeedSecrets", impl_ppp_manager_need_secrets, - "SetIp4Config", impl_ppp_manager_set_ip4_config, - "SetIp6Config", impl_ppp_manager_set_ip6_config, - "SetState", impl_ppp_manager_set_state, - NULL); -} - -/*******************************************/ - - - -typedef struct { - GPtrArray *array; - GStringChunk *chunk; -} NMCmdLine; - -static NMCmdLine * -nm_cmd_line_new (void) -{ - NMCmdLine *cmd; - - cmd = g_slice_new (NMCmdLine); - cmd->array = g_ptr_array_new (); - cmd->chunk = g_string_chunk_new (1024); - - return cmd; -} - -static void -nm_cmd_line_destroy (NMCmdLine *cmd) -{ - g_ptr_array_free (cmd->array, TRUE); - g_string_chunk_free (cmd->chunk); - g_slice_free (NMCmdLine, cmd); -} - -static char * -nm_cmd_line_to_str (NMCmdLine *cmd) -{ - char *str; - - g_ptr_array_add (cmd->array, NULL); - str = g_strjoinv (" ", (gchar **) cmd->array->pdata); - g_ptr_array_remove_index (cmd->array, cmd->array->len - 1); - - return str; -} - -static void -nm_cmd_line_add_string (NMCmdLine *cmd, const char *str) -{ - g_ptr_array_add (cmd->array, g_string_chunk_insert (cmd->chunk, str)); -} - -static void -nm_cmd_line_add_int (NMCmdLine *cmd, int i) -{ - char *str; - - str = g_strdup_printf ("%d", i); - nm_cmd_line_add_string (cmd, str); - g_free (str); -} - -/*******************************************/ - -static void -ppp_exit_code (guint pppd_exit_status, GPid pid) -{ - const char *msg; - - switch (pppd_exit_status) { - case 1: - msg = "Fatal pppd error"; - break; - case 2: - msg = "pppd options error"; - break; - case 3: - msg = "No root priv error"; - break; - case 4: - msg = "No ppp module error"; - break; - case 5: - msg = "pppd received a signal"; - break; - case 6: - msg = "Serial port lock failed"; - break; - case 7: - msg = "Serial port open failed"; - break; - case 8: - msg = "Connect script failed"; - break; - case 9: - msg = "Pty program error"; - break; - case 10: - msg = "PPP negotiation failed"; - break; - case 11: - msg = "Peer didn't authenticatie itself"; - break; - case 12: - msg = "Link idle: Idle Seconds reached."; - break; - case 13: - msg = "Connect time limit reached."; - break; - case 14: - msg = "Callback negotiated, call should come back."; - break; - case 15: - msg = "Lack of LCP echo responses"; - break; - case 16: - msg = "A modem hung up the phone"; - break; - case 17: - msg = "Loopback detected"; - break; - case 18: - msg = "The init script failed"; - break; - case 19: - msg = "Authentication error.\n" - "We failed to authenticate ourselves to the peer.\n" - "Maybe bad account or password?"; - break; - default: - msg = "Unknown error"; - } - - _LOGW ("pppd pid %d exited with error: %s", pid, msg); -} - -static void -ppp_watch_cb (GPid pid, gint status, gpointer user_data) -{ - NMPPPManager *manager = NM_PPP_MANAGER (user_data); - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - guint err; - - g_assert (pid == priv->pid); - - if (WIFEXITED (status)) { - err = WEXITSTATUS (status); - if (err != 0) - ppp_exit_code (err, priv->pid); - } else if (WIFSTOPPED (status)) { - _LOGI ("pppd pid %d stopped unexpectedly with signal %d", priv->pid, WSTOPSIG (status)); - } else if (WIFSIGNALED (status)) { - _LOGI ("pppd pid %d died with signal %d", priv->pid, WTERMSIG (status)); - } else - _LOGI ("pppd pid %d died from an unknown cause", priv->pid); - - _LOGD ("pppd pid %d cleaned up", priv->pid); - priv->pid = 0; - priv->ppp_watch_id = 0; - g_signal_emit (manager, signals[STATE_CHANGED], 0, NM_PPP_STATUS_DEAD); -} - -static gboolean -pppd_timed_out (gpointer data) -{ - NMPPPManager *manager = NM_PPP_MANAGER (data); - - _LOGW ("pppd timed out or didn't initialize our dbus module"); - _ppp_cleanup (manager); - _ppp_kill (manager); - - g_signal_emit (manager, signals[STATE_CHANGED], 0, NM_PPP_STATUS_DEAD); - - return FALSE; -} - -static NMCmdLine * -create_pppd_cmd_line (NMPPPManager *self, - NMSettingPpp *setting, - NMSettingPppoe *pppoe, - NMSettingAdsl *adsl, - const char *ppp_name, - guint baud_override, - GError **err) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self); - const char *pppd_binary = NULL; - NMCmdLine *cmd; - gboolean ppp_debug; - - g_return_val_if_fail (setting != NULL, NULL); - - pppd_binary = nm_utils_find_helper ("pppd", NULL, err); - if (!pppd_binary) - return NULL; - - /* Create pppd command line */ - cmd = nm_cmd_line_new (); - nm_cmd_line_add_string (cmd, pppd_binary); - - nm_cmd_line_add_string (cmd, "nodetach"); - nm_cmd_line_add_string (cmd, "lock"); - - /* 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_enabled (LOGL_DEBUG, LOGD_PPP)) - ppp_debug = TRUE; - - if (ppp_debug) - nm_cmd_line_add_string (cmd, "debug"); - - if (ppp_name) { - nm_cmd_line_add_string (cmd, "user"); - nm_cmd_line_add_string (cmd, ppp_name); - } - - if (pppoe) { - char *dev_str; - const char *pppoe_service; - - nm_cmd_line_add_string (cmd, "plugin"); - nm_cmd_line_add_string (cmd, "rp-pppoe.so"); - - dev_str = g_strdup_printf ("nic-%s", priv->parent_iface); - nm_cmd_line_add_string (cmd, dev_str); - g_free (dev_str); - - pppoe_service = nm_setting_pppoe_get_service (pppoe); - if (pppoe_service) { - 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 */ - nm_cmd_line_add_string (cmd, "noipdefault"); - } - - if (nm_setting_ppp_get_baud (setting)) - nm_cmd_line_add_int (cmd, nm_setting_ppp_get_baud (setting)); - else if (baud_override) - nm_cmd_line_add_int (cmd, (int) baud_override); - - /* noauth by default, because we certainly don't have any information - * with which to verify anything the peer gives us if we ask it to - * authenticate itself, which is what 'auth' really means. - */ - nm_cmd_line_add_string (cmd, "noauth"); - - if (nm_setting_ppp_get_refuse_eap (setting)) - nm_cmd_line_add_string (cmd, "refuse-eap"); - if (nm_setting_ppp_get_refuse_pap (setting)) - nm_cmd_line_add_string (cmd, "refuse-pap"); - if (nm_setting_ppp_get_refuse_chap (setting)) - nm_cmd_line_add_string (cmd, "refuse-chap"); - if (nm_setting_ppp_get_refuse_mschap (setting)) - nm_cmd_line_add_string (cmd, "refuse-mschap"); - if (nm_setting_ppp_get_refuse_mschapv2 (setting)) - nm_cmd_line_add_string (cmd, "refuse-mschap-v2"); - if (nm_setting_ppp_get_nobsdcomp (setting)) - nm_cmd_line_add_string (cmd, "nobsdcomp"); - if (nm_setting_ppp_get_no_vj_comp (setting)) - nm_cmd_line_add_string (cmd, "novj"); - if (nm_setting_ppp_get_nodeflate (setting)) - nm_cmd_line_add_string (cmd, "nodeflate"); - if (nm_setting_ppp_get_require_mppe (setting)) - nm_cmd_line_add_string (cmd, "require-mppe"); - if (nm_setting_ppp_get_require_mppe_128 (setting)) - nm_cmd_line_add_string (cmd, "require-mppe-128"); - if (nm_setting_ppp_get_mppe_stateful (setting)) - nm_cmd_line_add_string (cmd, "mppe-stateful"); - if (nm_setting_ppp_get_crtscts (setting)) - nm_cmd_line_add_string (cmd, "crtscts"); - - /* Always ask for DNS, we don't have to use them if the connection - * overrides the returned servers. - */ - nm_cmd_line_add_string (cmd, "usepeerdns"); - - if (nm_setting_ppp_get_mru (setting)) { - nm_cmd_line_add_string (cmd, "mru"); - nm_cmd_line_add_int (cmd, nm_setting_ppp_get_mru (setting)); - } - - if (nm_setting_ppp_get_mtu (setting)) { - nm_cmd_line_add_string (cmd, "mtu"); - nm_cmd_line_add_int (cmd, nm_setting_ppp_get_mtu (setting)); - } - - nm_cmd_line_add_string (cmd, "lcp-echo-failure"); - nm_cmd_line_add_int (cmd, nm_setting_ppp_get_lcp_echo_failure (setting)); - - nm_cmd_line_add_string (cmd, "lcp-echo-interval"); - nm_cmd_line_add_int (cmd, nm_setting_ppp_get_lcp_echo_interval (setting)); - - /* Avoid pppd to exit if no traffic going through */ - nm_cmd_line_add_string (cmd, "idle"); - nm_cmd_line_add_int (cmd, 0); - - nm_cmd_line_add_string (cmd, "ipparam"); - nm_cmd_line_add_string (cmd, nm_exported_object_get_path (NM_EXPORTED_OBJECT (self))); - - nm_cmd_line_add_string (cmd, "plugin"); - nm_cmd_line_add_string (cmd, NM_PPPD_PLUGIN); - - return cmd; -} - -static void -pppoe_fill_defaults (NMSettingPpp *setting) -{ - if (!nm_setting_ppp_get_mtu (setting)) - g_object_set (setting, NM_SETTING_PPP_MTU, (guint32) 1492, NULL); - - if (!nm_setting_ppp_get_mru (setting)) - g_object_set (setting, NM_SETTING_PPP_MRU, (guint32) 1492, NULL); - - g_object_set (setting, - NM_SETTING_PPP_NOAUTH, TRUE, - NM_SETTING_PPP_NODEFLATE, TRUE, - NULL); - - /* FIXME: These commented settings should be set as well, update NMSettingPpp first. */ -#if 0 - setting->noipdefault = TRUE; - setting->default_asyncmap = TRUE; - setting->defaultroute = TRUE; - setting->hide_password = TRUE; - setting->noaccomp = TRUE; - setting->nopcomp = TRUE; - setting->novj = TRUE; - setting->novjccomp = TRUE; -#endif -} - -gboolean -nm_ppp_manager_start (NMPPPManager *manager, - NMActRequest *req, - const char *ppp_name, - guint32 timeout_secs, - guint baud_override, - GError **err) -{ - NMPPPManagerPrivate *priv; - NMConnection *connection; - NMSettingPpp *s_ppp; - gs_unref_object NMSettingPpp *s_ppp_free = NULL; - NMSettingPppoe *pppoe_setting; - NMSettingAdsl *adsl_setting; - NMCmdLine *ppp_cmd; - char *cmd_str; - struct stat st; - - g_return_val_if_fail (NM_IS_PPP_MANAGER (manager), FALSE); - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); - - priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - -#if !WITH_PPP - /* PPP support disabled */ - g_set_error_literal (err, - NM_MANAGER_ERROR, - NM_MANAGER_ERROR_FAILED, - "PPP support is not enabled."); - return FALSE; -#endif - - priv->pid = 0; - - /* Make sure /dev/ppp exists (bgo #533064) */ - if (stat ("/dev/ppp", &st) || !S_ISCHR (st.st_mode)) - nm_utils_modprobe (NULL, FALSE, "ppp_generic", NULL); - - connection = nm_act_request_get_applied_connection (req); - g_return_val_if_fail (connection, FALSE); - - s_ppp = nm_connection_get_setting_ppp (connection); - if (!s_ppp) { - /* If the PPP settings are all default we may not have a PPP setting yet, - * so just make a default one here. - */ - s_ppp = s_ppp_free = NM_SETTING_PPP (nm_setting_ppp_new ()); - } - - pppoe_setting = nm_connection_get_setting_pppoe (connection); - if (pppoe_setting) { - /* We can't modify the applied connection's setting, make a copy */ - if (!s_ppp_free) - s_ppp = s_ppp_free = NM_SETTING_PPP (nm_setting_duplicate ((NMSetting *) s_ppp)); - pppoe_fill_defaults (s_ppp); - } - - 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, baud_override, err); - if (!ppp_cmd) - goto out; - - g_ptr_array_add (ppp_cmd->array, NULL); - - _LOGI ("starting PPP connection"); - - cmd_str = nm_cmd_line_to_str (ppp_cmd); - _LOGD ("command line: %s", cmd_str); - g_free (cmd_str); - - priv->pid = 0; - if (!g_spawn_async (NULL, (char **) ppp_cmd->array->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD, - nm_utils_setpgid, NULL, - &priv->pid, err)) { - goto out; - } - - _LOGI ("pppd started with pid %d", priv->pid); - - priv->ppp_watch_id = g_child_watch_add (priv->pid, (GChildWatchFunc) ppp_watch_cb, manager); - priv->ppp_timeout_handler = g_timeout_add_seconds (timeout_secs, pppd_timed_out, manager); - priv->act_req = g_object_ref (req); - -out: - if (ppp_cmd) - nm_cmd_line_destroy (ppp_cmd); - - return priv->pid > 0; -} - -static void -_ppp_kill (NMPPPManager *manager) -{ - NMPPPManagerPrivate *priv; - - g_return_if_fail (NM_IS_PPP_MANAGER (manager)); - - priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - - if (priv->pid) { - nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_PPP, "pppd", 2000, NULL, NULL); - priv->pid = 0; - } -} - -static void -_ppp_cleanup (NMPPPManager *manager) -{ - NMPPPManagerPrivate *priv; - - g_return_if_fail (NM_IS_PPP_MANAGER (manager)); - - priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - - cancel_get_secrets (manager); - - nm_clear_g_source (&priv->monitor_id); - - if (priv->monitor_fd >= 0) { - /* Get the stats one last time */ - monitor_cb (manager); - close (priv->monitor_fd); - priv->monitor_fd = -1; - } - - nm_clear_g_source (&priv->ppp_timeout_handler); - nm_clear_g_source (&priv->ppp_watch_id); -} - -/***********************************************************/ - -typedef struct { - NMPPPManager *manager; - GSimpleAsyncResult *result; - GCancellable *cancellable; -} StopContext; - -static void -stop_context_complete (StopContext *ctx) -{ - if (ctx->cancellable) - g_object_unref (ctx->cancellable); - g_simple_async_result_complete_in_idle (ctx->result); - g_object_unref (ctx->result); - g_object_unref (ctx->manager); - g_slice_free (StopContext, ctx); -} - -static gboolean -stop_context_complete_if_cancelled (StopContext *ctx) -{ - GError *error = NULL; - - if (g_cancellable_set_error_if_cancelled (ctx->cancellable, &error)) { - g_simple_async_result_take_error (ctx->result, error); - stop_context_complete (ctx); - return TRUE; - } - return FALSE; -} - -gboolean -nm_ppp_manager_stop_finish (NMPPPManager *manager, - GAsyncResult *res, - GError **error) -{ - return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); -} - -static void -kill_child_ready (pid_t pid, - gboolean success, - int child_status, - StopContext *ctx) -{ - if (stop_context_complete_if_cancelled (ctx)) - return; - stop_context_complete (ctx); -} - -void -nm_ppp_manager_stop (NMPPPManager *manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager); - StopContext *ctx; - - ctx = g_slice_new0 (StopContext); - ctx->manager = g_object_ref (manager); - ctx->result = g_simple_async_result_new (G_OBJECT (manager), - callback, - user_data, - nm_ppp_manager_stop); - - /* Setup cancellable */ - ctx->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - if (stop_context_complete_if_cancelled (ctx)) - return; - - /* Cleanup internals */ - _ppp_cleanup (manager); - - /* If no pppd running, we're done */ - if (!priv->pid) { - stop_context_complete (ctx); - return; - } - - /* No cancellable operation, so just wait until it returns always */ - nm_utils_kill_child_async (priv->pid, - SIGTERM, - LOGD_PPP, - "pppd", - 2000, - (NMUtilsKillChildAsyncCb) kill_child_ready, - ctx); - priv->pid = 0; -} diff --git a/src/ppp-manager/nm-ppp-manager.h b/src/ppp-manager/nm-ppp-manager.h deleted file mode 100644 index 9a8b13dc..00000000 --- a/src/ppp-manager/nm-ppp-manager.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2010 Red Hat, Inc. - */ - -#ifndef __NETWORKMANAGER_PPP_MANAGER_H__ -#define __NETWORKMANAGER_PPP_MANAGER_H__ - - -#include "nm-exported-object.h" -#include "nm-ppp-status.h" -#include "nm-activation-request.h" -#include "nm-connection.h" -#include "nm-ip4-config.h" -#include "nm-ip6-config.h" -#include "nm-pppd-plugin.h" -#include "NetworkManagerUtils.h" - -#define NM_TYPE_PPP_MANAGER (nm_ppp_manager_get_type ()) -#define NM_PPP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_PPP_MANAGER, NMPPPManager)) -#define NM_PPP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_PPP_MANAGER, NMPPPManagerClass)) -#define NM_IS_PPP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_PPP_MANAGER)) -#define NM_IS_PPP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_PPP_MANAGER)) -#define NM_PPP_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_PPP_MANAGER, NMPPPManagerClass)) - -#define NM_PPP_MANAGER_PARENT_IFACE "parent-iface" - -/* signals */ -#define NM_PPP_MANAGER_STATE_CHANGED "state-changed" - -typedef struct { - NMExportedObject parent; -} NMPPPManager; - -typedef struct { - NMExportedObjectClass parent; - - /* Signals */ - void (*state_changed) (NMPPPManager *manager, NMPPPStatus status); - void (*ip4_config) (NMPPPManager *manager, const char *iface, NMIP4Config *config); - void (*ip6_config) (NMPPPManager *manager, - const char *iface, - const NMUtilsIPv6IfaceId *iid, - NMIP6Config *config); - void (*stats) (NMPPPManager *manager, guint32 in_bytes, guint32 out_bytes); -} NMPPPManagerClass; - -GType nm_ppp_manager_get_type (void); - -NMPPPManager *nm_ppp_manager_new (const char *iface); - -gboolean nm_ppp_manager_start (NMPPPManager *manager, - NMActRequest *req, - const char *ppp_name, - guint32 timeout_secs, - guint baud_override, - GError **err); - -void nm_ppp_manager_stop (NMPPPManager *manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean nm_ppp_manager_stop_finish (NMPPPManager *manager, - GAsyncResult *res, - GError **error); - -#endif /* __NETWORKMANAGER_PPP_MANAGER_H__ */ diff --git a/src/ppp-manager/nm-ppp-status.h b/src/ppp-manager/nm-ppp-status.h deleted file mode 100644 index 391b5aa9..00000000 --- a/src/ppp-manager/nm-ppp-status.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 Red Hat, Inc. - */ - -#ifndef __NETWORKMANAGER_PPP_STATUS_H__ -#define __NETWORKMANAGER_PPP_STATUS_H__ - -typedef enum { - NM_PPP_STATUS_UNKNOWN, - - NM_PPP_STATUS_DEAD, - NM_PPP_STATUS_INITIALIZE, - NM_PPP_STATUS_SERIALCONN, - NM_PPP_STATUS_DORMANT, - NM_PPP_STATUS_ESTABLISH, - NM_PPP_STATUS_AUTHENTICATE, - NM_PPP_STATUS_CALLBACK, - NM_PPP_STATUS_NETWORK, - NM_PPP_STATUS_RUNNING, - NM_PPP_STATUS_TERMINATE, - NM_PPP_STATUS_DISCONNECT, - NM_PPP_STATUS_HOLDOFF, - NM_PPP_STATUS_MASTER -} NMPPPStatus; - -#endif /* __NETWORKMANAGER_PPP_STATUS_H__ */ diff --git a/src/ppp-manager/nm-pppd-plugin.c b/src/ppp-manager/nm-pppd-plugin.c deleted file mode 100644 index 9c47c339..00000000 --- a/src/ppp-manager/nm-pppd-plugin.c +++ /dev/null @@ -1,417 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 Red Hat, Inc. - */ - -#include <config.h> -#define ___CONFIG_H__ - -#include <string.h> -#include <pppd/pppd.h> -#include <pppd/fsm.h> -#include <pppd/ipcp.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <dlfcn.h> - -#define INET6 -#include <pppd/eui64.h> -#include <pppd/ipv6cp.h> - -#include "nm-default.h" -#include "nm-dbus-interface.h" -#include "nm-pppd-plugin.h" -#include "nm-ppp-status.h" - -int plugin_init (void); - -char pppd_version[] = VERSION; - -static GDBusProxy *proxy = NULL; - -static void -nm_phasechange (void *data, int arg) -{ - NMPPPStatus ppp_status = NM_PPP_STATUS_UNKNOWN; - char *ppp_phase; - - g_return_if_fail (G_IS_DBUS_PROXY (proxy)); - - switch (arg) { - case PHASE_DEAD: - ppp_status = NM_PPP_STATUS_DEAD; - ppp_phase = "dead"; - break; - case PHASE_INITIALIZE: - ppp_status = NM_PPP_STATUS_INITIALIZE; - ppp_phase = "initialize"; - break; - case PHASE_SERIALCONN: - ppp_status = NM_PPP_STATUS_SERIALCONN; - ppp_phase = "serial connection"; - break; - case PHASE_DORMANT: - ppp_status = NM_PPP_STATUS_DORMANT; - ppp_phase = "dormant"; - break; - case PHASE_ESTABLISH: - ppp_status = NM_PPP_STATUS_ESTABLISH; - ppp_phase = "establish"; - break; - case PHASE_AUTHENTICATE: - ppp_status = NM_PPP_STATUS_AUTHENTICATE; - ppp_phase = "authenticate"; - break; - case PHASE_CALLBACK: - ppp_status = NM_PPP_STATUS_CALLBACK; - ppp_phase = "callback"; - break; - case PHASE_NETWORK: - ppp_status = NM_PPP_STATUS_NETWORK; - ppp_phase = "network"; - break; - case PHASE_RUNNING: - ppp_status = NM_PPP_STATUS_RUNNING; - ppp_phase = "running"; - break; - case PHASE_TERMINATE: - ppp_status = NM_PPP_STATUS_TERMINATE; - ppp_phase = "terminate"; - break; - case PHASE_DISCONNECT: - ppp_status = NM_PPP_STATUS_DISCONNECT; - ppp_phase = "disconnect"; - break; - case PHASE_HOLDOFF: - ppp_status = NM_PPP_STATUS_HOLDOFF; - ppp_phase = "holdoff"; - break; - case PHASE_MASTER: - ppp_status = NM_PPP_STATUS_MASTER; - ppp_phase = "master"; - break; - - default: - ppp_phase = "unknown"; - break; - } - - g_message ("nm-ppp-plugin: (%s): status %d / phase '%s'", - __func__, - ppp_status, - ppp_phase); - - if (ppp_status != NM_PPP_STATUS_UNKNOWN) { - g_dbus_proxy_call (proxy, - "SetState", - g_variant_new ("(u)", ppp_status), - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, - NULL, NULL); - } -} - -static void -nm_ip_up (void *data, int arg) -{ - ipcp_options opts = ipcp_gotoptions[0]; - ipcp_options peer_opts = ipcp_hisoptions[0]; - GVariantBuilder builder; - guint32 pppd_made_up_address = htonl (0x0a404040 + ifunit); - - g_return_if_fail (G_IS_DBUS_PROXY (proxy)); - - g_message ("nm-ppp-plugin: (%s): ip-up event", __func__); - - if (!opts.ouraddr) { - g_warning ("nm-ppp-plugin: (%s): didn't receive an internal IP from pppd!", __func__); - nm_phasechange (NULL, PHASE_DEAD); - return; - } - - g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); - - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_INTERFACE, - g_variant_new_string (ifname)); - - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_ADDRESS, - g_variant_new_uint32 (opts.ouraddr)); - - /* Prefer the peer options remote address first, _unless_ pppd made the - * address up, at which point prefer the local options remote address, - * and if that's not right, use the made-up address as a last resort. - */ - if (peer_opts.hisaddr && (peer_opts.hisaddr != pppd_made_up_address)) { - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_GATEWAY, - g_variant_new_uint32 (peer_opts.hisaddr)); - } else if (opts.hisaddr) { - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_GATEWAY, - g_variant_new_uint32 (opts.hisaddr)); - } else if (peer_opts.hisaddr == pppd_made_up_address) { - /* As a last resort, use the made-up address */ - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_GATEWAY, - g_variant_new_uint32 (peer_opts.ouraddr)); - } - - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_PREFIX, - g_variant_new_uint32 (32)); - - if (opts.dnsaddr[0] || opts.dnsaddr[1]) { - guint32 dns[2]; - int len = 0; - - if (opts.dnsaddr[0]) - dns[len++] = opts.dnsaddr[0]; - if (opts.dnsaddr[1]) - dns[len++] = opts.dnsaddr[1]; - - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_DNS, - g_variant_new_fixed_array (G_VARIANT_TYPE_UINT32, - dns, len, sizeof (guint32))); - } - - if (opts.winsaddr[0] || opts.winsaddr[1]) { - guint32 wins[2]; - int len = 0; - - if (opts.winsaddr[0]) - wins[len++] = opts.winsaddr[0]; - if (opts.winsaddr[1]) - wins[len++] = opts.winsaddr[1]; - - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP4_CONFIG_WINS, - g_variant_new_fixed_array (G_VARIANT_TYPE_UINT32, - wins, len, sizeof (guint32))); - } - - g_message ("nm-ppp-plugin: (%s): sending IPv4 config to NetworkManager...", __func__); - - g_dbus_proxy_call (proxy, - "SetIp4Config", - g_variant_new ("(a{sv})", &builder), - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, - NULL, NULL); -} - -static GVariant * -eui64_to_variant (eui64_t eui) -{ - guint64 iid; - - G_STATIC_ASSERT (sizeof (iid) == sizeof (eui)); - - memcpy (&iid, &eui, sizeof (eui)); - return g_variant_new_uint64 (iid); -} - -static void -nm_ip6_up (void *data, int arg) -{ - ipv6cp_options *ho = &ipv6cp_hisoptions[0]; - ipv6cp_options *go = &ipv6cp_gotoptions[0]; - GVariantBuilder builder; - - g_return_if_fail (G_IS_DBUS_PROXY (proxy)); - - g_message ("nm-ppp-plugin: (%s): ip6-up event", __func__); - - g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT); - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP6_CONFIG_INTERFACE, - g_variant_new_string (ifname)); - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP6_CONFIG_OUR_IID, - eui64_to_variant (go->ourid)); - g_variant_builder_add (&builder, "{sv}", - NM_PPP_IP6_CONFIG_PEER_IID, - eui64_to_variant (ho->hisid)); - - /* DNS is done via DHCPv6 or router advertisements */ - - g_message ("nm-ppp-plugin: (%s): sending IPv6 config to NetworkManager...", __func__); - - g_dbus_proxy_call (proxy, - "SetIp6Config", - g_variant_new ("(a{sv})", &builder), - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, - NULL, NULL); -} - -static int -get_chap_check (void) -{ - return 1; -} - -static int -get_pap_check (void) -{ - return 1; -} - -static int -get_credentials (char *username, char *password) -{ - const char *my_username = NULL; - const char *my_password = NULL; - size_t len; - GVariant *ret; - GError *err = NULL; - - if (!password) { - /* pppd is checking pap support; return 1 for supported */ - g_return_val_if_fail (username, -1); - return 1; - } - - g_return_val_if_fail (username, -1); - g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), -1); - - g_message ("nm-ppp-plugin: (%s): passwd-hook, requesting credentials...", __func__); - - ret = g_dbus_proxy_call_sync (proxy, - "NeedSecrets", - NULL, - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, &err); - if (!ret) { - g_warning ("nm-ppp-plugin: (%s): could not get secrets: %s", - __func__, - err->message); - g_error_free (err); - return -1; - } - - g_message ("nm-ppp-plugin: (%s): got credentials from NetworkManager", __func__); - - g_variant_get (ret, "(&s&s)", &my_username, &my_password); - - if (my_username) { - len = strlen (my_username) + 1; - len = len < MAXNAMELEN ? len : MAXNAMELEN; - - strncpy (username, my_username, len); - username[len - 1] = '\0'; - } - - if (my_password) { - len = strlen (my_password) + 1; - len = len < MAXSECRETLEN ? len : MAXSECRETLEN; - - strncpy (password, my_password, len); - password[len - 1] = '\0'; - } - - g_variant_unref (ret); - - return 1; -} - -static void -nm_exit_notify (void *data, int arg) -{ - g_return_if_fail (G_IS_DBUS_PROXY (proxy)); - - g_message ("nm-ppp-plugin: (%s): cleaning up", __func__); - - g_object_unref (proxy); - proxy = NULL; -} - -static void -add_ip6_notifier (void) -{ - static struct notifier **notifier = NULL; - static gsize load_once = 0; - - if (g_once_init_enter (&load_once)) { - void *handle = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); - - if (handle) { - notifier = dlsym (handle, "ipv6_up_notifier"); - dlclose (handle); - } - g_once_init_leave (&load_once, 1); - } - if (notifier) - add_notifier (notifier, nm_ip6_up, NULL); - else - g_message ("nm-ppp-plugin: no IPV6CP notifier support; IPv6 not available"); -} - -int -plugin_init (void) -{ - GDBusConnection *bus; - GError *err = NULL; - - nm_g_type_init (); - - g_message ("nm-ppp-plugin: (%s): initializing", __func__); - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &err); - if (!bus) { - g_warning ("nm-pppd-plugin: (%s): couldn't connect to system bus: %s", - __func__, err->message); - g_error_free (err); - return -1; - } - - /* NM passes in the object path of the corresponding PPPManager - * object as the 'ipparam' argument to pppd. - */ - proxy = g_dbus_proxy_new_sync (bus, - G_DBUS_PROXY_FLAGS_NONE, - NULL, - NM_DBUS_SERVICE, - ipparam, - NM_DBUS_INTERFACE_PPP, - NULL, &err); - g_object_unref (bus); - - if (!proxy) { - g_warning ("nm-pppd-plugin: (%s): couldn't create D-Bus proxy: %s", - __func__, err->message); - g_error_free (err); - return -1; - } - - chap_passwd_hook = get_credentials; - chap_check_hook = get_chap_check; - pap_passwd_hook = get_credentials; - pap_check_hook = get_pap_check; - - add_notifier (&phasechange, nm_phasechange, NULL); - add_notifier (&ip_up_notifier, nm_ip_up, NULL); - add_notifier (&exitnotify, nm_exit_notify, proxy); - add_ip6_notifier (); - - return 0; -} diff --git a/src/ppp-manager/nm-pppd-plugin.h b/src/ppp-manager/nm-pppd-plugin.h deleted file mode 100644 index 1a2ea09e..00000000 --- a/src/ppp-manager/nm-pppd-plugin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2008 Novell, Inc. - * Copyright (C) 2008 - 2014 Red Hat, Inc. - */ - -#define NM_DBUS_INTERFACE_PPP "org.freedesktop.NetworkManager.PPP" - -#define NM_PPP_IP4_CONFIG_INTERFACE "interface" -#define NM_PPP_IP4_CONFIG_ADDRESS "address" -#define NM_PPP_IP4_CONFIG_PREFIX "prefix" -#define NM_PPP_IP4_CONFIG_GATEWAY "gateway" -#define NM_PPP_IP4_CONFIG_DNS "dns" -#define NM_PPP_IP4_CONFIG_WINS "wins" - -#define NM_PPP_IP6_CONFIG_INTERFACE "interface" -#define NM_PPP_IP6_CONFIG_OUR_IID "our-iid" -#define NM_PPP_IP6_CONFIG_PEER_IID "peer-iid" - |