diff options
Diffstat (limited to 'src')
216 files changed, 13048 insertions, 9531 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 731043451..db11d6b78 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,7 +8,6 @@ SUBDIRS= \ ip6-manager \ supplicant-manager \ ppp-manager \ - backends \ dnsmasq-manager \ modem-manager \ bluez-manager \ @@ -115,6 +114,7 @@ libtest_wifi_ap_utils_la_LIBADD = \ sbin_PROGRAMS = NetworkManager NetworkManager_SOURCES = \ + nm-types.h \ nm-call-store.c \ nm-call-store.h \ nm-device.c \ @@ -138,6 +138,8 @@ NetworkManager_SOURCES = \ nm-device-infiniband.h \ nm-device-bond.c \ nm-device-bond.h \ + nm-device-bridge.c \ + nm-device-bridge.h \ nm-device-vlan.c \ nm-device-vlan.h \ nm-wifi-ap.c \ @@ -192,8 +194,11 @@ NetworkManager_SOURCES = \ nm-session-monitor.h \ nm-session-utils.c \ nm-session-utils.h \ + nm-sleep-monitor.h \ nm-connection-provider.h \ - nm-connection-provider.c + nm-connection-provider.c \ + nm-dispatcher.c \ + nm-dispatcher.h if WITH_CONCHECK NetworkManager_SOURCES += nm-connectivity.c nm-connectivity.h @@ -209,6 +214,13 @@ NetworkManager_SOURCES += nm-session-monitor-null.c endif endif +if SUSPEND_RESUME_SYSTEMD +NetworkManager_SOURCES += nm-sleep-monitor-systemd.c +else +# UPower suspend/resume used whenever systemd is not enabled +NetworkManager_SOURCES += nm-sleep-monitor-upower.c +endif + nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_access_point --mode=glib-server --output=$@ $< @@ -239,6 +251,9 @@ nm-device-olpc-mesh-glue.h: $(top_srcdir)/introspection/nm-device-olpc-mesh.xml nm-device-bond-glue.h: $(top_srcdir)/introspection/nm-device-bond.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_bond --mode=glib-server --output=$@ $< +nm-device-bridge-glue.h: $(top_srcdir)/introspection/nm-device-bridge.xml + $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_bridge --mode=glib-server --output=$@ $< + nm-device-vlan-glue.h: $(top_srcdir)/introspection/nm-device-vlan.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_vlan --mode=glib-server --output=$@ $< @@ -267,6 +282,7 @@ BUILT_SOURCES = \ nm-device-ethernet-glue.h \ nm-device-infiniband-glue.h \ nm-device-bond-glue.h \ + nm-device-bridge-glue.h \ nm-device-vlan-glue.h \ nm-device-adsl-glue.h \ nm-device-wifi-glue.h \ @@ -284,25 +300,29 @@ NetworkManager_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(GUDEV_CFLAGS) \ $(LIBNL_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(POLKIT_CFLAGS) \ - $(SYSTEMD_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ + $(SYSTEMD_LOGIN_CFLAGS) \ -DBINDIR=\"$(bindir)\" \ -DSBINDIR=\"$(sbindir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DDATADIR=\"$(datadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ - -DNM_RUN_DIR=\"$(rundir)\" \ -DNMLOCALEDIR=\"$(datadir)/locale\" \ - -DNMPLUGINDIR=\"$(pkglibdir)\" + -DNMPLUGINDIR=\"$(pkglibdir)\" \ + -DNMCONFDIR=\"$(nmconfdir)\" \ + -DNMRUNDIR=\"$(nmrundir)\" \ + -DNMSTATEDIR=\"$(nmstatedir)\" \ -DARP_DEBUG if WITH_CONCHECK NetworkManager_CPPFLAGS += $(LIBSOUP_CFLAGS) endif +if SESSION_TRACKING_CK +NetworkManager_CPPFLAGS += -DCKDB_PATH=\"${CKDB_PATH}\" +endif + NetworkManager_LDADD = \ ./generated/libnm-generated.la \ ./logging/libnm-logging.la \ @@ -319,15 +339,13 @@ NetworkManager_LDADD = \ ./wifi/libwifi-utils.la \ ./firewall-manager/libfirewall-manager.la \ ./settings/libsettings.la \ - ./backends/libnmbackend.la \ $(top_builddir)/libnm-util/libnm-util.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) \ $(GUDEV_LIBS) \ $(LIBNL_LIBS) \ - $(GMODULE_LIBS) \ $(POLKIT_LIBS) \ - $(SYSTEMD_LIBS) \ + $(SYSTEMD_LOGIN_LIBS) \ $(LIBM) \ $(LIBDL) @@ -341,12 +359,11 @@ libexec_PROGRAMS = nm-crash-logger nm_crash_logger_SOURCES = nm-crash-logger.c nm_crash_logger_CPPFLAGS = \ $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DBINDIR=\"$(bindir)\" \ - -DSBINDIR=\"$(sbindir)\" \ - -DDATADIR=\"$(datadir)\" \ + -DNMBINARY=\"$(nmbinary)\" \ + -DNMDATADIR=\"$(nmdatadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLOCALSTATEDIR=\"$(localstatedir)\" + -DNMSTATEDIR=\"$(nmstatedir)\" nm_crash_logger_LDADD = $(GLIB_LIBS) @@ -365,6 +382,7 @@ statedir=$(localstatedir)/lib/NetworkManager install-data-hook: $(mkinstalldirs) -m 0700 $(DESTDIR)$(rundir) $(mkinstalldirs) -m 0700 $(DESTDIR)$(statedir) + $(mkinstalldirs) -m 0755 $(DESTDIR)$(pkglibdir) CLEANFILES = $(BUILT_SOURCES) diff --git a/src/Makefile.in b/src/Makefile.in index b286e057e..0011a0d3a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -59,23 +59,29 @@ sbin_PROGRAMS = NetworkManager$(EXEEXT) @SESSION_TRACKING_SYSTEMD_TRUE@am__append_3 = nm-session-monitor-systemd.c @SESSION_TRACKING_CK_TRUE@@SESSION_TRACKING_SYSTEMD_FALSE@am__append_4 = nm-session-monitor-ck.c @SESSION_TRACKING_CK_FALSE@@SESSION_TRACKING_SYSTEMD_FALSE@am__append_5 = nm-session-monitor-null.c -@WITH_CONCHECK_TRUE@am__append_6 = $(LIBSOUP_CFLAGS) -@WITH_CONCHECK_TRUE@am__append_7 = $(LIBSOUP_LIBS) +@SUSPEND_RESUME_SYSTEMD_TRUE@am__append_6 = nm-sleep-monitor-systemd.c +# UPower suspend/resume used whenever systemd is not enabled +@SUSPEND_RESUME_SYSTEMD_FALSE@am__append_7 = nm-sleep-monitor-upower.c +@WITH_CONCHECK_TRUE@am__append_8 = $(LIBSOUP_CFLAGS) +@SESSION_TRACKING_CK_TRUE@am__append_9 = -DCKDB_PATH=\"${CKDB_PATH}\" +@WITH_CONCHECK_TRUE@am__append_10 = $(LIBSOUP_LIBS) libexec_PROGRAMS = nm-crash-logger$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -112,23 +118,23 @@ libtest_wifi_ap_utils_la_OBJECTS = \ am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(NetworkManagerdir)" "$(DESTDIR)$(dbusservicedir)" PROGRAMS = $(libexec_PROGRAMS) $(sbin_PROGRAMS) -am__NetworkManager_SOURCES_DIST = nm-call-store.c nm-call-store.h \ - nm-device.c nm-device.h nm-device-private.h \ +am__NetworkManager_SOURCES_DIST = nm-types.h nm-call-store.c \ + nm-call-store.h nm-device.c nm-device.h nm-device-private.h \ nm-device-ethernet.c nm-device-ethernet.h nm-device-adsl.c \ nm-device-adsl.h nm-device-wifi.c nm-device-wifi.h \ nm-device-wired.c nm-device-wired.h nm-device-olpc-mesh.c \ nm-device-olpc-mesh.h nm-device-bt.c nm-device-bt.h \ nm-device-modem.h nm-device-modem.c nm-device-infiniband.c \ nm-device-infiniband.h nm-device-bond.c nm-device-bond.h \ - nm-device-vlan.c nm-device-vlan.h nm-wifi-ap.c nm-wifi-ap.h \ - nm-wifi-ap-utils.c nm-wifi-ap-utils.h nm-dbus-manager.h \ - nm-dbus-manager.c nm-udev-manager.c nm-udev-manager.h \ - nm-device-factory.h nm-hostname-provider.c \ - nm-hostname-provider.h nm-ip4-config.c nm-ip4-config.h \ - nm-ip6-config.c nm-ip6-config.h nm-active-connection.h \ - nm-active-connection.c nm-config.h nm-config.c main.c \ - nm-policy.c nm-policy.h nm-policy-hosts.c nm-policy-hosts.h \ - nm-policy-hostname.c nm-policy-hostname.h \ + nm-device-bridge.c nm-device-bridge.h nm-device-vlan.c \ + nm-device-vlan.h nm-wifi-ap.c nm-wifi-ap.h nm-wifi-ap-utils.c \ + nm-wifi-ap-utils.h nm-dbus-manager.h nm-dbus-manager.c \ + nm-udev-manager.c nm-udev-manager.h nm-device-factory.h \ + nm-hostname-provider.c nm-hostname-provider.h nm-ip4-config.c \ + nm-ip4-config.h nm-ip6-config.c nm-ip6-config.h \ + nm-active-connection.h nm-active-connection.c nm-config.h \ + nm-config.c main.c nm-policy.c nm-policy.h nm-policy-hosts.c \ + nm-policy-hosts.h nm-policy-hostname.c nm-policy-hostname.h \ NetworkManagerUtils.c NetworkManagerUtils.h nm-system.c \ nm-system.h nm-manager.c nm-manager.h nm-manager-auth.c \ nm-manager-auth.h nm-netlink-monitor.c nm-netlink-monitor.h \ @@ -138,15 +144,19 @@ am__NetworkManager_SOURCES_DIST = nm-call-store.c nm-call-store.h \ nm-properties-changed-signal.h nm-dhcp4-config.c \ nm-dhcp4-config.h nm-dhcp6-config.c nm-dhcp6-config.h \ nm-rfkill.h nm-session-monitor.h nm-session-utils.c \ - nm-session-utils.h nm-connection-provider.h \ - nm-connection-provider.c nm-connectivity.c nm-connectivity.h \ + nm-session-utils.h nm-sleep-monitor.h nm-connection-provider.h \ + nm-connection-provider.c nm-dispatcher.c nm-dispatcher.h \ + nm-connectivity.c nm-connectivity.h \ nm-session-monitor-systemd.c nm-session-monitor-ck.c \ - nm-session-monitor-null.c + nm-session-monitor-null.c nm-sleep-monitor-systemd.c \ + nm-sleep-monitor-upower.c @WITH_CONCHECK_TRUE@am__objects_1 = \ @WITH_CONCHECK_TRUE@ NetworkManager-nm-connectivity.$(OBJEXT) @SESSION_TRACKING_SYSTEMD_TRUE@am__objects_2 = NetworkManager-nm-session-monitor-systemd.$(OBJEXT) @SESSION_TRACKING_CK_TRUE@@SESSION_TRACKING_SYSTEMD_FALSE@am__objects_3 = NetworkManager-nm-session-monitor-ck.$(OBJEXT) @SESSION_TRACKING_CK_FALSE@@SESSION_TRACKING_SYSTEMD_FALSE@am__objects_4 = NetworkManager-nm-session-monitor-null.$(OBJEXT) +@SUSPEND_RESUME_SYSTEMD_TRUE@am__objects_5 = NetworkManager-nm-sleep-monitor-systemd.$(OBJEXT) +@SUSPEND_RESUME_SYSTEMD_FALSE@am__objects_6 = NetworkManager-nm-sleep-monitor-upower.$(OBJEXT) am_NetworkManager_OBJECTS = NetworkManager-nm-call-store.$(OBJEXT) \ NetworkManager-nm-device.$(OBJEXT) \ NetworkManager-nm-device-ethernet.$(OBJEXT) \ @@ -158,6 +168,7 @@ am_NetworkManager_OBJECTS = NetworkManager-nm-call-store.$(OBJEXT) \ NetworkManager-nm-device-modem.$(OBJEXT) \ NetworkManager-nm-device-infiniband.$(OBJEXT) \ NetworkManager-nm-device-bond.$(OBJEXT) \ + NetworkManager-nm-device-bridge.$(OBJEXT) \ NetworkManager-nm-device-vlan.$(OBJEXT) \ NetworkManager-nm-wifi-ap.$(OBJEXT) \ NetworkManager-nm-wifi-ap-utils.$(OBJEXT) \ @@ -185,8 +196,9 @@ am_NetworkManager_OBJECTS = NetworkManager-nm-call-store.$(OBJEXT) \ NetworkManager-nm-dhcp6-config.$(OBJEXT) \ NetworkManager-nm-session-utils.$(OBJEXT) \ NetworkManager-nm-connection-provider.$(OBJEXT) \ - $(am__objects_1) $(am__objects_2) $(am__objects_3) \ - $(am__objects_4) + NetworkManager-nm-dispatcher.$(OBJEXT) $(am__objects_1) \ + $(am__objects_2) $(am__objects_3) $(am__objects_4) \ + $(am__objects_5) $(am__objects_6) NetworkManager_OBJECTS = $(am_NetworkManager_OBJECTS) @WITH_CONCHECK_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) NetworkManager_DEPENDENCIES = ./generated/libnm-generated.la \ @@ -202,13 +214,12 @@ NetworkManager_DEPENDENCIES = ./generated/libnm-generated.la \ ./modem-manager/libmodem-manager.la \ ./bluez-manager/libbluez-manager.la ./wifi/libwifi-utils.la \ ./firewall-manager/libfirewall-manager.la \ - ./settings/libsettings.la ./backends/libnmbackend.la \ + ./settings/libsettings.la \ $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) NetworkManager_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(NetworkManager_LDFLAGS) $(LDFLAGS) -o \ @@ -300,8 +311,8 @@ ETAGS = etags CTAGS = ctags DIST_SUBDIRS = generated logging posix-signals dns-manager vpn-manager \ dhcp-manager ip6-manager supplicant-manager ppp-manager \ - backends dnsmasq-manager modem-manager bluez-manager \ - firewall-manager wifi settings wimax . tests + dnsmasq-manager modem-manager bluez-manager firewall-manager \ + wifi settings wimax . tests DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -340,6 +351,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -354,9 +369,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -366,17 +379,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -417,6 +427,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -433,11 +444,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -452,6 +459,8 @@ 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@ @@ -461,6 +470,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -487,13 +497,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -548,6 +559,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -562,10 +578,14 @@ 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@ SUBDIRS = generated logging posix-signals dns-manager vpn-manager \ dhcp-manager ip6-manager supplicant-manager ppp-manager \ - backends dnsmasq-manager modem-manager bluez-manager \ - firewall-manager wifi settings $(am__append_1) . tests + dnsmasq-manager modem-manager bluez-manager firewall-manager \ + wifi settings $(am__append_1) . tests INCLUDES = -I${top_srcdir} \ -I${top_builddir}/include \ -I${top_srcdir}/include \ @@ -650,23 +670,23 @@ libtest_wifi_ap_utils_la_LIBADD = \ ${top_builddir}/libnm-util/libnm-util.la \ $(GLIB_LIBS) -NetworkManager_SOURCES = nm-call-store.c nm-call-store.h nm-device.c \ - nm-device.h nm-device-private.h nm-device-ethernet.c \ - nm-device-ethernet.h nm-device-adsl.c nm-device-adsl.h \ - nm-device-wifi.c nm-device-wifi.h nm-device-wired.c \ - nm-device-wired.h nm-device-olpc-mesh.c nm-device-olpc-mesh.h \ - nm-device-bt.c nm-device-bt.h nm-device-modem.h \ - nm-device-modem.c nm-device-infiniband.c \ +NetworkManager_SOURCES = nm-types.h nm-call-store.c nm-call-store.h \ + nm-device.c nm-device.h nm-device-private.h \ + nm-device-ethernet.c nm-device-ethernet.h nm-device-adsl.c \ + nm-device-adsl.h nm-device-wifi.c nm-device-wifi.h \ + nm-device-wired.c nm-device-wired.h nm-device-olpc-mesh.c \ + nm-device-olpc-mesh.h nm-device-bt.c nm-device-bt.h \ + nm-device-modem.h nm-device-modem.c nm-device-infiniband.c \ nm-device-infiniband.h nm-device-bond.c nm-device-bond.h \ - nm-device-vlan.c nm-device-vlan.h nm-wifi-ap.c nm-wifi-ap.h \ - nm-wifi-ap-utils.c nm-wifi-ap-utils.h nm-dbus-manager.h \ - nm-dbus-manager.c nm-udev-manager.c nm-udev-manager.h \ - nm-device-factory.h nm-hostname-provider.c \ - nm-hostname-provider.h nm-ip4-config.c nm-ip4-config.h \ - nm-ip6-config.c nm-ip6-config.h nm-active-connection.h \ - nm-active-connection.c nm-config.h nm-config.c main.c \ - nm-policy.c nm-policy.h nm-policy-hosts.c nm-policy-hosts.h \ - nm-policy-hostname.c nm-policy-hostname.h \ + nm-device-bridge.c nm-device-bridge.h nm-device-vlan.c \ + nm-device-vlan.h nm-wifi-ap.c nm-wifi-ap.h nm-wifi-ap-utils.c \ + nm-wifi-ap-utils.h nm-dbus-manager.h nm-dbus-manager.c \ + nm-udev-manager.c nm-udev-manager.h nm-device-factory.h \ + nm-hostname-provider.c nm-hostname-provider.h nm-ip4-config.c \ + nm-ip4-config.h nm-ip6-config.c nm-ip6-config.h \ + nm-active-connection.h nm-active-connection.c nm-config.h \ + nm-config.c main.c nm-policy.c nm-policy.h nm-policy-hosts.c \ + nm-policy-hosts.h nm-policy-hostname.c nm-policy-hostname.h \ NetworkManagerUtils.c NetworkManagerUtils.h nm-system.c \ nm-system.h nm-manager.c nm-manager.h nm-manager-auth.c \ nm-manager-auth.h nm-netlink-monitor.c nm-netlink-monitor.h \ @@ -676,9 +696,10 @@ NetworkManager_SOURCES = nm-call-store.c nm-call-store.h nm-device.c \ nm-properties-changed-signal.h nm-dhcp4-config.c \ nm-dhcp4-config.h nm-dhcp6-config.c nm-dhcp6-config.h \ nm-rfkill.h nm-session-monitor.h nm-session-utils.c \ - nm-session-utils.h nm-connection-provider.h \ - nm-connection-provider.c $(am__append_2) $(am__append_3) \ - $(am__append_4) $(am__append_5) + nm-session-utils.h nm-sleep-monitor.h nm-connection-provider.h \ + nm-connection-provider.c nm-dispatcher.c nm-dispatcher.h \ + $(am__append_2) $(am__append_3) $(am__append_4) \ + $(am__append_5) $(am__append_6) $(am__append_7) BUILT_SOURCES = \ nm-access-point-glue.h \ nm-manager-glue.h \ @@ -686,6 +707,7 @@ BUILT_SOURCES = \ nm-device-ethernet-glue.h \ nm-device-infiniband-glue.h \ nm-device-bond-glue.h \ + nm-device-bridge-glue.h \ nm-device-vlan-glue.h \ nm-device-adsl-glue.h \ nm-device-wifi-glue.h \ @@ -699,14 +721,15 @@ BUILT_SOURCES = \ nm-dhcp6-config-glue.h NetworkManager_CPPFLAGS = $(DBUS_CFLAGS) $(GLIB_CFLAGS) \ - $(GUDEV_CFLAGS) $(LIBNL_CFLAGS) $(GMODULE_CFLAGS) \ - $(POLKIT_CFLAGS) $(SYSTEMD_CFLAGS) -DG_DISABLE_DEPRECATED \ - -DBINDIR=\"$(bindir)\" -DSBINDIR=\"$(sbindir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" -DDATADIR=\"$(datadir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ + $(GUDEV_CFLAGS) $(LIBNL_CFLAGS) $(POLKIT_CFLAGS) \ + $(SYSTEMD_LOGIN_CFLAGS) -DBINDIR=\"$(bindir)\" \ + -DSBINDIR=\"$(sbindir)\" -DLIBEXECDIR=\"$(libexecdir)\" \ + -DDATADIR=\"$(datadir)\" -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ - -DNM_RUN_DIR=\"$(rundir)\" -DNMLOCALEDIR=\"$(datadir)/locale\" \ - -DNMPLUGINDIR=\"$(pkglibdir)\" $(am__append_6) + -DNMLOCALEDIR=\"$(datadir)/locale\" \ + -DNMPLUGINDIR=\"$(pkglibdir)\" -DNMCONFDIR=\"$(nmconfdir)\" \ + -DNMRUNDIR=\"$(nmrundir)\" -DNMSTATEDIR=\"$(nmstatedir)\" \ + -DARP_DEBUG $(am__append_8) $(am__append_9) NetworkManager_LDADD = ./generated/libnm-generated.la \ ./logging/libnm-logging.la \ ./posix-signals/libnm-posix-signals.la \ @@ -720,21 +743,19 @@ NetworkManager_LDADD = ./generated/libnm-generated.la \ ./modem-manager/libmodem-manager.la \ ./bluez-manager/libbluez-manager.la ./wifi/libwifi-utils.la \ ./firewall-manager/libfirewall-manager.la \ - ./settings/libsettings.la ./backends/libnmbackend.la \ + ./settings/libsettings.la \ $(top_builddir)/libnm-util/libnm-util.la $(DBUS_LIBS) \ - $(GLIB_LIBS) $(GUDEV_LIBS) $(LIBNL_LIBS) $(GMODULE_LIBS) \ - $(POLKIT_LIBS) $(SYSTEMD_LIBS) $(LIBM) $(LIBDL) \ - $(am__append_7) + $(GLIB_LIBS) $(GUDEV_LIBS) $(LIBNL_LIBS) $(POLKIT_LIBS) \ + $(SYSTEMD_LOGIN_LIBS) $(LIBM) $(LIBDL) $(am__append_10) NetworkManager_LDFLAGS = -rdynamic nm_crash_logger_SOURCES = nm-crash-logger.c nm_crash_logger_CPPFLAGS = \ $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DBINDIR=\"$(bindir)\" \ - -DSBINDIR=\"$(sbindir)\" \ - -DDATADIR=\"$(datadir)\" \ + -DNMBINARY=\"$(nmbinary)\" \ + -DNMDATADIR=\"$(nmdatadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLOCALSTATEDIR=\"$(localstatedir)\" + -DNMSTATEDIR=\"$(nmstatedir)\" nm_crash_logger_LDADD = $(GLIB_LIBS) NetworkManagerdir = $(datadir)/NetworkManager @@ -914,6 +935,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-dbus-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device-adsl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device-bond.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device-bridge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device-bt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device-ethernet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device-infiniband.Po@am__quote@ @@ -925,6 +947,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-device.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-dhcp4-config.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-dhcp6-config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-dispatcher.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-hostname-provider.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-ip4-config.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-ip6-config.Po@am__quote@ @@ -941,6 +964,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-session-monitor-null.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-session-monitor-systemd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-session-utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-system.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-udev-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetworkManager-nm-wifi-ap-utils.Po@am__quote@ @@ -954,25 +979,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm_crash_logger-nm-crash-logger.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -1173,6 +1195,20 @@ NetworkManager-nm-device-bond.obj: nm-device-bond.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-device-bond.obj `if test -f 'nm-device-bond.c'; then $(CYGPATH_W) 'nm-device-bond.c'; else $(CYGPATH_W) '$(srcdir)/nm-device-bond.c'; fi` +NetworkManager-nm-device-bridge.o: nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-device-bridge.o -MD -MP -MF $(DEPDIR)/NetworkManager-nm-device-bridge.Tpo -c -o NetworkManager-nm-device-bridge.o `test -f 'nm-device-bridge.c' || echo '$(srcdir)/'`nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-device-bridge.Tpo $(DEPDIR)/NetworkManager-nm-device-bridge.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-device-bridge.c' object='NetworkManager-nm-device-bridge.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-device-bridge.o `test -f 'nm-device-bridge.c' || echo '$(srcdir)/'`nm-device-bridge.c + +NetworkManager-nm-device-bridge.obj: nm-device-bridge.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-device-bridge.obj -MD -MP -MF $(DEPDIR)/NetworkManager-nm-device-bridge.Tpo -c -o NetworkManager-nm-device-bridge.obj `if test -f 'nm-device-bridge.c'; then $(CYGPATH_W) 'nm-device-bridge.c'; else $(CYGPATH_W) '$(srcdir)/nm-device-bridge.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-device-bridge.Tpo $(DEPDIR)/NetworkManager-nm-device-bridge.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-device-bridge.c' object='NetworkManager-nm-device-bridge.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-device-bridge.obj `if test -f 'nm-device-bridge.c'; then $(CYGPATH_W) 'nm-device-bridge.c'; else $(CYGPATH_W) '$(srcdir)/nm-device-bridge.c'; fi` + NetworkManager-nm-device-vlan.o: nm-device-vlan.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-device-vlan.o -MD -MP -MF $(DEPDIR)/NetworkManager-nm-device-vlan.Tpo -c -o NetworkManager-nm-device-vlan.o `test -f 'nm-device-vlan.c' || echo '$(srcdir)/'`nm-device-vlan.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-device-vlan.Tpo $(DEPDIR)/NetworkManager-nm-device-vlan.Po @@ -1551,6 +1587,20 @@ NetworkManager-nm-connection-provider.obj: nm-connection-provider.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-connection-provider.obj `if test -f 'nm-connection-provider.c'; then $(CYGPATH_W) 'nm-connection-provider.c'; else $(CYGPATH_W) '$(srcdir)/nm-connection-provider.c'; fi` +NetworkManager-nm-dispatcher.o: nm-dispatcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-dispatcher.o -MD -MP -MF $(DEPDIR)/NetworkManager-nm-dispatcher.Tpo -c -o NetworkManager-nm-dispatcher.o `test -f 'nm-dispatcher.c' || echo '$(srcdir)/'`nm-dispatcher.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-dispatcher.Tpo $(DEPDIR)/NetworkManager-nm-dispatcher.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-dispatcher.c' object='NetworkManager-nm-dispatcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-dispatcher.o `test -f 'nm-dispatcher.c' || echo '$(srcdir)/'`nm-dispatcher.c + +NetworkManager-nm-dispatcher.obj: nm-dispatcher.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-dispatcher.obj -MD -MP -MF $(DEPDIR)/NetworkManager-nm-dispatcher.Tpo -c -o NetworkManager-nm-dispatcher.obj `if test -f 'nm-dispatcher.c'; then $(CYGPATH_W) 'nm-dispatcher.c'; else $(CYGPATH_W) '$(srcdir)/nm-dispatcher.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-dispatcher.Tpo $(DEPDIR)/NetworkManager-nm-dispatcher.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-dispatcher.c' object='NetworkManager-nm-dispatcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-dispatcher.obj `if test -f 'nm-dispatcher.c'; then $(CYGPATH_W) 'nm-dispatcher.c'; else $(CYGPATH_W) '$(srcdir)/nm-dispatcher.c'; fi` + NetworkManager-nm-connectivity.o: nm-connectivity.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-connectivity.o -MD -MP -MF $(DEPDIR)/NetworkManager-nm-connectivity.Tpo -c -o NetworkManager-nm-connectivity.o `test -f 'nm-connectivity.c' || echo '$(srcdir)/'`nm-connectivity.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-connectivity.Tpo $(DEPDIR)/NetworkManager-nm-connectivity.Po @@ -1607,6 +1657,34 @@ NetworkManager-nm-session-monitor-null.obj: nm-session-monitor-null.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-session-monitor-null.obj `if test -f 'nm-session-monitor-null.c'; then $(CYGPATH_W) 'nm-session-monitor-null.c'; else $(CYGPATH_W) '$(srcdir)/nm-session-monitor-null.c'; fi` +NetworkManager-nm-sleep-monitor-systemd.o: nm-sleep-monitor-systemd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-sleep-monitor-systemd.o -MD -MP -MF $(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Tpo -c -o NetworkManager-nm-sleep-monitor-systemd.o `test -f 'nm-sleep-monitor-systemd.c' || echo '$(srcdir)/'`nm-sleep-monitor-systemd.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Tpo $(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-sleep-monitor-systemd.c' object='NetworkManager-nm-sleep-monitor-systemd.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-sleep-monitor-systemd.o `test -f 'nm-sleep-monitor-systemd.c' || echo '$(srcdir)/'`nm-sleep-monitor-systemd.c + +NetworkManager-nm-sleep-monitor-systemd.obj: nm-sleep-monitor-systemd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-sleep-monitor-systemd.obj -MD -MP -MF $(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Tpo -c -o NetworkManager-nm-sleep-monitor-systemd.obj `if test -f 'nm-sleep-monitor-systemd.c'; then $(CYGPATH_W) 'nm-sleep-monitor-systemd.c'; else $(CYGPATH_W) '$(srcdir)/nm-sleep-monitor-systemd.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Tpo $(DEPDIR)/NetworkManager-nm-sleep-monitor-systemd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-sleep-monitor-systemd.c' object='NetworkManager-nm-sleep-monitor-systemd.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-sleep-monitor-systemd.obj `if test -f 'nm-sleep-monitor-systemd.c'; then $(CYGPATH_W) 'nm-sleep-monitor-systemd.c'; else $(CYGPATH_W) '$(srcdir)/nm-sleep-monitor-systemd.c'; fi` + +NetworkManager-nm-sleep-monitor-upower.o: nm-sleep-monitor-upower.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-sleep-monitor-upower.o -MD -MP -MF $(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Tpo -c -o NetworkManager-nm-sleep-monitor-upower.o `test -f 'nm-sleep-monitor-upower.c' || echo '$(srcdir)/'`nm-sleep-monitor-upower.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Tpo $(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-sleep-monitor-upower.c' object='NetworkManager-nm-sleep-monitor-upower.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-sleep-monitor-upower.o `test -f 'nm-sleep-monitor-upower.c' || echo '$(srcdir)/'`nm-sleep-monitor-upower.c + +NetworkManager-nm-sleep-monitor-upower.obj: nm-sleep-monitor-upower.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT NetworkManager-nm-sleep-monitor-upower.obj -MD -MP -MF $(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Tpo -c -o NetworkManager-nm-sleep-monitor-upower.obj `if test -f 'nm-sleep-monitor-upower.c'; then $(CYGPATH_W) 'nm-sleep-monitor-upower.c'; else $(CYGPATH_W) '$(srcdir)/nm-sleep-monitor-upower.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Tpo $(DEPDIR)/NetworkManager-nm-sleep-monitor-upower.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-sleep-monitor-upower.c' object='NetworkManager-nm-sleep-monitor-upower.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(NetworkManager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o NetworkManager-nm-sleep-monitor-upower.obj `if test -f 'nm-sleep-monitor-upower.c'; then $(CYGPATH_W) 'nm-sleep-monitor-upower.c'; else $(CYGPATH_W) '$(srcdir)/nm-sleep-monitor-upower.c'; fi` + nm_crash_logger-nm-crash-logger.o: nm-crash-logger.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_crash_logger_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_crash_logger-nm-crash-logger.o -MD -MP -MF $(DEPDIR)/nm_crash_logger-nm-crash-logger.Tpo -c -o nm_crash_logger-nm-crash-logger.o `test -f 'nm-crash-logger.c' || echo '$(srcdir)/'`nm-crash-logger.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nm_crash_logger-nm-crash-logger.Tpo $(DEPDIR)/nm_crash_logger-nm-crash-logger.Po @@ -2029,6 +2107,9 @@ nm-device-olpc-mesh-glue.h: $(top_srcdir)/introspection/nm-device-olpc-mesh.xml nm-device-bond-glue.h: $(top_srcdir)/introspection/nm-device-bond.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_bond --mode=glib-server --output=$@ $< +nm-device-bridge-glue.h: $(top_srcdir)/introspection/nm-device-bridge.xml + $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_bridge --mode=glib-server --output=$@ $< + nm-device-vlan-glue.h: $(top_srcdir)/introspection/nm-device-vlan.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_vlan --mode=glib-server --output=$@ $< @@ -2049,10 +2130,10 @@ nm-dhcp6-config-glue.h: $(top_srcdir)/introspection/nm-dhcp6-config.xml nm-device-modem-glue.h: $(top_srcdir)/introspection/nm-device-modem.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_device_modem --mode=glib-server --output=$@ $< - -DARP_DEBUG install-data-hook: $(mkinstalldirs) -m 0700 $(DESTDIR)$(rundir) $(mkinstalldirs) -m 0700 $(DESTDIR)$(statedir) + $(mkinstalldirs) -m 0755 $(DESTDIR)$(pkglibdir) # 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. diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 45d867d96..db627091e 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -22,19 +22,14 @@ #include <glib.h> #include <errno.h> #include <fcntl.h> -#include <stdio.h> #include <string.h> #include <unistd.h> -#include <ctype.h> #include <stdlib.h> #include "NetworkManagerUtils.h" #include "nm-utils.h" #include "nm-logging.h" #include "nm-device.h" -#include "nm-dbus-manager.h" -#include "nm-dispatcher-action.h" -#include "nm-dbus-glib-types.h" #include "nm-setting-connection.h" #include "nm-setting-ip4-config.h" #include "nm-setting-ip6-config.h" @@ -368,221 +363,6 @@ nm_utils_merge_ip6_config (NMIP6Config *ip6_config, NMSettingIP6Config *setting) nm_ip6_config_set_never_default (ip6_config, TRUE); } -static void -dump_object_to_props (GObject *object, GHashTable *hash) -{ - GParamSpec **pspecs; - guint len = 0, i; - - pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &len); - for (i = 0; i < len; i++) { - value_hash_add_object_property (hash, - pspecs[i]->name, - object, - pspecs[i]->name, - pspecs[i]->value_type); - } - g_free (pspecs); -} - -static void -dump_dhcp4_to_props (NMDHCP4Config *config, GHashTable *hash) -{ - GSList *options, *iter; - - options = nm_dhcp4_config_list_options (config); - for (iter = options; iter; iter = g_slist_next (iter)) { - const char *option = (const char *) iter->data; - const char *val; - - val = nm_dhcp4_config_get_option (config, option); - value_hash_add_str (hash, option, val); - } - g_slist_free (options); -} - -static void -dump_dhcp6_to_props (NMDHCP6Config *config, GHashTable *hash) -{ - GSList *options, *iter; - - options = nm_dhcp6_config_list_options (config); - for (iter = options; iter; iter = g_slist_next (iter)) { - const char *option = (const char *) iter->data; - const char *val; - - val = nm_dhcp6_config_get_option (config, option); - value_hash_add_str (hash, option, val); - } - g_slist_free (options); -} - -static void -fill_device_props (NMDevice *device, - GHashTable *dev_hash, - GHashTable *ip4_hash, - GHashTable *ip6_hash, - GHashTable *dhcp4_hash, - GHashTable *dhcp6_hash) -{ - NMIP4Config *ip4_config; - NMIP6Config *ip6_config; - NMDHCP4Config *dhcp4_config; - NMDHCP6Config *dhcp6_config; - - /* If the action is for a VPN, send the VPN's IP interface instead of the device's */ - value_hash_add_str (dev_hash, NMD_DEVICE_PROPS_IP_INTERFACE, nm_device_get_ip_iface (device)); - value_hash_add_str (dev_hash, NMD_DEVICE_PROPS_INTERFACE, nm_device_get_iface (device)); - value_hash_add_uint (dev_hash, NMD_DEVICE_PROPS_TYPE, nm_device_get_device_type (device)); - value_hash_add_uint (dev_hash, NMD_DEVICE_PROPS_STATE, nm_device_get_state (device)); - value_hash_add_object_path (dev_hash, NMD_DEVICE_PROPS_PATH, nm_device_get_path (device)); - - ip4_config = nm_device_get_ip4_config (device); - if (ip4_config) - dump_object_to_props (G_OBJECT (ip4_config), ip4_hash); - - ip6_config = nm_device_get_ip6_config (device); - if (ip6_config) - dump_object_to_props (G_OBJECT (ip6_config), ip6_hash); - - dhcp4_config = nm_device_get_dhcp4_config (device); - if (dhcp4_config) - dump_dhcp4_to_props (dhcp4_config, dhcp4_hash); - - dhcp6_config = nm_device_get_dhcp6_config (device); - if (dhcp6_config) - dump_dhcp6_to_props (dhcp6_config, dhcp6_hash); -} - -static void -fill_vpn_props (NMIP4Config *ip4_config, - NMIP6Config *ip6_config, - GHashTable *ip4_hash, - GHashTable *ip6_hash) -{ - if (ip4_config) - dump_object_to_props (G_OBJECT (ip4_config), ip4_hash); - if (ip6_config) - dump_object_to_props (G_OBJECT (ip6_config), ip6_hash); -} - -static void -dispatcher_done_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) -{ - dbus_g_proxy_end_call (proxy, call, NULL, G_TYPE_INVALID); - g_object_unref (proxy); -} - -void -nm_utils_call_dispatcher (const char *action, - NMConnection *connection, - NMDevice *device, - const char *vpn_iface, - NMIP4Config *vpn_ip4_config, - NMIP6Config *vpn_ip6_config) -{ - NMDBusManager *dbus_mgr; - DBusGProxy *proxy; - DBusGConnection *g_connection; - GHashTable *connection_hash; - GHashTable *connection_props; - GHashTable *device_props; - GHashTable *device_ip4_props; - GHashTable *device_ip6_props; - GHashTable *device_dhcp4_props; - GHashTable *device_dhcp6_props; - GHashTable *vpn_ip4_props; - GHashTable *vpn_ip6_props; - - g_return_if_fail (action != NULL); - - /* All actions except 'hostname' require a device */ - if (strcmp (action, "hostname") != 0) - g_return_if_fail (NM_IS_DEVICE (device)); - /* VPN actions require at least an IPv4 config (for now) */ - if (strcmp (action, "vpn-up") == 0) - g_return_if_fail (vpn_ip4_config != NULL); - - dbus_mgr = nm_dbus_manager_get (); - g_connection = nm_dbus_manager_get_connection (dbus_mgr); - proxy = dbus_g_proxy_new_for_name (g_connection, - NM_DISPATCHER_DBUS_SERVICE, - NM_DISPATCHER_DBUS_PATH, - NM_DISPATCHER_DBUS_IFACE); - if (!proxy) { - nm_log_err (LOGD_CORE, "could not get dispatcher proxy!"); - g_object_unref (dbus_mgr); - return; - } - - if (connection) { - connection_hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_NO_SECRETS); - - connection_props = value_hash_create (); - - /* path */ - value_hash_add_object_path (connection_props, - NMD_CONNECTION_PROPS_PATH, - nm_connection_get_path (connection)); - } else { - connection_hash = value_hash_create (); - connection_props = value_hash_create (); - } - - device_props = value_hash_create (); - device_ip4_props = value_hash_create (); - device_ip6_props = value_hash_create (); - device_dhcp4_props = value_hash_create (); - device_dhcp6_props = value_hash_create (); - vpn_ip4_props = value_hash_create (); - vpn_ip6_props = value_hash_create (); - - /* hostname actions only send the hostname */ - if (strcmp (action, "hostname") != 0) { - fill_device_props (device, - device_props, - device_ip4_props, - device_ip6_props, - device_dhcp4_props, - device_dhcp6_props); - if (vpn_iface) - fill_vpn_props (vpn_ip4_config, NULL, vpn_ip4_props, vpn_ip6_props); - } - - /* Do a non-blocking call, but wait for the reply, because dbus-glib - * sometimes needs time to complete internal housekeeping. If we use - * dbus_g_proxy_call_no_reply(), that housekeeping (specifically the - * GetNameOwner response) doesn't complete and we run into an assert - * on unreffing the proxy. - */ - dbus_g_proxy_begin_call_with_timeout (proxy, "Action", - dispatcher_done_cb, - dbus_mgr, /* automatically unref the dbus mgr when call is done */ - g_object_unref, - 5000, - G_TYPE_STRING, action, - DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash, - DBUS_TYPE_G_MAP_OF_VARIANT, connection_props, - DBUS_TYPE_G_MAP_OF_VARIANT, device_props, - DBUS_TYPE_G_MAP_OF_VARIANT, device_ip4_props, - DBUS_TYPE_G_MAP_OF_VARIANT, device_ip6_props, - DBUS_TYPE_G_MAP_OF_VARIANT, device_dhcp4_props, - DBUS_TYPE_G_MAP_OF_VARIANT, device_dhcp6_props, - G_TYPE_STRING, vpn_iface ? vpn_iface : "", - DBUS_TYPE_G_MAP_OF_VARIANT, vpn_ip4_props, - DBUS_TYPE_G_MAP_OF_VARIANT, vpn_ip6_props, - G_TYPE_INVALID); - g_hash_table_destroy (connection_hash); - g_hash_table_destroy (connection_props); - g_hash_table_destroy (device_props); - g_hash_table_destroy (device_ip4_props); - g_hash_table_destroy (device_ip6_props); - g_hash_table_destroy (device_dhcp4_props); - g_hash_table_destroy (device_dhcp6_props); - g_hash_table_destroy (vpn_ip4_props); - g_hash_table_destroy (vpn_ip6_props); -} - gboolean nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr) { @@ -629,12 +409,12 @@ parse_subchannels (const char *subchannels, guint32 *a, guint32 *b, guint32 *c) g_return_val_if_fail (*c == 0, FALSE); /* sanity check */ - if (!isxdigit (subchannels[0])) + if (!g_ascii_isxdigit (subchannels[0])) return FALSE; /* Get the first channel */ while (*p && (*p != ',')) { - if (!isxdigit (*p) && (*p != '.')) + if (!g_ascii_isxdigit (*p) && (*p != '.')) return FALSE; /* Invalid chars */ if (i >= BUFSIZE) return FALSE; /* Too long to be a subchannel */ @@ -830,27 +610,48 @@ value_hash_add_object_property (GHashTable *hash, gboolean nm_utils_do_sysctl (const char *path, const char *value) { - int fd, len, nwrote, total; + int fd, len, nwrote, tries; + char *actual; + + g_return_val_if_fail (path != NULL, FALSE); + g_return_val_if_fail (value != NULL, FALSE); + g_return_val_if_fail (value[0], FALSE); fd = open (path, O_WRONLY | O_TRUNC); - if (fd == -1) + if (fd == -1) { + nm_log_warn (LOGD_CORE, "sysctl: failed to open '%s': (%d) %s", + path, errno, strerror (errno)); return FALSE; + } + + nm_log_dbg (LOGD_CORE, "sysctl: setting '%s' to '%s'", path, value); - len = strlen (value); - total = 0; - do { - nwrote = write (fd, value + total, len - total); + /* Most sysfs and sysctl options don't care about a trailing CR, while some + * (like infiniband) do. So always add the CR. Also, neither sysfs nor + * sysctl support partial writes so the CR must be added to the string we're + * about to write. + */ + actual = g_strdup_printf ("%s\n", value); + + /* Try to write the entire value three times if a partial write occurs */ + len = strlen (actual); + for (tries = 0, nwrote = 0; tries < 3 && nwrote != len; tries++) { + nwrote = write (fd, actual, len); if (nwrote == -1) { if (errno == EINTR) continue; - close (fd); - return FALSE; + break; } - total += nwrote; - } while (total < len); + } + g_free (actual); + + if (nwrote != len) { + nm_log_warn (LOGD_CORE, "sysctl: failed to set '%s' to '%s': (%d) %s", + path, value, errno, strerror (errno)); + } close (fd); - return TRUE; + return (nwrote == len); } gboolean @@ -1018,23 +819,6 @@ nm_utils_complete_generic (NMConnection *connection, } } -gboolean -nm_utils_is_uuid (const char *str) -{ - const char *p = str; - int num_dashes = 0; - - while (*p) { - if (*p == '-') - num_dashes++; - else if (!isxdigit (*p)) - return FALSE; - p++; - } - - return (num_dashes == 4) && (p - str == 36); -} - char * nm_utils_new_vlan_name (const char *parent_iface, guint32 vlan_id) { diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 2474f6548..057ad283f 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -26,7 +26,6 @@ #include <stdio.h> #include <net/ethernet.h> -#include "nm-device.h" #include "nm-ip4-config.h" #include "nm-setting-ip4-config.h" #include "nm-ip6-config.h" @@ -40,13 +39,6 @@ int nm_spawn_process (const char *args); void nm_utils_merge_ip4_config (NMIP4Config *ip4_config, NMSettingIP4Config *setting); void nm_utils_merge_ip6_config (NMIP6Config *ip6_config, NMSettingIP6Config *setting); -void nm_utils_call_dispatcher (const char *action, - NMConnection *connection, - NMDevice *device, - const char *vpn_iface, - NMIP4Config *vpn_ip4_config, - NMIP6Config *vpn_ip6_config); - gboolean nm_match_spec_hwaddr (const GSList *specs, const char *hwaddr); gboolean nm_match_spec_s390_subchannels (const GSList *specs, const char *subchannels); @@ -98,8 +90,6 @@ void nm_utils_complete_generic (NMConnection *connection, const char *preferred, gboolean default_enable_ipv6); -gboolean nm_utils_is_uuid (const char *str); - char *nm_utils_new_vlan_name (const char *parent_iface, guint32 vlan_id); #endif /* NETWORK_MANAGER_UTILS_H */ diff --git a/src/backends/Makefile.am b/src/backends/Makefile.am deleted file mode 100644 index 647e5e5b3..000000000 --- a/src/backends/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -INCLUDES = \ - -I${top_srcdir} \ - -I${top_srcdir}/src/logging \ - -I${top_srcdir}/include \ - -I${top_builddir}/include \ - -I${top_srcdir}/src \ - -I${top_srcdir}/libnm-util - -noinst_LTLIBRARIES = libnmbackend.la - -libnmbackend_la_SOURCES = \ - NetworkManagerGeneric.c \ - NetworkManagerGeneric.h \ - nm-backend.h - -libnmbackend_la_LIBADD = - -if TARGET_REDHAT -libnmbackend_la_SOURCES += NetworkManagerRedHat.c -endif - -if TARGET_SUSE -libnmbackend_la_SOURCES += NetworkManagerSuSE.c -endif - -if TARGET_GENTOO -libnmbackend_la_SOURCES += NetworkManagerGentoo.c -endif - -if TARGET_DEBIAN -libnmbackend_la_SOURCES += NetworkManagerDebian.c -endif - -if TARGET_SLACKWARE -libnmbackend_la_SOURCES += NetworkManagerSlackware.c -endif - -if TARGET_ARCH -libnmbackend_la_SOURCES += NetworkManagerArch.c -endif - -if TARGET_PALDO -libnmbackend_la_SOURCES += NetworkManagerPaldo.c -endif - -if TARGET_FRUGALWARE -libnmbackend_la_SOURCES += NetworkManagerFrugalware.c -libnmbackend_la_LIBADD += -lfwnetconfig -lfwutil -endif - -if TARGET_MANDRIVA -libnmbackend_la_SOURCES += NetworkManagerMandriva.c -endif - -if TARGET_PARDUS -libnmbackend_la_SOURCES += NetworkManagerPardus.c -endif - -if TARGET_LINEXA -libnmbackend_la_SOURCES += NetworkManagerLinexa.c -endif - -if TARGET_EXHERBO -libnmbackend_la_SOURCES += NetworkManagerExherbo.c -endif - -if TARGET_LFS -libnmbackend_la_SOURCES += NetworkManagerLFS.c -endif - -libnmbackend_la_LIBADD += \ - $(top_builddir)/src/logging/libnm-logging.la \ - $(LIBNL_LIBS) \ - $(DBUS_LIBS) \ - $(GLIB_LIBS) - -libnmbackend_la_CPPFLAGS = \ - $(LIBNL_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ - -DBINDIR=\"$(bindir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" - diff --git a/src/backends/Makefile.in b/src/backends/Makefile.in deleted file mode 100644 index b821d6d76..000000000 --- a/src/backends/Makefile.in +++ /dev/null @@ -1,832 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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@ -@TARGET_REDHAT_TRUE@am__append_1 = NetworkManagerRedHat.c -@TARGET_SUSE_TRUE@am__append_2 = NetworkManagerSuSE.c -@TARGET_GENTOO_TRUE@am__append_3 = NetworkManagerGentoo.c -@TARGET_DEBIAN_TRUE@am__append_4 = NetworkManagerDebian.c -@TARGET_SLACKWARE_TRUE@am__append_5 = NetworkManagerSlackware.c -@TARGET_ARCH_TRUE@am__append_6 = NetworkManagerArch.c -@TARGET_PALDO_TRUE@am__append_7 = NetworkManagerPaldo.c -@TARGET_FRUGALWARE_TRUE@am__append_8 = NetworkManagerFrugalware.c -@TARGET_FRUGALWARE_TRUE@am__append_9 = -lfwnetconfig -lfwutil -@TARGET_MANDRIVA_TRUE@am__append_10 = NetworkManagerMandriva.c -@TARGET_PARDUS_TRUE@am__append_11 = NetworkManagerPardus.c -@TARGET_LINEXA_TRUE@am__append_12 = NetworkManagerLinexa.c -@TARGET_EXHERBO_TRUE@am__append_13 = NetworkManagerExherbo.c -@TARGET_LFS_TRUE@am__append_14 = NetworkManagerLFS.c -subdir = src/backends -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -am__DEPENDENCIES_1 = -libnmbackend_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(top_builddir)/src/logging/libnm-logging.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am__libnmbackend_la_SOURCES_DIST = NetworkManagerGeneric.c \ - NetworkManagerGeneric.h nm-backend.h NetworkManagerRedHat.c \ - NetworkManagerSuSE.c NetworkManagerGentoo.c \ - NetworkManagerDebian.c NetworkManagerSlackware.c \ - NetworkManagerArch.c NetworkManagerPaldo.c \ - NetworkManagerFrugalware.c NetworkManagerMandriva.c \ - NetworkManagerPardus.c NetworkManagerLinexa.c \ - NetworkManagerExherbo.c NetworkManagerLFS.c -@TARGET_REDHAT_TRUE@am__objects_1 = \ -@TARGET_REDHAT_TRUE@ libnmbackend_la-NetworkManagerRedHat.lo -@TARGET_SUSE_TRUE@am__objects_2 = \ -@TARGET_SUSE_TRUE@ libnmbackend_la-NetworkManagerSuSE.lo -@TARGET_GENTOO_TRUE@am__objects_3 = \ -@TARGET_GENTOO_TRUE@ libnmbackend_la-NetworkManagerGentoo.lo -@TARGET_DEBIAN_TRUE@am__objects_4 = \ -@TARGET_DEBIAN_TRUE@ libnmbackend_la-NetworkManagerDebian.lo -@TARGET_SLACKWARE_TRUE@am__objects_5 = libnmbackend_la-NetworkManagerSlackware.lo -@TARGET_ARCH_TRUE@am__objects_6 = \ -@TARGET_ARCH_TRUE@ libnmbackend_la-NetworkManagerArch.lo -@TARGET_PALDO_TRUE@am__objects_7 = \ -@TARGET_PALDO_TRUE@ libnmbackend_la-NetworkManagerPaldo.lo -@TARGET_FRUGALWARE_TRUE@am__objects_8 = libnmbackend_la-NetworkManagerFrugalware.lo -@TARGET_MANDRIVA_TRUE@am__objects_9 = libnmbackend_la-NetworkManagerMandriva.lo -@TARGET_PARDUS_TRUE@am__objects_10 = \ -@TARGET_PARDUS_TRUE@ libnmbackend_la-NetworkManagerPardus.lo -@TARGET_LINEXA_TRUE@am__objects_11 = \ -@TARGET_LINEXA_TRUE@ libnmbackend_la-NetworkManagerLinexa.lo -@TARGET_EXHERBO_TRUE@am__objects_12 = \ -@TARGET_EXHERBO_TRUE@ libnmbackend_la-NetworkManagerExherbo.lo -@TARGET_LFS_TRUE@am__objects_13 = \ -@TARGET_LFS_TRUE@ libnmbackend_la-NetworkManagerLFS.lo -am_libnmbackend_la_OBJECTS = libnmbackend_la-NetworkManagerGeneric.lo \ - $(am__objects_1) $(am__objects_2) $(am__objects_3) \ - $(am__objects_4) $(am__objects_5) $(am__objects_6) \ - $(am__objects_7) $(am__objects_8) $(am__objects_9) \ - $(am__objects_10) $(am__objects_11) $(am__objects_12) \ - $(am__objects_13) -libnmbackend_la_OBJECTS = $(am_libnmbackend_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -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_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -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_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(libnmbackend_la_SOURCES) -DIST_SOURCES = $(am__libnmbackend_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 -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -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@ -IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ -IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBDL = @LIBDL@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNL1_CFLAGS = @LIBNL1_CFLAGS@ -LIBNL1_LIBS = @LIBNL1_LIBS@ -LIBNL2_CFLAGS = @LIBNL2_CFLAGS@ -LIBNL2_LIBS = @LIBNL2_LIBS@ -LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ -LIBNL3_LIBS = @LIBNL3_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -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@ -PKGCONFIG_PATH = @PKGCONFIG_PATH@ -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_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -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@ -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@ -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@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -INCLUDES = \ - -I${top_srcdir} \ - -I${top_srcdir}/src/logging \ - -I${top_srcdir}/include \ - -I${top_builddir}/include \ - -I${top_srcdir}/src \ - -I${top_srcdir}/libnm-util - -noinst_LTLIBRARIES = libnmbackend.la -libnmbackend_la_SOURCES = NetworkManagerGeneric.c \ - NetworkManagerGeneric.h nm-backend.h $(am__append_1) \ - $(am__append_2) $(am__append_3) $(am__append_4) \ - $(am__append_5) $(am__append_6) $(am__append_7) \ - $(am__append_8) $(am__append_10) $(am__append_11) \ - $(am__append_12) $(am__append_13) $(am__append_14) -libnmbackend_la_LIBADD = $(am__append_9) \ - $(top_builddir)/src/logging/libnm-logging.la $(LIBNL_LIBS) \ - $(DBUS_LIBS) $(GLIB_LIBS) -libnmbackend_la_CPPFLAGS = \ - $(LIBNL_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ - -DBINDIR=\"$(bindir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" - -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/backends/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/backends/Makefile -.PRECIOUS: 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): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libnmbackend.la: $(libnmbackend_la_OBJECTS) $(libnmbackend_la_DEPENDENCIES) $(EXTRA_libnmbackend_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libnmbackend_la_OBJECTS) $(libnmbackend_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerArch.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerDebian.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerExherbo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerFrugalware.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerGeneric.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerGentoo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerLinexa.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerMandriva.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerPaldo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerPardus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerRedHat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerSlackware.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerSuSE.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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 $@ $< - -libnmbackend_la-NetworkManagerGeneric.lo: NetworkManagerGeneric.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerGeneric.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerGeneric.Tpo -c -o libnmbackend_la-NetworkManagerGeneric.lo `test -f 'NetworkManagerGeneric.c' || echo '$(srcdir)/'`NetworkManagerGeneric.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerGeneric.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerGeneric.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerGeneric.c' object='libnmbackend_la-NetworkManagerGeneric.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerGeneric.lo `test -f 'NetworkManagerGeneric.c' || echo '$(srcdir)/'`NetworkManagerGeneric.c - -libnmbackend_la-NetworkManagerRedHat.lo: NetworkManagerRedHat.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerRedHat.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerRedHat.Tpo -c -o libnmbackend_la-NetworkManagerRedHat.lo `test -f 'NetworkManagerRedHat.c' || echo '$(srcdir)/'`NetworkManagerRedHat.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerRedHat.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerRedHat.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerRedHat.c' object='libnmbackend_la-NetworkManagerRedHat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerRedHat.lo `test -f 'NetworkManagerRedHat.c' || echo '$(srcdir)/'`NetworkManagerRedHat.c - -libnmbackend_la-NetworkManagerSuSE.lo: NetworkManagerSuSE.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerSuSE.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerSuSE.Tpo -c -o libnmbackend_la-NetworkManagerSuSE.lo `test -f 'NetworkManagerSuSE.c' || echo '$(srcdir)/'`NetworkManagerSuSE.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerSuSE.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerSuSE.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerSuSE.c' object='libnmbackend_la-NetworkManagerSuSE.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerSuSE.lo `test -f 'NetworkManagerSuSE.c' || echo '$(srcdir)/'`NetworkManagerSuSE.c - -libnmbackend_la-NetworkManagerGentoo.lo: NetworkManagerGentoo.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerGentoo.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerGentoo.Tpo -c -o libnmbackend_la-NetworkManagerGentoo.lo `test -f 'NetworkManagerGentoo.c' || echo '$(srcdir)/'`NetworkManagerGentoo.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerGentoo.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerGentoo.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerGentoo.c' object='libnmbackend_la-NetworkManagerGentoo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerGentoo.lo `test -f 'NetworkManagerGentoo.c' || echo '$(srcdir)/'`NetworkManagerGentoo.c - -libnmbackend_la-NetworkManagerDebian.lo: NetworkManagerDebian.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerDebian.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerDebian.Tpo -c -o libnmbackend_la-NetworkManagerDebian.lo `test -f 'NetworkManagerDebian.c' || echo '$(srcdir)/'`NetworkManagerDebian.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerDebian.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerDebian.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerDebian.c' object='libnmbackend_la-NetworkManagerDebian.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerDebian.lo `test -f 'NetworkManagerDebian.c' || echo '$(srcdir)/'`NetworkManagerDebian.c - -libnmbackend_la-NetworkManagerSlackware.lo: NetworkManagerSlackware.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerSlackware.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerSlackware.Tpo -c -o libnmbackend_la-NetworkManagerSlackware.lo `test -f 'NetworkManagerSlackware.c' || echo '$(srcdir)/'`NetworkManagerSlackware.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerSlackware.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerSlackware.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerSlackware.c' object='libnmbackend_la-NetworkManagerSlackware.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerSlackware.lo `test -f 'NetworkManagerSlackware.c' || echo '$(srcdir)/'`NetworkManagerSlackware.c - -libnmbackend_la-NetworkManagerArch.lo: NetworkManagerArch.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerArch.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerArch.Tpo -c -o libnmbackend_la-NetworkManagerArch.lo `test -f 'NetworkManagerArch.c' || echo '$(srcdir)/'`NetworkManagerArch.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerArch.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerArch.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerArch.c' object='libnmbackend_la-NetworkManagerArch.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerArch.lo `test -f 'NetworkManagerArch.c' || echo '$(srcdir)/'`NetworkManagerArch.c - -libnmbackend_la-NetworkManagerPaldo.lo: NetworkManagerPaldo.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerPaldo.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerPaldo.Tpo -c -o libnmbackend_la-NetworkManagerPaldo.lo `test -f 'NetworkManagerPaldo.c' || echo '$(srcdir)/'`NetworkManagerPaldo.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerPaldo.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerPaldo.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerPaldo.c' object='libnmbackend_la-NetworkManagerPaldo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerPaldo.lo `test -f 'NetworkManagerPaldo.c' || echo '$(srcdir)/'`NetworkManagerPaldo.c - -libnmbackend_la-NetworkManagerFrugalware.lo: NetworkManagerFrugalware.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerFrugalware.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerFrugalware.Tpo -c -o libnmbackend_la-NetworkManagerFrugalware.lo `test -f 'NetworkManagerFrugalware.c' || echo '$(srcdir)/'`NetworkManagerFrugalware.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerFrugalware.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerFrugalware.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerFrugalware.c' object='libnmbackend_la-NetworkManagerFrugalware.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerFrugalware.lo `test -f 'NetworkManagerFrugalware.c' || echo '$(srcdir)/'`NetworkManagerFrugalware.c - -libnmbackend_la-NetworkManagerMandriva.lo: NetworkManagerMandriva.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerMandriva.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerMandriva.Tpo -c -o libnmbackend_la-NetworkManagerMandriva.lo `test -f 'NetworkManagerMandriva.c' || echo '$(srcdir)/'`NetworkManagerMandriva.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerMandriva.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerMandriva.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerMandriva.c' object='libnmbackend_la-NetworkManagerMandriva.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerMandriva.lo `test -f 'NetworkManagerMandriva.c' || echo '$(srcdir)/'`NetworkManagerMandriva.c - -libnmbackend_la-NetworkManagerPardus.lo: NetworkManagerPardus.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerPardus.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerPardus.Tpo -c -o libnmbackend_la-NetworkManagerPardus.lo `test -f 'NetworkManagerPardus.c' || echo '$(srcdir)/'`NetworkManagerPardus.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerPardus.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerPardus.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerPardus.c' object='libnmbackend_la-NetworkManagerPardus.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerPardus.lo `test -f 'NetworkManagerPardus.c' || echo '$(srcdir)/'`NetworkManagerPardus.c - -libnmbackend_la-NetworkManagerLinexa.lo: NetworkManagerLinexa.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerLinexa.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerLinexa.Tpo -c -o libnmbackend_la-NetworkManagerLinexa.lo `test -f 'NetworkManagerLinexa.c' || echo '$(srcdir)/'`NetworkManagerLinexa.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerLinexa.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerLinexa.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerLinexa.c' object='libnmbackend_la-NetworkManagerLinexa.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerLinexa.lo `test -f 'NetworkManagerLinexa.c' || echo '$(srcdir)/'`NetworkManagerLinexa.c - -libnmbackend_la-NetworkManagerExherbo.lo: NetworkManagerExherbo.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerExherbo.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerExherbo.Tpo -c -o libnmbackend_la-NetworkManagerExherbo.lo `test -f 'NetworkManagerExherbo.c' || echo '$(srcdir)/'`NetworkManagerExherbo.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerExherbo.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerExherbo.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerExherbo.c' object='libnmbackend_la-NetworkManagerExherbo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerExherbo.lo `test -f 'NetworkManagerExherbo.c' || echo '$(srcdir)/'`NetworkManagerExherbo.c - -libnmbackend_la-NetworkManagerLFS.lo: NetworkManagerLFS.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerLFS.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Tpo -c -o libnmbackend_la-NetworkManagerLFS.lo `test -f 'NetworkManagerLFS.c' || echo '$(srcdir)/'`NetworkManagerLFS.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='NetworkManagerLFS.c' object='libnmbackend_la-NetworkManagerLFS.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerLFS.lo `test -f 'NetworkManagerLFS.c' || echo '$(srcdir)/'`NetworkManagerLFS.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - 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 -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - 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" - -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: -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-noinstLTLIBRARIES \ - 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-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: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags 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-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 uninstall uninstall-am - - -# 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/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c deleted file mode 100644 index 7e25ee37a..000000000 --- a/src/backends/NetworkManagerArch.c +++ /dev/null @@ -1,60 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Backend implementation for the Arch Linux distribution http://www.archlinux.org - * - * Tor Krill <tor@krill.nu> and Will Rea <sillywilly@gmail.com> - * - * Updated by Wael Nasreddine <gandalf@siemens-mobiles.org> - * - * Updated by Valentine Sinitsyn <e_val@inbox.ru> - * - * Heavily based on NetworkManagerDebian.c by Matthew Garrett <mjg59@srcf.ucam.org> - * - * Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 Tom Parker - * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 - 2012 Red Hat, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd; check if the daemon was already running - do not - * start a new instance - */ - if (g_file_test("/var/run/daemons/nscd", G_FILE_TEST_EXISTS)) - nm_spawn_process ("/etc/rc.d/nscd restart"); -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c deleted file mode 100644 index ed29dd3a0..000000000 --- a/src/backends/NetworkManagerDebian.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * Matthew Garrett <mjg59@srcf.ucam.org> - * - * Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 Tom Parker - * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 - 2012 Red Hat, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" - -void nm_backend_enable_loopback (void) -{ - /* ifupdown isn't always installed (bgo #625427) */ - if (g_file_test ("/sbin/ifup", G_FILE_TEST_EXISTS)) - nm_spawn_process ("/sbin/ifup lo"); - else - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Invalidate the nscd host cache since we changed resolv.conf */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerExherbo.c b/src/backends/NetworkManagerExherbo.c deleted file mode 100644 index d02778969..000000000 --- a/src/backends/NetworkManagerExherbo.c +++ /dev/null @@ -1,54 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Dan Williams <dcbw@redhat.com> - * Dan Willemsen <dan@willemsen.us> - * Robert Paskowitz - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - * (C) Copyright 2004 Dan Willemsen - * (C) Copyright 2004 Robert Paskowitz - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. Only restart if already running. - */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerFrugalware.c b/src/backends/NetworkManagerFrugalware.c deleted file mode 100644 index 301751e90..000000000 --- a/src/backends/NetworkManagerFrugalware.c +++ /dev/null @@ -1,43 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Implementation for the Frugalware Linux distro - http://www.frugalware.org - * - * Alex Smith <alex.extreme2@gmail.com> - * - * Based on NetworkManagerSlackware.c by Narayan Newton <narayan_newton@yahoo.com> - * - * 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. - * - * (C) Copyright 2006 Alex Smith - */ - -/* Provided by the frugalwareutils package on Frugalware */ -#include <libfwnetconfig.h> - -void nm_backend_enable_loopback (void) -{ - fwnet_loup (); -} - -void nm_backend_update_dns (void) -{ - /* I'm not running nscd */ -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerGeneric.c b/src/backends/NetworkManagerGeneric.c deleted file mode 100644 index eae6f733d..000000000 --- a/src/backends/NetworkManagerGeneric.c +++ /dev/null @@ -1,177 +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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - * (C) Copyright 2006 Timothee Lecomte <timothee.lecomte@ens.fr> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <errno.h> -#include <stdio.h> -#include <sys/types.h> -#include <signal.h> -#include <arpa/inet.h> -#include <string.h> - -#include "NetworkManagerGeneric.h" -#include "nm-system.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" -#include "nm-netlink-compat.h" -#include "nm-netlink-monitor.h" -#include "nm-netlink-utils.h" - -/* Because of a bug in libnl, rtnl.h should be included before route.h */ -#include <netlink/route/rtnl.h> - -#include <netlink/route/addr.h> -#include <netlink/netlink.h> - -/* - * nm_generic_enable_loopback - * - * Bring up the loopback interface - * - */ -void nm_generic_enable_loopback (void) -{ - struct nl_sock * nlh = NULL; - struct rtnl_addr * addr = NULL; - struct nl_addr * nl_addr = NULL; - guint32 binaddr = 0; - int iface_idx = -1; - int err; - - nlh = nm_netlink_get_default_handle (); - if (!nlh) - return; - - iface_idx = nm_netlink_iface_to_index ("lo"); - if (iface_idx < 0) - return; - - nm_system_iface_set_up (iface_idx, TRUE, NULL); - - addr = rtnl_addr_alloc (); - if (!addr) - return; - - binaddr = htonl (0x7f000001); /* 127.0.0.1 */ - nl_addr = nl_addr_build (AF_INET, &binaddr, sizeof(binaddr)); - if (!nl_addr) - goto out; - rtnl_addr_set_local (addr, nl_addr); - nl_addr_put (nl_addr); - - binaddr = htonl (0x7fffffff); /* 127.255.255.255 */ - nl_addr = nl_addr_build (AF_INET, &binaddr, sizeof(binaddr)); - if (!nl_addr) - goto out; - rtnl_addr_set_broadcast (addr, nl_addr); - nl_addr_put (nl_addr); - - rtnl_addr_set_prefixlen (addr, 8); - rtnl_addr_set_ifindex (addr, iface_idx); - rtnl_addr_set_scope (addr, RT_SCOPE_HOST); - rtnl_addr_set_label (addr, "lo"); - - err = rtnl_addr_add (nlh, addr, 0); - if (err && (err != -NLE_EXIST)) { - nm_log_warn (LOGD_CORE, "error setting loopback address: (%d) %s", - err, nl_geterror (err)); - } -out: - if (addr) - rtnl_addr_put (addr); -} - -/* - * nm_generic_update_dns - * - * Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. - * - */ -void nm_generic_update_dns (void) -{ -} - -/* - * nm_generic_ipv6_use_tempaddr - * - * Get net.ipv6.conf.default.use_tempaddr value from /etc/sysctl.conf or - * /lib/sysctl.d/sysctl.conf - * - */ -int nm_generic_ipv6_use_tempaddr (void) -{ - char *contents = NULL; - gsize len = 0; - const char *group_name = "[forged_group]\n"; - char *sysctl_data = NULL; - GKeyFile *keyfile; - GError *error = NULL; - int tmp, ret = -1; - - /* Read file contents to a string. */ - if (!g_file_get_contents ("/etc/sysctl.conf", &contents, &len, NULL)) - if (!g_file_get_contents ("/lib/sysctl.d/sysctl.conf", &contents, &len, NULL)) - return -1; - - /* Prepend a group so that we can use GKeyFile parser. */ - sysctl_data = g_strdup_printf ("%s%s", group_name, contents); - - keyfile = g_key_file_new (); - if (keyfile == NULL) - goto done; - - if (!g_key_file_load_from_data (keyfile, sysctl_data, len + strlen (group_name), G_KEY_FILE_NONE, NULL)) - goto done; - - tmp = g_key_file_get_integer (keyfile, "forged_group", "net.ipv6.conf.default.use_tempaddr", &error); - if (error == NULL) - ret = tmp; - -done: - g_free (contents); - g_free (sysctl_data); - g_clear_error (&error); - g_key_file_free (keyfile); - - return ret; -} - -#ifdef TARGET_GENERIC -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - nm_generic_update_dns (); -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} -#endif - diff --git a/src/backends/NetworkManagerGeneric.h b/src/backends/NetworkManagerGeneric.h deleted file mode 100644 index 3d4017e45..000000000 --- a/src/backends/NetworkManagerGeneric.h +++ /dev/null @@ -1,33 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Timothee Lecomte <timothee.lecomte@ens.fr> - * - * Heavily based on NetworkManagerSystem.h by Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - */ - -#ifndef NM_GENERIC_H -#define NM_GENERIC_H - -#include "nm-backend.h" - -void nm_generic_enable_loopback (void); -void nm_generic_update_dns (void); -int nm_generic_ipv6_use_tempaddr (void); - -#endif /* NM_GENERIC_H */ diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c deleted file mode 100644 index 7370645a4..000000000 --- a/src/backends/NetworkManagerGentoo.c +++ /dev/null @@ -1,82 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Dan Williams <dcbw@redhat.com> - * Dan Willemsen <dan@willemsen.us> - * Robert Paskowitz - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - * (C) Copyright 2004 Dan Willemsen - * (C) Copyright 2004 Robert Paskowitz - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" - -static void openrc_start_lo_if_necessary() -{ - /* No need to run net.lo if it is already running */ - if (nm_spawn_process ("/etc/init.d/net.lo status") != 0) - nm_spawn_process ("/etc/init.d/net.lo start"); -} - -void nm_backend_enable_loopback (void) -{ - gchar *comm; - - /* If anything goes wrong trying to open /proc/1/comm, we will assume OpenRC */ - if (!g_file_get_contents ("/proc/1/comm", &comm, NULL, NULL)) { - nm_log_info (LOGD_CORE, "NetworkManager is running with OpenRC..."); - openrc_start_lo_if_necessary (); - return; - } - - if (g_strstr_len (comm, -1, "systemd")) { - /* We use the generic loopback enabler if using systemd. */ - nm_log_info (LOGD_CORE, "NetworkManager is running with systemd..."); - nm_generic_enable_loopback (); - } else { - /* OpenRC otherwise. */ - nm_log_info (LOGD_CORE, "NetworkManager is running with OpenRC..."); - openrc_start_lo_if_necessary(); - } - - g_free (comm); -} - -void nm_backend_update_dns (void) -{ - /* Make glibc/nscd aware of any changes to the resolv.conf file by - * restarting nscd. Only restart if already running. - */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerLFS.c b/src/backends/NetworkManagerLFS.c deleted file mode 100644 index 7df2031cf..000000000 --- a/src/backends/NetworkManagerLFS.c +++ /dev/null @@ -1,50 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Backend implementation for the Linux From Scratch http://www.linuxfromscratch.org/ - * - * Wayne Blaszczyk <wblaszcz@bigpond.net.au> - * Armin K. <krejzi@email.com> - * - * Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 Tom Parker - * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 - 2012 Red Hat, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - if (g_file_test("/var/run/nscd/nscd.pid", G_FILE_TEST_EXISTS)) - nm_spawn_process ("/usr/sbin/nscd -i hosts"); -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} diff --git a/src/backends/NetworkManagerLinexa.c b/src/backends/NetworkManagerLinexa.c deleted file mode 100644 index 34fed3bbb..000000000 --- a/src/backends/NetworkManagerLinexa.c +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager -- Network link manager - * - * Matthew Garrett <mjg59@srcf.ucam.org> - * - * Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 Tom Parker - * (C) Copyright 2004 Matthew Garrett - * (C) Copyright 2004 - 2012 Red Hat, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerMandriva.c b/src/backends/NetworkManagerMandriva.c deleted file mode 100644 index f059beb65..000000000 --- a/src/backends/NetworkManagerMandriva.c +++ /dev/null @@ -1,49 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Dan Williams <dcbw@redhat.com> - * Per Øyvind Karlsen <peroyvind@mandriva.org> - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - * (C) Copyright 2008 Per Øyvind Karlsen - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_REGULAR)) { - nm_spawn_process ("/etc/init.d/nscd condrestart"); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerPaldo.c b/src/backends/NetworkManagerPaldo.c deleted file mode 100644 index 2d01d8577..000000000 --- a/src/backends/NetworkManagerPaldo.c +++ /dev/null @@ -1,51 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Jürg Billeter <juerg@paldo.org> - * - * Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - * (C) Copyright 2006 Jürg Billeter - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerPardus.c b/src/backends/NetworkManagerPardus.c deleted file mode 100644 index acfeaed38..000000000 --- a/src/backends/NetworkManagerPardus.c +++ /dev/null @@ -1,42 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Ozan Caglayan <ozan@pardus.org.tr> - * - * 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. - * - * (C) Copyright 2004 - 2012 RedHat, Inc. - * (C) Copyright 2009 TUBITAK/UEKAE - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c deleted file mode 100644 index 843b03b20..000000000 --- a/src/backends/NetworkManagerRedHat.c +++ /dev/null @@ -1,51 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Dan Williams <dcbw@redhat.com> - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Invalidate the nscd host cache since we changed resolv.conf */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_REGULAR)) { - if (g_file_test ("/etc/init.d/nscd", G_FILE_TEST_EXISTS)) - nm_spawn_process ("/etc/init.d/nscd condrestart"); - else if (g_file_test ("/bin/systemctl", G_FILE_TEST_IS_EXECUTABLE)) - nm_spawn_process ("/bin/systemctl condrestart nscd.service"); - - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c deleted file mode 100644 index cdd2dfb07..000000000 --- a/src/backends/NetworkManagerSlackware.c +++ /dev/null @@ -1,42 +0,0 @@ -/* NetworkManager -- Network link manager - * - * Narayan Newton <narayan_newton@yahoo.com> - * - * 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. - * - * (C) Copyright 2004 - 2012 RedHat, Inc. - * (C) Copyright 2004 Narayan Newton - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c deleted file mode 100644 index 126185320..000000000 --- a/src/backends/NetworkManagerSuSE.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * NetworkManager -- Network link manager - * - * Dan Williams <dcbw@redhat.com> - * Kay Sievers <kay.sievers@suse.de> - * Robert Love <rml@novell.com> - * - * 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. - * - * (C) Copyright 2004 - 2012 Red Hat, Inc. - * (C) Copyright 2005-2006 SuSE GmbH - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "NetworkManagerGeneric.h" -#include "NetworkManagerUtils.h" -#include "nm-logging.h" - -void nm_backend_enable_loopback (void) -{ - nm_generic_enable_loopback (); -} - -void nm_backend_update_dns (void) -{ - /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ - if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { - nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); - nm_spawn_process ("/usr/sbin/nscd -i hosts"); - } -} - -int nm_backend_ipv6_use_tempaddr (void) -{ - return nm_generic_ipv6_use_tempaddr (); -} - diff --git a/src/bluez-manager/Makefile.am b/src/bluez-manager/Makefile.am index 63c6d3def..7e7ed9a02 100644 --- a/src/bluez-manager/Makefile.am +++ b/src/bluez-manager/Makefile.am @@ -24,7 +24,6 @@ libbluez_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ $(BLUEZ_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DBINDIR=\"$(bindir)\" \ -DDATADIR=\"$(datadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ diff --git a/src/bluez-manager/Makefile.in b/src/bluez-manager/Makefile.in index dfd62f462..f80f8cb0a 100644 --- a/src/bluez-manager/Makefile.in +++ b/src/bluez-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/bluez-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -133,6 +135,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -147,9 +153,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -159,17 +163,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -210,6 +211,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -226,11 +228,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -245,6 +243,8 @@ 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@ @@ -254,6 +254,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -280,13 +281,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -341,6 +343,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -355,6 +362,10 @@ 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@ INCLUDES = \ -I${top_srcdir} \ -I${top_builddir}/include \ @@ -380,7 +391,6 @@ libbluez_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ $(BLUEZ_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DBINDIR=\"$(bindir)\" \ -DDATADIR=\"$(datadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ @@ -451,25 +461,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbluez_manager_la-nm-bluez-manager.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/dhcp-manager/Makefile.am b/src/dhcp-manager/Makefile.am index 602867039..04ae14894 100644 --- a/src/dhcp-manager/Makefile.am +++ b/src/dhcp-manager/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I${top_srcdir} \ @@ -25,12 +25,12 @@ libdhcp_dhclient_la_SOURCES = \ libdhcp_dhclient_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ -DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \ - -DDHCLIENT_V$(DHCLIENT_VERSION) + -DNMSTATEDIR=\"$(nmstatedir)\" \ + -DNMCONFDIR=\"$(nmconfdir)\" libdhcp_dhclient_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ @@ -52,11 +52,11 @@ libdhcp_manager_la_SOURCES = \ libdhcp_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ -DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \ - -DDHCPCD_PATH=\"$(DHCPCD_PATH)\" + -DDHCPCD_PATH=\"$(DHCPCD_PATH)\" \ + -DNMSTATEDIR=\"$(nmstatedir)\" libdhcp_manager_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ diff --git a/src/dhcp-manager/Makefile.in b/src/dhcp-manager/Makefile.in index f7ed43f0a..f161c2105 100644 --- a/src/dhcp-manager/Makefile.in +++ b/src/dhcp-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/dhcp-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -181,6 +183,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -195,9 +201,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -207,17 +211,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -258,6 +259,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -274,11 +276,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -293,6 +291,8 @@ 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@ @@ -302,6 +302,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -328,13 +329,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -389,6 +391,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -403,6 +410,10 @@ 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@ SUBDIRS = . tests INCLUDES = \ -I${top_srcdir} \ @@ -428,12 +439,12 @@ libdhcp_dhclient_la_SOURCES = \ libdhcp_dhclient_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ -DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \ - -DDHCLIENT_V$(DHCLIENT_VERSION) + -DNMSTATEDIR=\"$(nmstatedir)\" \ + -DNMCONFDIR=\"$(nmconfdir)\" libdhcp_dhclient_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ @@ -455,11 +466,11 @@ libdhcp_manager_la_SOURCES = \ libdhcp_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ -DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \ - -DDHCPCD_PATH=\"$(DHCPCD_PATH)\" + -DDHCPCD_PATH=\"$(DHCPCD_PATH)\" \ + -DNMSTATEDIR=\"$(nmstatedir)\" libdhcp_manager_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ @@ -529,25 +540,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdhcp_manager_la-nm-dhcp-manager.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c index ea4084ac1..f721adf5b 100644 --- a/src/dhcp-manager/nm-dhcp-client.c +++ b/src/dhcp-manager/nm-dhcp-client.c @@ -18,7 +18,6 @@ */ #include <config.h> -#include <ctype.h> #include <glib.h> #include <string.h> #include <sys/types.h> @@ -183,7 +182,7 @@ nm_dhcp_client_stop_pid (GPid pid, const char *iface, guint timeout_secs) } static void -real_stop (NMDHCPClient *self, gboolean release) +stop (NMDHCPClient *self, gboolean release) { NMDHCPClientPrivate *priv; @@ -886,7 +885,7 @@ ip4_process_classless_routes (GHashTable *options, p = str; while (*p) { - if (!isdigit (*p) && (*p != ' ') && (*p != '.') && (*p != '/')) { + if (!g_ascii_isdigit (*p) && (*p != ' ') && (*p != '.') && (*p != '/')) { nm_log_warn (LOGD_DHCP4, "ignoring invalid classless static routes '%s'", str); return FALSE; } @@ -1399,7 +1398,7 @@ nm_dhcp_client_class_init (NMDHCPClientClass *client_class) object_class->get_property = get_property; object_class->set_property = set_property; - client_class->stop = real_stop; + client_class->stop = stop; g_object_class_install_property (object_class, PROP_IFACE, diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.c b/src/dhcp-manager/nm-dhcp-dhclient-utils.c index ab49a7651..f3d3b1b6c 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.c +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.c @@ -22,7 +22,6 @@ #include <glib.h> #include <glib/gi18n.h> #include <string.h> -#include <ctype.h> #include "nm-dhcp-dhclient-utils.h" @@ -30,8 +29,11 @@ #define CLIENTID_FORMAT CLIENTID_TAG " \"%s\"; # added by NetworkManager" #define CLIENTID_FORMAT_OCTETS CLIENTID_TAG " %s; # added by NetworkManager" -#define HOSTNAME_TAG "send host-name" -#define HOSTNAME_FORMAT HOSTNAME_TAG " \"%s\"; # added by NetworkManager" +#define HOSTNAME4_TAG "send host-name" +#define HOSTNAME4_FORMAT HOSTNAME4_TAG " \"%s\"; # added by NetworkManager" + +#define HOSTNAME6_TAG "send fqdn.fqdn" +#define HOSTNAME6_FORMAT HOSTNAME6_TAG " \"%s\"; # added by NetworkManager" #define ALSOREQ_TAG "also request " @@ -47,9 +49,83 @@ add_also_request (GPtrArray *array, const char *item) g_ptr_array_add (array, g_strdup (item)); } +static void +add_hostname (GString *str, const char *format, const char *hostname) +{ + char *plain_hostname, *dot; + + if (hostname) { + plain_hostname = g_strdup (hostname); + dot = strchr (plain_hostname, '.'); + /* get rid of the domain */ + if (dot) + *dot = '\0'; + + g_string_append_printf (str, format, plain_hostname); + g_free (plain_hostname); + } +} + +static void +add_ip4_config (GString *str, NMSettingIP4Config *s_ip4, const char *hostname) +{ + if (s_ip4) { + const char *tmp; + + tmp = nm_setting_ip4_config_get_dhcp_client_id (s_ip4); + if (tmp) { + gboolean is_octets = TRUE; + const char *p = tmp; + + while (*p) { + if (!g_ascii_isxdigit (*p) && (*p != ':')) { + is_octets = FALSE; + break; + } + p++; + } + + /* If the client ID is just hex digits and : then don't use quotes, + * because dhclient expects either a quoted ASCII string, or a byte + * array formated as hex octets separated by : + */ + if (is_octets) + g_string_append_printf (str, CLIENTID_FORMAT_OCTETS "\n", tmp); + else + g_string_append_printf (str, CLIENTID_FORMAT "\n", tmp); + } + } + + add_hostname (str, HOSTNAME4_FORMAT "\n", hostname); + + g_string_append_c (str, '\n'); + + /* Define options for classless static routes */ + g_string_append (str, + "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n"); + g_string_append (str, + "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n"); + /* Web Proxy Auto-Discovery option (bgo #368423) */ + g_string_append (str, "option wpad code 252 = string;\n"); + + g_string_append_c (str, '\n'); +} + +static void +add_ip6_config (GString *str, NMSettingIP6Config *s_ip6, const char *hostname) +{ + add_hostname (str, HOSTNAME6_FORMAT "\n", hostname); + g_string_append (str, + "send fqdn.encoded on;\n" + "send fqdn.no-client-update on;\n" + "send fqdn.server-update on;\n"); +} + char * nm_dhcp_dhclient_create_config (const char *interface, + gboolean is_ip6, NMSettingIP4Config *s_ip4, + NMSettingIP6Config *s_ip6, guint8 *anycast_addr, const char *hostname, const char *orig_path, @@ -84,8 +160,12 @@ nm_dhcp_dhclient_create_config (const char *interface, continue; /* Override config file hostname and use one from the connection */ - if (hostname && !strncmp (p, HOSTNAME_TAG, strlen (HOSTNAME_TAG))) - continue; + if (hostname) { + if (strncmp (p, HOSTNAME4_TAG, strlen (HOSTNAME4_TAG)) == 0) + continue; + if (strncmp (p, HOSTNAME6_TAG, strlen (HOSTNAME6_TAG)) == 0) + continue; + } /* Check for "also require" */ if (!strncmp (p, ALSOREQ_TAG, strlen (ALSOREQ_TAG))) { @@ -108,7 +188,7 @@ nm_dhcp_dhclient_create_config (const char *interface, break; } - if (!isalnum ((*aiter)[0])) + if (!g_ascii_isalnum ((*aiter)[0])) continue; if ((*aiter)[strlen (*aiter) - 1] == ';') { @@ -136,71 +216,20 @@ nm_dhcp_dhclient_create_config (const char *interface, } else g_string_append_c (new_contents, '\n'); - /* Add NM options from connection */ - if (s_ip4) { - const char *tmp; - gboolean added = FALSE; - - tmp = nm_setting_ip4_config_get_dhcp_client_id (s_ip4); - if (tmp) { - gboolean is_octets = TRUE; - const char *p = tmp; - - while (*p) { - if (!isxdigit (*p) && (*p != ':')) { - is_octets = FALSE; - break; - } - p++; - } - - /* If the client ID is just hex digits and : then don't use quotes, - * because dhclient expects either a quoted ASCII string, or a byte - * array formated as hex octets separated by : - */ - if (is_octets) - g_string_append_printf (new_contents, CLIENTID_FORMAT_OCTETS "\n", tmp); - else - g_string_append_printf (new_contents, CLIENTID_FORMAT "\n", tmp); - added = TRUE; - } - - if (hostname) { - char *plain_hostname, *dot; - - plain_hostname = g_strdup (hostname); - dot = strchr (plain_hostname, '.'); - - /* get rid of the domain */ - if (dot) - *dot = '\0'; - - g_string_append_printf (new_contents, HOSTNAME_FORMAT "\n", plain_hostname); - added = TRUE; - - g_free (plain_hostname); - } - - if (added) - g_string_append_c (new_contents, '\n'); + if (is_ip6) { + add_ip6_config (new_contents, s_ip6, hostname); + add_also_request (alsoreq, "dhcp6.name-servers"); + add_also_request (alsoreq, "dhcp6.domain-search"); + add_also_request (alsoreq, "dhcp6.client-id"); + add_also_request (alsoreq, "dhcp6.server-id"); + } else { + add_ip4_config (new_contents, s_ip4, hostname); + add_also_request (alsoreq, "rfc3442-classless-static-routes"); + add_also_request (alsoreq, "ms-classless-static-routes"); + add_also_request (alsoreq, "wpad"); + add_also_request (alsoreq, "ntp-servers"); } - /* Define options for classless static routes */ - g_string_append (new_contents, - "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n"); - g_string_append (new_contents, - "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n"); - /* Web Proxy Auto-Discovery option (bgo #368423) */ - g_string_append (new_contents, "option wpad code 252 = string;\n"); - - g_string_append_c (new_contents, '\n'); - - /* Everything we want to request from the DHCP server */ - add_also_request (alsoreq, "rfc3442-classless-static-routes"); - add_also_request (alsoreq, "ms-classless-static-routes"); - add_also_request (alsoreq, "wpad"); - add_also_request (alsoreq, "ntp-servers"); - /* And add it to the dhclient configuration */ for (i = 0; i < alsoreq->len; i++) { char *t = g_ptr_array_index (alsoreq, i); diff --git a/src/dhcp-manager/nm-dhcp-dhclient-utils.h b/src/dhcp-manager/nm-dhcp-dhclient-utils.h index 77def5518..2f9f7c454 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient-utils.h +++ b/src/dhcp-manager/nm-dhcp-dhclient-utils.h @@ -23,9 +23,12 @@ #include <glib-object.h> #include <nm-setting-ip4-config.h> +#include <nm-setting-ip6-config.h> char *nm_dhcp_dhclient_create_config (const char *interface, + gboolean is_ip6, NMSettingIP4Config *s_ip4, + NMSettingIP6Config *s_ip6, guint8 *anycast_addr, const char *hostname, const char *orig_path, diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c index 043cd63de..347d97c4f 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient.c +++ b/src/dhcp-manager/nm-dhcp-dhclient.c @@ -32,7 +32,6 @@ #include <stdio.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <ctype.h> #include <config.h> @@ -46,16 +45,6 @@ G_DEFINE_TYPE (NMDHCPDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT) #define NM_DHCP_DHCLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_DHCLIENT, NMDHCPDhclientPrivate)) -#if defined(TARGET_DEBIAN) || defined(TARGET_SUSE) || defined(TARGET_MANDRIVA) -#if defined(DHCLIENT_V3) -#define NM_DHCLIENT_LEASE_DIR LOCALSTATEDIR "/lib/dhcp3" -#else -#define NM_DHCLIENT_LEASE_DIR LOCALSTATEDIR "/lib/dhcp" -#endif -#else -#define NM_DHCLIENT_LEASE_DIR LOCALSTATEDIR "/lib/dhclient" -#endif - #define ACTION_SCRIPT_PATH LIBEXECDIR "/nm-dhcp-client.action" typedef struct { @@ -90,10 +79,9 @@ nm_dhcp_dhclient_get_path (const char *try_first) } static char * -get_leasefile_for_iface (const char * iface, const char *uuid, gboolean ipv6) +get_dhclient_leasefile (const char * iface, const char *uuid, gboolean ipv6) { - return g_strdup_printf ("%s/dhclient%s-%s-%s.lease", - NM_DHCLIENT_LEASE_DIR, + return g_strdup_printf (NMSTATEDIR "/dhclient%s-%s-%s.lease", ipv6 ? "6" : "", uuid, iface); @@ -140,7 +128,7 @@ add_lease_option (GHashTable *hash, char *line) } GSList * -nm_dhcp_dhclient_get_lease_config (const char *iface, const char *uuid) +nm_dhcp_dhclient_get_lease_config (const char *iface, const char *uuid, gboolean ipv6) { GSList *parsed = NULL, *iter, *leases = NULL; char *contents = NULL; @@ -148,7 +136,11 @@ nm_dhcp_dhclient_get_lease_config (const char *iface, const char *uuid) char **line, **split = NULL; GHashTable *hash = NULL; - leasefile = get_leasefile_for_iface (iface, uuid, FALSE); + /* IPv6 not supported */ + if (ipv6) + return NULL; + + leasefile = get_dhclient_leasefile (iface, uuid, FALSE); if (!leasefile) return NULL; @@ -308,7 +300,9 @@ out: static gboolean merge_dhclient_config (const char *iface, const char *conf_file, + gboolean is_ip6, NMSettingIP4Config *s_ip4, + NMSettingIP6Config *s_ip6, guint8 *anycast_addr, const char *hostname, const char *orig_path, @@ -324,13 +318,13 @@ merge_dhclient_config (const char *iface, GError *read_error = NULL; if (!g_file_get_contents (orig_path, &orig, NULL, &read_error)) { - nm_log_warn (LOGD_DHCP, "(%s): error reading dhclient configuration %s: %s", - iface, orig_path, read_error->message); + nm_log_warn (LOGD_DHCP, "(%s): error reading dhclient%s configuration %s: %s", + iface, is_ip6 ? "6" : "", orig_path, read_error->message); g_error_free (read_error); } } - new = nm_dhcp_dhclient_create_config (iface, s_ip4, anycast_addr, hostname, orig_path, orig); + new = nm_dhcp_dhclient_create_config (iface, is_ip6, s_ip4, s_ip6, anycast_addr, hostname, orig_path, orig); g_assert (new); success = g_file_set_contents (conf_file, new, -1, error); g_free (new); @@ -339,6 +333,64 @@ merge_dhclient_config (const char *iface, return success; } +static char * +get_dhclient_config (const char * iface, const char *uuid, gboolean ipv6) +{ + char *path; + + /* NetworkManager-overridden configuration can be used to ship DHCP config + * with NetworkManager itself. It can be uuid-specific, device-specific + * or generic. + */ + if (uuid) { + path = g_strdup_printf (NMCONFDIR "/dhclient%s-%s.conf", ipv6 ? "6" : "", uuid); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + } + + path = g_strdup_printf (NMCONFDIR "/dhclient%s-%s.conf", ipv6 ? "6" : "", iface); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + + path = g_strdup_printf (NMCONFDIR "/dhclient%s.conf", ipv6 ? "6" : ""); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + + /* Distribution's dhclient configuration is used so that we can use + * configuration shipped with dhclient (if any). + * + * This replaces conditional compilation based on distribution name. Fedora + * and Debian store the configs in /etc/dhcp while upstream defaults to /etc + * which is then used by many other distributions. Some distributions + * (including Fedora) don't even provide a default configuration file. + */ + path = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient%s-%s.conf", ipv6 ? "6" : "", iface); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + + path = g_strdup_printf (SYSCONFDIR "/dhclient%s-%s.conf", ipv6 ? "6" : "", iface); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + + path = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient%s.conf", ipv6 ? "6" : ""); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + + path = g_strdup_printf (SYSCONFDIR "/dhclient%s.conf", ipv6 ? "6" : ""); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + return path; + g_free (path); + + return NULL; +} + + /* NM provides interface-specific options; thus the same dhclient config * file cannot be used since DHCP transactions can happen in parallel. * Since some distros don't have default per-interface dhclient config files, @@ -347,59 +399,32 @@ merge_dhclient_config (const char *iface, */ static char * create_dhclient_config (const char *iface, + gboolean is_ip6, NMSettingIP4Config *s_ip4, + NMSettingIP6Config *s_ip6, guint8 *dhcp_anycast_addr, const char *hostname) { - char *orig = NULL, *tmp, *conf_file = NULL; + char *orig = NULL, *new = NULL; GError *error = NULL; gboolean success = FALSE; g_return_val_if_fail (iface != NULL, NULL); -#if defined(TARGET_SUSE) - orig = g_strdup (SYSCONFDIR "/dhclient.conf"); -#elif defined(TARGET_DEBIAN) || defined(TARGET_GENTOO) -#if defined(DHCLIENT_V3) - orig = g_strdup (SYSCONFDIR "/dhcp3/dhclient.conf"); -#else - orig = g_strdup (SYSCONFDIR "/dhcp/dhclient.conf"); -#endif -#else - orig = g_strdup_printf (SYSCONFDIR "/dhclient-%s.conf", iface); -#endif - - if (!orig) { - nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface); - return NULL; - } - -#if !defined(TARGET_SUSE) && !defined(TARGET_DEBIAN) && !defined(TARGET_GENTOO) - /* Try /etc/dhcp/ too (rh #607759) */ - if (!g_file_test (orig, G_FILE_TEST_EXISTS)) { - g_free (orig); - orig = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient-%s.conf", iface); - if (!orig) { - nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface); - return NULL; - } - } -#endif - - tmp = g_strdup_printf ("nm-dhclient-%s.conf", iface); - conf_file = g_build_filename ("/var", "run", tmp, NULL); - g_free (tmp); + new = g_strdup_printf (NMSTATEDIR "/dhclient%s-%s.conf", is_ip6 ? "6" : "", iface); + /* TODO: also support UUID */ + orig = get_dhclient_config (iface, NULL, is_ip6); error = NULL; - success = merge_dhclient_config (iface, conf_file, s_ip4, dhcp_anycast_addr, hostname, orig, &error); + success = merge_dhclient_config (iface, new, is_ip6, s_ip4, s_ip6, dhcp_anycast_addr, hostname, orig, &error); if (!success) { - nm_log_warn (LOGD_DHCP, "(%s): error creating dhclient configuration: %s", - iface, error->message); + nm_log_warn (LOGD_DHCP, "(%s): error creating dhclient%s configuration: %s", + iface, is_ip6 ? "6" : "", error->message); g_error_free (error); } g_free (orig); - return conf_file; + return new; } @@ -439,13 +464,6 @@ dhclient_start (NMDHCPClient *client, log_domain = ipv6 ? LOGD_DHCP6 : LOGD_DHCP4; -#if defined(DHCLIENT_V3) - if (ipv6) { - nm_log_warn (log_domain, "(%s): ISC dhcp3 does not support IPv6", iface); - return -1; - } -#endif - if (!g_file_test (priv->path, G_FILE_TEST_EXISTS)) { nm_log_warn (log_domain, "%s does not exist.", priv->path); return -1; @@ -471,7 +489,7 @@ dhclient_start (NMDHCPClient *client, } g_free (priv->lease_file); - priv->lease_file = get_leasefile_for_iface (iface, uuid, ipv6); + priv->lease_file = get_dhclient_leasefile (iface, uuid, ipv6); if (!priv->lease_file) { nm_log_warn (log_domain, "(%s): not enough memory for dhclient options.", iface); return -1; @@ -485,16 +503,11 @@ dhclient_start (NMDHCPClient *client, if (release) g_ptr_array_add (argv, (gpointer) "-r"); -#if !defined(DHCLIENT_V3) if (ipv6) { g_ptr_array_add (argv, (gpointer) "-6"); if (mode_opt) g_ptr_array_add (argv, (gpointer) mode_opt); - } else { - g_ptr_array_add (argv, (gpointer) "-4"); } -#endif - g_ptr_array_add (argv, (gpointer) "-sf"); /* Set script file */ g_ptr_array_add (argv, (gpointer) ACTION_SCRIPT_PATH ); @@ -546,17 +559,17 @@ dhclient_start (NMDHCPClient *client, } static GPid -real_ip4_start (NMDHCPClient *client, - NMSettingIP4Config *s_ip4, - guint8 *dhcp_anycast_addr, - const char *hostname) +ip4_start (NMDHCPClient *client, + NMSettingIP4Config *s_ip4, + guint8 *dhcp_anycast_addr, + const char *hostname) { NMDHCPDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client); const char *iface; iface = nm_dhcp_client_get_iface (client); - priv->conf_file = create_dhclient_config (iface, s_ip4, dhcp_anycast_addr, hostname); + priv->conf_file = create_dhclient_config (iface, FALSE, s_ip4, NULL, dhcp_anycast_addr, hostname); if (!priv->conf_file) { nm_log_warn (LOGD_DHCP4, "(%s): error creating dhclient configuration file.", iface); return -1; @@ -566,17 +579,28 @@ real_ip4_start (NMDHCPClient *client, } static GPid -real_ip6_start (NMDHCPClient *client, - NMSettingIP6Config *s_ip6, - guint8 *dhcp_anycast_addr, - const char *hostname, - gboolean info_only) +ip6_start (NMDHCPClient *client, + NMSettingIP6Config *s_ip6, + guint8 *dhcp_anycast_addr, + const char *hostname, + gboolean info_only) { + NMDHCPDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client); + const char *iface; + + iface = nm_dhcp_client_get_iface (client); + + priv->conf_file = create_dhclient_config (iface, TRUE, NULL, s_ip6, dhcp_anycast_addr, hostname); + if (!priv->conf_file) { + nm_log_warn (LOGD_DHCP6, "(%s): error creating dhclient6 configuration file.", iface); + return -1; + } + return dhclient_start (client, info_only ? "-S" : "-N", FALSE); } static void -real_stop (NMDHCPClient *client, gboolean release) +stop (NMDHCPClient *client, gboolean release) { NMDHCPDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (client); @@ -635,8 +659,8 @@ nm_dhcp_dhclient_class_init (NMDHCPDhclientClass *dhclient_class) /* virtual methods */ object_class->dispose = dispose; - client_class->ip4_start = real_ip4_start; - client_class->ip6_start = real_ip6_start; - client_class->stop = real_stop; + client_class->ip4_start = ip4_start; + client_class->ip6_start = ip6_start; + client_class->stop = stop; } diff --git a/src/dhcp-manager/nm-dhcp-dhclient.h b/src/dhcp-manager/nm-dhcp-dhclient.h index f3da6014c..89039189d 100644 --- a/src/dhcp-manager/nm-dhcp-dhclient.h +++ b/src/dhcp-manager/nm-dhcp-dhclient.h @@ -41,7 +41,7 @@ typedef struct { GType nm_dhcp_dhclient_get_type (void); -GSList *nm_dhcp_dhclient_get_lease_config (const char *iface, const char *uuid); +GSList *nm_dhcp_dhclient_get_lease_config (const char *iface, const char *uuid, gboolean ipv6); const char *nm_dhcp_dhclient_get_path (const char *try_first); diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c index dc9bee130..dda96e2a0 100644 --- a/src/dhcp-manager/nm-dhcp-dhcpcd.c +++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c @@ -73,7 +73,7 @@ nm_dhcp_dhcpcd_get_path (const char *try_first) } GSList * -nm_dhcp_dhcpcd_get_lease_config (const char *iface, const char *uuid) +nm_dhcp_dhcpcd_get_lease_config (const char *iface, const char *uuid, gboolean ipv6) { return NULL; } @@ -93,10 +93,10 @@ dhcpcd_child_setup (gpointer user_data G_GNUC_UNUSED) } static GPid -real_ip4_start (NMDHCPClient *client, - NMSettingIP4Config *s_ip4, - guint8 *dhcp_anycast_addr, - const char *hostname) +ip4_start (NMDHCPClient *client, + NMSettingIP4Config *s_ip4, + guint8 *dhcp_anycast_addr, + const char *hostname) { NMDHCPDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (client); GPtrArray *argv = NULL; @@ -110,7 +110,7 @@ real_ip4_start (NMDHCPClient *client, iface = nm_dhcp_client_get_iface (client); uuid = nm_dhcp_client_get_uuid (client); - priv->pid_file = g_strdup_printf (LOCALSTATEDIR "/run/dhcpcd-%s.pid", iface); + priv->pid_file = g_strdup_printf (NMSTATEDIR "/dhcpcd-%s.pid", iface); if (!priv->pid_file) { nm_log_warn (LOGD_DHCP4, "(%s): not enough memory for dhcpcd options.", iface); return -1; @@ -166,18 +166,18 @@ real_ip4_start (NMDHCPClient *client, } static GPid -real_ip6_start (NMDHCPClient *client, - NMSettingIP6Config *s_ip6, - guint8 *dhcp_anycast_addr, - const char *hostname, - gboolean info_only) +ip6_start (NMDHCPClient *client, + NMSettingIP6Config *s_ip6, + guint8 *dhcp_anycast_addr, + const char *hostname, + gboolean info_only) { nm_log_warn (LOGD_DHCP6, "the dhcpcd backend does not support IPv6."); return -1; } static void -real_stop (NMDHCPClient *client, gboolean release) +stop (NMDHCPClient *client, gboolean release) { NMDHCPDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (client); @@ -221,8 +221,8 @@ nm_dhcp_dhcpcd_class_init (NMDHCPDhcpcdClass *dhcpcd_class) /* virtual methods */ object_class->dispose = dispose; - client_class->ip4_start = real_ip4_start; - client_class->ip6_start = real_ip6_start; - client_class->stop = real_stop; + client_class->ip4_start = ip4_start; + client_class->ip6_start = ip6_start; + client_class->stop = stop; } diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.h b/src/dhcp-manager/nm-dhcp-dhcpcd.h index 4ddc1089a..c90dcb74d 100644 --- a/src/dhcp-manager/nm-dhcp-dhcpcd.h +++ b/src/dhcp-manager/nm-dhcp-dhcpcd.h @@ -41,7 +41,7 @@ typedef struct { GType nm_dhcp_dhcpcd_get_type (void); -GSList *nm_dhcp_dhcpcd_get_lease_config (const char *iface, const char *uuid); +GSList *nm_dhcp_dhcpcd_get_lease_config (const char *iface, const char *uuid, gboolean ipv6); const char *nm_dhcp_dhcpcd_get_path (const char *try_first); diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c index 1af1b1630..995bff479 100644 --- a/src/dhcp-manager/nm-dhcp-manager.c +++ b/src/dhcp-manager/nm-dhcp-manager.c @@ -62,7 +62,7 @@ nm_dhcp_manager_error_quark (void) static NMDHCPManager *singleton = NULL; -typedef GSList * (*GetLeaseConfigFunc) (const char *iface, const char *uuid); +typedef GSList * (*GetLeaseConfigFunc) (const char *iface, const char *uuid, gboolean ipv6); typedef struct { GType client_type; @@ -450,6 +450,7 @@ nm_dhcp_manager_start_ip4 (NMDHCPManager *self, NMDHCPManagerPrivate *priv; NMDHCPClient *client = NULL; const char *hostname = NULL; + gboolean send_hostname = TRUE; g_return_val_if_fail (self, NULL); g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL); @@ -464,22 +465,23 @@ nm_dhcp_manager_start_ip4 (NMDHCPManager *self, g_return_val_if_fail (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, NULL); } - /* If we're asked to send the hostname to DHCP server, and the hostname - * isn't specified, and a hostname provider is registered: use that - */ - if (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4)) { + send_hostname = nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4); + if (send_hostname) hostname = nm_setting_ip4_config_get_dhcp_hostname (s_ip4); + } - /* If we're supposed to send the hostname to the DHCP server but - * the user didn't specify one, use the persistent hostname. - */ - if (!hostname && priv->hostname_provider) { - hostname = nm_hostname_provider_get_hostname (priv->hostname_provider); - if ( hostname - && (!strcmp (hostname, "localhost.localdomain") || - !strcmp (hostname, "localhost6.localdomain6"))) - hostname = NULL; - } + if (send_hostname) { + /* If we're supposed to send the hostname to the DHCP server but + * the user didn't specify one, then use the hostname from the + * hostname provider if there is one, otherwise use the persistent + * hostname. + */ + if (!hostname && priv->hostname_provider) { + hostname = nm_hostname_provider_get_hostname (priv->hostname_provider); + if ( hostname + && (!strcmp (hostname, "localhost.localdomain") || + !strcmp (hostname, "localhost6.localdomain6"))) + hostname = NULL; } } @@ -498,7 +500,23 @@ nm_dhcp_manager_start_ip6 (NMDHCPManager *self, guint8 *dhcp_anycast_addr, gboolean info_only) { - return client_start (self, iface, uuid, TRUE, NULL, s_ip6, timeout, dhcp_anycast_addr, NULL, info_only); + NMDHCPManagerPrivate *priv; + const char *hostname = NULL; + + g_return_val_if_fail (self, NULL); + g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL); + + priv = NM_DHCP_MANAGER_GET_PRIVATE (self); + + hostname = nm_setting_ip6_config_get_dhcp_hostname (s_ip6); + if (!hostname && priv->hostname_provider) { + hostname = nm_hostname_provider_get_hostname (priv->hostname_provider); + if ( g_strcmp0 (hostname, "localhost.localdomain") == 0 + || g_strcmp0 (hostname, "localhost6.localdomain6") == 0) + hostname = NULL; + } + + return client_start (self, iface, uuid, TRUE, NULL, s_ip6, timeout, dhcp_anycast_addr, hostname, info_only); } static void @@ -531,14 +549,15 @@ nm_dhcp_manager_set_hostname_provider (NMDHCPManager *manager, GSList * nm_dhcp_manager_get_lease_config (NMDHCPManager *self, const char *iface, - const char *uuid) + const char *uuid, + gboolean ipv6) { g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL); g_return_val_if_fail (iface != NULL, NULL); g_return_val_if_fail (uuid != NULL, NULL); - return NM_DHCP_MANAGER_GET_PRIVATE (self)->get_lease_config_func (iface, uuid); + return NM_DHCP_MANAGER_GET_PRIVATE (self)->get_lease_config_func (iface, uuid, ipv6); } NMIP4Config * diff --git a/src/dhcp-manager/nm-dhcp-manager.h b/src/dhcp-manager/nm-dhcp-manager.h index fe3290461..68db7e370 100644 --- a/src/dhcp-manager/nm-dhcp-manager.h +++ b/src/dhcp-manager/nm-dhcp-manager.h @@ -82,7 +82,8 @@ NMDHCPClient * nm_dhcp_manager_start_ip6 (NMDHCPManager *manager, GSList * nm_dhcp_manager_get_lease_config (NMDHCPManager *self, const char *iface, - const char *uuid); + const char *uuid, + gboolean ipv6); /* For testing only */ NMIP4Config *nm_dhcp_manager_test_ip4_options_to_config (const char *dhcp_client, diff --git a/src/dhcp-manager/tests/Makefile.am b/src/dhcp-manager/tests/Makefile.am index 1feade869..251aa224e 100644 --- a/src/dhcp-manager/tests/Makefile.am +++ b/src/dhcp-manager/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @@ -21,10 +23,7 @@ test_dhcp_dhclient_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(GLIB_LIBS) -if WITH_TESTS - check-local: test-dhcp-dhclient $(abs_builddir)/test-dhcp-dhclient endif - diff --git a/src/dhcp-manager/tests/Makefile.in b/src/dhcp-manager/tests/Makefile.in index 5d03e22a7..32cdf4dbb 100644 --- a/src/dhcp-manager/tests/Makefile.in +++ b/src/dhcp-manager/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-dhcp-dhclient$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-dhcp-dhclient$(EXEEXT) subdir = src/dhcp-manager/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,13 +75,13 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_dhcp_dhclient_OBJECTS = \ - test_dhcp_dhclient-test-dhcp-dhclient.$(OBJEXT) +am__test_dhcp_dhclient_SOURCES_DIST = test-dhcp-dhclient.c +@ENABLE_TESTS_TRUE@am_test_dhcp_dhclient_OBJECTS = test_dhcp_dhclient-test-dhcp-dhclient.$(OBJEXT) test_dhcp_dhclient_OBJECTS = $(am_test_dhcp_dhclient_OBJECTS) am__DEPENDENCIES_1 = -test_dhcp_dhclient_DEPENDENCIES = \ - $(top_builddir)/src/dhcp-manager/libdhcp-dhclient.la \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_dhcp_dhclient_DEPENDENCIES = $(top_builddir)/src/dhcp-manager/libdhcp-dhclient.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -110,7 +112,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_dhcp_dhclient_SOURCES) -DIST_SOURCES = $(test_dhcp_dhclient_SOURCES) +DIST_SOURCES = $(am__test_dhcp_dhclient_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -131,6 +133,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -145,9 +151,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -157,17 +161,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -208,6 +209,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -224,11 +226,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -243,6 +241,8 @@ 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@ @@ -252,6 +252,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -278,13 +279,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -339,6 +341,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -353,26 +360,30 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I${top_srcdir}/libnm-util \ - -I${top_builddir}/libnm-util \ - -I$(top_srcdir)/src/dhcp-manager +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I${top_srcdir}/libnm-util \ +@ENABLE_TESTS_TRUE@ -I${top_builddir}/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src/dhcp-manager ####### policy /etc/hosts test ####### -test_dhcp_dhclient_SOURCES = \ - test-dhcp-dhclient.c +@ENABLE_TESTS_TRUE@test_dhcp_dhclient_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-dhcp-dhclient.c -test_dhcp_dhclient_CPPFLAGS = \ - $(GLIB_CFLAGS) +@ENABLE_TESTS_TRUE@test_dhcp_dhclient_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) -test_dhcp_dhclient_LDADD = \ - -ldl \ - $(top_builddir)/src/dhcp-manager/libdhcp-dhclient.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) +@ENABLE_TESTS_TRUE@test_dhcp_dhclient_LDADD = \ +@ENABLE_TESTS_TRUE@ -ldl \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/dhcp-manager/libdhcp-dhclient.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) all: all-am @@ -430,25 +441,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dhcp_dhclient-test-dhcp-dhclient.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -555,7 +563,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -679,8 +687,8 @@ uninstall-am: tags uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-dhcp-dhclient -@WITH_TESTS_TRUE@ $(abs_builddir)/test-dhcp-dhclient +@ENABLE_TESTS_TRUE@check-local: test-dhcp-dhclient +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-dhcp-dhclient # 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. diff --git a/src/dhcp-manager/tests/test-dhcp-dhclient.c b/src/dhcp-manager/tests/test-dhcp-dhclient.c index c1cd6f80c..a87c29aa0 100644 --- a/src/dhcp-manager/tests/test-dhcp-dhclient.c +++ b/src/dhcp-manager/tests/test-dhcp-dhclient.c @@ -41,7 +41,9 @@ test_config (const char *orig, g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, dhcp_client_id, NULL); new = nm_dhcp_dhclient_create_config (iface, + FALSE, s_ip4, + NULL, anycast_addr, hostname, "/path/to/dhclient.conf", @@ -49,12 +51,15 @@ test_config (const char *orig, g_assert (new != NULL); #if DEBUG - g_message ("\n- NEW ---------------------------------\n" - "%s" - "+ EXPECTED ++++++++++++++++++++++++++++++\n" - "%s" - "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", - new, expected); + if ( strlen (new) != strlen (expected) + || strcmp (new, expected)) { + g_message ("\n- NEW ---------------------------------\n" + "%s" + "+ EXPECTED ++++++++++++++++++++++++++++++\n" + "%s" + "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", + new, expected); + } #endif g_assert (strlen (new) == strlen (expected)); g_assert (strcmp (new, expected) == 0); @@ -65,7 +70,7 @@ test_config (const char *orig, static const char *orig_missing_expected = \ "# Created by NetworkManager\n" - "\n" + "\n\n" "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n" "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n" "option wpad code 252 = string;\n" @@ -158,7 +163,7 @@ static const char *existing_alsoreq_orig = \ static const char *existing_alsoreq_expected = \ "# Created by NetworkManager\n" "# Merged from /path/to/dhclient.conf\n" - "\n" + "\n\n" "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n" "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n" "option wpad code 252 = string;\n" @@ -191,7 +196,7 @@ static const char *existing_multiline_alsoreq_orig = \ static const char *existing_multiline_alsoreq_expected = \ "# Created by NetworkManager\n" "# Merged from /path/to/dhclient.conf\n" - "\n" + "\n\n" "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n" "option ms-classless-static-routes code 249 = array of unsigned integer 8;\n" "option wpad code 252 = string;\n" diff --git a/src/dns-manager/Makefile.am b/src/dns-manager/Makefile.am index c6c284461..e6c2ff220 100644 --- a/src/dns-manager/Makefile.am +++ b/src/dns-manager/Makefile.am @@ -16,8 +16,6 @@ libdns_manager_la_SOURCES = \ nm-dns-plugin.c \ nm-dns-dnsmasq.h \ nm-dns-dnsmasq.c \ - nm-dns-bind.h \ - nm-dns-bind.c \ nm-dns-utils.h \ nm-dns-utils.c @@ -26,7 +24,9 @@ libdns_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DNMCONFDIR=\"$(nmconfdir)\" \ + -DNMRUNDIR=\"$(nmrundir)\" libdns_manager_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ diff --git a/src/dns-manager/Makefile.in b/src/dns-manager/Makefile.in index b8d5c12bc..b0ea7e776 100644 --- a/src/dns-manager/Makefile.in +++ b/src/dns-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/dns-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -81,7 +83,6 @@ libdns_manager_la_DEPENDENCIES = \ am_libdns_manager_la_OBJECTS = libdns_manager_la-nm-dns-manager.lo \ libdns_manager_la-nm-dns-plugin.lo \ libdns_manager_la-nm-dns-dnsmasq.lo \ - libdns_manager_la-nm-dns-bind.lo \ libdns_manager_la-nm-dns-utils.lo libdns_manager_la_OBJECTS = $(am_libdns_manager_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -135,6 +136,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -149,9 +154,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -161,17 +164,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -212,6 +212,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -228,11 +229,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -247,6 +244,8 @@ 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@ @@ -256,6 +255,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -282,13 +282,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -343,6 +344,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -357,6 +363,10 @@ 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@ INCLUDES = \ -I${top_srcdir}/src/logging \ -I${top_srcdir}/src/posix-signals \ @@ -374,8 +384,6 @@ libdns_manager_la_SOURCES = \ nm-dns-plugin.c \ nm-dns-dnsmasq.h \ nm-dns-dnsmasq.c \ - nm-dns-bind.h \ - nm-dns-bind.c \ nm-dns-utils.h \ nm-dns-utils.c @@ -384,7 +392,9 @@ libdns_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ -DLOCALSTATEDIR=\"$(localstatedir)\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DNMCONFDIR=\"$(nmconfdir)\" \ + -DNMRUNDIR=\"$(nmrundir)\" libdns_manager_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ @@ -445,32 +455,28 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdns_manager_la-nm-dns-bind.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdns_manager_la-nm-dns-dnsmasq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdns_manager_la-nm-dns-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdns_manager_la-nm-dns-plugin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdns_manager_la-nm-dns-utils.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -496,13 +502,6 @@ libdns_manager_la-nm-dns-dnsmasq.lo: nm-dns-dnsmasq.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdns_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdns_manager_la-nm-dns-dnsmasq.lo `test -f 'nm-dns-dnsmasq.c' || echo '$(srcdir)/'`nm-dns-dnsmasq.c -libdns_manager_la-nm-dns-bind.lo: nm-dns-bind.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdns_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdns_manager_la-nm-dns-bind.lo -MD -MP -MF $(DEPDIR)/libdns_manager_la-nm-dns-bind.Tpo -c -o libdns_manager_la-nm-dns-bind.lo `test -f 'nm-dns-bind.c' || echo '$(srcdir)/'`nm-dns-bind.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdns_manager_la-nm-dns-bind.Tpo $(DEPDIR)/libdns_manager_la-nm-dns-bind.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-dns-bind.c' object='libdns_manager_la-nm-dns-bind.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdns_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdns_manager_la-nm-dns-bind.lo `test -f 'nm-dns-bind.c' || echo '$(srcdir)/'`nm-dns-bind.c - libdns_manager_la-nm-dns-utils.lo: nm-dns-utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdns_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdns_manager_la-nm-dns-utils.lo -MD -MP -MF $(DEPDIR)/libdns_manager_la-nm-dns-utils.Tpo -c -o libdns_manager_la-nm-dns-utils.lo `test -f 'nm-dns-utils.c' || echo '$(srcdir)/'`nm-dns-utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdns_manager_la-nm-dns-utils.Tpo $(DEPDIR)/libdns_manager_la-nm-dns-utils.Plo diff --git a/src/dns-manager/nm-dns-bind.c b/src/dns-manager/nm-dns-bind.c deleted file mode 100644 index 1a3243be8..000000000 --- a/src/dns-manager/nm-dns-bind.c +++ /dev/null @@ -1,529 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* - * Copyright (C) 2010 Dan Williams <dcbw@redhat.com> - * - * 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, 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. - * - */ - -#include <config.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <arpa/inet.h> -#include <sys/stat.h> - -#include <glib.h> -#include <glib/gi18n.h> - -#include "nm-dns-bind.h" -#include "nm-logging.h" -#include "nm-ip4-config.h" -#include "nm-ip6-config.h" - -G_DEFINE_TYPE (NMDnsBind, nm_dns_bind, NM_TYPE_DNS_PLUGIN) - -#define NM_DNS_BIND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DNS_BIND, NMDnsBindPrivate)) - -#define PIDFILE LOCALSTATEDIR "/run/nm-dns-named.pid" -#define CONFFILE LOCALSTATEDIR "/run/nm-dns-named.conf" - -typedef struct { - GPid pid; -} NMDnsBindPrivate; - -/*******************************************/ - -static inline const char * -find_bind (void) -{ - static const char *paths[] = { - "/usr/local/sbin/named", - "/usr/sbin/named", - "/sbin/named", - NULL - }; - const char **binary = paths; - - while (*binary != NULL) { - if (g_file_test (*binary, G_FILE_TEST_EXISTS)) - return *binary; - binary++; - } - return NULL; -} - -static gboolean -start_bind (NMDnsBind *self) -{ - const char *argv[10]; - - argv[0] = find_bind (); - argv[1] = "-f"; /* don't daemonize; stay in foreground */ - argv[2] = "-c"; - argv[3] = CONFFILE; - argv[4] = NULL; - - /* And finally spawn bind */ - return nm_dns_plugin_child_spawn (NM_DNS_PLUGIN (self), argv, PIDFILE, "bin/named"); -} - -/*******************************************/ - -static gboolean -find_address (GPtrArray *array, const char *addr) -{ - int n; - - for (n = 0; n < array->len; n++) { - if (g_strcmp0 ((const char*) g_ptr_array_index (array, n), addr) == 0) - return TRUE; - } - return FALSE; -} - -static void -add_ip4_nameservers (NMIP4Config *ip4, GPtrArray *array) -{ - int i; - - for (i = 0; i < nm_ip4_config_get_num_nameservers (ip4); i++) { - char buf[INET_ADDRSTRLEN + 1]; - struct in_addr addr; - - memset (&buf[0], 0, sizeof (buf)); - addr.s_addr = nm_ip4_config_get_nameserver (ip4, i); - if (inet_ntop (AF_INET, &addr, buf, sizeof (buf))) { - if (!find_address (array, buf)) - g_ptr_array_add (array, g_strdup (buf)); - } - } -} - -static gboolean -ip6_addr_to_string (const struct in6_addr *addr, char *buf, size_t buflen) -{ - /* inet_ntop is probably supposed to do this for us, but it doesn't */ - if (IN6_IS_ADDR_V4MAPPED (addr)) - return !!inet_ntop (AF_INET, &(addr->s6_addr32[3]), buf, buflen); - - return !!inet_ntop (AF_INET6, addr, buf, buflen); -} - -static void -add_ip6_nameservers (NMIP6Config *ip6, GPtrArray *array) -{ - char buf[INET6_ADDRSTRLEN + 1]; - int i; - - for (i = 0; i < nm_ip6_config_get_num_nameservers (ip6); i++) { - memset (buf, 0, sizeof (buf)); - if (ip6_addr_to_string (nm_ip6_config_get_nameserver (ip6, i), buf, sizeof (buf))) { - if (!find_address (array, buf)) - g_ptr_array_add (array, g_strdup (buf)); - } - } -} - -typedef struct { - guint32 dhash; - char *domain; - GPtrArray *servers; -} ZoneInfo; - -static ZoneInfo * -zone_new (const char *domain) -{ - ZoneInfo *info; - - g_return_val_if_fail (domain != NULL, NULL); - - info = g_malloc0 (sizeof (ZoneInfo)); - info->domain = g_strdup (domain); - info->dhash = g_str_hash (domain); - info->servers = g_ptr_array_sized_new (4); - return info; -} - -static void -zone_add_nameserver (ZoneInfo *info, const char *server) -{ - guint32 i; - - g_return_if_fail (info != NULL); - g_return_if_fail (server != NULL); - - for (i = 0; i < info->servers->len; i++) { - if (g_strcmp0 ((char *) g_ptr_array_index (info->servers, i), server) == 0) - return; - } - g_ptr_array_add (info->servers, g_strdup (server)); -} - -static void -zone_free (ZoneInfo *info) -{ - g_return_if_fail (info != NULL); - - g_free (info->domain); - g_ptr_array_foreach (info->servers, (GFunc) g_free, NULL); - g_ptr_array_free (info->servers, TRUE); - memset (info, 0, sizeof (ZoneInfo)); - g_free (info); -} - -static ZoneInfo * -find_zone (GPtrArray *zones, const char *domain) -{ - guint32 dhash, i; - - g_return_val_if_fail (domain != NULL, NULL); - - dhash = g_str_hash (domain); - for (i = 0; i < zones->len; i++) { - ZoneInfo *zone = g_ptr_array_index (zones, i); - - if (zone->dhash == dhash) - return zone; - } - return NULL; -} - -static void -add_zone (GObject *ip, GPtrArray *zones) -{ - guint32 i, j, ns, nd, nn; - GPtrArray *to_add; - ZoneInfo *z; - - if (NM_IS_IP4_CONFIG (ip)) { - ns = nm_ip4_config_get_num_searches (NM_IP4_CONFIG (ip)); - nd = nm_ip4_config_get_num_domains (NM_IP4_CONFIG (ip)); - nn = nm_ip4_config_get_num_nameservers (NM_IP4_CONFIG (ip)); - } else if (NM_IS_IP6_CONFIG (ip)) { - ns = nm_ip6_config_get_num_searches (NM_IP6_CONFIG (ip)); - nd = nm_ip6_config_get_num_domains (NM_IP6_CONFIG (ip)); - nn = nm_ip6_config_get_num_nameservers (NM_IP6_CONFIG (ip)); - } else - g_assert_not_reached (); - - /* If we don't have any domains or searches, or we don't have any - * nameservers, we can't do split DNS for this config. - */ - if ((!nd && !ns) || !nn) - return; - - to_add = g_ptr_array_sized_new (MAX (ns, nd)); - - /* searches are preferred over domains */ - for (i = 0; i < ns; i++) { - const char *domain = NULL; - - if (NM_IS_IP4_CONFIG (ip)) - domain = nm_ip4_config_get_search (NM_IP4_CONFIG (ip), i); - else if (NM_IS_IP6_CONFIG (ip)) - domain = nm_ip6_config_get_search (NM_IP6_CONFIG (ip), i); - - z = find_zone (zones, domain); - if (!z) { - z = zone_new (domain); - g_ptr_array_add (zones, z); - } - g_ptr_array_add (to_add, z); - } - - if (ns == 0) { - /* If no searches, add any domains */ - for (i = 0; i < nd; i++) { - const char *domain = NULL; - - if (NM_IS_IP4_CONFIG (ip)) - domain = nm_ip4_config_get_domain (NM_IP4_CONFIG (ip), i); - else if (NM_IS_IP6_CONFIG (ip)) - domain = nm_ip6_config_get_domain (NM_IP6_CONFIG (ip), i); - - z = find_zone (zones, domain); - if (!z) { - z = zone_new (domain); - g_ptr_array_add (zones, z); - } - g_ptr_array_add (to_add, z); - } - } - - /* Now add the nameservers to every zone for this config */ - for (i = 0; i < nn; i++) { - char buf[INET6_ADDRSTRLEN + 1]; - struct in_addr addr4; - const struct in6_addr *addr6; - - memset (&buf[0], 0, sizeof (buf)); - - if (NM_IS_IP4_CONFIG (ip)) { - addr4.s_addr = nm_ip4_config_get_nameserver (NM_IP4_CONFIG (ip), i); - if (!inet_ntop (AF_INET, &addr4, buf, sizeof (buf))) - continue; - } else if (NM_IS_IP6_CONFIG (ip)) { - addr6 = nm_ip6_config_get_nameserver (NM_IP6_CONFIG (ip), i); - if (!ip6_addr_to_string (addr6, buf, sizeof (buf))) - continue; - } - - /* Add this nameserver to every zone from this IP config */ - for (j = 0; j < to_add->len; j++) { - z = g_ptr_array_index (to_add, j); - zone_add_nameserver (z, buf); - } - } - - g_ptr_array_free (to_add, TRUE); -} - -static gboolean -update (NMDnsPlugin *plugin, - const GSList *vpn_configs, - const GSList *dev_configs, - const GSList *other_configs, - const char *hostname, - const char *iface) -{ - NMDnsBind *self = NM_DNS_BIND (plugin); - NMDnsBindPrivate *priv = NM_DNS_BIND_GET_PRIVATE (self); - GString *conf; - GPtrArray *globals, *zones; - GSList *iter; - GError *error = NULL; - int ignored, i, j; - gboolean success = FALSE; - - /* Build up the new bind config file */ - conf = g_string_sized_new (200); - globals = g_ptr_array_sized_new (6); - - /* If any of the VPN configs *don't* have domains or searches, then we - * dont' have any split DNS configuration for them, and we add them - * first in the global nameserver lists. Otherwise we add them later as - * split DNS zones. - */ - for (iter = (GSList *) vpn_configs; iter;iter = g_slist_next (iter)) { - if (NM_IS_IP4_CONFIG (iter->data)) { - NMIP4Config *ip4 = NM_IP4_CONFIG (iter->data); - - if (!nm_ip4_config_get_num_domains (ip4) && !nm_ip4_config_get_num_searches (ip4)) - add_ip4_nameservers (ip4, globals); - } else if (NM_IS_IP6_CONFIG (iter->data)) { - NMIP6Config *ip6 = NM_IP6_CONFIG (iter->data); - - if (!nm_ip6_config_get_num_domains (ip6) && !nm_ip6_config_get_num_searches (ip6)) - add_ip6_nameservers (ip6, globals); - } - } - - /* Get a list of global upstream servers with dupe checking */ - for (iter = (GSList *) dev_configs; iter;iter = g_slist_next (iter)) { - if (NM_IS_IP4_CONFIG (iter->data)) - add_ip4_nameservers (NM_IP4_CONFIG (iter->data), globals); - else if (NM_IS_IP6_CONFIG (iter->data)) - add_ip6_nameservers (NM_IP6_CONFIG (iter->data), globals); - } - - /* And any other random configs with dupe checking */ - for (iter = (GSList *) other_configs; iter;iter = g_slist_next (iter)) { - if (NM_IS_IP4_CONFIG (iter->data)) - add_ip4_nameservers (NM_IP4_CONFIG (iter->data), globals); - else if (NM_IS_IP6_CONFIG (iter->data)) - add_ip6_nameservers (NM_IP6_CONFIG (iter->data), globals); - } - - g_string_append (conf, - "options {\n" - " directory \"" LOCALSTATEDIR "/named\";\n" - " forward only;\n" - " recursion yes;\n" - " listen-on-v6 { ::1; };\n" - " listen-on { 127.0.0.1; };\n" - " forwarders {\n"); - - for (i = 0; i < globals->len; i++) { - char *ns = g_ptr_array_index (globals, i); - - g_string_append_printf (conf, " %s;\n", ns); - g_free (ns); - } - g_ptr_array_free (globals, TRUE); - - g_string_append (conf, - " };\n" - "};\n\n"); - - /* Build up the list of any split DNS zones, avoiding duplicates */ - zones = g_ptr_array_sized_new (4); - for (iter = (GSList *) vpn_configs; iter;iter = g_slist_next (iter)) { - if (NM_IS_IP4_CONFIG (iter->data)) - add_zone (G_OBJECT (iter->data), zones); - else if (NM_IS_IP6_CONFIG (iter->data)) - add_zone (G_OBJECT (iter->data), zones); - } - - /* Add all the zones to the config */ - for (i = 0; i < zones->len; i++) { - ZoneInfo *z = g_ptr_array_index (zones, i); - - g_string_append_printf (conf, - "zone \"%s\" IN {\n" - " type forward;\n" - " forward only;\n" - " forwarders {\n", - z->domain); - - /* Add each nameserver for this zone */ - for (j = 0; j < z->servers->len; j++) { - g_string_append_printf (conf, - " %s;\n", - (const char *) g_ptr_array_index (z->servers, j)); - } - - g_string_append (conf, - " };\n" - "};\n\n"); - - zone_free (z); - } - g_ptr_array_free (zones, TRUE); - - /* Write out the config file */ - if (!g_file_set_contents (CONFFILE, conf->str, -1, &error)) { - nm_log_warn (LOGD_DNS, "Failed to write named config file %s: (%d) %s", - CONFFILE, - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); - g_clear_error (&error); - goto out; - } - ignored = chmod (CONFFILE, 0644); - - nm_log_dbg (LOGD_DNS, "BIND local caching DNS configuration:"); - nm_log_dbg (LOGD_DNS, "%s", conf->str); - - if (priv->pid) { - /* Send it SIGHUP to reload the new configuration */ - if (kill (priv->pid, SIGHUP) == 0) - success = TRUE; - else { - /* Sigh... some error. Kill it and restart */ - nm_dns_plugin_child_kill (NM_DNS_PLUGIN (self)); - priv->pid = 0; - } - } - - if (!success) { - /* Spawn it */ - priv->pid = start_bind (self); - if (priv->pid) - success = TRUE; - } - -out: - g_string_free (conf, TRUE); - return success; -} - -/****************************************************************/ - -static void -child_quit (NMDnsPlugin *plugin, gint status) -{ - NMDnsBind *self = NM_DNS_BIND (plugin); - gboolean failed = TRUE; - int err; - - if (WIFEXITED (status)) { - err = WEXITSTATUS (status); - if (err) { - nm_log_warn (LOGD_DNS, "named exited with error %d", err); - } else - failed = FALSE; - } else if (WIFSTOPPED (status)) { - nm_log_warn (LOGD_DNS, "named stopped unexpectedly with signal %d", WSTOPSIG (status)); - } else if (WIFSIGNALED (status)) { - nm_log_warn (LOGD_DNS, "named died with signal %d", WTERMSIG (status)); - } else { - nm_log_warn (LOGD_DNS, "named died from an unknown cause"); - } - unlink (CONFFILE); - - if (failed) - g_signal_emit_by_name (self, NM_DNS_PLUGIN_FAILED); -} - -/****************************************************************/ - -static gboolean -init (NMDnsPlugin *plugin) -{ - return TRUE; -} - -static gboolean -is_caching (NMDnsPlugin *plugin) -{ - return TRUE; -} - -static const char * -get_name (NMDnsPlugin *plugin) -{ - return "bind"; -} - -/****************************************************************/ - -NMDnsBind * -nm_dns_bind_new (void) -{ - return (NMDnsBind *) g_object_new (NM_TYPE_DNS_BIND, NULL); -} - -static void -nm_dns_bind_init (NMDnsBind *self) -{ -} - -static void -dispose (GObject *object) -{ - unlink (CONFFILE); - - G_OBJECT_CLASS (nm_dns_bind_parent_class)->dispose (object); -} - -static void -nm_dns_bind_class_init (NMDnsBindClass *dns_class) -{ - NMDnsPluginClass *plugin_class = NM_DNS_PLUGIN_CLASS (dns_class); - GObjectClass *object_class = G_OBJECT_CLASS (dns_class); - - g_type_class_add_private (dns_class, sizeof (NMDnsBindPrivate)); - - object_class->dispose = dispose; - - plugin_class->init = init; - plugin_class->child_quit = child_quit; - plugin_class->is_caching = is_caching; - plugin_class->update = update; - plugin_class->get_name = get_name; -} - diff --git a/src/dns-manager/nm-dns-bind.h b/src/dns-manager/nm-dns-bind.h deleted file mode 100644 index d3ab38197..000000000 --- a/src/dns-manager/nm-dns-bind.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* 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, 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) 2010 Red Hat, Inc. - */ - -#ifndef NM_DNS_BIND_H -#define NM_DNS_BIND_H - -#include <glib.h> -#include <glib-object.h> - -#include "nm-dns-plugin.h" - -#define NM_TYPE_DNS_BIND (nm_dns_bind_get_type ()) -#define NM_DNS_BIND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DNS_BIND, NMDnsBind)) -#define NM_DNS_BIND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DNS_BIND, NMDnsBindClass)) -#define NM_IS_DNS_BIND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DNS_BIND)) -#define NM_IS_DNS_BIND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DNS_BIND)) -#define NM_DNS_BIND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DNS_BIND, NMDnsBindClass)) - -typedef struct { - NMDnsPlugin parent; -} NMDnsBind; - -typedef struct { - NMDnsPluginClass parent; -} NMDnsBindClass; - -GType nm_dns_bind_get_type (void); - -NMDnsBind *nm_dns_bind_new (void); - -#endif /* NM_DNS_BIND_H */ - diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c index 5d37e3749..e07240c56 100644 --- a/src/dns-manager/nm-dns-dnsmasq.c +++ b/src/dns-manager/nm-dns-dnsmasq.c @@ -39,9 +39,9 @@ G_DEFINE_TYPE (NMDnsDnsmasq, nm_dns_dnsmasq, NM_TYPE_DNS_PLUGIN) #define NM_DNS_DNSMASQ_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DNS_DNSMASQ, NMDnsDnsmasqPrivate)) -#define PIDFILE LOCALSTATEDIR "/run/nm-dns-dnsmasq.pid" -#define CONFFILE LOCALSTATEDIR "/run/nm-dns-dnsmasq.conf" -#define CONFDIR SYSCONFDIR "/NetworkManager/dnsmasq.d" +#define PIDFILE NMRUNDIR "/dnsmasq.pid" +#define CONFFILE NMRUNDIR "/dnsmasq.conf" +#define CONFDIR NMCONFDIR "/dnsmasq.d" typedef struct { guint32 foo; @@ -253,10 +253,11 @@ update (NMDnsPlugin *plugin, NMDnsDnsmasq *self = NM_DNS_DNSMASQ (plugin); GString *conf; GSList *iter; - const char *argv[12]; + const char *argv[15]; GError *error = NULL; int ignored; GPid pid = 0; + guint idx = 0; /* Kill the old dnsmasq; there doesn't appear to be a way to get dnsmasq * to reread the config file using SIGHUP or similar. This is a small race @@ -306,18 +307,23 @@ update (NMDnsPlugin *plugin, nm_log_dbg (LOGD_DNS, "dnsmasq local caching DNS configuration:"); nm_log_dbg (LOGD_DNS, "%s", conf->str); - argv[0] = find_dnsmasq (); - argv[1] = "--no-resolv"; /* Use only commandline */ - argv[2] = "--keep-in-foreground"; - argv[3] = "--no-hosts"; /* don't use /etc/hosts to resolve */ - argv[4] = "--bind-interfaces"; - argv[5] = "--pid-file=" PIDFILE; - argv[6] = "--listen-address=127.0.0.1"; /* Should work for both 4 and 6 */ - argv[7] = "--conf-file=" CONFFILE; - argv[8] = "--cache-size=400"; - argv[9] = "--proxy-dnssec"; /* Allow DNSSEC to pass through */ - argv[10] = "--conf-dir=" CONFDIR; - argv[11] = NULL; + argv[idx++] = find_dnsmasq (); + argv[idx++] = "--no-resolv"; /* Use only commandline */ + argv[idx++] = "--keep-in-foreground"; + argv[idx++] = "--no-hosts"; /* don't use /etc/hosts to resolve */ + argv[idx++] = "--bind-interfaces"; + argv[idx++] = "--pid-file=" PIDFILE; + argv[idx++] = "--listen-address=127.0.0.1"; /* Should work for both 4 and 6 */ + argv[idx++] = "--conf-file=" CONFFILE; + argv[idx++] = "--cache-size=400"; + argv[idx++] = "--proxy-dnssec"; /* Allow DNSSEC to pass through */ + + /* dnsmasq exits if the conf dir is not present */ + if (g_file_test (CONFDIR, G_FILE_TEST_IS_DIR)) + argv[idx++] = "--conf-dir=" CONFDIR; + + argv[idx++] = NULL; + g_warn_if_fail (idx <= G_N_ELEMENTS (argv)); /* And finally spawn dnsmasq */ pid = nm_dns_plugin_child_spawn (NM_DNS_PLUGIN (self), argv, PIDFILE, "bin/dnsmasq"); diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 38ef08ead..38691f37d 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -40,17 +40,11 @@ #include "nm-ip4-config.h" #include "nm-ip6-config.h" #include "nm-logging.h" -#include "backends/nm-backend.h" #include "NetworkManagerUtils.h" #include "nm-posix-signals.h" #include "nm-dns-plugin.h" #include "nm-dns-dnsmasq.h" -#include "nm-dns-bind.h" - -#ifdef HAVE_SELINUX -#include <selinux/selinux.h> -#endif #ifndef RESOLV_CONF #define RESOLV_CONF "/etc/resolv.conf" @@ -208,7 +202,7 @@ merge_one_ip6_config (NMResolvConfData *rc, NMIP6Config *src, const char *iface) } -#if defined(TARGET_SUSE) +#if defined(NETCONFIG_PATH) /**********************************/ /* SUSE */ @@ -232,7 +226,7 @@ run_netconfig (GError **error, gint *stdin_fd) char *tmp; GPid pid = -1; - argv[0] = "/sbin/netconfig"; + argv[0] = NETCONFIG_PATH; argv[1] = "modify"; argv[2] = "--service"; argv[3] = "NetworkManager"; @@ -756,7 +750,7 @@ update_dns (NMDnsManager *self, success = dispatch_resolvconf (domain, searches, nameservers, iface, error); #endif -#ifdef TARGET_SUSE +#ifdef NETCONFIG_PATH if (success == FALSE) { success = dispatch_netconfig (domain, searches, nameservers, nis_domain, nis_servers, @@ -767,9 +761,6 @@ update_dns (NMDnsManager *self, if (success == FALSE) success = update_resolv_conf (domain, searches, nameservers, iface, error); - if (success) - nm_backend_update_dns (); - if (searches) g_strfreev (searches); if (nameservers) @@ -1055,10 +1046,7 @@ load_plugins (NMDnsManager *self, const char **plugins) for (iter = plugins; iter && *iter; iter++) { if (!strcasecmp (*iter, "dnsmasq")) plugin = NM_DNS_PLUGIN (nm_dns_dnsmasq_new ()); - else if (!strcasecmp (*iter, "bind")) { - plugin = NM_DNS_PLUGIN (nm_dns_bind_new ()); - nm_log_warn (LOGD_DNS, "The BIND plugin is experimental!"); - } else { + else { nm_log_warn (LOGD_DNS, "Unknown DNS plugin '%s'", *iter);\ continue; } diff --git a/src/dnsmasq-manager/Makefile.in b/src/dnsmasq-manager/Makefile.in index a1aae5088..55bdc75a0 100644 --- a/src/dnsmasq-manager/Makefile.in +++ b/src/dnsmasq-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/dnsmasq-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -131,6 +133,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -145,9 +151,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -157,17 +161,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -208,6 +209,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -224,11 +226,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -243,6 +241,8 @@ 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@ @@ -252,6 +252,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -278,13 +279,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -339,6 +341,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -353,6 +360,10 @@ 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@ INCLUDES = \ -I${top_srcdir}/libnm-util \ -I${top_srcdir}/src/logging \ @@ -429,25 +440,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdnsmasq_manager_la-nm-dnsmasq-manager.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index 0b3b629f3..f708f6f6c 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -258,8 +258,8 @@ create_dm_cmd_line (const char *iface, dm_binary = nm_find_dnsmasq (); if (!dm_binary) { - g_set_error (error, NM_DNSMASQ_MANAGER_ERROR, NM_DNSMASQ_MANAGER_ERROR_NOT_FOUND, - "Could not find dnsmasq binary."); + g_set_error_literal (error, NM_DNSMASQ_MANAGER_ERROR, NM_DNSMASQ_MANAGER_ERROR_NOT_FOUND, + "Could not find dnsmasq binary."); return NULL; } @@ -298,8 +298,11 @@ create_dm_cmd_line (const char *iface, s = g_string_new ("--listen-address="); addr.s_addr = nm_ip4_address_get_address (tmp); if (!inet_ntop (AF_INET, &addr, &localaddr[0], INET_ADDRSTRLEN)) { - nm_log_warn (LOGD_SHARING, "error converting IP4 address 0x%X", - ntohl (addr.s_addr)); + char *err_msg = g_strdup_printf ("error converting IP4 address 0x%X", + ntohl (addr.s_addr)); + g_set_error_literal (error, NM_DNSMASQ_MANAGER_ERROR, NM_DNSMASQ_MANAGER_ERROR_NOT_FOUND, err_msg); + nm_log_warn (LOGD_SHARING, "%s", err_msg); + g_free (err_msg); goto error; } g_string_append (s, localaddr); @@ -311,8 +314,11 @@ create_dm_cmd_line (const char *iface, /* Add start of address range */ addr.s_addr = nm_ip4_address_get_address (tmp) + htonl (9); if (!inet_ntop (AF_INET, &addr, &buf[0], INET_ADDRSTRLEN)) { - nm_log_warn (LOGD_SHARING, "error converting IP4 address 0x%X", - ntohl (addr.s_addr)); + char *err_msg = g_strdup_printf ("error converting IP4 address 0x%X", + ntohl (addr.s_addr)); + g_set_error_literal (error, NM_DNSMASQ_MANAGER_ERROR, NM_DNSMASQ_MANAGER_ERROR_NOT_FOUND, err_msg); + nm_log_warn (LOGD_SHARING, "%s", err_msg); + g_free (err_msg); goto error; } g_string_append (s, buf); @@ -322,8 +328,11 @@ create_dm_cmd_line (const char *iface, /* Add end of address range */ addr.s_addr = nm_ip4_address_get_address (tmp) + htonl (99); if (!inet_ntop (AF_INET, &addr, &buf[0], INET_ADDRSTRLEN)) { - nm_log_warn (LOGD_SHARING, "error converting IP4 address 0x%X", - ntohl (addr.s_addr)); + char *err_msg = g_strdup_printf ("error converting IP4 address 0x%X", + ntohl (addr.s_addr)); + g_set_error_literal (error, NM_DNSMASQ_MANAGER_ERROR, NM_DNSMASQ_MANAGER_ERROR_NOT_FOUND, err_msg); + nm_log_warn (LOGD_SHARING, "%s", err_msg); + g_free (err_msg); goto error; } g_string_append (s, buf); diff --git a/src/firewall-manager/Makefile.in b/src/firewall-manager/Makefile.in index 8c6284d88..bf3f46c49 100644 --- a/src/firewall-manager/Makefile.in +++ b/src/firewall-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/firewall-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -130,6 +132,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -144,9 +150,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -156,17 +160,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -207,6 +208,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -223,11 +225,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -242,6 +240,8 @@ 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@ @@ -251,6 +251,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -277,13 +278,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -338,6 +340,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -352,6 +359,10 @@ 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@ INCLUDES = \ -I${top_srcdir}/src \ -I${top_srcdir}/src/logging \ @@ -429,25 +440,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfirewall_manager_la-nm-firewall-manager.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/generated/Makefile.am b/src/generated/Makefile.am index 252973cda..307766e1e 100644 --- a/src/generated/Makefile.am +++ b/src/generated/Makefile.am @@ -16,7 +16,6 @@ nm_daemon_all_sources = \ $(top_srcdir)/src/dhcp-manager/*.[ch] \ $(top_srcdir)/src/ip6-manager/*.[ch] \ $(top_srcdir)/src/supplicant-manager/*.[ch] \ - $(top_srcdir)/src/backends/*.[ch] \ $(top_srcdir)/src/ppp-manager/*.[ch] \ $(top_srcdir)/src/dnsmasq-manager/*.[ch] \ $(top_srcdir)/src/modem-manager/*.[ch] \ @@ -28,9 +27,21 @@ if WITH_WIMAX nm_daemon_all_sources += $(top_srcdir)/src/wimax/*.[ch] endif -nm_daemon_sources = \ +nm_daemon_sources_no_bindings = \ $(filter-out %-glue.h %-bindings.h, $(wildcard $(nm_daemon_all_sources))) +if WITH_MODEM_MANAGER_1 +# We filter out this file, which doesn't have any enum, and which clashes +# with ModemManager1-defined symbols +nm_daemon_sources = \ + $(filter-out $(top_srcdir)/src/modem-manager/nm-modem-types.h, $(wildcard $(nm_daemon_sources_no_bindings))) +else +# Don't include ModemManager1-specific headers if we're not compiling with +# ModemManager1 support. +nm_daemon_sources = \ + $(filter-out $(top_srcdir)/src/modem-manager/nm-modem-broadband.h, $(wildcard $(nm_daemon_sources_no_bindings))) +endif + GLIB_GENERATED = nm-enum-types.h nm-enum-types.c nm_enum_types_sources = $(nm_daemon_sources) GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM @@ -49,7 +60,6 @@ INCLUDES = \ -I${top_srcdir}/src/dhcp-manager \ -I${top_srcdir}/src/ip6-manager \ -I${top_srcdir}/src/supplicant-manager \ - -I${top_srcdir}/src/backends \ -I${top_srcdir}/src/ppp-manager \ -I${top_srcdir}/src/dnsmasq-manager \ -I${top_srcdir}/src/modem-manager \ @@ -68,11 +78,14 @@ libnm_generated_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(GUDEV_CFLAGS) \ $(LIBNL_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(POLKIT_CFLAGS) \ - $(SYSTEMD_CFLAGS) \ + $(SYSTEMD_LOGIN_CFLAGS) \ $(IWMX_SDK_CFLAGS) +if WITH_MODEM_MANAGER_1 + libnm_generated_la_CPPFLAGS += $(MM_GLIB_CFLAGS) +endif + libnm_generated_la_LIBADD = \ $(GLIB_LIBS) diff --git a/src/generated/Makefile.in b/src/generated/Makefile.in index a38efc022..7d55789b8 100644 --- a/src/generated/Makefile.in +++ b/src/generated/Makefile.in @@ -57,16 +57,18 @@ subdir = src/generated DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -130,6 +132,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -144,9 +150,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -156,17 +160,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -207,6 +208,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -223,11 +225,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -242,6 +240,8 @@ 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@ @@ -251,6 +251,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -277,13 +278,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -338,6 +340,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -352,6 +359,10 @@ 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@ noinst_LTLIBRARIES = libnm-generated.la libnm_generated_la_SOURCES = \ nm-enum-types.c \ @@ -366,16 +377,26 @@ nm_daemon_all_sources = $(top_srcdir)/src/*.[ch] \ $(top_srcdir)/src/dhcp-manager/*.[ch] \ $(top_srcdir)/src/ip6-manager/*.[ch] \ $(top_srcdir)/src/supplicant-manager/*.[ch] \ - $(top_srcdir)/src/backends/*.[ch] \ $(top_srcdir)/src/ppp-manager/*.[ch] \ $(top_srcdir)/src/dnsmasq-manager/*.[ch] \ $(top_srcdir)/src/modem-manager/*.[ch] \ $(top_srcdir)/src/bluez-manager/*.[ch] \ $(top_srcdir)/src/firewall-manager/*.[ch] \ $(top_srcdir)/src/settings/*.[ch] $(am__append_1) -nm_daemon_sources = \ +nm_daemon_sources_no_bindings = \ $(filter-out %-glue.h %-bindings.h, $(wildcard $(nm_daemon_all_sources))) +# Don't include ModemManager1-specific headers if we're not compiling with +# ModemManager1 support. +@WITH_MODEM_MANAGER_1_FALSE@nm_daemon_sources = \ +@WITH_MODEM_MANAGER_1_FALSE@ $(filter-out $(top_srcdir)/src/modem-manager/nm-modem-broadband.h, $(wildcard $(nm_daemon_sources_no_bindings))) + + +# We filter out this file, which doesn't have any enum, and which clashes +# with ModemManager1-defined symbols +@WITH_MODEM_MANAGER_1_TRUE@nm_daemon_sources = \ +@WITH_MODEM_MANAGER_1_TRUE@ $(filter-out $(top_srcdir)/src/modem-manager/nm-modem-types.h, $(wildcard $(nm_daemon_sources_no_bindings))) + GLIB_GENERATED = nm-enum-types.h nm-enum-types.c nm-marshal.h \ nm-marshal.c nm_enum_types_sources = $(nm_daemon_sources) @@ -389,7 +410,7 @@ INCLUDES = -I${top_srcdir}/include -I${top_builddir}/include \ -I${top_srcdir}/src/dhcp-manager \ -I${top_srcdir}/src/ip6-manager \ -I${top_srcdir}/src/supplicant-manager \ - -I${top_srcdir}/src/backends -I${top_srcdir}/src/ppp-manager \ + -I${top_srcdir}/src/ppp-manager \ -I${top_srcdir}/src/dnsmasq-manager \ -I${top_srcdir}/src/modem-manager \ -I$(top_srcdir)/src/bluez-manager \ @@ -401,9 +422,8 @@ libnm_generated_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(GUDEV_CFLAGS) \ $(LIBNL_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(POLKIT_CFLAGS) \ - $(SYSTEMD_CFLAGS) \ + $(SYSTEMD_LOGIN_CFLAGS) \ $(IWMX_SDK_CFLAGS) libnm_generated_la_LIBADD = \ @@ -467,25 +487,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_generated_la-nm-marshal.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -717,6 +734,8 @@ uninstall-am: include $(GLIB_MAKEFILE) +@WITH_MODEM_MANAGER_1_TRUE@ libnm_generated_la_CPPFLAGS += $(MM_GLIB_CFLAGS) + # 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/generated/nm-enum-types.c b/src/generated/nm-enum-types.c index a7a6c9fa3..6d09c50a5 100644 --- a/src/generated/nm-enum-types.c +++ b/src/generated/nm-enum-types.c @@ -5,53 +5,56 @@ #include "nm-enum-types.h" +#include "nm-hostname-provider.h" +#include "nm-sleep-monitor.h" #include "nm-device.h" -#include "NetworkManagerUtils.h" -#include "nm-system.h" +#include "nm-rfkill.h" +#include "nm-device-vlan.h" #include "nm-device-factory.h" #include "nm-active-connection.h" #include "nm-wifi-ap.h" -#include "nm-device-ethernet.h" #include "nm-device-bt.h" #include "nm-call-store.h" -#include "nm-device-infiniband.h" #include "nm-device-wifi.h" #include "nm-dbus-manager.h" -#include "nm-device-wired.h" -#include "nm-device-private.h" +#include "nm-device-olpc-mesh.h" +#include "nm-device-bridge.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" -#include "nm-session-utils.h" #include "nm-netlink-compat.h" #include "nm-session-monitor.h" -#include "nm-ip4-config.h" +#include "nm-connection-provider.h" #include "nm-device-bond.h" #include "nm-wifi-ap-utils.h" -#include "nm-hostname-provider.h" #include "nm-device-adsl.h" #include "nm-policy-hosts.h" -#include "nm-rfkill.h" +#include "nm-dispatcher.h" #include "nm-manager.h" #include "nm-device-modem.h" +#include "nm-device-wired.h" #include "nm-activation-request.h" +#include "nm-session-utils.h" #include "nm-policy-hostname.h" -#include "nm-connection-provider.h" +#include "nm-device-infiniband.h" #include "nm-properties-changed-signal.h" +#include "nm-types.h" #include "nm-ip6-config.h" +#include "nm-device-private.h" #include "nm-policy.h" #include "nm-manager-auth.h" +#include "NetworkManagerUtils.h" #include "nm-config.h" #include "nm-netlink-utils.h" #include "nm-netlink-monitor.h" #include "nm-udev-manager.h" +#include "nm-system.h" #include "nm-connectivity.h" -#include "nm-device-vlan.h" -#include "nm-device-olpc-mesh.h" +#include "nm-device-ethernet.h" +#include "nm-ip4-config.h" #include "nm-logging.h" #include "nm-dns-utils.h" #include "nm-dns-plugin.h" #include "nm-dns-manager.h" -#include "nm-dns-bind.h" #include "nm-dns-dnsmasq.h" #include "nm-vpn-connection.h" #include "nm-vpn-manager.h" @@ -67,15 +70,14 @@ #include "nm-supplicant-settings-verify.h" #include "nm-supplicant-manager.h" #include "nm-supplicant-interface.h" -#include "nm-backend.h" -#include "NetworkManagerGeneric.h" #include "nm-ppp-status.h" #include "nm-pppd-plugin.h" #include "nm-ppp-manager.h" #include "nm-dnsmasq-manager.h" #include "nm-modem.h" +#include "nm-modem-generic.h" #include "nm-modem-cdma.h" -#include "nm-modem-types.h" +#include "nm-modem-broadband.h" #include "nm-modem-gsm.h" #include "nm-modem-manager.h" #include "nm-bluez-device.h" @@ -119,60 +121,82 @@ nm_device_error_get_type (void) return g_define_type_id__volatile; } GType -nm_ethernet_error_get_type (void) +nm_rf_kill_state_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED, "NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED", "ConnectionNotWired" }, - { NM_ETHERNET_ERROR_CONNECTION_INVALID, "NM_ETHERNET_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, - { NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE, "NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { RFKILL_UNBLOCKED, "RFKILL_UNBLOCKED", "unblocked" }, + { RFKILL_SOFT_BLOCKED, "RFKILL_SOFT_BLOCKED", "soft-blocked" }, + { RFKILL_HARD_BLOCKED, "RFKILL_HARD_BLOCKED", "hard-blocked" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMEthernetError"), values); + g_enum_register_static (g_intern_static_string ("RfKillState"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_bt_error_get_type (void) +nm_rf_kill_type_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_BT_ERROR_CONNECTION_NOT_BT, "NM_BT_ERROR_CONNECTION_NOT_BT", "ConnectionNotBt" }, - { NM_BT_ERROR_CONNECTION_INVALID, "NM_BT_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, - { NM_BT_ERROR_CONNECTION_INCOMPATIBLE, "NM_BT_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { RFKILL_TYPE_WLAN, "RFKILL_TYPE_WLAN", "wlan" }, + { RFKILL_TYPE_WWAN, "RFKILL_TYPE_WWAN", "wwan" }, + { RFKILL_TYPE_WIMAX, "RFKILL_TYPE_WIMAX", "wimax" }, + { RFKILL_TYPE_UNKNOWN, "RFKILL_TYPE_UNKNOWN", "unknown" }, + { RFKILL_TYPE_MAX, "RFKILL_TYPE_MAX", "max" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMBtError"), values); + g_enum_register_static (g_intern_static_string ("RfKillType"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_infiniband_error_get_type (void) +nm_vlan_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND, "NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND", "ConnectionNotInfiniband" }, - { NM_INFINIBAND_ERROR_CONNECTION_INVALID, "NM_INFINIBAND_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, - { NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE, "NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { NM_VLAN_ERROR_CONNECTION_NOT_VLAN, "NM_VLAN_ERROR_CONNECTION_NOT_VLAN", "ConnectionNotVlan" }, + { NM_VLAN_ERROR_CONNECTION_INVALID, "NM_VLAN_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_VLAN_ERROR_CONNECTION_INCOMPATIBLE, "NM_VLAN_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMInfinibandError"), values); + g_enum_register_static (g_intern_static_string ("NMVlanError"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} +GType +nm_bt_error_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const GEnumValue values[] = { + { NM_BT_ERROR_CONNECTION_NOT_BT, "NM_BT_ERROR_CONNECTION_NOT_BT", "ConnectionNotBt" }, + { NM_BT_ERROR_CONNECTION_INVALID, "NM_BT_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_BT_ERROR_CONNECTION_INCOMPATIBLE, "NM_BT_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_enum_register_static (g_intern_static_string ("NMBtError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } @@ -191,6 +215,7 @@ nm_wifi_error_get_type (void) { NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE, "NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, { NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND, "NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND", "AccessPointNotFound" }, { NM_WIFI_ERROR_SCAN_NOT_ALLOWED, "NM_WIFI_ERROR_SCAN_NOT_ALLOWED", "ScanNotAllowed" }, + { NM_WIFI_ERROR_AP_MODE_UNSUPPORTED, "NM_WIFI_ERROR_AP_MODE_UNSUPPORTED", "ApModeUnsupported" }, { 0, NULL, NULL } }; GType g_define_type_id = @@ -201,51 +226,40 @@ nm_wifi_error_get_type (void) return g_define_type_id__volatile; } GType -nm_session_monitor_error_get_type (void) +nm_olpc_mesh_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_SESSION_MONITOR_ERROR_IO_ERROR, "NM_SESSION_MONITOR_ERROR_IO_ERROR", "IOError" }, - { NM_SESSION_MONITOR_ERROR_MALFORMED_DATABASE, "NM_SESSION_MONITOR_ERROR_MALFORMED_DATABASE", "MalformedDatabase" }, - { NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, "NM_SESSION_MONITOR_ERROR_UNKNOWN_USER", "UnknownUser" }, - { NM_SESSION_MONITOR_ERROR_NO_DATABASE, "NM_SESSION_MONITOR_ERROR_NO_DATABASE", "NoDatabase" }, + { NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH, "NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH", "ConnectionNotMesh" }, + { NM_OLPC_MESH_ERROR_CONNECTION_INVALID, "NM_OLPC_MESH_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE, "NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMSessionMonitorError"), values); + g_enum_register_static (g_intern_static_string ("NMOlpcMeshError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_ip4_config_compare_flags_get_type (void) +nm_bridge_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_IP4_COMPARE_FLAG_NONE, "NM_IP4_COMPARE_FLAG_NONE", "none" }, - { NM_IP4_COMPARE_FLAG_ADDRESSES, "NM_IP4_COMPARE_FLAG_ADDRESSES", "addresses" }, - { NM_IP4_COMPARE_FLAG_PTP_ADDRESS, "NM_IP4_COMPARE_FLAG_PTP_ADDRESS", "ptp-address" }, - { NM_IP4_COMPARE_FLAG_NAMESERVERS, "NM_IP4_COMPARE_FLAG_NAMESERVERS", "nameservers" }, - { NM_IP4_COMPARE_FLAG_ROUTES, "NM_IP4_COMPARE_FLAG_ROUTES", "routes" }, - { NM_IP4_COMPARE_FLAG_DOMAINS, "NM_IP4_COMPARE_FLAG_DOMAINS", "domains" }, - { NM_IP4_COMPARE_FLAG_SEARCHES, "NM_IP4_COMPARE_FLAG_SEARCHES", "searches" }, - { NM_IP4_COMPARE_FLAG_MTU, "NM_IP4_COMPARE_FLAG_MTU", "mtu" }, - { NM_IP4_COMPARE_FLAG_MSS, "NM_IP4_COMPARE_FLAG_MSS", "mss" }, - { NM_IP4_COMPARE_FLAG_WINS_SERVERS, "NM_IP4_COMPARE_FLAG_WINS_SERVERS", "wins-servers" }, - { NM_IP4_COMPARE_FLAG_NIS_SERVERS, "NM_IP4_COMPARE_FLAG_NIS_SERVERS", "nis-servers" }, - { NM_IP4_COMPARE_FLAG_NIS_DOMAIN, "NM_IP4_COMPARE_FLAG_NIS_DOMAIN", "nis-domain" }, - { NM_IP4_COMPARE_FLAG_ALL, "NM_IP4_COMPARE_FLAG_ALL", "all" }, + { NM_BRIDGE_ERROR_CONNECTION_NOT_BRIDGE, "NM_BRIDGE_ERROR_CONNECTION_NOT_BRIDGE", "ConnectionNotBridge" }, + { NM_BRIDGE_ERROR_CONNECTION_INVALID, "NM_BRIDGE_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_BRIDGE_ERROR_CONNECTION_INCOMPATIBLE, "NM_BRIDGE_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMIP4ConfigCompareFlags"), values); + g_enum_register_static (g_intern_static_string ("NMBridgeError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } @@ -292,90 +306,94 @@ nm_adsl_error_get_type (void) return g_define_type_id__volatile; } GType -nm_rf_kill_state_get_type (void) +nm_dispatcher_action_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { RFKILL_UNBLOCKED, "RFKILL_UNBLOCKED", "unblocked" }, - { RFKILL_SOFT_BLOCKED, "RFKILL_SOFT_BLOCKED", "soft-blocked" }, - { RFKILL_HARD_BLOCKED, "RFKILL_HARD_BLOCKED", "hard-blocked" }, + { DISPATCHER_ACTION_HOSTNAME, "DISPATCHER_ACTION_HOSTNAME", "hostname" }, + { DISPATCHER_ACTION_UP, "DISPATCHER_ACTION_UP", "up" }, + { DISPATCHER_ACTION_PRE_DOWN, "DISPATCHER_ACTION_PRE_DOWN", "pre-down" }, + { DISPATCHER_ACTION_DOWN, "DISPATCHER_ACTION_DOWN", "down" }, + { DISPATCHER_ACTION_VPN_UP, "DISPATCHER_ACTION_VPN_UP", "vpn-up" }, + { DISPATCHER_ACTION_VPN_PRE_DOWN, "DISPATCHER_ACTION_VPN_PRE_DOWN", "vpn-pre-down" }, + { DISPATCHER_ACTION_VPN_DOWN, "DISPATCHER_ACTION_VPN_DOWN", "vpn-down" }, + { DISPATCHER_ACTION_DHCP4_CHANGE, "DISPATCHER_ACTION_DHCP4_CHANGE", "dhcp4-change" }, + { DISPATCHER_ACTION_DHCP6_CHANGE, "DISPATCHER_ACTION_DHCP6_CHANGE", "dhcp6-change" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("RfKillState"), values); + g_enum_register_static (g_intern_static_string ("DispatcherAction"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_rf_kill_type_get_type (void) +nm_manager_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { RFKILL_TYPE_WLAN, "RFKILL_TYPE_WLAN", "wlan" }, - { RFKILL_TYPE_WWAN, "RFKILL_TYPE_WWAN", "wwan" }, - { RFKILL_TYPE_WIMAX, "RFKILL_TYPE_WIMAX", "wimax" }, - { RFKILL_TYPE_UNKNOWN, "RFKILL_TYPE_UNKNOWN", "unknown" }, - { RFKILL_TYPE_MAX, "RFKILL_TYPE_MAX", "max" }, + { NM_MANAGER_ERROR_UNKNOWN_CONNECTION, "NM_MANAGER_ERROR_UNKNOWN_CONNECTION", "UnknownConnection" }, + { NM_MANAGER_ERROR_UNKNOWN_DEVICE, "NM_MANAGER_ERROR_UNKNOWN_DEVICE", "UnknownDevice" }, + { NM_MANAGER_ERROR_UNMANAGED_DEVICE, "NM_MANAGER_ERROR_UNMANAGED_DEVICE", "UnmanagedDevice" }, + { NM_MANAGER_ERROR_SYSTEM_CONNECTION, "NM_MANAGER_ERROR_SYSTEM_CONNECTION", "SystemConnection" }, + { NM_MANAGER_ERROR_PERMISSION_DENIED, "NM_MANAGER_ERROR_PERMISSION_DENIED", "PermissionDenied" }, + { NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, "NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE", "ConnectionNotActive" }, + { NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE, "NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE", "AlreadyAsleepOrAwake" }, + { NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, "NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED", "AlreadyEnabledOrDisabled" }, + { NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE, "NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE", "UnsupportedConnectionType" }, + { NM_MANAGER_ERROR_DEPENDENCY_FAILED, "NM_MANAGER_ERROR_DEPENDENCY_FAILED", "DependencyFailed" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("RfKillType"), values); + g_enum_register_static (g_intern_static_string ("NMManagerError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_manager_error_get_type (void) +nm_session_monitor_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_MANAGER_ERROR_UNKNOWN_CONNECTION, "NM_MANAGER_ERROR_UNKNOWN_CONNECTION", "UnknownConnection" }, - { NM_MANAGER_ERROR_UNKNOWN_DEVICE, "NM_MANAGER_ERROR_UNKNOWN_DEVICE", "UnknownDevice" }, - { NM_MANAGER_ERROR_UNMANAGED_DEVICE, "NM_MANAGER_ERROR_UNMANAGED_DEVICE", "UnmanagedDevice" }, - { NM_MANAGER_ERROR_SYSTEM_CONNECTION, "NM_MANAGER_ERROR_SYSTEM_CONNECTION", "SystemConnection" }, - { NM_MANAGER_ERROR_PERMISSION_DENIED, "NM_MANAGER_ERROR_PERMISSION_DENIED", "PermissionDenied" }, - { NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, "NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE", "ConnectionNotActive" }, - { NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE, "NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE", "AlreadyAsleepOrAwake" }, - { NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, "NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED", "AlreadyEnabledOrDisabled" }, - { NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE, "NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE", "UnsupportedConnectionType" }, - { NM_MANAGER_ERROR_DEPENDENCY_FAILED, "NM_MANAGER_ERROR_DEPENDENCY_FAILED", "DependencyFailed" }, + { NM_SESSION_MONITOR_ERROR_IO_ERROR, "NM_SESSION_MONITOR_ERROR_IO_ERROR", "IOError" }, + { NM_SESSION_MONITOR_ERROR_MALFORMED_DATABASE, "NM_SESSION_MONITOR_ERROR_MALFORMED_DATABASE", "MalformedDatabase" }, + { NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, "NM_SESSION_MONITOR_ERROR_UNKNOWN_USER", "UnknownUser" }, + { NM_SESSION_MONITOR_ERROR_NO_DATABASE, "NM_SESSION_MONITOR_ERROR_NO_DATABASE", "NoDatabase" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMManagerError"), values); + g_enum_register_static (g_intern_static_string ("NMSessionMonitorError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_act_request_dependency_result_get_type (void) +nm_infiniband_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_ACT_REQUEST_DEP_RESULT_UNKNOWN, "NM_ACT_REQUEST_DEP_RESULT_UNKNOWN", "unknown" }, - { NM_ACT_REQUEST_DEP_RESULT_WAIT, "NM_ACT_REQUEST_DEP_RESULT_WAIT", "wait" }, - { NM_ACT_REQUEST_DEP_RESULT_READY, "NM_ACT_REQUEST_DEP_RESULT_READY", "ready" }, - { NM_ACT_REQUEST_DEP_RESULT_FAILED, "NM_ACT_REQUEST_DEP_RESULT_FAILED", "failed" }, + { NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND, "NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND", "ConnectionNotInfiniband" }, + { NM_INFINIBAND_ERROR_CONNECTION_INVALID, "NM_INFINIBAND_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE, "NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMActRequestDependencyResult"), values); + g_enum_register_static (g_intern_static_string ("NMInfinibandError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } @@ -495,40 +513,50 @@ nm_netlink_monitor_error_get_type (void) return g_define_type_id__volatile; } GType -nm_vlan_error_get_type (void) +nm_ethernet_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_VLAN_ERROR_CONNECTION_NOT_VLAN, "NM_VLAN_ERROR_CONNECTION_NOT_VLAN", "ConnectionNotVlan" }, - { NM_VLAN_ERROR_CONNECTION_INVALID, "NM_VLAN_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, - { NM_VLAN_ERROR_CONNECTION_INCOMPATIBLE, "NM_VLAN_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED, "NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED", "ConnectionNotWired" }, + { NM_ETHERNET_ERROR_CONNECTION_INVALID, "NM_ETHERNET_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE, "NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMVlanError"), values); + g_enum_register_static (g_intern_static_string ("NMEthernetError"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } return g_define_type_id__volatile; } GType -nm_olpc_mesh_error_get_type (void) +nm_ip4_config_compare_flags_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; if (g_once_init_enter (&g_define_type_id__volatile)) { static const GEnumValue values[] = { - { NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH, "NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH", "ConnectionNotMesh" }, - { NM_OLPC_MESH_ERROR_CONNECTION_INVALID, "NM_OLPC_MESH_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, - { NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE, "NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { NM_IP4_COMPARE_FLAG_NONE, "NM_IP4_COMPARE_FLAG_NONE", "none" }, + { NM_IP4_COMPARE_FLAG_ADDRESSES, "NM_IP4_COMPARE_FLAG_ADDRESSES", "addresses" }, + { NM_IP4_COMPARE_FLAG_PTP_ADDRESS, "NM_IP4_COMPARE_FLAG_PTP_ADDRESS", "ptp-address" }, + { NM_IP4_COMPARE_FLAG_NAMESERVERS, "NM_IP4_COMPARE_FLAG_NAMESERVERS", "nameservers" }, + { NM_IP4_COMPARE_FLAG_ROUTES, "NM_IP4_COMPARE_FLAG_ROUTES", "routes" }, + { NM_IP4_COMPARE_FLAG_DOMAINS, "NM_IP4_COMPARE_FLAG_DOMAINS", "domains" }, + { NM_IP4_COMPARE_FLAG_SEARCHES, "NM_IP4_COMPARE_FLAG_SEARCHES", "searches" }, + { NM_IP4_COMPARE_FLAG_MTU, "NM_IP4_COMPARE_FLAG_MTU", "mtu" }, + { NM_IP4_COMPARE_FLAG_MSS, "NM_IP4_COMPARE_FLAG_MSS", "mss" }, + { NM_IP4_COMPARE_FLAG_WINS_SERVERS, "NM_IP4_COMPARE_FLAG_WINS_SERVERS", "wins-servers" }, + { NM_IP4_COMPARE_FLAG_NIS_SERVERS, "NM_IP4_COMPARE_FLAG_NIS_SERVERS", "nis-servers" }, + { NM_IP4_COMPARE_FLAG_NIS_DOMAIN, "NM_IP4_COMPARE_FLAG_NIS_DOMAIN", "nis-domain" }, + { NM_IP4_COMPARE_FLAG_ALL, "NM_IP4_COMPARE_FLAG_ALL", "all" }, { 0, NULL, NULL } }; GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMOlpcMeshError"), values); + g_enum_register_static (g_intern_static_string ("NMIP4ConfigCompareFlags"), values); g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); } @@ -700,6 +728,26 @@ nm_opt_type_get_type (void) return g_define_type_id__volatile; } GType +nm_ap_support_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const GEnumValue values[] = { + { AP_SUPPORT_UNKNOWN, "AP_SUPPORT_UNKNOWN", "unknown" }, + { AP_SUPPORT_NO, "AP_SUPPORT_NO", "no" }, + { AP_SUPPORT_YES, "AP_SUPPORT_YES", "yes" }, + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_enum_register_static (g_intern_static_string ("ApSupport"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} +GType nm_ppp_status_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; @@ -751,6 +799,34 @@ nm_dns_masq_status_get_type (void) return g_define_type_id__volatile; } GType +nm_modem_state_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const GEnumValue values[] = { + { NM_MODEM_STATE_UNKNOWN, "NM_MODEM_STATE_UNKNOWN", "unknown" }, + { NM_MODEM_STATE_DISABLED, "NM_MODEM_STATE_DISABLED", "disabled" }, + { NM_MODEM_STATE_DISABLING, "NM_MODEM_STATE_DISABLING", "disabling" }, + { NM_MODEM_STATE_ENABLING, "NM_MODEM_STATE_ENABLING", "enabling" }, + { NM_MODEM_STATE_ENABLED, "NM_MODEM_STATE_ENABLED", "enabled" }, + { NM_MODEM_STATE_SEARCHING, "NM_MODEM_STATE_SEARCHING", "searching" }, + { NM_MODEM_STATE_REGISTERED, "NM_MODEM_STATE_REGISTERED", "registered" }, + { NM_MODEM_STATE_DISCONNECTING, "NM_MODEM_STATE_DISCONNECTING", "disconnecting" }, + { NM_MODEM_STATE_CONNECTING, "NM_MODEM_STATE_CONNECTING", "connecting" }, + { NM_MODEM_STATE_CONNECTED, "NM_MODEM_STATE_CONNECTED", "connected" }, + { NM_MODEM_STATE_LAST, "NM_MODEM_STATE_LAST", "last" }, + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_enum_register_static (g_intern_static_string ("NMModemState"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} +GType nm_cdma_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; @@ -771,6 +847,27 @@ nm_cdma_error_get_type (void) return g_define_type_id__volatile; } GType +nm_modem_broadband_error_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const GEnumValue values[] = { + { NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_GSM, "NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_GSM", "ConnectionNotGsm" }, + { NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_CDMA, "NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_CDMA", "ConnectionNotCdma" }, + { NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID, "NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID", "ConnectionInvalid" }, + { NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE, "NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE", "ConnectionIncompatible" }, + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_enum_register_static (g_intern_static_string ("NMModemBroadbandError"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} +GType nm_gsm_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; diff --git a/src/generated/nm-enum-types.h b/src/generated/nm-enum-types.h index e1b06a4f7..36de65cc0 100644 --- a/src/generated/nm-enum-types.h +++ b/src/generated/nm-enum-types.h @@ -11,30 +11,32 @@ G_BEGIN_DECLS GType nm_device_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_DEVICE_ERROR (nm_device_error_get_type ()) -GType nm_ethernet_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_ETHERNET_ERROR (nm_ethernet_error_get_type ()) +GType nm_rf_kill_state_get_type (void) G_GNUC_CONST; +#define NM_TYPE_RF_KILL_STATE (nm_rf_kill_state_get_type ()) +GType nm_rf_kill_type_get_type (void) G_GNUC_CONST; +#define NM_TYPE_RF_KILL_TYPE (nm_rf_kill_type_get_type ()) +GType nm_vlan_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_VLAN_ERROR (nm_vlan_error_get_type ()) GType nm_bt_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_BT_ERROR (nm_bt_error_get_type ()) -GType nm_infiniband_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_INFINIBAND_ERROR (nm_infiniband_error_get_type ()) GType nm_wifi_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_WIFI_ERROR (nm_wifi_error_get_type ()) -GType nm_session_monitor_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_SESSION_MONITOR_ERROR (nm_session_monitor_error_get_type ()) -GType nm_ip4_config_compare_flags_get_type (void) G_GNUC_CONST; -#define NM_TYPE_IP4_CONFIG_COMPARE_FLAGS (nm_ip4_config_compare_flags_get_type ()) +GType nm_olpc_mesh_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_OLPC_MESH_ERROR (nm_olpc_mesh_error_get_type ()) +GType nm_bridge_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_BRIDGE_ERROR (nm_bridge_error_get_type ()) GType nm_bond_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_BOND_ERROR (nm_bond_error_get_type ()) GType nm_adsl_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_ADSL_ERROR (nm_adsl_error_get_type ()) -GType nm_rf_kill_state_get_type (void) G_GNUC_CONST; -#define NM_TYPE_RF_KILL_STATE (nm_rf_kill_state_get_type ()) -GType nm_rf_kill_type_get_type (void) G_GNUC_CONST; -#define NM_TYPE_RF_KILL_TYPE (nm_rf_kill_type_get_type ()) +GType nm_dispatcher_action_get_type (void) G_GNUC_CONST; +#define NM_TYPE_DISPATCHER_ACTION (nm_dispatcher_action_get_type ()) GType nm_manager_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_MANAGER_ERROR (nm_manager_error_get_type ()) -GType nm_act_request_dependency_result_get_type (void) G_GNUC_CONST; -#define NM_TYPE_ACT_REQUEST_DEPENDENCY_RESULT (nm_act_request_dependency_result_get_type ()) +GType nm_session_monitor_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_SESSION_MONITOR_ERROR (nm_session_monitor_error_get_type ()) +GType nm_infiniband_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_INFINIBAND_ERROR (nm_infiniband_error_get_type ()) GType nm_ip6_config_compare_flags_get_type (void) G_GNUC_CONST; #define NM_TYPE_IP6_CONFIG_COMPARE_FLAGS (nm_ip6_config_compare_flags_get_type ()) GType nm_auth_call_result_get_type (void) G_GNUC_CONST; @@ -45,10 +47,10 @@ GType nm_nm_nl_prop_get_type (void) G_GNUC_CONST; #define NM_TYPE_NM_NL_PROP (nm_nm_nl_prop_get_type ()) GType nm_netlink_monitor_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_NETLINK_MONITOR_ERROR (nm_netlink_monitor_error_get_type ()) -GType nm_vlan_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_VLAN_ERROR (nm_vlan_error_get_type ()) -GType nm_olpc_mesh_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_OLPC_MESH_ERROR (nm_olpc_mesh_error_get_type ()) +GType nm_ethernet_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_ETHERNET_ERROR (nm_ethernet_error_get_type ()) +GType nm_ip4_config_compare_flags_get_type (void) G_GNUC_CONST; +#define NM_TYPE_IP4_CONFIG_COMPARE_FLAGS (nm_ip4_config_compare_flags_get_type ()) GType nm_logging_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_LOGGING_ERROR (nm_logging_error_get_type ()) GType nm_dns_manager_error_get_type (void) G_GNUC_CONST; @@ -63,12 +65,18 @@ GType nm_dhcp_state_get_type (void) G_GNUC_CONST; #define NM_TYPE_DHCP_STATE (nm_dhcp_state_get_type ()) GType nm_opt_type_get_type (void) G_GNUC_CONST; #define NM_TYPE_OPT_TYPE (nm_opt_type_get_type ()) +GType nm_ap_support_get_type (void) G_GNUC_CONST; +#define NM_TYPE_AP_SUPPORT (nm_ap_support_get_type ()) GType nm_ppp_status_get_type (void) G_GNUC_CONST; #define NM_TYPE_PPP_STATUS (nm_ppp_status_get_type ()) GType nm_dns_masq_status_get_type (void) G_GNUC_CONST; #define NM_TYPE_DNS_MASQ_STATUS (nm_dns_masq_status_get_type ()) +GType nm_modem_state_get_type (void) G_GNUC_CONST; +#define NM_TYPE_MODEM_STATE (nm_modem_state_get_type ()) GType nm_cdma_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_CDMA_ERROR (nm_cdma_error_get_type ()) +GType nm_modem_broadband_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_MODEM_BROADBAND_ERROR (nm_modem_broadband_error_get_type ()) GType nm_gsm_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_GSM_ERROR (nm_gsm_error_get_type ()) GType nm_system_config_interface_capabilities_get_type (void) G_GNUC_CONST; diff --git a/src/generated/nm-marshal.c b/src/generated/nm-marshal.c index e3d39724c..6f6808df1 100644 --- a/src/generated/nm-marshal.c +++ b/src/generated/nm-marshal.c @@ -200,20 +200,20 @@ _nm_marshal_VOID__OBJECT_OBJECT (GClosure *closure, data2); } -/* VOID:OBJECT,STRING (nm-marshal.list:5) */ +/* VOID:OBJECT,POINTER (nm-marshal.list:5) */ void -_nm_marshal_VOID__OBJECT_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) +_nm_marshal_VOID__OBJECT_POINTER (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__OBJECT_STRING) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_VOID__OBJECT_STRING callback; + typedef void (*GMarshalFunc_VOID__OBJECT_POINTER) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer data2); + register GMarshalFunc_VOID__OBJECT_POINTER callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; @@ -229,34 +229,32 @@ _nm_marshal_VOID__OBJECT_STRING (GClosure *closure, data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } - callback = (GMarshalFunc_VOID__OBJECT_STRING) (marshal_data ? marshal_data : cc->callback); + callback = (GMarshalFunc_VOID__OBJECT_POINTER) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_object (param_values + 1), - g_marshal_value_peek_string (param_values + 2), + g_marshal_value_peek_pointer (param_values + 2), data2); } -/* VOID:OBJECT,UINT,UINT,UINT (nm-marshal.list:6) */ +/* VOID:OBJECT,STRING (nm-marshal.list:6) */ void -_nm_marshal_VOID__OBJECT_UINT_UINT_UINT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) +_nm_marshal_VOID__OBJECT_STRING (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) { - typedef void (*GMarshalFunc_VOID__OBJECT_UINT_UINT_UINT) (gpointer data1, - gpointer arg_1, - guint arg_2, - guint arg_3, - guint arg_4, - gpointer data2); - register GMarshalFunc_VOID__OBJECT_UINT_UINT_UINT callback; + typedef void (*GMarshalFunc_VOID__OBJECT_STRING) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer data2); + register GMarshalFunc_VOID__OBJECT_STRING callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; - g_return_if_fail (n_param_values == 5); + g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -268,13 +266,11 @@ _nm_marshal_VOID__OBJECT_UINT_UINT_UINT (GClosure *closure, data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } - callback = (GMarshalFunc_VOID__OBJECT_UINT_UINT_UINT) (marshal_data ? marshal_data : cc->callback); + callback = (GMarshalFunc_VOID__OBJECT_STRING) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_object (param_values + 1), - g_marshal_value_peek_uint (param_values + 2), - g_marshal_value_peek_uint (param_values + 3), - g_marshal_value_peek_uint (param_values + 4), + g_marshal_value_peek_string (param_values + 2), data2); } @@ -516,46 +512,7 @@ _nm_marshal_VOID__STRING_OBJECT (GClosure *closure, data2); } -/* VOID:STRING,OBJECT,POINTER (nm-marshal.list:14) */ -void -_nm_marshal_VOID__STRING_OBJECT_POINTER (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__STRING_OBJECT_POINTER) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_VOID__STRING_OBJECT_POINTER callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_OBJECT_POINTER) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_string (param_values + 1), - g_marshal_value_peek_object (param_values + 2), - g_marshal_value_peek_pointer (param_values + 3), - data2); -} - -/* VOID:STRING,POINTER (nm-marshal.list:15) */ +/* VOID:STRING,POINTER (nm-marshal.list:14) */ void _nm_marshal_VOID__STRING_POINTER (GClosure *closure, GValue *return_value G_GNUC_UNUSED, @@ -592,7 +549,7 @@ _nm_marshal_VOID__STRING_POINTER (GClosure *closure, data2); } -/* VOID:STRING,STRING (nm-marshal.list:16) */ +/* VOID:STRING,STRING (nm-marshal.list:15) */ void _nm_marshal_VOID__STRING_STRING (GClosure *closure, GValue *return_value G_GNUC_UNUSED, @@ -629,7 +586,7 @@ _nm_marshal_VOID__STRING_STRING (GClosure *closure, data2); } -/* VOID:STRING,STRING,STRING (nm-marshal.list:17) */ +/* VOID:STRING,STRING,STRING (nm-marshal.list:16) */ void _nm_marshal_VOID__STRING_STRING_STRING (GClosure *closure, GValue *return_value G_GNUC_UNUSED, @@ -668,7 +625,7 @@ _nm_marshal_VOID__STRING_STRING_STRING (GClosure *closure, data2); } -/* VOID:STRING,STRING,STRING,UINT (nm-marshal.list:18) */ +/* VOID:STRING,STRING,STRING,UINT (nm-marshal.list:17) */ void _nm_marshal_VOID__STRING_STRING_STRING_UINT (GClosure *closure, GValue *return_value G_GNUC_UNUSED, @@ -709,7 +666,7 @@ _nm_marshal_VOID__STRING_STRING_STRING_UINT (GClosure *closure, data2); } -/* VOID:UINT,UINT (nm-marshal.list:19) */ +/* VOID:UINT,UINT (nm-marshal.list:18) */ void _nm_marshal_VOID__UINT_UINT (GClosure *closure, GValue *return_value G_GNUC_UNUSED, @@ -746,6 +703,45 @@ _nm_marshal_VOID__UINT_UINT (GClosure *closure, data2); } +/* VOID:UINT,UINT,INT (nm-marshal.list:19) */ +void +_nm_marshal_VOID__UINT_UINT_INT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__UINT_UINT_INT) (gpointer data1, + guint arg_1, + guint arg_2, + gint arg_3, + gpointer data2); + register GMarshalFunc_VOID__UINT_UINT_INT callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 4); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__UINT_UINT_INT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_uint (param_values + 1), + g_marshal_value_peek_uint (param_values + 2), + g_marshal_value_peek_int (param_values + 3), + data2); +} + /* VOID:UINT,UINT,UINT (nm-marshal.list:20) */ void _nm_marshal_VOID__UINT_UINT_UINT (GClosure *closure, diff --git a/src/generated/nm-marshal.h b/src/generated/nm-marshal.h index 61ef6479c..bc64ec5c8 100644 --- a/src/generated/nm-marshal.h +++ b/src/generated/nm-marshal.h @@ -38,7 +38,15 @@ extern void _nm_marshal_VOID__OBJECT_OBJECT (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:OBJECT,STRING (nm-marshal.list:5) */ +/* VOID:OBJECT,POINTER (nm-marshal.list:5) */ +extern void _nm_marshal_VOID__OBJECT_POINTER (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +/* VOID:OBJECT,STRING (nm-marshal.list:6) */ extern void _nm_marshal_VOID__OBJECT_STRING (GClosure *closure, GValue *return_value, guint n_param_values, @@ -46,14 +54,6 @@ extern void _nm_marshal_VOID__OBJECT_STRING (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:OBJECT,UINT,UINT,UINT (nm-marshal.list:6) */ -extern void _nm_marshal_VOID__OBJECT_UINT_UINT_UINT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - /* VOID:POINTER (nm-marshal.list:7) */ #define _nm_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER @@ -105,15 +105,7 @@ extern void _nm_marshal_VOID__STRING_OBJECT (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:STRING,OBJECT,POINTER (nm-marshal.list:14) */ -extern void _nm_marshal_VOID__STRING_OBJECT_POINTER (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:STRING,POINTER (nm-marshal.list:15) */ +/* VOID:STRING,POINTER (nm-marshal.list:14) */ extern void _nm_marshal_VOID__STRING_POINTER (GClosure *closure, GValue *return_value, guint n_param_values, @@ -121,7 +113,7 @@ extern void _nm_marshal_VOID__STRING_POINTER (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:STRING,STRING (nm-marshal.list:16) */ +/* VOID:STRING,STRING (nm-marshal.list:15) */ extern void _nm_marshal_VOID__STRING_STRING (GClosure *closure, GValue *return_value, guint n_param_values, @@ -129,7 +121,7 @@ extern void _nm_marshal_VOID__STRING_STRING (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:STRING,STRING,STRING (nm-marshal.list:17) */ +/* VOID:STRING,STRING,STRING (nm-marshal.list:16) */ extern void _nm_marshal_VOID__STRING_STRING_STRING (GClosure *closure, GValue *return_value, guint n_param_values, @@ -137,7 +129,7 @@ extern void _nm_marshal_VOID__STRING_STRING_STRING (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:STRING,STRING,STRING,UINT (nm-marshal.list:18) */ +/* VOID:STRING,STRING,STRING,UINT (nm-marshal.list:17) */ extern void _nm_marshal_VOID__STRING_STRING_STRING_UINT (GClosure *closure, GValue *return_value, guint n_param_values, @@ -145,7 +137,7 @@ extern void _nm_marshal_VOID__STRING_STRING_STRING_UINT (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); -/* VOID:UINT,UINT (nm-marshal.list:19) */ +/* VOID:UINT,UINT (nm-marshal.list:18) */ extern void _nm_marshal_VOID__UINT_UINT (GClosure *closure, GValue *return_value, guint n_param_values, @@ -153,6 +145,14 @@ extern void _nm_marshal_VOID__UINT_UINT (GClosure *closure, gpointer invocation_hint, gpointer marshal_data); +/* VOID:UINT,UINT,INT (nm-marshal.list:19) */ +extern void _nm_marshal_VOID__UINT_UINT_INT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + /* VOID:UINT,UINT,UINT (nm-marshal.list:20) */ extern void _nm_marshal_VOID__UINT_UINT_UINT (GClosure *closure, GValue *return_value, diff --git a/src/ip6-manager/Makefile.am b/src/ip6-manager/Makefile.am index be4b97134..eb730394e 100644 --- a/src/ip6-manager/Makefile.am +++ b/src/ip6-manager/Makefile.am @@ -18,8 +18,7 @@ libip6_manager_la_SOURCES = \ libip6_manager_la_CPPFLAGS = \ $(LIBNL_CFLAGS) \ $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED + $(GLIB_CFLAGS) libip6_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ diff --git a/src/ip6-manager/Makefile.in b/src/ip6-manager/Makefile.in index 833245b0d..317f27fb9 100644 --- a/src/ip6-manager/Makefile.in +++ b/src/ip6-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/ip6-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -131,6 +133,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -145,9 +151,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -157,17 +161,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -208,6 +209,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -224,11 +226,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -243,6 +241,8 @@ 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@ @@ -252,6 +252,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -278,13 +279,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -339,6 +341,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -353,6 +360,10 @@ 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@ INCLUDES = \ -I${top_srcdir} \ -I${top_builddir}/include \ @@ -372,8 +383,7 @@ libip6_manager_la_SOURCES = \ libip6_manager_la_CPPFLAGS = \ $(LIBNL_CFLAGS) \ $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED + $(GLIB_CFLAGS) libip6_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ @@ -437,25 +447,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libip6_manager_la-nm-ip6-manager.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/ip6-manager/nm-ip6-manager.c b/src/ip6-manager/nm-ip6-manager.c index 4432aa5c4..490e9574b 100644 --- a/src/ip6-manager/nm-ip6-manager.c +++ b/src/ip6-manager/nm-ip6-manager.c @@ -140,7 +140,7 @@ nm_ip6_device_destroy (NMIP6Device *device) /* reset the saved IPv6 value */ if (device->disable_ip6_save_valid) { nm_utils_do_sysctl (device->disable_ip6_path, - device->disable_ip6_save ? "1\n" : "0\n"); + device->disable_ip6_save ? "1" : "0"); } if (device->finish_addrconf_id) @@ -1399,10 +1399,10 @@ nm_ip6_manager_prepare_interface (NMIP6Manager *manager, /* Establish target state and turn router advertisement acceptance on or off */ if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) { device->target_state = NM_IP6_DEVICE_GOT_LINK_LOCAL; - nm_utils_do_sysctl (accept_ra_path, "0\n"); + nm_utils_do_sysctl (accept_ra_path, "0"); } else { device->target_state = NM_IP6_DEVICE_GOT_ADDRESS; - nm_utils_do_sysctl (accept_ra_path, "2\n"); + nm_utils_do_sysctl (accept_ra_path, "2"); } return TRUE; @@ -1447,9 +1447,9 @@ nm_ip6_manager_begin_addrconf (NMIP6Manager *manager, int ifindex) * new RAs; there doesn't seem to be a better way to do this right now. */ if (device->target_state >= NM_IP6_DEVICE_GOT_ADDRESS) { - nm_utils_do_sysctl (device->disable_ip6_path, "1\n"); + nm_utils_do_sysctl (device->disable_ip6_path, "1"); g_usleep (200); - nm_utils_do_sysctl (device->disable_ip6_path, "0\n"); + nm_utils_do_sysctl (device->disable_ip6_path, "0"); } device->ip6flags_poll_id = g_timeout_add_seconds (1, poll_ip6_flags, priv->monitor); diff --git a/src/logging/Makefile.am b/src/logging/Makefile.am index 51a6b25dc..e8fe60ee7 100644 --- a/src/logging/Makefile.am +++ b/src/logging/Makefile.am @@ -6,8 +6,7 @@ libnm_logging_la_SOURCES = \ libnm_logging_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DG_DISABLE_DEPRECATED + -DLIBEXECDIR=\"$(libexecdir)\" libnm_logging_la_LIBADD = \ -ldl \ diff --git a/src/logging/Makefile.in b/src/logging/Makefile.in index 8af1bde3d..38c994c2a 100644 --- a/src/logging/Makefile.in +++ b/src/logging/Makefile.in @@ -55,16 +55,18 @@ subdir = src/logging DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -127,6 +129,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -141,9 +147,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -153,17 +157,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -204,6 +205,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -220,11 +222,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -239,6 +237,8 @@ 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@ @@ -248,6 +248,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -274,13 +275,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -335,6 +337,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -349,6 +356,10 @@ 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@ noinst_LTLIBRARIES = libnm-logging.la libnm_logging_la_SOURCES = \ nm-logging.c \ @@ -356,8 +367,7 @@ libnm_logging_la_SOURCES = \ libnm_logging_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DG_DISABLE_DEPRECATED + -DLIBEXECDIR=\"$(libexecdir)\" libnm_logging_la_LIBADD = \ -ldl \ @@ -418,25 +428,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_logging_la-nm-logging.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/logging/nm-logging.c b/src/logging/nm-logging.c index 8ec22982b..3461412e8 100644 --- a/src/logging/nm-logging.c +++ b/src/logging/nm-logging.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2006 - 2010 Red Hat, Inc. + * Copyright (C) 2006 - 2012 Red Hat, Inc. * Copyright (C) 2006 - 2008 Novell, Inc. */ @@ -40,13 +40,19 @@ #include "nm-logging.h" +#define LOGD_ALL \ + (LOGD_HW | LOGD_RFKILL | LOGD_ETHER | LOGD_WIFI | LOGD_BT | LOGD_MB | \ + LOGD_DHCP4 | LOGD_DHCP6 | LOGD_PPP | LOGD_WIFI_SCAN | LOGD_IP4 | \ + LOGD_IP6 | LOGD_AUTOIP4 | LOGD_DNS | LOGD_VPN | LOGD_SHARING | \ + LOGD_SUPPLICANT | LOGD_AGENTS | LOGD_SETTINGS | LOGD_SUSPEND | \ + LOGD_CORE | LOGD_DEVICE | LOGD_OLPC_MESH | LOGD_WIMAX | \ + LOGD_INFINIBAND | LOGD_FIREWALL | LOGD_ADSL | LOGD_BOND | \ + LOGD_VLAN) + +#define LOGD_DEFAULT (LOGD_ALL & ~LOGD_WIFI_SCAN) + static guint32 log_level = LOGL_INFO | LOGL_WARN | LOGL_ERR; -static guint32 log_domains = \ - LOGD_HW | LOGD_RFKILL | LOGD_ETHER | LOGD_WIFI | LOGD_BT | LOGD_MB | \ - LOGD_DHCP4 | LOGD_DHCP6 | LOGD_PPP | LOGD_IP4 | LOGD_IP6 | LOGD_AUTOIP4 | \ - LOGD_DNS | LOGD_VPN | LOGD_SHARING | LOGD_SUPPLICANT | LOGD_AGENTS | \ - LOGD_SETTINGS | LOGD_SUSPEND | LOGD_CORE | LOGD_DEVICE | LOGD_OLPC_MESH | \ - LOGD_WIMAX | LOGD_INFINIBAND | LOGD_FIREWALL | LOGD_ADSL; +static guint32 log_domains = LOGD_DEFAULT; typedef struct { guint32 num; @@ -90,9 +96,17 @@ static const LogDesc domain_descs[] = { { LOGD_INFINIBAND,"INFINIBAND" }, { LOGD_FIREWALL, "FIREWALL" }, { LOGD_ADSL, "ADSL" }, + { LOGD_BOND, "BOND" }, + { LOGD_VLAN, "VLAN" }, { 0, NULL } }; +/* Combined domains */ +#define LOGD_ALL_STRING "ALL" +#define LOGD_DEFAULT_STRING "DEFAULT" +#define LOGD_DHCP_STRING "DHCP" +#define LOGD_IP_STRING "IP" + /************************************************************************/ GQuark @@ -151,6 +165,21 @@ nm_logging_setup (const char *level, const char *domains, GError **error) } } + /* Check for combined domains */ + if (!strcasecmp (*iter, LOGD_ALL_STRING)) { + new_domains = LOGD_ALL; + found = TRUE; + } else if (!strcasecmp (*iter, LOGD_DEFAULT_STRING)) { + new_domains = LOGD_DEFAULT; + found = TRUE; + } else if (!strcasecmp (*iter, LOGD_DHCP_STRING)) { + new_domains |= LOGD_DHCP; + found = TRUE; + } else if (!strcasecmp (*iter, LOGD_IP_STRING)) { + new_domains |= LOGD_IP; + found = TRUE; + } + if (!found) { g_set_error (error, NM_LOGGING_ERROR, NM_LOGGING_ERROR_UNKNOWN_DOMAIN, _("Unknown log domain '%s'"), *iter); diff --git a/src/logging/nm-logging.h b/src/logging/nm-logging.h index b3595d18c..b3c583f22 100644 --- a/src/logging/nm-logging.h +++ b/src/logging/nm-logging.h @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2006 - 2010 Red Hat, Inc. + * Copyright (C) 2006 - 2012 Red Hat, Inc. * Copyright (C) 2006 - 2008 Novell, Inc. */ @@ -55,9 +55,12 @@ enum { LOGD_INFINIBAND = 0x01000000, LOGD_FIREWALL = 0x02000000, LOGD_ADSL = 0x04000000, + LOGD_BOND = 0x08000000, + LOGD_VLAN = 0x10000000, }; #define LOGD_DHCP (LOGD_DHCP4 | LOGD_DHCP6) +#define LOGD_IP (LOGD_IP4 | LOGD_IP6) /* Log levels */ enum { diff --git a/src/main.c b/src/main.c index 8bc6d3f6f..b074bd8a8 100644 --- a/src/main.c +++ b/src/main.c @@ -42,7 +42,6 @@ #include "NetworkManagerUtils.h" #include "nm-manager.h" #include "nm-policy.h" -#include "backends/nm-backend.h" #include "nm-dns-manager.h" #include "nm-dbus-manager.h" #include "nm-supplicant-manager.h" @@ -55,13 +54,14 @@ #include "nm-policy-hosts.h" #include "nm-config.h" #include "nm-posix-signals.h" +#include "nm-system.h" #if !defined(NM_DIST_VERSION) # define NM_DIST_VERSION VERSION #endif -#define NM_DEFAULT_PID_FILE LOCALSTATEDIR"/run/NetworkManager.pid" -#define NM_DEFAULT_SYSTEM_STATE_FILE LOCALSTATEDIR"/lib/NetworkManager/NetworkManager.state" +#define NM_DEFAULT_PID_FILE NMRUNDIR "/NetworkManager.pid" +#define NM_DEFAULT_SYSTEM_STATE_FILE NMSTATEDIR "/NetworkManager.state" /* * Globals @@ -278,24 +278,11 @@ parse_state_file (const char *filename, * users upgrading NM get this working too. */ if (g_error_matches (tmp_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) { - char *data, *dirname; + char *data; gsize len = 0; g_clear_error (&tmp_error); - /* try to create the directory if it doesn't exist */ - dirname = g_path_get_dirname (filename); - errno = 0; - if (g_mkdir_with_parents (dirname, 0755) != 0) { - if (errno != EEXIST) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_ACCES, - "Error creating state directory %s: %s", dirname, strerror(errno)); - g_free (dirname); - return FALSE; - } - } - g_free (dirname); - /* Write out the initial state to the state file */ g_key_file_set_boolean (state_file, "main", "NetworkingEnabled", *net_enabled); g_key_file_set_boolean (state_file, "main", "WirelessEnabled", *wifi_enabled); @@ -401,10 +388,6 @@ main (int argc, char *argv[]) exit (1); } - /* Set up unix signal handling */ - if (!setup_signals ()) - exit (1); - /* Set locale to be able to use environment variables */ setlocale (LC_ALL, ""); @@ -446,6 +429,18 @@ main (int argc, char *argv[]) */ setenv ("GIO_USE_VFS", "local", 1); + /* Setup runtime directory */ + if (g_mkdir_with_parents (NMRUNDIR, 0755) != 0) { + nm_log_err (LOGD_CORE, "Cannot create '%s': %s", NMRUNDIR, strerror (errno)); + exit (1); + } + + /* Ensure state directory exists */ + if (g_mkdir_with_parents (NMSTATEDIR, 0755) != 0) { + nm_log_err (LOGD_CORE, "Cannot create '%s': %s", NMSTATEDIR, strerror (errno)); + exit (1); + } + pidfile = pidfile ? pidfile : g_strdup (NM_DEFAULT_PID_FILE); state_file = state_file ? state_file : g_strdup (NM_DEFAULT_SYSTEM_STATE_FILE); @@ -501,6 +496,10 @@ main (int argc, char *argv[]) wrote_pidfile = TRUE; } + /* Set up unix signal handling - before creating threads, but after daemonizing! */ + if (!setup_signals ()) + exit (1); + if (g_fatal_warnings) { GLogLevelFlags fatal_mask; @@ -600,7 +599,7 @@ main (int argc, char *argv[]) goto done; } - policy = nm_policy_new (manager, vpn_manager, settings); + policy = nm_policy_new (manager, settings); if (policy == NULL) { nm_log_err (LOGD_CORE, "failed to initialize the policy."); goto done; @@ -640,8 +639,18 @@ main (int argc, char *argv[]) nm_manager_start (manager); - /* Bring up the loopback interface. */ - nm_backend_enable_loopback (); + /* Make sure the loopback interface is up. If interface is down, we bring + * it up and kernel will assign it link-local IPv4 and IPv6 addresses. If + * it was already up, we assume is in clean state. + * + * TODO: it might be desirable to check the list of addresses and compare + * it with a list of expected addresses (one of the protocol families + * could be disabled). The 'lo' interface is sometimes used for assigning + * global addresses so their availability doesn't depend on the state of + * physical interfaces. + */ + nm_log_dbg (LOGD_CORE, "setting up local loopback"); + nm_system_iface_set_up (nm_netlink_iface_to_index ("lo"), TRUE, NULL); success = TRUE; diff --git a/src/modem-manager/Makefile.am b/src/modem-manager/Makefile.am index b9cc76449..aa5534fcd 100644 --- a/src/modem-manager/Makefile.am +++ b/src/modem-manager/Makefile.am @@ -15,6 +15,8 @@ noinst_LTLIBRARIES = libmodem-manager.la libmodem_manager_la_SOURCES = \ nm-modem.c \ nm-modem.h \ + nm-modem-generic.c \ + nm-modem-generic.h \ nm-modem-cdma.c \ nm-modem-cdma.h \ nm-modem-gsm.c \ @@ -33,3 +35,11 @@ libmodem_manager_la_LIBADD = \ $(LIBNL_LIBS) \ $(DBUS_LIBS) +# Support for the new ModemManager1 interface +if WITH_MODEM_MANAGER_1 +libmodem_manager_la_SOURCES += \ + nm-modem-broadband.h \ + nm-modem-broadband.c +libmodem_manager_la_CPPFLAGS += $(MM_GLIB_CFLAGS) +libmodem_manager_la_LIBADD += $(MM_GLIB_LIBS) +endif diff --git a/src/modem-manager/Makefile.in b/src/modem-manager/Makefile.in index 6da50ed0f..0546ee2e5 100644 --- a/src/modem-manager/Makefile.in +++ b/src/modem-manager/Makefile.in @@ -51,20 +51,30 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ + +# Support for the new ModemManager1 interface +@WITH_MODEM_MANAGER_1_TRUE@am__append_1 = \ +@WITH_MODEM_MANAGER_1_TRUE@ nm-modem-broadband.h \ +@WITH_MODEM_MANAGER_1_TRUE@ nm-modem-broadband.c + +@WITH_MODEM_MANAGER_1_TRUE@am__append_2 = $(MM_GLIB_CFLAGS) +@WITH_MODEM_MANAGER_1_TRUE@am__append_3 = $(MM_GLIB_LIBS) subdir = src/modem-manager -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,14 +83,23 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = +@WITH_MODEM_MANAGER_1_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) libmodem_manager_la_DEPENDENCIES = \ $(top_builddir)/src/generated/libnm-generated.la \ $(top_builddir)/src/logging/libnm-logging.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) +am__libmodem_manager_la_SOURCES_DIST = nm-modem.c nm-modem.h \ + nm-modem-generic.c nm-modem-generic.h nm-modem-cdma.c \ + nm-modem-cdma.h nm-modem-gsm.c nm-modem-gsm.h \ + nm-modem-manager.h nm-modem-manager.c nm-modem-types.h \ + nm-modem-broadband.h nm-modem-broadband.c +@WITH_MODEM_MANAGER_1_TRUE@am__objects_1 = libmodem_manager_la-nm-modem-broadband.lo am_libmodem_manager_la_OBJECTS = libmodem_manager_la-nm-modem.lo \ + libmodem_manager_la-nm-modem-generic.lo \ libmodem_manager_la-nm-modem-cdma.lo \ libmodem_manager_la-nm-modem-gsm.lo \ - libmodem_manager_la-nm-modem-manager.lo + libmodem_manager_la-nm-modem-manager.lo $(am__objects_1) libmodem_manager_la_OBJECTS = $(am_libmodem_manager_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -112,7 +131,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libmodem_manager_la_SOURCES) -DIST_SOURCES = $(libmodem_manager_la_SOURCES) +DIST_SOURCES = $(am__libmodem_manager_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -133,6 +152,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -147,9 +170,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -159,17 +180,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -210,6 +228,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -226,11 +245,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -245,6 +260,8 @@ 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@ @@ -254,6 +271,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -280,13 +298,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -341,6 +360,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -355,6 +379,10 @@ 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@ INCLUDES = \ -I${top_srcdir}/src \ -I${top_builddir}/src/generated \ @@ -366,27 +394,16 @@ INCLUDES = \ -I${top_srcdir}/libnm-util noinst_LTLIBRARIES = libmodem-manager.la -libmodem_manager_la_SOURCES = \ - nm-modem.c \ - nm-modem.h \ - nm-modem-cdma.c \ - nm-modem-cdma.h \ - nm-modem-gsm.c \ - nm-modem-gsm.h \ - nm-modem-manager.h \ - nm-modem-manager.c \ - nm-modem-types.h - -libmodem_manager_la_CPPFLAGS = \ - $(LIBNL_CFLAGS) \ - $(DBUS_CFLAGS) - -libmodem_manager_la_LIBADD = \ +libmodem_manager_la_SOURCES = nm-modem.c nm-modem.h nm-modem-generic.c \ + nm-modem-generic.h nm-modem-cdma.c nm-modem-cdma.h \ + nm-modem-gsm.c nm-modem-gsm.h nm-modem-manager.h \ + nm-modem-manager.c nm-modem-types.h $(am__append_1) +libmodem_manager_la_CPPFLAGS = $(LIBNL_CFLAGS) $(DBUS_CFLAGS) \ + $(am__append_2) +libmodem_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ - $(top_builddir)/src/logging/libnm-logging.la \ - $(LIBNL_LIBS) \ - $(DBUS_LIBS) - + $(top_builddir)/src/logging/libnm-logging.la $(LIBNL_LIBS) \ + $(DBUS_LIBS) $(am__append_3) all: all-am .SUFFIXES: @@ -439,31 +456,30 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-broadband.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-generic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-gsm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -475,6 +491,13 @@ libmodem_manager_la-nm-modem.lo: nm-modem.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem.lo `test -f 'nm-modem.c' || echo '$(srcdir)/'`nm-modem.c +libmodem_manager_la-nm-modem-generic.lo: nm-modem-generic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem-generic.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem-generic.Tpo -c -o libmodem_manager_la-nm-modem-generic.lo `test -f 'nm-modem-generic.c' || echo '$(srcdir)/'`nm-modem-generic.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem-generic.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem-generic.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-modem-generic.c' object='libmodem_manager_la-nm-modem-generic.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem-generic.lo `test -f 'nm-modem-generic.c' || echo '$(srcdir)/'`nm-modem-generic.c + libmodem_manager_la-nm-modem-cdma.lo: nm-modem-cdma.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem-cdma.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Tpo -c -o libmodem_manager_la-nm-modem-cdma.lo `test -f 'nm-modem-cdma.c' || echo '$(srcdir)/'`nm-modem-cdma.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Plo @@ -496,6 +519,13 @@ libmodem_manager_la-nm-modem-manager.lo: nm-modem-manager.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem-manager.lo `test -f 'nm-modem-manager.c' || echo '$(srcdir)/'`nm-modem-manager.c +libmodem_manager_la-nm-modem-broadband.lo: nm-modem-broadband.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem-broadband.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem-broadband.Tpo -c -o libmodem_manager_la-nm-modem-broadband.lo `test -f 'nm-modem-broadband.c' || echo '$(srcdir)/'`nm-modem-broadband.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem-broadband.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem-broadband.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nm-modem-broadband.c' object='libmodem_manager_la-nm-modem-broadband.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem-broadband.lo `test -f 'nm-modem-broadband.c' || echo '$(srcdir)/'`nm-modem-broadband.c + mostlyclean-libtool: -rm -f *.lo diff --git a/src/modem-manager/README b/src/modem-manager/README new file mode 100644 index 000000000..c9f0f5f1e --- /dev/null +++ b/src/modem-manager/README @@ -0,0 +1,45 @@ + +ModemManager integration is organized as follows: + + +Common source +******************************************************************************** + + * nm-modem.[h|c]: + Defines the basic `NMModem' object. The core NetworkManager implementation + will use this interface exclusively, regardless of the real final type of + the modem object. + + * nm-modem-manager.[h|c]: + Defines the `NMModemManager' object, which takes care of listening to + signals from the DBus inteface notifying about added or removed modems. + It also takes care of creating proper `NMModem' objects from the + information retrieved from the DBus interface. + + +ModemManager 0.7 integration +******************************************************************************** + + * nm-modem-broadband.[h|c]: + Defines the `NMModemBroadband' object, which is a subclass of `NMModem'. + This object handles both 3GPP and 3GPP2 modems exposed in the new + `ModemManager1' interface. + + +ModemManager 0.4/0.5/0.6 integration +******************************************************************************** + + * nm-modem-types.h: + Defines helper types to use with the (old) ModemManager DBus API. + + * nm-modem-generic.[h|c]: + Defines the `NMModemGeneric' object. All modem objects based on the old + ModemManager interface are subclasses of this one. + + * nm-modem-gsm.[h|c]: + Defines the `NMModemGsm' object, which is a subclass of `NMModemGeneric'. + This object handles 3GPP-specific (GSM, UMTS, HSPA, LTE) modems. + + * nm-modem-cdma.[h|c]: + Defines the `NMModemCdma' object, which is a subclass of `NMModemGeneric'. + This object handles 3GPP2-specific modems (CDMA, EV-DO). diff --git a/src/modem-manager/nm-modem-broadband.c b/src/modem-manager/nm-modem-broadband.c new file mode 100644 index 000000000..05cd35651 --- /dev/null +++ b/src/modem-manager/nm-modem-broadband.c @@ -0,0 +1,1033 @@ +/* -*- 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) 2012 Aleksander Morgado <aleksander@gnu.org> + */ + +#include <glib/gi18n.h> +#include <string.h> +#include <libmm-glib.h> +#include "nm-modem-broadband.h" +#include "nm-system.h" +#include "nm-setting-connection.h" +#include "nm-logging.h" +#include "NetworkManagerUtils.h" +#include "nm-device-private.h" + +G_DEFINE_TYPE (NMModemBroadband, nm_modem_broadband, NM_TYPE_MODEM) + +struct _NMModemBroadbandPrivate { + /* The modem object from dbus */ + MMObject *modem_object; + /* Per-interface objects */ + MMModem *modem_iface; + MMModemSimple *simple_iface; + + /* Connection setup */ + MMSimpleConnectProperties *connect_properties; + MMBearer *bearer; + MMBearerIpConfig *ipv4_config; + MMBearerIpConfig *ipv6_config; + + guint32 pin_tries; +}; + +enum { + PROP_0, + PROP_MODEM, +}; + +#define MODEM_CAPS_3GPP(caps) (caps & (MM_MODEM_CAPABILITY_GSM_UMTS | \ + MM_MODEM_CAPABILITY_LTE | \ + MM_MODEM_CAPABILITY_LTE_ADVANCED)) + +#define MODEM_CAPS_3GPP2(caps) (caps & (MM_MODEM_CAPABILITY_CDMA_EVDO)) + +/*****************************************************************************/ + +#define NM_MODEM_BROADBAND_ERROR (nm_modem_broadband_error_quark ()) + +static GQuark +nm_modem_broadband_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("nm-modem-broadband-error"); + return quark; +} + +static NMDeviceStateReason +translate_mm_error (GError *error) +{ + NMDeviceStateReason reason; + + if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_CARRIER)) + reason = NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER; + else if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_DIALTONE)) + reason = NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE; + else if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_BUSY)) + reason = NM_DEVICE_STATE_REASON_MODEM_BUSY; + else if (g_error_matches (error, MM_CONNECTION_ERROR, MM_CONNECTION_ERROR_NO_ANSWER)) + reason = NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_NETWORK_NOT_ALLOWED)) + reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_NETWORK_TIMEOUT)) + reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_NO_NETWORK)) + reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED)) + reason = NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_PIN)) + reason = NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_PUK)) + reason = NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED; + else if (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG)) + reason = NM_DEVICE_STATE_REASON_GSM_SIM_WRONG; + else { + /* unable to map the ModemManager error to a NM_DEVICE_STATE_REASON */ + nm_log_dbg (LOGD_MB, "unmapped error detected: '%s'", error->message); + reason = NM_DEVICE_STATE_REASON_UNKNOWN; + } + + return reason; +} + +/*****************************************************************************/ + +void +nm_modem_broadband_get_capabilities (NMModemBroadband *self, + NMDeviceModemCapabilities *modem_caps, + NMDeviceModemCapabilities *current_caps) +{ + *modem_caps = (NMDeviceModemCapabilities)mm_modem_get_modem_capabilities (self->priv->modem_iface); + *current_caps = (NMDeviceModemCapabilities)mm_modem_get_current_capabilities (self->priv->modem_iface); +} + +/*****************************************************************************/ + +static void +ask_for_pin (NMModemBroadband *self) +{ + guint32 tries; + + tries = self->priv->pin_tries++; + nm_modem_get_secrets (NM_MODEM (self), + NM_SETTING_GSM_SETTING_NAME, + tries ? TRUE : FALSE, + NM_SETTING_GSM_PIN); +} + +static void +connect_ready (MMModemSimple *simple_iface, + GAsyncResult *res, + NMModemBroadband *self) +{ + GError *error = NULL; + guint ip_method; + + g_clear_object (&self->priv->connect_properties); + + self->priv->bearer = mm_modem_simple_connect_finish (simple_iface, res, &error); + if (!self->priv->bearer) { + if (g_error_matches (error, + MM_MOBILE_EQUIPMENT_ERROR, + MM_MOBILE_EQUIPMENT_ERROR_SIM_PIN) || + (g_error_matches (error, + MM_CORE_ERROR, + MM_CORE_ERROR_UNAUTHORIZED) && + mm_modem_get_unlock_required (self->priv->modem_iface) == MM_MODEM_LOCK_SIM_PIN)) { + /* Request PIN */ + ask_for_pin (self); + } else { + /* Strip remote error info before logging it */ + if (g_dbus_error_is_remote_error (error)) + g_dbus_error_strip_remote_error (error); + + nm_log_warn (LOGD_MB, "(%s) failed to connect modem: %s", + nm_modem_get_uid (NM_MODEM (self)), + error && error->message ? error->message : "(unknown)"); + g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, translate_mm_error (error)); + } + + g_clear_error (&error); + g_object_unref (self); + return; + } + + /* Grab IP configurations */ + self->priv->ipv4_config = mm_bearer_get_ipv4_config (self->priv->bearer); + self->priv->ipv6_config = mm_bearer_get_ipv6_config (self->priv->bearer); + + switch (mm_bearer_ip_config_get_method (self->priv->ipv4_config)) { + case MM_BEARER_IP_METHOD_PPP: + ip_method = MM_MODEM_IP_METHOD_PPP; + break; + case MM_BEARER_IP_METHOD_STATIC: + ip_method = MM_MODEM_IP_METHOD_STATIC; + break; + case MM_BEARER_IP_METHOD_DHCP: + ip_method = MM_MODEM_IP_METHOD_DHCP; + break; + default: + error = g_error_new (NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID, + "invalid IP config"); + nm_log_warn (LOGD_MB, "(%s) failed to connect modem: %s", + nm_modem_get_uid (NM_MODEM (self)), + error->message); + g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, translate_mm_error (error)); + g_error_free (error); + g_object_unref (self); + return; + } + + /* IPv4 for now only */ + g_object_set (self, + NM_MODEM_DATA_PORT, mm_bearer_get_interface (self->priv->bearer), + NM_MODEM_IP_METHOD, ip_method, + NM_MODEM_IP_TIMEOUT, mm_bearer_get_ip_timeout (self->priv->bearer), + NULL); + + g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, TRUE, NM_DEVICE_STATE_REASON_NONE); + g_object_unref (self); +} + +static MMSimpleConnectProperties * +create_cdma_connect_properties (NMConnection *connection) +{ + NMSettingCdma *setting; + MMSimpleConnectProperties *properties; + const gchar *str; + + setting = nm_connection_get_setting_cdma (connection); + properties = mm_simple_connect_properties_new (); + + str = nm_setting_cdma_get_number (setting); + if (str) + mm_simple_connect_properties_set_number (properties, str); + + return properties; +} + +static MMSimpleConnectProperties * +create_gsm_connect_properties (NMConnection *connection) +{ + NMSettingGsm *setting; + NMSettingPPP *s_ppp; + MMSimpleConnectProperties *properties; + const gchar *str; + + setting = nm_connection_get_setting_gsm (connection); + properties = mm_simple_connect_properties_new (); + + /* TODO: not needed */ + str = nm_setting_gsm_get_number (setting); + if (str) + mm_simple_connect_properties_set_number (properties, str); + + str = nm_setting_gsm_get_apn (setting); + if (str) + mm_simple_connect_properties_set_apn (properties, str); + + str = nm_setting_gsm_get_network_id (setting); + if (str) + mm_simple_connect_properties_set_operator_id (properties, str); + + str = nm_setting_gsm_get_pin (setting); + if (str) + mm_simple_connect_properties_set_pin (properties, str); + + str = nm_setting_gsm_get_username (setting); + if (str) + mm_simple_connect_properties_set_user (properties, str); + + str = nm_setting_gsm_get_password (setting); + if (str) + mm_simple_connect_properties_set_password (properties, str); + + /* TODO: We should check SUPPORTED MODES here */ + switch (nm_setting_gsm_get_network_type (setting)) { + case NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_3G, + MM_MODEM_MODE_NONE); + break; + case NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_2G, + MM_MODEM_MODE_NONE); + break; + case NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_ANY, + MM_MODEM_MODE_3G); + break; + case NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_ANY, + MM_MODEM_MODE_2G); + break; + case NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_ANY, + MM_MODEM_MODE_4G); + break; + case NM_SETTING_GSM_NETWORK_TYPE_4G: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_4G, + MM_MODEM_MODE_NONE); + break; + default: + mm_simple_connect_properties_set_allowed_modes (properties, + MM_MODEM_MODE_ANY, + MM_MODEM_MODE_NONE); + break; + } + + /* Roaming */ + if (nm_setting_gsm_get_home_only (setting)) + mm_simple_connect_properties_set_allow_roaming (properties, FALSE); + + /* For IpMethod == STATIC or DHCP */ + s_ppp = nm_connection_get_setting_ppp (connection); + if (s_ppp) { + MMBearerAllowedAuth allowed_auth = MM_BEARER_ALLOWED_AUTH_UNKNOWN; + + if (nm_setting_ppp_get_noauth (s_ppp)) + allowed_auth = MM_BEARER_ALLOWED_AUTH_NONE; + if (!nm_setting_ppp_get_refuse_pap (s_ppp)) + allowed_auth |= MM_BEARER_ALLOWED_AUTH_PAP; + if (!nm_setting_ppp_get_refuse_chap (s_ppp)) + allowed_auth |= MM_BEARER_ALLOWED_AUTH_CHAP; + if (!nm_setting_ppp_get_refuse_mschap (s_ppp)) + allowed_auth |= MM_BEARER_ALLOWED_AUTH_MSCHAP; + if (!nm_setting_ppp_get_refuse_mschapv2 (s_ppp)) + allowed_auth |= MM_BEARER_ALLOWED_AUTH_MSCHAPV2; + if (!nm_setting_ppp_get_refuse_eap (s_ppp)) + allowed_auth |= MM_BEARER_ALLOWED_AUTH_EAP; + + mm_simple_connect_properties_set_allowed_auth (properties, allowed_auth); + } + + return properties; +} + +static NMActStageReturn +act_stage1_prepare (NMModem *_self, + NMActRequest *req, + GPtrArray **out_hints, + const char **out_setting_name, + NMDeviceStateReason *reason) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + NMConnection *connection; + + connection = nm_act_request_get_connection (req); + g_assert (connection); + + *out_setting_name = nm_connection_need_secrets (connection, out_hints); + if (!*out_setting_name) { + MMModemCapability caps; + + caps = mm_modem_get_current_capabilities (self->priv->modem_iface); + + g_clear_object (&self->priv->connect_properties); + + if (MODEM_CAPS_3GPP (caps)) + self->priv->connect_properties = create_gsm_connect_properties (connection); + else if (MODEM_CAPS_3GPP2 (caps)) + self->priv->connect_properties = create_cdma_connect_properties (connection); + else { + nm_log_warn (LOGD_MB, "(%s) not a mobile broadband modem", + nm_modem_get_uid (NM_MODEM (self))); + return NM_ACT_STAGE_RETURN_FAILURE; + } + + if (!self->priv->simple_iface) + self->priv->simple_iface = mm_object_get_modem_simple (self->priv->modem_object); + + mm_modem_simple_connect (self->priv->simple_iface, + self->priv->connect_properties, + NULL, + (GAsyncReadyCallback)connect_ready, + g_object_ref (self)); + } else { + /* NMModem will handle requesting secrets... */ + } + + return NM_ACT_STAGE_RETURN_POSTPONE; +} + +/*****************************************************************************/ + +static NMConnection * +get_best_auto_connection (NMModem *_self, + GSList *connections, + char **specific_object) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + MMModemCapability modem_caps; + GSList *iter; + + modem_caps = mm_modem_get_current_capabilities (self->priv->modem_iface); + + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMConnection *connection = NM_CONNECTION (iter->data); + NMSettingConnection *s_con; + + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + + if (!nm_setting_connection_get_autoconnect (s_con)) + continue; + + /* If GSM settings given and our modem is 3GPP, those are the best ones */ + if ( g_str_equal (nm_setting_connection_get_connection_type (s_con), + NM_SETTING_GSM_SETTING_NAME) + && MODEM_CAPS_3GPP (modem_caps)) + return connection; + + /* If CDMA settings given and our modem is 3GPP2, return those */ + if ( g_str_equal (nm_setting_connection_get_connection_type (s_con), + NM_SETTING_CDMA_SETTING_NAME) + && MODEM_CAPS_3GPP2 (modem_caps)) + return connection; + + /* continue */ + } + + return NULL; +} + +/*****************************************************************************/ + +static gboolean +check_connection_compatible (NMModem *_self, + NMConnection *connection, + GError **error) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + MMModemCapability modem_caps; + NMSettingConnection *s_con; + + modem_caps = mm_modem_get_current_capabilities (self->priv->modem_iface); + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + + if (MODEM_CAPS_3GPP (modem_caps)) { + NMSettingGsm *s_gsm; + + if (!g_str_equal (nm_setting_connection_get_connection_type (s_con), + NM_SETTING_GSM_SETTING_NAME)) { + g_set_error (error, + NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_GSM, + "The connection was not a 3GPP connection."); + return FALSE; + } + + s_gsm = nm_connection_get_setting_gsm (connection); + if (!s_gsm) { + g_set_error (error, + NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID, + "The connection was not a valid 3GPP connection."); + return FALSE; + } + + return TRUE; + } + + if (MODEM_CAPS_3GPP2 (modem_caps)) { + NMSettingCdma *s_cdma; + + if (!g_str_equal (nm_setting_connection_get_connection_type (s_con), + NM_SETTING_CDMA_SETTING_NAME)) { + g_set_error (error, + NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_CDMA, + "The connection was not a 3GPP2 connection."); + return FALSE; + } + + s_cdma = nm_connection_get_setting_cdma (connection); + if (!s_cdma) { + g_set_error (error, + NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID, + "The connection was not a valid 3GPP2 connection."); + return FALSE; + } + + return TRUE; + } + + g_set_error (error, + NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE, + "Device is not a mobile broadband modem"); + return FALSE; +} + +/*****************************************************************************/ + +static gboolean +complete_connection (NMModem *_self, + NMConnection *connection, + const GSList *existing_connections, + GError **error) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + MMModemCapability modem_caps; + NMSettingPPP *s_ppp; + + modem_caps = mm_modem_get_current_capabilities (self->priv->modem_iface); + + /* PPP settings common to 3GPP and 3GPP2 */ + s_ppp = nm_connection_get_setting_ppp (connection); + if (!s_ppp) { + s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); + g_object_set (G_OBJECT (s_ppp), + NM_SETTING_PPP_LCP_ECHO_FAILURE, 5, + NM_SETTING_PPP_LCP_ECHO_INTERVAL, 30, + NULL); + nm_connection_add_setting (connection, NM_SETTING (s_ppp)); + } + + if (MODEM_CAPS_3GPP (modem_caps)) { + NMSettingGsm *s_gsm; + + s_gsm = nm_connection_get_setting_gsm (connection); + if (!s_gsm || !nm_setting_gsm_get_apn (s_gsm)) { + /* Need an APN at least */ + g_set_error_literal (error, + NM_SETTING_GSM_ERROR, + NM_SETTING_GSM_ERROR_MISSING_PROPERTY, + NM_SETTING_GSM_APN); + return FALSE; + } + + /* TODO: This is not needed */ + if (!nm_setting_gsm_get_number (s_gsm)) + g_object_set (G_OBJECT (s_gsm), NM_SETTING_GSM_NUMBER, "*99#", NULL); + + nm_utils_complete_generic (connection, + NM_SETTING_GSM_SETTING_NAME, + existing_connections, + _("GSM connection %d"), + NULL, + FALSE); /* No IPv6 yet by default */ + + return TRUE; + } + + if (MODEM_CAPS_3GPP2 (modem_caps)) { + NMSettingCdma *s_cdma; + + s_cdma = nm_connection_get_setting_cdma (connection); + if (!s_cdma) { + s_cdma = (NMSettingCdma *) nm_setting_cdma_new (); + nm_connection_add_setting (connection, NM_SETTING (s_cdma)); + } + + if (!nm_setting_cdma_get_number (s_cdma)) + g_object_set (G_OBJECT (s_cdma), NM_SETTING_CDMA_NUMBER, "#777", NULL); + + nm_utils_complete_generic (connection, + NM_SETTING_CDMA_SETTING_NAME, + existing_connections, + _("CDMA connection %d"), + NULL, + FALSE); /* No IPv6 yet by default */ + + return TRUE; + } + + g_set_error (error, + NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE, + "Device is not a mobile broadband modem"); + return FALSE; +} + +/*****************************************************************************/ + +static gboolean +get_user_pass (NMModem *modem, + NMConnection *connection, + const char **user, + const char **pass) +{ + NMSettingGsm *s_gsm; + NMSettingCdma *s_cdma; + + s_gsm = nm_connection_get_setting_gsm (connection); + s_cdma = nm_connection_get_setting_cdma (connection); + if (!s_gsm && !s_cdma) + return FALSE; + + if (user) { + if (s_gsm) + *user = nm_setting_gsm_get_username (s_gsm); + else if (s_cdma) + *user = nm_setting_cdma_get_username (s_cdma); + } + if (pass) { + if (s_gsm) + *pass = nm_setting_gsm_get_password (s_gsm); + else if (s_cdma) + *pass = nm_setting_cdma_get_password (s_cdma); + } + + return TRUE; +} + +/*****************************************************************************/ + +static const char * +get_setting_name (NMModem *_self) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + MMModemCapability modem_caps; + + modem_caps = mm_modem_get_current_capabilities (self->priv->modem_iface); + if (MODEM_CAPS_3GPP (modem_caps)) + return NM_SETTING_GSM_SETTING_NAME; + + if (MODEM_CAPS_3GPP2 (modem_caps)) + return NM_SETTING_CDMA_SETTING_NAME; + + return "unknown"; +} + +/*****************************************************************************/ +/* Query/Update enabled state */ + +static void +update_mm_enabled (NMModem *self, + gboolean new_enabled) +{ + if (nm_modem_get_mm_enabled (self) != new_enabled) { + g_object_set (self, + NM_MODEM_ENABLED, new_enabled, + NULL); + } +} + +static void +modem_disable_ready (MMModem *modem_iface, + GAsyncResult *res, + NMModemBroadband *self) +{ + GError *error = NULL; + + if (!mm_modem_disable_finish (modem_iface, res, &error)) { + nm_log_warn (LOGD_MB, "(%s) failed to disable modem: %s", + nm_modem_get_uid (NM_MODEM (self)), + error && error->message ? error->message : "(unknown)"); + g_clear_error (&error); + } else + /* Update enabled/disabled state again */ + update_mm_enabled (NM_MODEM (self), FALSE); + + /* Balance refcount */ + g_object_unref (self); +} + +static void +modem_enable_ready (MMModem *modem_iface, + GAsyncResult *res, + NMModemBroadband *self) +{ + GError *error = NULL; + + if (!mm_modem_enable_finish (modem_iface, res, &error)) { + nm_log_warn (LOGD_MB, "(%s) failed to enable modem: %s", + nm_modem_get_uid (NM_MODEM (self)), + error && error->message ? error->message : "(unknown)"); + g_clear_error (&error); + } else + update_mm_enabled (NM_MODEM (self), TRUE); + + /* Balance refcount */ + g_object_unref (self); +} + +static void +set_mm_enabled (NMModem *_self, + gboolean enabled) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + + if (enabled) { + /* Don't even try to enable if we're known to be already locked */ + if (mm_modem_get_state (self->priv->modem_iface) == MM_MODEM_STATE_LOCKED) { + nm_log_warn (LOGD_MB, "(%s) cannot enable modem: locked", + nm_modem_get_uid (NM_MODEM (self))); + g_signal_emit_by_name (self, NM_MODEM_AUTH_REQUESTED, 0); + return; + } + + mm_modem_enable (self->priv->modem_iface, + NULL, /* cancellable */ + (GAsyncReadyCallback)modem_enable_ready, + g_object_ref (self)); + } else { + mm_modem_disable (self->priv->modem_iface, + NULL, /* cancellable */ + (GAsyncReadyCallback)modem_disable_ready, + g_object_ref (self)); + + /* When disabling don't say we're enabled */ + update_mm_enabled (NM_MODEM (self), enabled); + } +} + +/*****************************************************************************/ +/* IP method static */ + +static gboolean +ip_string_to_network_address (const gchar *str, + guint32 *out) +{ + struct in_addr addr; + + /* IP address */ + if (inet_pton (AF_INET, str, &addr) <= 0) + return FALSE; + + *out = (guint32)addr.s_addr; + return TRUE; +} + +static gboolean +static_stage3_done (NMModemBroadband *self) +{ + GError *error = NULL; + NMIP4Config *config = NULL; + const gchar *address_string; + guint32 address_network; + NMIP4Address *addr; + const gchar **dns; + guint i; + guint prefix; + + g_assert (self->priv->ipv4_config); + + nm_log_info (LOGD_MB, "(%s): IPv4 static configuration:", + nm_modem_get_uid (NM_MODEM (self))); + + /* Fully fail if invalid IP address retrieved */ + address_string = mm_bearer_ip_config_get_address (self->priv->ipv4_config); + if (!ip_string_to_network_address (address_string, &address_network)) { + error = g_error_new (NM_MODEM_BROADBAND_ERROR, + NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID, + "(%s) retrieving IP4 configuration failed: invalid address given '%s'", + nm_modem_get_uid (NM_MODEM (self)), + address_string); + goto out; + } + + config = nm_ip4_config_new (); + addr = nm_ip4_address_new (); + nm_ip4_address_set_address (addr, address_network); + prefix = mm_bearer_ip_config_get_prefix (self->priv->ipv4_config); + if (prefix > 0) + nm_ip4_address_set_prefix (addr, prefix); + nm_ip4_config_take_address (config, addr); + + nm_log_info (LOGD_MB, " address %s/%d", + mm_bearer_ip_config_get_address (self->priv->ipv4_config), + mm_bearer_ip_config_get_prefix (self->priv->ipv4_config)); + + /* DNS servers */ + dns = mm_bearer_ip_config_get_dns (self->priv->ipv4_config); + for (i = 0; dns[i]; i++) { + if ( ip_string_to_network_address (dns[i], &address_network) + && address_network > 0) { + nm_ip4_config_add_nameserver (config, address_network); + nm_log_info (LOGD_MB, " DNS %s", dns[i]); + } + } + +out: + g_signal_emit_by_name (self, NM_MODEM_IP4_CONFIG_RESULT, config, error); + g_clear_error (&error); + return FALSE; +} + +static NMActStageReturn +static_stage3_ip4_config_start (NMModem *_self, + NMActRequest *req, + NMDeviceStateReason *reason) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + + /* We schedule it in an idle just to follow the same logic as in the + * generic modem implementation. */ + g_idle_add ((GSourceFunc)static_stage3_done, self); + + return NM_ACT_STAGE_RETURN_POSTPONE; +} + +/*****************************************************************************/ +/* Disconnect */ + +typedef struct { + NMModemBroadband *self; + gboolean warn; +} SimpleDisconnectContext; + +static void +simple_disconnect_context_free (SimpleDisconnectContext *ctx) +{ + g_object_unref (ctx->self); + g_slice_free (SimpleDisconnectContext, ctx); +} + +static void +simple_disconnect_ready (MMModemSimple *modem_iface, + GAsyncResult *res, + SimpleDisconnectContext *ctx) +{ + GError *error = NULL; + + if (!mm_modem_simple_disconnect_finish (modem_iface, res, &error)) { + if (ctx->warn) + nm_log_warn (LOGD_MB, "(%s) failed to disconnect modem: %s", + nm_modem_get_uid (NM_MODEM (ctx->self)), + error && error->message ? error->message : "(unknown)"); + g_clear_error (&error); + } + + simple_disconnect_context_free (ctx); +} + +static void +disconnect (NMModem *self, + gboolean warn) +{ + SimpleDisconnectContext *ctx; + + ctx = g_slice_new (SimpleDisconnectContext); + ctx->self = g_object_ref (self); + + /* Don't bother warning on FAILED since the modem is already gone */ + ctx->warn = warn; + + mm_modem_simple_disconnect ( + ctx->self->priv->simple_iface, + NULL, /* bearer path; if NULL given ALL get disconnected */ + NULL, /* cancellable */ + (GAsyncReadyCallback)simple_disconnect_ready, + ctx); +} + +/*****************************************************************************/ + +static void +deactivate (NMModem *_self, NMDevice *device) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (_self); + + /* TODO: cancel SimpleConnect() if any */ + + /* Cleanup IPv4 addresses and routes */ + g_clear_object (&self->priv->ipv4_config); + g_clear_object (&self->priv->ipv6_config); + g_clear_object (&self->priv->bearer); + + self->priv->pin_tries = 0; + + /* Chain up parent's */ + NM_MODEM_CLASS (nm_modem_broadband_parent_class)->deactivate (_self, device); +} + +/*****************************************************************************/ + +static void +modem_state_changed (MMModem *modem, + MMModemState old_state, + MMModemState new_state, + MMModemStateChangeReason reason, + NMModemBroadband *self) +{ + gboolean old; + gboolean new; + + nm_log_info (LOGD_MB, "(%s) state changed, '%s' --> '%s' (reason: %s)\n", + nm_modem_get_uid (NM_MODEM (self)), + mm_modem_state_get_string (old_state), + mm_modem_state_get_string (new_state), + mm_modem_state_change_reason_get_string (reason)); + + old = nm_modem_get_mm_enabled (NM_MODEM (self)); + new = (mm_modem_get_state (self->priv->modem_iface) >= MM_MODEM_STATE_ENABLED); + if (old != new) + g_object_set (self, + NM_MODEM_ENABLED, new, + NULL); + + old = nm_modem_get_mm_connected (NM_MODEM (self)); + new = (mm_modem_get_state (self->priv->modem_iface) >= MM_MODEM_STATE_CONNECTED); + if (old != new) + g_object_set (self, + NM_MODEM_CONNECTED, new, + NULL); +} + +/*****************************************************************************/ + +NMModem * +nm_modem_broadband_new (GObject *object) +{ + MMObject *modem_object; + MMModem *modem_iface; + + g_return_val_if_fail (MM_IS_OBJECT (object), NULL); + modem_object = MM_OBJECT (object); + + /* Ensure we have the 'Modem' interface and the primary port at least */ + modem_iface = mm_object_peek_modem (modem_object); + g_return_val_if_fail (!!modem_iface, NULL); + g_return_val_if_fail (!!mm_modem_get_primary_port (modem_iface), NULL); + + /* If the modem is in 'FAILED' state we cannot do anything with it. + * This happens when a severe error happened when trying to initialize it, + * like missing SIM. */ + if (mm_modem_get_state (modem_iface) == MM_MODEM_STATE_FAILED) { + nm_log_warn (LOGD_MB, "(%s): unusable modem detected", + mm_modem_get_primary_port (modem_iface)); + return NULL; + } + + return (NMModem *) g_object_new (NM_TYPE_MODEM_BROADBAND, + NM_MODEM_PATH, mm_object_get_path (modem_object), + NM_MODEM_UID, mm_modem_get_primary_port (modem_iface), + NM_MODEM_CONTROL_PORT, mm_modem_get_primary_port (modem_iface), + NM_MODEM_DATA_PORT, NULL, /* We don't know it until bearer created */ + NM_MODEM_BROADBAND_MODEM, modem_object, + NULL); +} + +static void +nm_modem_broadband_init (NMModemBroadband *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + NM_TYPE_MODEM_BROADBAND, + NMModemBroadbandPrivate); +} + +static void +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (object); + + switch (prop_id) { + case PROP_MODEM: + /* construct-only */ + self->priv->modem_object = g_value_dup_object (value); + self->priv->modem_iface = mm_object_get_modem (self->priv->modem_object); + g_assert (self->priv->modem_iface != NULL); + g_signal_connect (self->priv->modem_iface, + "state-changed", + G_CALLBACK (modem_state_changed), + self); + + g_object_set (object, + NM_MODEM_ENABLED, (mm_modem_get_state (self->priv->modem_iface) >= MM_MODEM_STATE_ENABLED), + NM_MODEM_CONNECTED, (mm_modem_get_state (self->priv->modem_iface) >= MM_MODEM_STATE_CONNECTED), + NULL); + + /* Note: don't grab the Simple iface here; the Modem interface is the + * only one assumed to be always valid and available */ + 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) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (object); + + switch (prop_id) { + case PROP_MODEM: + g_value_set_object (value, self->priv->modem_object); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +dispose (GObject *object) +{ + NMModemBroadband *self = NM_MODEM_BROADBAND (object); + + g_clear_object (&self->priv->ipv4_config); + g_clear_object (&self->priv->ipv6_config); + g_clear_object (&self->priv->bearer); + g_clear_object (&self->priv->modem_iface); + g_clear_object (&self->priv->simple_iface); + g_clear_object (&self->priv->modem_object); + + G_OBJECT_CLASS (nm_modem_broadband_parent_class)->dispose (object); +} + +static void +nm_modem_broadband_class_init (NMModemBroadbandClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMModemClass *modem_class = NM_MODEM_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (NMModemBroadbandPrivate)); + + /* Virtual methods */ + object_class->dispose = dispose; + object_class->get_property = get_property; + object_class->set_property = set_property; + + modem_class->static_stage3_ip4_config_start = static_stage3_ip4_config_start; + modem_class->disconnect = disconnect; + modem_class->deactivate = deactivate; + modem_class->set_mm_enabled = set_mm_enabled; + modem_class->get_user_pass = get_user_pass; + modem_class->get_setting_name = get_setting_name; + modem_class->get_best_auto_connection = get_best_auto_connection; + modem_class->check_connection_compatible = check_connection_compatible; + modem_class->complete_connection = complete_connection; + modem_class->act_stage1_prepare = act_stage1_prepare; + + /* Properties */ + g_object_class_install_property + (object_class, PROP_MODEM, + g_param_spec_object (NM_MODEM_BROADBAND_MODEM, + "Modem", + "Broadband modem object", + MM_GDBUS_TYPE_OBJECT, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); +} diff --git a/src/modem-manager/nm-modem-broadband.h b/src/modem-manager/nm-modem-broadband.h new file mode 100644 index 000000000..005c38535 --- /dev/null +++ b/src/modem-manager/nm-modem-broadband.h @@ -0,0 +1,69 @@ +/* -*- 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) 2012 - Aleksander Morgado <aleksander@gnu.org> + */ + +#ifndef NM_MODEM_BROADBAND_H +#define NM_MODEM_BROADBAND_H + +#include <dbus/dbus-glib.h> +#include <glib-object.h> +#include "nm-modem.h" + +G_BEGIN_DECLS + +#define NM_TYPE_MODEM_BROADBAND (nm_modem_broadband_get_type ()) +#define NM_MODEM_BROADBAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_BROADBAND, NMModemBroadband)) +#define NM_MODEM_BROADBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM_BROADBAND, NMModemBroadbandClass)) +#define NM_IS_MODEM_BROADBAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_BROADBAND)) +#define NM_IS_MODEM_BROADBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM_BROADBAND)) +#define NM_MODEM_BROADBAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM_BROADBAND, NMModemBroadbandClass)) + +#define NM_MODEM_BROADBAND_MODEM "modem" + +typedef struct _NMModemBroadband NMModemBroadband; +typedef struct _NMModemBroadbandClass NMModemBroadbandClass; +typedef struct _NMModemBroadbandPrivate NMModemBroadbandPrivate; + +typedef enum { + NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_GSM, /*< nick=ConnectionNotGsm >*/ + NM_MODEM_BROADBAND_ERROR_CONNECTION_NOT_CDMA, /*< nick=ConnectionNotCdma >*/ + NM_MODEM_BROADBAND_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ + NM_MODEM_BROADBAND_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ +} NMModemBroadbandError; + +struct _NMModemBroadband { + NMModem parent; + NMModemBroadbandPrivate *priv; +}; + +struct _NMModemBroadbandClass { + NMModemClass parent; +}; + +GType nm_modem_broadband_get_type (void); + +NMModem *nm_modem_broadband_new (GObject *object); + +void nm_modem_broadband_get_capabilities (NMModemBroadband *self, + NMDeviceModemCapabilities *modem_caps, + NMDeviceModemCapabilities *current_caps); + +G_END_DECLS + +#endif /* NM_MODEM_BROADBAND_H */ diff --git a/src/modem-manager/nm-modem-cdma.c b/src/modem-manager/nm-modem-cdma.c index fa19a3425..73c87c289 100644 --- a/src/modem-manager/nm-modem-cdma.c +++ b/src/modem-manager/nm-modem-cdma.c @@ -37,7 +37,7 @@ #include "NetworkManagerUtils.h" #include "nm-logging.h" -G_DEFINE_TYPE (NMModemCdma, nm_modem_cdma, NM_TYPE_MODEM) +G_DEFINE_TYPE (NMModemCdma, nm_modem_cdma, NM_TYPE_MODEM_GENERIC) #define NM_MODEM_CDMA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_CDMA, NMModemCdmaPrivate)) @@ -62,19 +62,20 @@ nm_cdma_error_quark (void) NMModem * nm_modem_cdma_new (const char *path, - const char *device, const char *data_device, - guint32 ip_method) + guint32 ip_method, + NMModemState state) { g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (device != NULL, NULL); g_return_val_if_fail (data_device != NULL, NULL); return (NMModem *) g_object_new (NM_TYPE_MODEM_CDMA, NM_MODEM_PATH, path, - NM_MODEM_DEVICE, device, - NM_MODEM_IFACE, data_device, + NM_MODEM_UID, data_device, + NM_MODEM_CONTROL_PORT, NULL, + NM_MODEM_DATA_PORT, data_device, NM_MODEM_IP_METHOD, ip_method, + NM_MODEM_CONNECTED, (state == NM_MODEM_STATE_CONNECTED), NULL); } @@ -109,7 +110,7 @@ do_connect (NMModemCdma *self) NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (self); DBusGProxy *proxy; - proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM_SIMPLE); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), MM_OLD_DBUS_INTERFACE_MODEM_SIMPLE); priv->call = dbus_g_proxy_begin_call_with_timeout (proxy, "Connect", stage1_prepare_done, self, NULL, 120000, @@ -152,11 +153,11 @@ create_connect_properties (NMConnection *connection) } static NMActStageReturn -real_act_stage1_prepare (NMModem *modem, - NMActRequest *req, - GPtrArray **out_hints, - const char **out_setting_name, - NMDeviceStateReason *reason) +act_stage1_prepare (NMModem *modem, + NMActRequest *req, + GPtrArray **out_hints, + const char **out_setting_name, + NMDeviceStateReason *reason) { NMModemCdma *self = NM_MODEM_CDMA (modem); NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (self); @@ -177,7 +178,7 @@ real_act_stage1_prepare (NMModem *modem, if (enabled) do_connect (self); else { - proxy = nm_modem_get_proxy (modem, MM_DBUS_INTERFACE_MODEM); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (modem), MM_OLD_DBUS_INTERFACE_MODEM); dbus_g_proxy_begin_call_with_timeout (proxy, "Enable", stage1_enable_done, modem, NULL, 20000, @@ -192,9 +193,9 @@ real_act_stage1_prepare (NMModem *modem, } static NMConnection * -real_get_best_auto_connection (NMModem *modem, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMModem *modem, + GSList *connections, + char **specific_object) { GSList *iter; @@ -217,9 +218,9 @@ real_get_best_auto_connection (NMModem *modem, } static gboolean -real_check_connection_compatible (NMModem *modem, - NMConnection *connection, - GError **error) +check_connection_compatible (NMModem *modem, + NMConnection *connection, + GError **error) { NMSettingConnection *s_con; NMSettingCdma *s_cdma; @@ -246,10 +247,10 @@ real_check_connection_compatible (NMModem *modem, } static gboolean -real_complete_connection (NMModem *modem, - NMConnection *connection, - const GSList *existing_connections, - GError **error) +complete_connection (NMModem *modem, + NMConnection *connection, + const GSList *existing_connections, + GError **error) { NMSettingCdma *s_cdma; NMSettingPPP *s_ppp; @@ -284,10 +285,10 @@ real_complete_connection (NMModem *modem, } static gboolean -real_get_user_pass (NMModem *modem, - NMConnection *connection, - const char **user, - const char **pass) +get_user_pass (NMModem *modem, + NMConnection *connection, + const char **user, + const char **pass) { NMSettingCdma *s_cdma; @@ -304,25 +305,25 @@ real_get_user_pass (NMModem *modem, } static const char * -real_get_setting_name (NMModem *modem) +get_setting_name (NMModem *modem) { return NM_SETTING_CDMA_SETTING_NAME; } static void -real_deactivate (NMModem *modem, NMDevice *device) +deactivate (NMModem *modem, NMDevice *device) { NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (modem); if (priv->call) { DBusGProxy *proxy; - proxy = nm_modem_get_proxy (modem, MM_DBUS_INTERFACE_MODEM_SIMPLE); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (modem), MM_OLD_DBUS_INTERFACE_MODEM_SIMPLE); dbus_g_proxy_cancel_call (proxy, priv->call); priv->call = NULL; } - NM_MODEM_CLASS (nm_modem_cdma_parent_class)->deactivate (modem, device); + NM_MODEM_CLASS (nm_modem_cdma_parent_class)->deactivate (modem, device); } /*****************************************************************************/ @@ -354,13 +355,13 @@ nm_modem_cdma_class_init (NMModemCdmaClass *klass) /* Virtual methods */ object_class->dispose = dispose; - modem_class->get_user_pass = real_get_user_pass; - modem_class->get_setting_name = real_get_setting_name; - modem_class->get_best_auto_connection = real_get_best_auto_connection; - modem_class->check_connection_compatible = real_check_connection_compatible; - modem_class->complete_connection = real_complete_connection; - modem_class->act_stage1_prepare = real_act_stage1_prepare; - modem_class->deactivate = real_deactivate; + modem_class->get_user_pass = get_user_pass; + modem_class->get_setting_name = get_setting_name; + modem_class->get_best_auto_connection = get_best_auto_connection; + modem_class->check_connection_compatible = check_connection_compatible; + modem_class->complete_connection = complete_connection; + modem_class->act_stage1_prepare = act_stage1_prepare; + modem_class->deactivate = deactivate; dbus_g_error_domain_register (NM_CDMA_ERROR, NULL, NM_TYPE_CDMA_ERROR); } diff --git a/src/modem-manager/nm-modem-cdma.h b/src/modem-manager/nm-modem-cdma.h index 2229c1837..ab1b48749 100644 --- a/src/modem-manager/nm-modem-cdma.h +++ b/src/modem-manager/nm-modem-cdma.h @@ -22,14 +22,14 @@ #ifndef NM_MODEM_CDMA_H #define NM_MODEM_CDMA_H -#include <nm-modem.h> +#include <nm-modem-generic.h> G_BEGIN_DECLS -#define NM_TYPE_MODEM_CDMA (nm_modem_cdma_get_type ()) -#define NM_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_CDMA, NMModemCdma)) -#define NM_MODEM_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM_CDMA, NMModemCdmaClass)) -#define NM_IS_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_CDMA)) +#define NM_TYPE_MODEM_CDMA (nm_modem_cdma_get_type ()) +#define NM_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_CDMA, NMModemCdma)) +#define NM_MODEM_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM_CDMA, NMModemCdmaClass)) +#define NM_IS_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_CDMA)) #define NM_IS_MODEM_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM_CDMA)) #define NM_MODEM_CDMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM_CDMA, NMModemCdmaClass)) @@ -40,22 +40,19 @@ typedef enum { } NMCdmaError; typedef struct { - NMModem parent; + NMModemGeneric parent; } NMModemCdma; typedef struct { - NMModemClass parent; - - /* Signals */ - void (*signal_quality) (NMModemCdma *self, guint32 quality); + NMModemGenericClass parent; } NMModemCdmaClass; GType nm_modem_cdma_get_type (void); NMModem *nm_modem_cdma_new (const char *path, - const char *device, const char *data_device, - guint32 ip_method); + guint32 ip_method, + NMModemState state); G_END_DECLS diff --git a/src/modem-manager/nm-modem-generic.c b/src/modem-manager/nm-modem-generic.c new file mode 100644 index 000000000..f4e7a52fc --- /dev/null +++ b/src/modem-manager/nm-modem-generic.c @@ -0,0 +1,445 @@ +/* -*- 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) 2009 - 2011 Red Hat, Inc. + * Copyright (C) 2009 Novell, Inc. + */ + +#include <string.h> +#include "nm-modem-generic.h" +#include "nm-system.h" +#include "nm-dbus-manager.h" +#include "nm-setting-connection.h" +#include "nm-marshal.h" +#include "nm-properties-changed-signal.h" +#include "nm-modem-types.h" +#include "nm-logging.h" +#include "NetworkManagerUtils.h" +#include "nm-device-private.h" +#include "nm-dbus-glib-types.h" + +G_DEFINE_TYPE (NMModemGeneric, nm_modem_generic, NM_TYPE_MODEM) + +#define NM_MODEM_GENERIC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_GENERIC, NMModemGenericPrivate)) + +typedef struct { + NMDBusManager *dbus_mgr; + DBusGProxy *proxy; + DBusGProxy *props_proxy; + + DBusGProxyCall *call; + + NMModemState state; +} NMModemGenericPrivate; + +/*****************************************************************************/ + +DBusGProxy * +nm_modem_generic_get_proxy (NMModemGeneric *self, + const char *interface) +{ + + NMModemGenericPrivate *priv = NM_MODEM_GENERIC_GET_PRIVATE (self); + const char *current_iface; + + g_return_val_if_fail (NM_IS_MODEM_GENERIC (self), NULL); + + /* Default to the default interface. */ + if (interface == NULL) + interface = MM_OLD_DBUS_INTERFACE_MODEM; + + if (interface && !strcmp (interface, DBUS_INTERFACE_PROPERTIES)) + return priv->props_proxy; + + current_iface = dbus_g_proxy_get_interface (priv->proxy); + if (!current_iface || strcmp (current_iface, interface)) + dbus_g_proxy_set_interface (priv->proxy, interface); + + return priv->proxy; +} + +/*****************************************************************************/ +/* Query/Update enabled state */ + +static void +update_mm_enabled (NMModem *self, + gboolean new_enabled) +{ + if (nm_modem_get_mm_enabled (self) != new_enabled) { + g_object_set (self, + NM_MODEM_ENABLED, new_enabled, + NULL); + } +} + +static void +get_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) +{ + NMModem *self = NM_MODEM (user_data); + GError *error = NULL; + GValue value = { 0, }; + + if (!dbus_g_proxy_end_call (proxy, call_id, &error, + G_TYPE_VALUE, &value, + G_TYPE_INVALID)) { + nm_log_warn (LOGD_MB, "failed get modem enabled state: (%d) %s", + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); + return; + } + + if (G_VALUE_HOLDS_BOOLEAN (&value)) { + update_mm_enabled (self, g_value_get_boolean (&value)); + } else + nm_log_warn (LOGD_MB, "failed get modem enabled state: unexpected reply type"); + + g_value_unset (&value); +} + +static void +query_mm_enabled (NMModemGeneric *self) +{ + dbus_g_proxy_begin_call (NM_MODEM_GENERIC_GET_PRIVATE (self)->props_proxy, + "Get", get_mm_enabled_done, + self, NULL, + G_TYPE_STRING, MM_OLD_DBUS_INTERFACE_MODEM, + G_TYPE_STRING, "Enabled", + G_TYPE_INVALID); +} + +static void +set_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) +{ + GError *error = NULL; + + if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) { + nm_log_warn (LOGD_MB, "failed to enable/disable modem: (%d) %s", + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); + } + + /* Update enabled/disabled state again */ + query_mm_enabled (NM_MODEM_GENERIC (user_data)); +} + +static void +set_mm_enabled (NMModem *self, gboolean enabled) +{ + /* FIXME: For now this just toggles the ModemManager enabled state. In the + * future we want to tie this into rfkill state instead so that the user can + * toggle rfkill status of the WWAN modem. + */ + dbus_g_proxy_begin_call (nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), + MM_OLD_DBUS_INTERFACE_MODEM), + "Enable", set_mm_enabled_done, + self, NULL, + G_TYPE_BOOLEAN, enabled, + G_TYPE_INVALID); + /* If we are disabling the modem, stop saying that it's enabled. */ + if (!enabled) + update_mm_enabled (self, enabled); +} + +/*****************************************************************************/ +/* IP method static */ + +static char addr_to_string_buf[INET6_ADDRSTRLEN + 1]; + +static const char * +ip_address_to_string (guint32 numeric) +{ + struct in_addr temp_addr; + + memset (&addr_to_string_buf, '\0', sizeof (addr_to_string_buf)); + temp_addr.s_addr = numeric; + + if (inet_ntop (AF_INET, &temp_addr, addr_to_string_buf, INET_ADDRSTRLEN)) { + return addr_to_string_buf; + } else { + nm_log_warn (LOGD_VPN, "error converting IP4 address 0x%X", + ntohl (temp_addr.s_addr)); + return NULL; + } +} + +static void +static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) +{ + NMModemGeneric *self = NM_MODEM_GENERIC (user_data); + NMModemGenericPrivate *priv = NM_MODEM_GENERIC_GET_PRIVATE (self); + GValueArray *ret_array = NULL; + GError *error = NULL; + NMIP4Config *config = NULL; + + priv->call = NULL; + + /* Returned value array is (uuuu): [IP, DNS1, DNS2, DNS3], all in + * network byte order. + */ + if (dbus_g_proxy_end_call (proxy, call, &error, + G_TYPE_VALUE_ARRAY, &ret_array, + G_TYPE_INVALID)) { + NMIP4Address *addr; + int i; + + config = nm_ip4_config_new (); + + addr = nm_ip4_address_new (); + + nm_log_info (LOGD_MB, "(%s): IPv4 static configuration:", + nm_modem_get_uid (NM_MODEM (self))); + + /* IP address */ + nm_ip4_address_set_address (addr, g_value_get_uint (g_value_array_get_nth (ret_array, 0))); + nm_ip4_address_set_prefix (addr, 32); + nm_ip4_config_take_address (config, addr); + + nm_log_info (LOGD_MB, " address %s/%d", + ip_address_to_string (nm_ip4_address_get_address (addr)), + nm_ip4_address_get_prefix (addr)); + + /* DNS servers */ + for (i = 1; i < ret_array->n_values; i++) { + GValue *value = g_value_array_get_nth (ret_array, i); + guint32 tmp = g_value_get_uint (value); + + if (tmp > 0) { + nm_ip4_config_add_nameserver (config, tmp); + nm_log_info (LOGD_MB, " DNS %s", ip_address_to_string (tmp)); + } + } + g_value_array_free (ret_array); + } + + g_signal_emit_by_name (self, NM_MODEM_IP4_CONFIG_RESULT, config, error); + g_clear_error (&error); +} + +static NMActStageReturn +static_stage3_ip4_config_start (NMModem *self, + NMActRequest *req, + NMDeviceStateReason *reason) +{ + NMModemGenericPrivate *priv; + + g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE); + g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE); + g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE); + g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE); + g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); + + priv = NM_MODEM_GENERIC_GET_PRIVATE (self); + + priv->call = dbus_g_proxy_begin_call (nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), + MM_OLD_DBUS_INTERFACE_MODEM), + "GetIP4Config", static_stage3_done, + self, NULL, + G_TYPE_INVALID); + + return NM_ACT_STAGE_RETURN_POSTPONE; +} + +/*****************************************************************************/ + +static void +disconnect_done (DBusGProxy *proxy, + DBusGProxyCall *call_id, + gpointer user_data) +{ + GError *error = NULL; + gboolean warn = GPOINTER_TO_UINT (user_data); + + if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID) && warn) { + nm_log_info (LOGD_MB, "disconnect failed: (%d) %s", + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); + } +} + +static void +disconnect (NMModem *self, + gboolean warn) +{ + dbus_g_proxy_begin_call (nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), + MM_OLD_DBUS_INTERFACE_MODEM), + "Disconnect", + disconnect_done, + GUINT_TO_POINTER (warn), + NULL, + G_TYPE_INVALID); +} + +/*****************************************************************************/ + +static void +deactivate (NMModem *self, NMDevice *device) +{ + NMModemGenericPrivate *priv; + + g_assert (NM_IS_MODEM_GENERIC (self)); + g_assert (NM_IS_DEVICE (device)); + + priv = NM_MODEM_GENERIC_GET_PRIVATE (self); + + if (priv->call) { + dbus_g_proxy_cancel_call (priv->proxy, priv->call); + priv->call = NULL; + } + + /* Chain up parent's */ + NM_MODEM_CLASS (nm_modem_generic_parent_class)->deactivate (self, device); +} + +/*****************************************************************************/ + +static void +modem_properties_changed (DBusGProxy *proxy, + const char *interface, + GHashTable *props, + gpointer user_data) +{ + NMModemGeneric *self = NM_MODEM_GENERIC (user_data); + NMModemGenericPrivate *priv = NM_MODEM_GENERIC_GET_PRIVATE (self); + GValue *value; + NMModemState new_state; + + if (strcmp (interface, MM_OLD_DBUS_INTERFACE_MODEM)) + return; + + value = g_hash_table_lookup (props, "Enabled"); + if (value && G_VALUE_HOLDS_BOOLEAN (value)) { + g_object_set (self, + NM_MODEM_ENABLED, g_value_get_boolean (value), + NULL); + } + + value = g_hash_table_lookup (props, "IpMethod"); + if (value && G_VALUE_HOLDS_UINT (value)) { + g_object_set (self, + NM_MODEM_IP_METHOD, g_value_get_uint (value), + NULL); + } + + value = g_hash_table_lookup (props, "State"); + if (value && G_VALUE_HOLDS_UINT (value)) { + new_state = g_value_get_uint (value); + if (new_state != priv->state) { + if (new_state == NM_MODEM_STATE_CONNECTED) + g_object_set (self, + NM_MODEM_CONNECTED, TRUE, + NULL); + else if (priv->state == NM_MODEM_STATE_CONNECTED) + g_object_set (self, + NM_MODEM_CONNECTED, FALSE, + NULL); + priv->state = new_state; + } + } +} + +/*****************************************************************************/ + +static void +nm_modem_generic_init (NMModemGeneric *self) +{ + NMModemGenericPrivate *priv = NM_MODEM_GENERIC_GET_PRIVATE (self); + + priv->dbus_mgr = nm_dbus_manager_get (); +} + +static GObject* +constructor (GType type, + guint n_construct_params, + GObjectConstructParam *construct_params) +{ + GObject *object; + NMModemGenericPrivate *priv; + DBusGConnection *bus; + + object = G_OBJECT_CLASS (nm_modem_generic_parent_class)->constructor (type, n_construct_params, construct_params); + if (!object) + return NULL; + + priv = NM_MODEM_GENERIC_GET_PRIVATE (object); + + bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + priv->proxy = dbus_g_proxy_new_for_name (bus, + MM_OLD_DBUS_SERVICE, + nm_modem_get_path (NM_MODEM (object)), + MM_OLD_DBUS_INTERFACE_MODEM); + + priv->props_proxy = dbus_g_proxy_new_for_name (bus, + MM_OLD_DBUS_SERVICE, + nm_modem_get_path (NM_MODEM (object)), + DBUS_INTERFACE_PROPERTIES); + dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED, + G_TYPE_NONE, + G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT, + G_TYPE_INVALID); + dbus_g_proxy_add_signal (priv->props_proxy, "MmPropertiesChanged", + G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal (priv->props_proxy, "MmPropertiesChanged", + G_CALLBACK (modem_properties_changed), + object, + NULL); + + query_mm_enabled (NM_MODEM_GENERIC (object)); + + return object; +} + +static void +dispose (GObject *object) +{ + NMModemGenericPrivate *priv = NM_MODEM_GENERIC_GET_PRIVATE (object); + + if (priv->proxy) { + g_object_unref (priv->proxy); + priv->proxy = NULL; + } + + if (priv->props_proxy) { + g_object_unref (priv->props_proxy); + priv->props_proxy = NULL; + } + + if (priv->dbus_mgr) { + g_object_unref (priv->dbus_mgr); + priv->dbus_mgr = NULL; + } + + G_OBJECT_CLASS (nm_modem_generic_parent_class)->dispose (object); +} + +static void +nm_modem_generic_class_init (NMModemGenericClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMModemClass *modem_class = NM_MODEM_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (NMModemGenericPrivate)); + + /* Virtual methods */ + object_class->constructor = constructor; + object_class->dispose = dispose; + + modem_class->static_stage3_ip4_config_start = static_stage3_ip4_config_start; + modem_class->disconnect = disconnect; + modem_class->deactivate = deactivate; + modem_class->set_mm_enabled = set_mm_enabled; +} diff --git a/src/modem-manager/nm-modem-generic.h b/src/modem-manager/nm-modem-generic.h new file mode 100644 index 000000000..59866a1e6 --- /dev/null +++ b/src/modem-manager/nm-modem-generic.h @@ -0,0 +1,69 @@ +/* -*- 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) 2009 - 2011 Red Hat, Inc. + * Copyright (C) 2009 Novell, Inc. + */ + +#ifndef NM_MODEM_GENERIC_H +#define NM_MODEM_GENERIC_H + +#include <dbus/dbus-glib.h> +#include <glib-object.h> +#include "nm-modem.h" + +G_BEGIN_DECLS + +#define NM_TYPE_MODEM_GENERIC (nm_modem_generic_get_type ()) +#define NM_MODEM_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_GENERIC, NMModemGeneric)) +#define NM_MODEM_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM_GENERIC, NMModemGenericClass)) +#define NM_IS_MODEM_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_GENERIC)) +#define NM_IS_MODEM_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM_GENERIC)) +#define NM_MODEM_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM_GENERIC, NMModemGenericClass)) + +typedef enum { + NM_MODEM_STATE_UNKNOWN = 0, + NM_MODEM_STATE_DISABLED = 10, + NM_MODEM_STATE_DISABLING = 20, + NM_MODEM_STATE_ENABLING = 30, + NM_MODEM_STATE_ENABLED = 40, + NM_MODEM_STATE_SEARCHING = 50, + NM_MODEM_STATE_REGISTERED = 60, + NM_MODEM_STATE_DISCONNECTING = 70, + NM_MODEM_STATE_CONNECTING = 80, + NM_MODEM_STATE_CONNECTED = 90, + + NM_MODEM_STATE_LAST = NM_MODEM_STATE_CONNECTED +} NMModemState; + +typedef struct { + NMModem parent; +} NMModemGeneric; + +typedef struct { + NMModemClass parent; +} NMModemGenericClass; + +GType nm_modem_generic_get_type (void); + +/* Protected */ +DBusGProxy *nm_modem_generic_get_proxy (NMModemGeneric *modem, + const gchar *interface); + +G_END_DECLS + +#endif /* NM_MODEM_GENERIC_H */ diff --git a/src/modem-manager/nm-modem-gsm.c b/src/modem-manager/nm-modem-gsm.c index 183b4780b..b6d3c857a 100644 --- a/src/modem-manager/nm-modem-gsm.c +++ b/src/modem-manager/nm-modem-gsm.c @@ -58,8 +58,10 @@ typedef enum { MM_MODEM_GSM_ALLOWED_MODE_3G_PREFERRED = 2, MM_MODEM_GSM_ALLOWED_MODE_2G_ONLY = 3, MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY = 4, + MM_MODEM_GSM_ALLOWED_MODE_4G_PREFERRED = 5, + MM_MODEM_GSM_ALLOWED_MODE_4G_ONLY = 6, - MM_MODEM_GSM_ALLOWED_MODE_LAST = MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY + MM_MODEM_GSM_ALLOWED_MODE_LAST = MM_MODEM_GSM_ALLOWED_MODE_4G_ONLY } MMModemGsmAllowedMode; typedef enum { @@ -75,7 +77,7 @@ typedef enum { MM_MODEM_GSM_ALLOWED_AUTH_LAST = MM_MODEM_GSM_ALLOWED_AUTH_EAP } MMModemGsmAllowedAuth; -G_DEFINE_TYPE (NMModemGsm, nm_modem_gsm, NM_TYPE_MODEM) +G_DEFINE_TYPE (NMModemGsm, nm_modem_gsm, NM_TYPE_MODEM_GENERIC) #define NM_MODEM_GSM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_GSM, NMModemGsmPrivate)) @@ -102,19 +104,20 @@ nm_gsm_error_quark (void) NMModem * nm_modem_gsm_new (const char *path, - const char *device, const char *data_device, - guint32 ip_method) + guint32 ip_method, + NMModemState state) { g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (device != NULL, NULL); g_return_val_if_fail (data_device != NULL, NULL); return (NMModem *) g_object_new (NM_TYPE_MODEM_GSM, NM_MODEM_PATH, path, - NM_MODEM_DEVICE, device, - NM_MODEM_IFACE, data_device, + NM_MODEM_UID, data_device, + NM_MODEM_CONTROL_PORT, NULL, + NM_MODEM_DATA_PORT, data_device, NM_MODEM_IP_METHOD, ip_method, + NM_MODEM_CONNECTED, (state == NM_MODEM_STATE_CONNECTED), NULL); } @@ -222,12 +225,12 @@ do_connect (NMModemGsm *self) NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self); DBusGProxy *proxy; - proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM_SIMPLE); - dbus_g_proxy_begin_call_with_timeout (proxy, - "Connect", stage1_prepare_done, - self, NULL, 120000, - DBUS_TYPE_G_MAP_OF_VARIANT, priv->connect_properties, - G_TYPE_INVALID); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), MM_OLD_DBUS_INTERFACE_MODEM_SIMPLE); + priv->call = dbus_g_proxy_begin_call_with_timeout (proxy, + "Connect", stage1_prepare_done, + self, NULL, 120000, + DBUS_TYPE_G_MAP_OF_VARIANT, priv->connect_properties, + G_TYPE_INVALID); } static void stage1_enable_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data); @@ -242,7 +245,7 @@ do_enable (NMModemGsm *self) g_return_val_if_fail (NM_IS_MODEM_GSM (self), FALSE); NM_MODEM_GSM_GET_PRIVATE (self)->enable_delay_id = 0; - proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), MM_OLD_DBUS_INTERFACE_MODEM); dbus_g_proxy_begin_call_with_timeout (proxy, "Enable", stage1_enable_done, self, NULL, 20000, @@ -295,7 +298,7 @@ handle_enable_pin_required (NMModemGsm *self) /* If we do, send it */ if (pin) { - proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM_GSM_CARD); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (self), MM_OLD_DBUS_INTERFACE_MODEM_GSM_CARD); dbus_g_proxy_begin_call_with_timeout (proxy, "SendPin", stage1_pin_done, self, NULL, 10000, @@ -387,6 +390,14 @@ create_connect_properties (NMConnection *connection) value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_2G_PREFERRED); value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_2G_PREFERRED); break; + case NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G: + /* deprecated modes not extended for 4G, so no need to set them here */ + value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_4G_PREFERRED); + break; + case NM_SETTING_GSM_NETWORK_TYPE_4G: + /* deprecated modes not extended for 4G, so no need to set them here */ + value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_4G_ONLY); + break; default: value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY); value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_ANY); @@ -423,11 +434,11 @@ create_connect_properties (NMConnection *connection) } static NMActStageReturn -real_act_stage1_prepare (NMModem *modem, - NMActRequest *req, - GPtrArray **out_hints, - const char **out_setting_name, - NMDeviceStateReason *reason) +act_stage1_prepare (NMModem *modem, + NMActRequest *req, + GPtrArray **out_hints, + const char **out_setting_name, + NMDeviceStateReason *reason) { NMModemGsm *self = NM_MODEM_GSM (modem); NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self); @@ -456,9 +467,9 @@ real_act_stage1_prepare (NMModem *modem, } static NMConnection * -real_get_best_auto_connection (NMModem *modem, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMModem *modem, + GSList *connections, + char **specific_object) { GSList *iter; @@ -481,9 +492,9 @@ real_get_best_auto_connection (NMModem *modem, } static gboolean -real_check_connection_compatible (NMModem *modem, - NMConnection *connection, - GError **error) +check_connection_compatible (NMModem *modem, + NMConnection *connection, + GError **error) { NMSettingConnection *s_con; NMSettingGsm *s_gsm; @@ -510,10 +521,10 @@ real_check_connection_compatible (NMModem *modem, } static gboolean -real_complete_connection (NMModem *modem, - NMConnection *connection, - const GSList *existing_connections, - GError **error) +complete_connection (NMModem *modem, + NMConnection *connection, + const GSList *existing_connections, + GError **error) { NMSettingGsm *s_gsm; NMSettingPPP *s_ppp; @@ -552,10 +563,10 @@ real_complete_connection (NMModem *modem, } static gboolean -real_get_user_pass (NMModem *modem, - NMConnection *connection, - const char **user, - const char **pass) +get_user_pass (NMModem *modem, + NMConnection *connection, + const char **user, + const char **pass) { NMSettingGsm *s_gsm; @@ -572,20 +583,20 @@ real_get_user_pass (NMModem *modem, } static const char * -real_get_setting_name (NMModem *modem) +get_setting_name (NMModem *modem) { return NM_SETTING_GSM_SETTING_NAME; } static void -real_deactivate (NMModem *modem, NMDevice *device) +deactivate (NMModem *modem, NMDevice *device) { NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (modem); if (priv->call) { DBusGProxy *proxy; - proxy = nm_modem_get_proxy (modem, MM_DBUS_INTERFACE_MODEM_SIMPLE); + proxy = nm_modem_generic_get_proxy (NM_MODEM_GENERIC (modem), MM_OLD_DBUS_INTERFACE_MODEM_SIMPLE); dbus_g_proxy_cancel_call (proxy, priv->call); priv->call = NULL; } @@ -630,13 +641,13 @@ nm_modem_gsm_class_init (NMModemGsmClass *klass) /* Virtual methods */ object_class->dispose = dispose; - modem_class->get_user_pass = real_get_user_pass; - modem_class->get_setting_name = real_get_setting_name; - modem_class->get_best_auto_connection = real_get_best_auto_connection; - modem_class->check_connection_compatible = real_check_connection_compatible; - modem_class->complete_connection = real_complete_connection; - modem_class->act_stage1_prepare = real_act_stage1_prepare; - modem_class->deactivate = real_deactivate; + modem_class->get_user_pass = get_user_pass; + modem_class->get_setting_name = get_setting_name; + modem_class->get_best_auto_connection = get_best_auto_connection; + modem_class->check_connection_compatible = check_connection_compatible; + modem_class->complete_connection = complete_connection; + modem_class->act_stage1_prepare = act_stage1_prepare; + modem_class->deactivate = deactivate; dbus_g_error_domain_register (NM_GSM_ERROR, NULL, NM_TYPE_GSM_ERROR); } diff --git a/src/modem-manager/nm-modem-gsm.h b/src/modem-manager/nm-modem-gsm.h index e1c94f045..b0f78b0a4 100644 --- a/src/modem-manager/nm-modem-gsm.h +++ b/src/modem-manager/nm-modem-gsm.h @@ -22,16 +22,16 @@ #ifndef NM_MODEM_GSM_H #define NM_MODEM_GSM_H -#include <nm-modem.h> +#include <nm-modem-generic.h> G_BEGIN_DECLS -#define NM_TYPE_MODEM_GSM (nm_modem_gsm_get_type ()) -#define NM_MODEM_GSM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_GSM, NMModemGsm)) -#define NM_MODEM_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM_GSM, NMModemGsmClass)) -#define NM_IS_MODEM_GSM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_GSM)) +#define NM_TYPE_MODEM_GSM (nm_modem_gsm_get_type ()) +#define NM_MODEM_GSM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_GSM, NMModemGsm)) +#define NM_MODEM_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM_GSM, NMModemGsmClass)) +#define NM_IS_MODEM_GSM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_GSM)) #define NM_IS_MODEM_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM_GSM)) -#define NM_MODEM_GSM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM_GSM, NMModemGsmClass)) +#define NM_MODEM_GSM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM_GSM, NMModemGsmClass)) typedef enum { NM_GSM_ERROR_CONNECTION_NOT_GSM = 0, /*< nick=ConnectionNotGsm >*/ @@ -40,22 +40,19 @@ typedef enum { } NMGsmError; typedef struct { - NMModem parent; + NMModemGeneric parent; } NMModemGsm; typedef struct { - NMModemClass parent; - - /* Signals */ - void (*signal_quality) (NMModemGsm *self, guint32 quality); + NMModemGenericClass parent; } NMModemGsmClass; GType nm_modem_gsm_get_type (void); NMModem *nm_modem_gsm_new (const char *path, - const char *device, const char *data_device, - guint32 ip_method); + guint32 ip_method, + NMModemState state); G_END_DECLS diff --git a/src/modem-manager/nm-modem-manager.c b/src/modem-manager/nm-modem-manager.c index 051940f5e..d896b4680 100644 --- a/src/modem-manager/nm-modem-manager.c +++ b/src/modem-manager/nm-modem-manager.c @@ -21,6 +21,7 @@ */ #include <string.h> +#include "config.h" #include "nm-modem-manager.h" #include "nm-logging.h" #include "nm-modem.h" @@ -31,19 +32,33 @@ #include "nm-marshal.h" #include "nm-dbus-glib-types.h" +#if WITH_MODEM_MANAGER_1 +#include <libmm-glib.h> +#include "nm-modem-broadband.h" +#endif + #define MODEM_POKE_INTERVAL 120 G_DEFINE_TYPE (NMModemManager, nm_modem_manager, G_TYPE_OBJECT) -#define NM_MODEM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_MANAGER, NMModemManagerPrivate)) - -typedef struct { +struct _NMModemManagerPrivate { + /* ModemManager < 0.7 */ NMDBusManager *dbus_mgr; DBusGProxy *proxy; - GHashTable *modems; - gboolean disposed; guint poke_id; -} NMModemManagerPrivate; + +#if WITH_MODEM_MANAGER_1 + /* ModemManager >= 0.7 */ + GDBusConnection *dbus_connection; + MMManager *modem_manager_1; + guint modem_manager_1_poke_id; + gboolean old_modem_manager_found; + gboolean new_modem_manager_found; +#endif + + /* Common */ + GHashTable *modems; +}; enum { MODEM_ADDED, @@ -69,6 +84,28 @@ nm_modem_manager_get (void) return singleton; } +/************************************************************************/ +/* Support for ModemManager < 0.7 */ + +static void +clear_modem_manager_support (NMModemManager *self) +{ + if (self->priv->poke_id) { + g_source_remove (self->priv->poke_id); + self->priv->poke_id = 0; + } + + if (self->priv->proxy) { + g_object_unref (self->priv->proxy); + self->priv->proxy = NULL; + } + + if (self->priv->dbus_mgr) { + g_object_unref (self->priv->dbus_mgr); + self->priv->dbus_mgr = NULL; + } +} + static gboolean get_modem_properties (DBusGConnection *connection, const char *path, @@ -77,7 +114,8 @@ get_modem_properties (DBusGConnection *connection, char **driver, guint32 *type, guint32 *ip_method, - guint32 *ip_timeout) + guint32 *ip_timeout, + NMModemState *state) { DBusGProxy *proxy; GError *err = NULL; @@ -87,12 +125,12 @@ get_modem_properties (DBusGConnection *connection, GValue *value; proxy = dbus_g_proxy_new_for_name (connection, - MM_DBUS_SERVICE, + MM_OLD_DBUS_SERVICE, path, "org.freedesktop.DBus.Properties"); if (!dbus_g_proxy_call_with_timeout (proxy, "GetAll", 15000, &err, - G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM, + G_TYPE_STRING, MM_OLD_DBUS_INTERFACE_MODEM, G_TYPE_INVALID, DBUS_TYPE_G_MAP_OF_VARIANT, &props, G_TYPE_INVALID)) { @@ -122,6 +160,8 @@ get_modem_properties (DBusGConnection *connection, *driver = g_value_dup_string (value); else if (g_strcmp0 (prop, "IpTimeout") == 0) *ip_timeout = g_value_get_uint (value); + else if (g_strcmp0 (prop, "State") == 0) + *state = g_value_get_uint (value); } g_hash_table_unref (props); @@ -132,23 +172,23 @@ get_modem_properties (DBusGConnection *connection, } static void -create_modem (NMModemManager *manager, const char *path) +create_modem (NMModemManager *self, const char *path) { - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (manager); NMModem *modem = NULL; char *data_device = NULL, *driver = NULL, *master_device = NULL; uint modem_type = MM_MODEM_TYPE_UNKNOWN; uint ip_method = MM_MODEM_IP_METHOD_PPP; uint ip_timeout = 0; + NMModemState state = NM_MODEM_STATE_UNKNOWN; - if (g_hash_table_lookup (priv->modems, path)) { + if (g_hash_table_lookup (self->priv->modems, path)) { nm_log_warn (LOGD_MB, "modem with path %s already exists, ignoring", path); return; } - if (!get_modem_properties (nm_dbus_manager_get_connection (priv->dbus_mgr), + if (!get_modem_properties (nm_dbus_manager_get_connection (self->priv->dbus_mgr), path, &master_device, &data_device, &driver, - &modem_type, &ip_method, &ip_timeout)) + &modem_type, &ip_method, &ip_timeout, &state)) return; if (modem_type == MM_MODEM_TYPE_UNKNOWN) { @@ -172,9 +212,9 @@ create_modem (NMModemManager *manager, const char *path) } if (modem_type == MM_MODEM_TYPE_GSM) - modem = nm_modem_gsm_new (path, master_device, data_device, ip_method); + modem = nm_modem_gsm_new (path, data_device, ip_method, state); else if (modem_type == MM_MODEM_TYPE_CDMA) - modem = nm_modem_cdma_new (path, master_device, data_device, ip_method); + modem = nm_modem_cdma_new (path, data_device, ip_method, state); else nm_log_warn (LOGD_MB, "unknown modem type '%d'", modem_type); @@ -182,8 +222,8 @@ create_modem (NMModemManager *manager, const char *path) if (modem) { g_object_set (G_OBJECT (modem), NM_MODEM_IP_TIMEOUT, ip_timeout, NULL); - g_hash_table_insert (priv->modems, g_strdup (path), modem); - g_signal_emit (manager, signals[MODEM_ADDED], 0, modem, driver); + g_hash_table_insert (self->priv->modems, g_strdup (path), modem); + g_signal_emit (self, signals[MODEM_ADDED], 0, modem, driver); } g_free (driver); @@ -198,13 +238,13 @@ modem_added (DBusGProxy *proxy, const char *path, gpointer user_data) static void modem_removed (DBusGProxy *proxy, const char *path, gpointer user_data) { - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (user_data); + NMModemManager *self = NM_MODEM_MANAGER (user_data); NMModem *modem; - modem = (NMModem *) g_hash_table_lookup (priv->modems, path); + modem = (NMModem *) g_hash_table_lookup (self->priv->modems, path); if (modem) { - g_signal_emit (user_data, signals[MODEM_REMOVED], 0, modem); - g_hash_table_remove (priv->modems, path); + g_signal_emit (self, signals[MODEM_REMOVED], 0, modem); + g_hash_table_remove (self->priv->modems, path); } } @@ -229,16 +269,17 @@ static gboolean poke_modem_cb (gpointer user_data) { NMModemManager *self = NM_MODEM_MANAGER (user_data); - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); DBusGConnection *g_connection; DBusGProxy *proxy; DBusGProxyCall *call; - g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr); + g_connection = nm_dbus_manager_get_connection (self->priv->dbus_mgr); proxy = dbus_g_proxy_new_for_name (g_connection, - MM_DBUS_SERVICE, - MM_DBUS_PATH, - MM_DBUS_INTERFACE); + MM_OLD_DBUS_SERVICE, + MM_OLD_DBUS_PATH, + MM_OLD_DBUS_INTERFACE); + + nm_log_dbg (LOGD_MB, "Requesting to (re)launch modem-manager..."); call = dbus_g_proxy_begin_call_with_timeout (proxy, "EnumerateDevices", @@ -276,33 +317,43 @@ enumerate_devices_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer dat } } +#if WITH_MODEM_MANAGER_1 +static void clear_modem_manager_1_support (NMModemManager *self); +#endif + static void modem_manager_appeared (NMModemManager *self, gboolean enumerate_devices) { - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); - - if (priv->poke_id) { - g_source_remove (priv->poke_id); - priv->poke_id = 0; + if (self->priv->poke_id) { + g_source_remove (self->priv->poke_id); + self->priv->poke_id = 0; } nm_log_info (LOGD_MB, "modem-manager is now available"); - priv->proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr), - MM_DBUS_SERVICE, MM_DBUS_PATH, MM_DBUS_INTERFACE); +#if WITH_MODEM_MANAGER_1 + self->priv->old_modem_manager_found = TRUE; + if (self->priv->new_modem_manager_found) + nm_log_warn (LOGD_MB, "Both the old and the new ModemManager were found"); + else + clear_modem_manager_1_support (self); +#endif + + self->priv->proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (self->priv->dbus_mgr), + MM_OLD_DBUS_SERVICE, MM_OLD_DBUS_PATH, MM_OLD_DBUS_INTERFACE); - dbus_g_proxy_add_signal (priv->proxy, "DeviceAdded", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->proxy, "DeviceAdded", + dbus_g_proxy_add_signal (self->priv->proxy, "DeviceAdded", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (self->priv->proxy, "DeviceAdded", G_CALLBACK (modem_added), self, NULL); - dbus_g_proxy_add_signal (priv->proxy, "DeviceRemoved", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->proxy, "DeviceRemoved", + dbus_g_proxy_add_signal (self->priv->proxy, "DeviceRemoved", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (self->priv->proxy, "DeviceRemoved", G_CALLBACK (modem_removed), self, NULL); if (enumerate_devices) - dbus_g_proxy_begin_call (priv->proxy, "EnumerateDevices", enumerate_devices_done, self, NULL, G_TYPE_INVALID); + dbus_g_proxy_begin_call (self->priv->proxy, "EnumerateDevices", enumerate_devices_done, self, NULL, G_TYPE_INVALID); } static gboolean @@ -316,19 +367,17 @@ remove_one_modem (gpointer key, gpointer value, gpointer user_data) static void modem_manager_disappeared (NMModemManager *self) { - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); - - g_hash_table_foreach_remove (priv->modems, remove_one_modem, self); + g_hash_table_foreach_remove (self->priv->modems, remove_one_modem, self); - if (priv->proxy) { - g_object_unref (priv->proxy); - priv->proxy = NULL; + if (self->priv->proxy) { + g_object_unref (self->priv->proxy); + self->priv->proxy = NULL; } /* Try to activate the modem-manager */ - nm_log_info (LOGD_MB, "trying to start the modem manager..."); + nm_log_dbg (LOGD_MB, "trying to start the modem manager..."); poke_modem_cb (self); - priv->poke_id = g_timeout_add_seconds (MODEM_POKE_INTERVAL, poke_modem_cb, self); + self->priv->poke_id = g_timeout_add_seconds (MODEM_POKE_INTERVAL, poke_modem_cb, self); } static void @@ -342,7 +391,7 @@ nm_modem_manager_name_owner_changed (NMDBusManager *dbus_mgr, gboolean new_owner_good; /* Can't handle the signal if its not from the modem service */ - if (strcmp (MM_DBUS_SERVICE, name) != 0) + if (strcmp (MM_OLD_DBUS_SERVICE, name) != 0) return; old_owner_good = (old_owner && strlen (old_owner)); @@ -356,52 +405,306 @@ nm_modem_manager_name_owner_changed (NMDBusManager *dbus_mgr, } } -/*******************************************************/ +/************************************************************************/ +/* Support for ModemManager >= 0.7 */ + +#if WITH_MODEM_MANAGER_1 static void -nm_modem_manager_init (NMModemManager *self) +clear_modem_manager_1_support (NMModemManager *self) { - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); + if (self->priv->modem_manager_1_poke_id) { + g_source_remove (self->priv->modem_manager_1_poke_id); + self->priv->modem_manager_1_poke_id = 0; + } - priv->modems = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); - priv->dbus_mgr = nm_dbus_manager_get (); + g_clear_object (&self->priv->modem_manager_1); + g_clear_object (&self->priv->dbus_connection); +} - g_signal_connect (priv->dbus_mgr, NM_DBUS_MANAGER_NAME_OWNER_CHANGED, - G_CALLBACK (nm_modem_manager_name_owner_changed), - self); +static void +modem_object_added (MMManager *modem_manager, + MMObject *modem_object, + NMModemManager *self) +{ + const gchar *path; + gchar *drivers; + MMModem *modem_iface; + NMModem *modem; - if (nm_dbus_manager_name_has_owner (priv->dbus_mgr, MM_DBUS_SERVICE)) - modem_manager_appeared (self, TRUE); + /* Ensure we don't have the same modem already */ + path = mm_object_get_path (modem_object); + if (g_hash_table_lookup (self->priv->modems, path)) { + nm_log_warn (LOGD_MB, "modem with path %s already exists, ignoring", path); + return; + } + + /* Ensure we have the 'Modem' interface at least */ + modem_iface = mm_object_peek_modem (modem_object); + if (!modem_iface) { + nm_log_warn (LOGD_MB, "modem with path %s doesn't have the Modem interface, ignoring", path); + return; + } + + /* Ensure we have a primary port reported */ + if (!mm_modem_get_primary_port (modem_iface)) { + nm_log_warn (LOGD_MB, "modem with path %s has unknown primary port, ignoring", path); + return; + } + + /* Create a new modem object */ + modem = nm_modem_broadband_new (G_OBJECT (modem_object)); + if (!modem) + return; + + /* Build a single string with all drivers listed */ + drivers = g_strjoinv (", ", (gchar **)mm_modem_get_drivers (modem_iface)); + + /* Keep track of the new modem and notify about it */ + g_hash_table_insert (self->priv->modems, g_strdup (path), modem); + g_signal_emit (self, signals[MODEM_ADDED], 0, modem, drivers); + g_free (drivers); +} + +static void +modem_object_removed (MMManager *manager, + MMObject *modem_object, + NMModemManager *self) +{ + NMModem *modem; + const gchar *path; + + path = mm_object_get_path (modem_object); + modem = (NMModem *) g_hash_table_lookup (self->priv->modems, path); + if (!modem) + return; + + g_signal_emit (self, signals[MODEM_REMOVED], 0, modem); + g_hash_table_remove (self->priv->modems, path); +} + +static void +modem_manager_1_available (NMModemManager *self) +{ + GList *modems, *l; + + nm_log_info (LOGD_MB, "ModemManager available in the bus"); + + self->priv->new_modem_manager_found = TRUE; + if (self->priv->old_modem_manager_found) + nm_log_warn (LOGD_MB, "Both the old and the new ModemManager were found"); else - modem_manager_disappeared (self); + clear_modem_manager_support (self); + + /* Update initial modems list */ + modems = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (self->priv->modem_manager_1)); + for (l = modems; l; l = g_list_next (l)) + modem_object_added (self->priv->modem_manager_1, MM_OBJECT (l->data), self); + g_list_free_full (modems, (GDestroyNotify) g_object_unref); } +static void schedule_modem_manager_1_relaunch (NMModemManager *self, + guint n_seconds); + static void -dispose (GObject *object) +modem_manager_1_name_owner_changed (MMManager *modem_manager_1, + GParamSpec *pspec, + NMModemManager *self) { - NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (object); + /* Quit poking, if any */ + if (self->priv->modem_manager_1_poke_id) { + g_source_remove (self->priv->modem_manager_1_poke_id); + self->priv->modem_manager_1_poke_id = 0; + } - if (priv->disposed) + if (!g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (modem_manager_1))) { + nm_log_info (LOGD_MB, "ModemManager disappeared from bus"); + schedule_modem_manager_1_relaunch (self, 0); return; + } + + /* Available! */ + modem_manager_1_available (self); +} + +static void +manager_new_ready (GObject *source, + GAsyncResult *res, + NMModemManager *self) +{ + /* Note we always get an extra reference to self here */ - priv->disposed = TRUE; + GError *error = NULL; - if (priv->poke_id) { - g_source_remove (priv->poke_id); - priv->poke_id = 0; + g_assert (!self->priv->modem_manager_1); + self->priv->modem_manager_1 = mm_manager_new_finish (res, &error); + if (!self->priv->modem_manager_1) { + if ( !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN) + && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_EXEC_FAILED) + && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FORK_FAILED) + && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FAILED) + && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_TIMEOUT) + && !g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND)) { + nm_log_warn (LOGD_MB, "error creating ModemManager client: %s", error->message); + } + g_error_free (error); + /* Setup timeout to relaunch */ + schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL); + } else if (self->priv->old_modem_manager_found) { + /* If we found the old MM, abort */ + clear_modem_manager_1_support (self); + } else { + gchar *name_owner; + + g_signal_connect (self->priv->modem_manager_1, + "notify::name-owner", + G_CALLBACK (modem_manager_1_name_owner_changed), + self); + g_signal_connect (self->priv->modem_manager_1, + "object-added", + G_CALLBACK (modem_object_added), + self); + g_signal_connect (self->priv->modem_manager_1, + "object-removed", + G_CALLBACK (modem_object_removed), + self); + + /* If there is no current owner right away, ensure we poke until we get + * one */ + name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (self->priv->modem_manager_1)); + if (!name_owner) { + /* Setup timeout to wait for an owner */ + schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL); + } else { + /* Available! */ + modem_manager_1_available (self); + g_free (name_owner); + } } - g_hash_table_foreach_remove (priv->modems, remove_one_modem, object); - g_hash_table_destroy (priv->modems); + /* Balance refcount */ + g_object_unref (self); +} + +static void +recreate_client (NMModemManager *self) +{ + g_assert (self->priv->dbus_connection); + + /* Re-create the GDBusObjectManagerClient so that we request again the owner + * for the well-known name. + * Note that we pass an extra reference always */ + g_clear_object (&self->priv->modem_manager_1); + mm_manager_new (self->priv->dbus_connection, + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, + NULL, + (GAsyncReadyCallback)manager_new_ready, + g_object_ref (self)); +} + +static void +bus_get_ready (GObject *source, + GAsyncResult *res, + NMModemManager *self) +{ + /* Note we always get an extra reference to self here */ + + GError *error = NULL; - if (priv->proxy) { - g_object_unref (priv->proxy); - priv->proxy = NULL; + self->priv->dbus_connection = g_bus_get_finish (res, &error); + if (!self->priv->dbus_connection) { + nm_log_warn (LOGD_CORE, "error getting bus connection: %s", error->message); + g_error_free (error); + /* Setup timeout to relaunch */ + schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL); + } else if (self->priv->old_modem_manager_found) { + /* If we found the old MM, abort */ + clear_modem_manager_1_support (self); + } else { + /* Got the bus, create new ModemManager client. */ + recreate_client (self); } - if (priv->dbus_mgr) { - g_object_unref (priv->dbus_mgr); - priv->dbus_mgr = NULL; + /* Balance refcount */ + g_object_unref (self); +} + +static gboolean +ensure_bus (NMModemManager *self) +{ + nm_log_dbg (LOGD_MB, "Requesting to (re)launch ModemManager..."); + + /* Clear poke ID */ + self->priv->modem_manager_1_poke_id = 0; + + if (!self->priv->dbus_connection) + g_bus_get (G_BUS_TYPE_SYSTEM, + NULL, + (GAsyncReadyCallback)bus_get_ready, + g_object_ref (self)); + else + /* If bus is already available, launch client re-creation */ + recreate_client (self); + + return FALSE; +} + +static void +schedule_modem_manager_1_relaunch (NMModemManager *self, + guint n_seconds) +{ + /* No need to pass an extra reference to self; timeout/idle will be + * cancelled if the object gets disposed. */ + + if (n_seconds) + self->priv->modem_manager_1_poke_id = g_timeout_add_seconds (n_seconds, (GSourceFunc)ensure_bus, self); + else + self->priv->modem_manager_1_poke_id = g_idle_add ((GSourceFunc)ensure_bus, self); +} + +#endif /* WITH_MODEM_MANAGER_1 */ + +/************************************************************************/ + +static void +nm_modem_manager_init (NMModemManager *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_MODEM_MANAGER, NMModemManagerPrivate); + + self->priv->modems = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + + /* ModemManager < 0.7 */ + self->priv->dbus_mgr = nm_dbus_manager_get (); + g_signal_connect (self->priv->dbus_mgr, NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + G_CALLBACK (nm_modem_manager_name_owner_changed), + self); + if (nm_dbus_manager_name_has_owner (self->priv->dbus_mgr, MM_OLD_DBUS_SERVICE)) + modem_manager_appeared (self, TRUE); + else + modem_manager_disappeared (self); + +#if WITH_MODEM_MANAGER_1 + /* ModemManager >= 0.7 */ + schedule_modem_manager_1_relaunch (self, 0); +#endif +} + +static void +dispose (GObject *object) +{ + NMModemManager *self = NM_MODEM_MANAGER (object); + + /* ModemManager < 0.7 */ + clear_modem_manager_support (self); + +#if WITH_MODEM_MANAGER_1 + /* ModemManager >= 0.7 */ + clear_modem_manager_1_support (self); +#endif + + if (self->priv->modems) { + g_hash_table_foreach_remove (self->priv->modems, remove_one_modem, object); + g_hash_table_destroy (self->priv->modems); } /* Chain up to the parent class */ diff --git a/src/modem-manager/nm-modem-manager.h b/src/modem-manager/nm-modem-manager.h index 56427baf0..0c2b243b9 100644 --- a/src/modem-manager/nm-modem-manager.h +++ b/src/modem-manager/nm-modem-manager.h @@ -33,18 +33,23 @@ #define NM_IS_MODEM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM_MANAGER)) #define NM_MODEM_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM_MANAGER, NMModemManagerClass)) -typedef struct { +typedef struct _NMModemManager NMModemManager; +typedef struct _NMModemManagerClass NMModemManagerClass; +typedef struct _NMModemManagerPrivate NMModemManagerPrivate; + +struct _NMModemManager { GObject parent; -} NMModemManager; + NMModemManagerPrivate *priv; +}; -typedef struct { +struct _NMModemManagerClass { GObjectClass parent; /* Signals */ void (*modem_added) (NMModemManager *manager, NMModem *modem, const char *driver); void (*modem_removed) (NMModemManager *manager, NMModem *modem); -} NMModemManagerClass; +}; GType nm_modem_manager_get_type (void); diff --git a/src/modem-manager/nm-modem-types.h b/src/modem-manager/nm-modem-types.h index e805cb213..9fc8deed1 100644 --- a/src/modem-manager/nm-modem-types.h +++ b/src/modem-manager/nm-modem-types.h @@ -21,37 +21,32 @@ #ifndef NM_MODEM_TYPES_H #define NM_MODEM_TYPES_H -#define MM_DBUS_SERVICE "org.freedesktop.ModemManager" -#define MM_DBUS_PATH "/org/freedesktop/ModemManager" -#define MM_DBUS_INTERFACE "org.freedesktop.ModemManager" -#define MM_DBUS_INTERFACE_MODEM "org.freedesktop.ModemManager.Modem" -#define MM_DBUS_INTERFACE_MODEM_SIMPLE "org.freedesktop.ModemManager.Modem.Simple" -#define MM_DBUS_INTERFACE_MODEM_CDMA "org.freedesktop.ModemManager.Modem.Cdma" - -#define MM_DBUS_INTERFACE_MODEM_GSM_CARD "org.freedesktop.ModemManager.Modem.Gsm.Card" -#define MM_DBUS_INTERFACE_MODEM_GSM_NETWORK "org.freedesktop.ModemManager.Modem.Gsm.Network" +#define MM_OLD_DBUS_SERVICE "org.freedesktop.ModemManager" +#define MM_OLD_DBUS_PATH "/org/freedesktop/ModemManager" +#define MM_OLD_DBUS_INTERFACE "org.freedesktop.ModemManager" +#define MM_OLD_DBUS_INTERFACE_MODEM "org.freedesktop.ModemManager.Modem" +#define MM_OLD_DBUS_INTERFACE_MODEM_SIMPLE "org.freedesktop.ModemManager.Modem.Simple" +#define MM_OLD_DBUS_INTERFACE_MODEM_CDMA "org.freedesktop.ModemManager.Modem.Cdma" +#define MM_OLD_DBUS_INTERFACE_MODEM_GSM_CARD "org.freedesktop.ModemManager.Modem.Gsm.Card" +#define MM_OLD_DBUS_INTERFACE_MODEM_GSM_NETWORK "org.freedesktop.ModemManager.Modem.Gsm.Network" #define MM_MODEM_TYPE_UNKNOWN 0 #define MM_MODEM_TYPE_GSM 1 #define MM_MODEM_TYPE_CDMA 2 -#define MM_MODEM_IP_METHOD_PPP 0 -#define MM_MODEM_IP_METHOD_STATIC 1 -#define MM_MODEM_IP_METHOD_DHCP 2 - /* Errors */ -#define MM_SERIAL_OPEN_FAILED MM_DBUS_INTERFACE_MODEM ".SerialOpenFailed" -#define MM_SERIAL_SEND_FAILED MM_DBUS_INTERFACE_MODEM ".SerialSendFailed" -#define MM_SERIAL_RESPONSE_TIMEOUT MM_DBUS_INTERFACE_MODEM ".SerialResponseTimeout" +#define MM_SERIAL_OPEN_FAILED MM_OLD_DBUS_INTERFACE_MODEM ".SerialOpenFailed" +#define MM_SERIAL_SEND_FAILED MM_OLD_DBUS_INTERFACE_MODEM ".SerialSendFailed" +#define MM_SERIAL_RESPONSE_TIMEOUT MM_OLD_DBUS_INTERFACE_MODEM ".SerialResponseTimeout" -#define MM_MODEM_ERROR_GENERAL MM_DBUS_INTERFACE_MODEM ".General" -#define MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED MM_DBUS_INTERFACE_MODEM ".OperationNotSupported" +#define MM_MODEM_ERROR_GENERAL MM_OLD_DBUS_INTERFACE_MODEM ".General" +#define MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED MM_OLD_DBUS_INTERFACE_MODEM ".OperationNotSupported" -#define MM_MODEM_CONNECT_ERROR_NO_CARRIER MM_DBUS_INTERFACE_MODEM ".NoCarrier" -#define MM_MODEM_CONNECT_ERROR_NO_DIALTONE MM_DBUS_INTERFACE_MODEM ".NoDialtone" -#define MM_MODEM_CONNECT_ERROR_BUSY MM_DBUS_INTERFACE_MODEM ".Busy" -#define MM_MODEM_CONNECT_ERROR_NO_ANSWER MM_DBUS_INTERFACE_MODEM ".NoAnswer" +#define MM_MODEM_CONNECT_ERROR_NO_CARRIER MM_OLD_DBUS_INTERFACE_MODEM ".NoCarrier" +#define MM_MODEM_CONNECT_ERROR_NO_DIALTONE MM_OLD_DBUS_INTERFACE_MODEM ".NoDialtone" +#define MM_MODEM_CONNECT_ERROR_BUSY MM_OLD_DBUS_INTERFACE_MODEM ".Busy" +#define MM_MODEM_CONNECT_ERROR_NO_ANSWER MM_OLD_DBUS_INTERFACE_MODEM ".NoAnswer" #define MM_MODEM_ERROR "org.freedesktop.ModemManager.Modem.Gsm" diff --git a/src/modem-manager/nm-modem.c b/src/modem-manager/nm-modem.c index c43e5e167..2d24a3ea7 100644 --- a/src/modem-manager/nm-modem.c +++ b/src/modem-manager/nm-modem.c @@ -38,35 +38,34 @@ G_DEFINE_TYPE (NMModem, nm_modem, G_TYPE_OBJECT) enum { PROP_0, - PROP_DEVICE, - PROP_IFACE, + PROP_CONTROL_PORT, + PROP_DATA_PORT, PROP_PATH, + PROP_UID, PROP_IP_METHOD, PROP_IP_TIMEOUT, PROP_ENABLED, + PROP_CONNECTED, LAST_PROP }; typedef struct { - NMDBusManager *dbus_mgr; - DBusGProxy *proxy; - DBusGProxy *props_proxy; - + char *uid; char *path; - NMPPPManager *ppp_manager; + char *control_port; + char *data_port; guint32 ip_method; - char *device; - char *iface; + + NMPPPManager *ppp_manager; NMActRequest *act_request; guint32 secrets_tries; guint32 secrets_id; - DBusGProxyCall *call; - gboolean mm_enabled; guint32 mm_ip_timeout; + gboolean mm_connected; /* PPP stats */ guint32 in_bytes; @@ -86,47 +85,31 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -static void -update_mm_enabled (NMModem *self, gboolean new_enabled) -{ - NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); - - if (priv->mm_enabled != new_enabled) { - priv->mm_enabled = new_enabled; - g_object_notify (G_OBJECT (self), NM_MODEM_ENABLED); - } -} +/*****************************************************************************/ +/* Get/Set enabled/connected */ gboolean nm_modem_get_mm_enabled (NMModem *self) { - g_return_val_if_fail (NM_IS_MODEM (self), TRUE); - return NM_MODEM_GET_PRIVATE (self)->mm_enabled; } -DBusGProxy * -nm_modem_get_proxy (NMModem *self, - const char *interface) +void +nm_modem_set_mm_enabled (NMModem *self, + gboolean enabled) { + NMModemPrivate *priv; - NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); - const char *current_iface; - - g_return_val_if_fail (NM_IS_MODEM (self), NULL); - - /* Default to the default interface. */ - if (interface == NULL) - interface = MM_DBUS_INTERFACE_MODEM; - - if (interface && !strcmp (interface, DBUS_INTERFACE_PROPERTIES)) - return priv->props_proxy; + priv = NM_MODEM_GET_PRIVATE (self); - current_iface = dbus_g_proxy_get_interface (priv->proxy); - if (!current_iface || strcmp (current_iface, interface)) - dbus_g_proxy_set_interface (priv->proxy, interface); + if (priv->mm_enabled != enabled) + NM_MODEM_GET_CLASS (self)->set_mm_enabled (self, enabled); +} - return priv->proxy; +gboolean +nm_modem_get_mm_connected (NMModem *self) +{ + return NM_MODEM_GET_PRIVATE (self)->mm_connected; } /*****************************************************************************/ @@ -154,6 +137,7 @@ ppp_ip4_config (NMPPPManager *ppp_manager, gpointer user_data) { NMModem *self = NM_MODEM (user_data); + NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); guint32 i, num; guint32 bad_dns1 = htonl (0x0A0B0C0D); guint32 good_dns1 = htonl (0x04020201); /* GTE nameserver */ @@ -161,6 +145,11 @@ ppp_ip4_config (NMPPPManager *ppp_manager, guint32 good_dns2 = htonl (0x04020202); /* GTE nameserver */ gboolean dns_workaround = FALSE; + /* Notify about the new data port to use */ + g_free (priv->data_port); + priv->data_port = g_strdup (iface); + g_object_notify (G_OBJECT (self), NM_MODEM_DATA_PORT); + /* Work around a PPP bug (#1732) which causes many mobile broadband * providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers. * Apparently fixed in ppp-2.4.5 but we've had some reports that this is @@ -197,7 +186,7 @@ ppp_ip4_config (NMPPPManager *ppp_manager, nm_ip4_config_add_nameserver (config, good_dns2); } - g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, iface, config, NULL); + g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, config, NULL); } static void @@ -250,17 +239,17 @@ ppp_stage3_ip4_config_start (NMModem *self, ip_timeout = priv->mm_ip_timeout; } - priv->ppp_manager = nm_ppp_manager_new (priv->iface); + priv->ppp_manager = nm_ppp_manager_new (priv->data_port); if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, ip_timeout, &error)) { g_signal_connect (priv->ppp_manager, "state-changed", - G_CALLBACK (ppp_state_changed), - self); + G_CALLBACK (ppp_state_changed), + self); g_signal_connect (priv->ppp_manager, "ip4-config", - G_CALLBACK (ppp_ip4_config), - self); + G_CALLBACK (ppp_ip4_config), + self); g_signal_connect (priv->ppp_manager, "stats", - G_CALLBACK (ppp_stats), - self); + G_CALLBACK (ppp_stats), + self); ret = NM_ACT_STAGE_RETURN_POSTPONE; } else { @@ -280,103 +269,6 @@ ppp_stage3_ip4_config_start (NMModem *self, } /*****************************************************************************/ -/* IP method static */ - -static char addr_to_string_buf[INET6_ADDRSTRLEN + 1]; - -static const char * -ip_address_to_string (guint32 numeric) -{ - struct in_addr temp_addr; - - memset (&addr_to_string_buf, '\0', sizeof (addr_to_string_buf)); - temp_addr.s_addr = numeric; - - if (inet_ntop (AF_INET, &temp_addr, addr_to_string_buf, INET_ADDRSTRLEN)) { - return addr_to_string_buf; - } else { - nm_log_warn (LOGD_VPN, "error converting IP4 address 0x%X", - ntohl (temp_addr.s_addr)); - return NULL; - } -} - -static void -static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) -{ - NMModem *self = NM_MODEM (user_data); - NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); - GValueArray *ret_array = NULL; - GError *error = NULL; - NMIP4Config *config = NULL; - - priv->call = NULL; - - /* Returned value array is (uuuu): [IP, DNS1, DNS2, DNS3], all in - * network byte order. - */ - if (dbus_g_proxy_end_call (proxy, call, &error, - G_TYPE_VALUE_ARRAY, &ret_array, - G_TYPE_INVALID)) { - NMIP4Address *addr; - int i; - - config = nm_ip4_config_new (); - - addr = nm_ip4_address_new (); - - nm_log_info (LOGD_MB, "(%s): IPv4 static configuration:", priv->iface); - - /* IP address */ - nm_ip4_address_set_address (addr, g_value_get_uint (g_value_array_get_nth (ret_array, 0))); - nm_ip4_address_set_prefix (addr, 32); - nm_ip4_config_take_address (config, addr); - - nm_log_info (LOGD_MB, " address %s/%d", - ip_address_to_string (nm_ip4_address_get_address (addr)), - nm_ip4_address_get_prefix (addr)); - - /* DNS servers */ - for (i = 1; i < ret_array->n_values; i++) { - GValue *value = g_value_array_get_nth (ret_array, i); - guint32 tmp = g_value_get_uint (value); - - if (tmp > 0) { - nm_ip4_config_add_nameserver (config, tmp); - nm_log_info (LOGD_MB, " DNS %s", ip_address_to_string (tmp)); - } - } - g_value_array_free (ret_array); - } - - g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, NULL, config, error); - g_clear_error (&error); -} - -static NMActStageReturn -static_stage3_ip4_config_start (NMModem *self, - NMActRequest *req, - NMDeviceStateReason *reason) -{ - NMModemPrivate *priv; - - g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE); - g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE); - g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE); - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE); - g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); - - priv = NM_MODEM_GET_PRIVATE (self); - - priv->call = dbus_g_proxy_begin_call (nm_modem_get_proxy (self, MM_DBUS_INTERFACE_MODEM), - "GetIP4Config", static_stage3_done, - self, NULL, - G_TYPE_INVALID); - - return NM_ACT_STAGE_RETURN_POSTPONE; -} - -/*****************************************************************************/ NMActStageReturn nm_modem_stage3_ip4_config_start (NMModem *self, @@ -405,7 +297,7 @@ nm_modem_stage3_ip4_config_start (NMModem *self, ret = ppp_stage3_ip4_config_start (self, req, reason); break; case MM_MODEM_IP_METHOD_STATIC: - ret = static_stage3_ip4_config_start (self, req, reason); + ret = NM_MODEM_GET_CLASS (self)->static_stage3_ip4_config_start (self, req, reason); break; case MM_MODEM_IP_METHOD_DHCP: ret = device_class->act_stage3_ip4_config_start (device, NULL, reason); @@ -419,6 +311,29 @@ nm_modem_stage3_ip4_config_start (NMModem *self, return ret; } +void +nm_modem_ip4_pre_commit (NMModem *modem, + NMDevice *device, + NMIP4Config *config) +{ + NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (modem); + + /* If the modem has an ethernet-type data interface (ie, not PPP and thus + * not point-to-point) and IP config has a /32 prefix, then we assume that + * ARP will be pointless and we turn it off. + */ + if ( priv->ip_method == MM_MODEM_IP_METHOD_STATIC + || priv->ip_method == MM_MODEM_IP_METHOD_DHCP) { + NMIP4Address *addr = nm_ip4_config_get_address (config, 0); + + g_assert (addr); + if (nm_ip4_address_get_prefix (addr) == 32) + nm_system_iface_set_arp (nm_device_get_ip_ifindex (device), FALSE); + } +} + +/*****************************************************************************/ + NMActStageReturn nm_modem_stage3_ip6_config_start (NMModem *self, NMDevice *device, @@ -430,6 +345,8 @@ nm_modem_stage3_ip6_config_start (NMModem *self, return NM_ACT_STAGE_RETURN_POSTPONE; } +/*****************************************************************************/ + static void cancel_get_secrets (NMModem *self) { @@ -486,12 +403,14 @@ nm_modem_get_secrets (NMModem *self, return !!(priv->secrets_id); } +/*****************************************************************************/ + static NMActStageReturn -real_act_stage1_prepare (NMModem *modem, - NMActRequest *req, - GPtrArray **out_hints, - const char **out_setting_name, - NMDeviceStateReason *reason) +act_stage1_prepare (NMModem *modem, + NMActRequest *req, + GPtrArray **out_hints, + const char **out_setting_name, + NMDeviceStateReason *reason) { *reason = NM_DEVICE_STATE_REASON_UNKNOWN; return NM_ACT_STAGE_RETURN_FAILURE; @@ -541,6 +460,8 @@ nm_modem_act_stage1_prepare (NMModem *self, return ret; } +/*****************************************************************************/ + NMActStageReturn nm_modem_act_stage2_config (NMModem *self, NMActRequest *req, @@ -556,6 +477,8 @@ nm_modem_act_stage2_config (NMModem *self, return NM_ACT_STAGE_RETURN_SUCCESS; } +/*****************************************************************************/ + NMConnection * nm_modem_get_best_auto_connection (NMModem *self, GSList *connections, @@ -566,6 +489,8 @@ nm_modem_get_best_auto_connection (NMModem *self, return NULL; } +/*****************************************************************************/ + gboolean nm_modem_check_connection_compatible (NMModem *self, NMConnection *connection, @@ -576,6 +501,8 @@ nm_modem_check_connection_compatible (NMModem *self, return FALSE; } +/*****************************************************************************/ + gboolean nm_modem_complete_connection (NMModem *self, NMConnection *connection, @@ -587,8 +514,10 @@ nm_modem_complete_connection (NMModem *self, return FALSE; } +/*****************************************************************************/ + static void -real_deactivate (NMModem *self, NMDevice *device) +deactivate (NMModem *self, NMDevice *device) { NMModemPrivate *priv; int ifindex; @@ -608,11 +537,6 @@ real_deactivate (NMModem *self, NMDevice *device) priv->act_request = NULL; } - if (priv->call) { - dbus_g_proxy_cancel_call (priv->proxy, priv->call); - priv->call = NULL; - } - priv->in_bytes = priv->out_bytes = 0; if (priv->ppp_manager) { @@ -639,24 +563,15 @@ real_deactivate (NMModem *self, NMDevice *device) } } +/*****************************************************************************/ + void nm_modem_deactivate (NMModem *self, NMDevice *device) { NM_MODEM_GET_CLASS (self)->deactivate (self, device); } -static void -disconnect_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) -{ - GError *error = NULL; - gboolean warn = GPOINTER_TO_UINT (user_data); - - if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID) && warn) { - nm_log_info (LOGD_MB, "disconnect failed: (%d) %s", - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); - } -} +/*****************************************************************************/ void nm_modem_device_state_changed (NMModem *self, @@ -697,12 +612,7 @@ nm_modem_device_state_changed (NMModem *self, /* Don't bother warning on FAILED since the modem is already gone */ if (new_state == NM_DEVICE_STATE_FAILED) warn = FALSE; - dbus_g_proxy_begin_call (nm_modem_get_proxy (self, MM_DBUS_INTERFACE_MODEM), - "Disconnect", - disconnect_done, - GUINT_TO_POINTER (warn), - NULL, - G_TYPE_INVALID); + NM_MODEM_GET_CLASS (self)->disconnect (self, warn); } break; default: @@ -710,29 +620,15 @@ nm_modem_device_state_changed (NMModem *self, } } -gboolean -nm_modem_hw_is_up (NMModem *self, NMDevice *device) -{ - int ifindex = nm_device_get_ip_ifindex (device); - - return ifindex > 0 ? nm_system_iface_is_up (ifindex) : TRUE; -} - -gboolean -nm_modem_hw_bring_up (NMModem *self, NMDevice *device, gboolean *no_firmware) -{ - int ifindex = nm_device_get_ip_ifindex (device); - - return ifindex > 0 ? nm_system_iface_set_up (ifindex, TRUE, no_firmware) : TRUE; -} +/*****************************************************************************/ const char * -nm_modem_get_iface (NMModem *self) +nm_modem_get_uid (NMModem *self) { g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (NM_IS_MODEM (self), NULL); - return NM_MODEM_GET_PRIVATE (self)->iface; + return NM_MODEM_GET_PRIVATE (self)->uid; } const char * @@ -744,109 +640,22 @@ nm_modem_get_path (NMModem *self) return NM_MODEM_GET_PRIVATE (self)->path; } -static void -get_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) -{ - NMModem *self = NM_MODEM (user_data); - GError *error = NULL; - GValue value = { 0, }; - - if (!dbus_g_proxy_end_call (proxy, call_id, &error, - G_TYPE_VALUE, &value, - G_TYPE_INVALID)) { - nm_log_warn (LOGD_MB, "failed get modem enabled state: (%d) %s", - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); - return; - } - - if (G_VALUE_HOLDS_BOOLEAN (&value)) { - update_mm_enabled (self, g_value_get_boolean (&value)); - } else - nm_log_warn (LOGD_MB, "failed get modem enabled state: unexpected reply type"); - - g_value_unset (&value); -} - -static void -query_mm_enabled (NMModem *self) -{ - dbus_g_proxy_begin_call (NM_MODEM_GET_PRIVATE (self)->props_proxy, - "Get", get_mm_enabled_done, - self, NULL, - G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM, - G_TYPE_STRING, "Enabled", - G_TYPE_INVALID); -} - -static void -set_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) -{ - GError *error = NULL; - - if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) { - nm_log_warn (LOGD_MB, "failed to enable/disable modem: (%d) %s", - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); - } - - /* Update enabled/disabled state again */ - query_mm_enabled (NM_MODEM (user_data)); -} - -void -nm_modem_set_mm_enabled (NMModem *self, gboolean enabled) +const char * +nm_modem_get_control_port (NMModem *self) { - NMModemPrivate *priv; - - g_return_if_fail (self != NULL); - g_return_if_fail (NM_IS_MODEM (self)); - - priv = NM_MODEM_GET_PRIVATE (self); - - /* FIXME: For now this just toggles the ModemManager enabled state. In the - * future we want to tie this into rfkill state instead so that the user can - * toggle rfkill status of the WWAN modem. - */ + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (NM_IS_MODEM (self), NULL); - if (priv->mm_enabled != enabled) { - DBusGProxy *proxy; - - proxy = nm_modem_get_proxy (self, MM_DBUS_INTERFACE_MODEM); - dbus_g_proxy_begin_call (proxy, - "Enable", set_mm_enabled_done, - self, NULL, - G_TYPE_BOOLEAN, enabled, - G_TYPE_INVALID); - /* If we are disabling the modem, stop saying that it's enabled. */ - if (!enabled) - update_mm_enabled (self, enabled); - } + return NM_MODEM_GET_PRIVATE (self)->control_port; } -static void -modem_properties_changed (DBusGProxy *proxy, - const char *interface, - GHashTable *props, - gpointer user_data) +const char * +nm_modem_get_data_port (NMModem *self) { - NMModem *self = NM_MODEM (user_data); - NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); - GValue *value; - - if (strcmp (interface, MM_DBUS_INTERFACE_MODEM)) - return; - - value = g_hash_table_lookup (props, "Enabled"); - if (value && G_VALUE_HOLDS_BOOLEAN (value)) { - update_mm_enabled (self, g_value_get_boolean (value)); - } + g_return_val_if_fail (self != NULL, NULL); + g_return_val_if_fail (NM_IS_MODEM (self), NULL); - value = g_hash_table_lookup (props, "IpMethod"); - if (value && G_VALUE_HOLDS_UINT (value)) { - priv->ip_method = g_value_get_uint (value); - g_object_notify (G_OBJECT (self), NM_MODEM_IP_METHOD); - } + return NM_MODEM_GET_PRIVATE (self)->data_port; } /*****************************************************************************/ @@ -854,9 +663,6 @@ modem_properties_changed (DBusGProxy *proxy, static void nm_modem_init (NMModem *self) { - NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self); - - priv->dbus_mgr = nm_dbus_manager_get (); } static GObject* @@ -866,23 +672,17 @@ constructor (GType type, { GObject *object; NMModemPrivate *priv; - DBusGConnection *bus; object = G_OBJECT_CLASS (nm_modem_parent_class)->constructor (type, - n_construct_params, - construct_params); + n_construct_params, + construct_params); if (!object) return NULL; priv = NM_MODEM_GET_PRIVATE (object); - if (!priv->device) { - nm_log_err (LOGD_HW, "modem parent device not provided"); - goto err; - } - - if (!priv->device) { - nm_log_err (LOGD_HW, "modem command interface not provided"); + if (!priv->data_port && !priv->control_port) { + nm_log_err (LOGD_HW, "neither modem command nor data interface provided"); goto err; } @@ -891,30 +691,6 @@ constructor (GType type, goto err; } - bus = nm_dbus_manager_get_connection (priv->dbus_mgr); - priv->proxy = dbus_g_proxy_new_for_name (bus, - MM_DBUS_SERVICE, - priv->path, - MM_DBUS_INTERFACE_MODEM); - - priv->props_proxy = dbus_g_proxy_new_for_name (bus, - MM_DBUS_SERVICE, - priv->path, - DBUS_INTERFACE_PROPERTIES); - dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED, - G_TYPE_NONE, - G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT, - G_TYPE_INVALID); - dbus_g_proxy_add_signal (priv->props_proxy, "MmPropertiesChanged", - G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->props_proxy, "MmPropertiesChanged", - G_CALLBACK (modem_properties_changed), - object, - NULL); - - query_mm_enabled (NM_MODEM (object)); - return object; err: @@ -924,7 +700,7 @@ constructor (GType type, static void get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) + GValue *value, GParamSpec *pspec) { NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object); @@ -932,11 +708,14 @@ get_property (GObject *object, guint prop_id, case PROP_PATH: g_value_set_string (value, priv->path); break; - case PROP_DEVICE: - g_value_set_string (value, priv->device); + case PROP_CONTROL_PORT: + g_value_set_string (value, priv->control_port); break; - case PROP_IFACE: - g_value_set_string (value, priv->iface); + case PROP_DATA_PORT: + g_value_set_string (value, priv->data_port); + break; + case PROP_UID: + g_value_set_string (value, priv->uid); break; case PROP_IP_METHOD: g_value_set_uint (value, priv->ip_method); @@ -947,16 +726,18 @@ get_property (GObject *object, guint prop_id, case PROP_ENABLED: g_value_set_boolean (value, priv->mm_enabled); break; + case PROP_CONNECTED: + g_value_set_boolean (value, priv->mm_connected); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } - } static void set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) + const GValue *value, GParamSpec *pspec) { NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object); @@ -965,22 +746,27 @@ set_property (GObject *object, guint prop_id, /* Construct only */ priv->path = g_value_dup_string (value); break; - case PROP_DEVICE: - /* Construct only */ - priv->device = g_value_dup_string (value); + case PROP_CONTROL_PORT: + priv->control_port = g_value_dup_string (value); + break; + case PROP_DATA_PORT: + priv->data_port = g_value_dup_string (value); break; - case PROP_IFACE: + case PROP_UID: /* Construct only */ - priv->iface = g_value_dup_string (value); + priv->uid = g_value_dup_string (value); break; case PROP_IP_METHOD: - /* Construct only */ priv->ip_method = g_value_get_uint (value); break; case PROP_IP_TIMEOUT: priv->mm_ip_timeout = g_value_get_uint (value); break; case PROP_ENABLED: + priv->mm_enabled = g_value_get_boolean (value); + break; + case PROP_CONNECTED: + priv->mm_connected = g_value_get_boolean (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -989,24 +775,27 @@ set_property (GObject *object, guint prop_id, } static void -finalize (GObject *object) +dispose (GObject *object) { NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object); - if (priv->act_request) + if (priv->act_request) { g_object_unref (priv->act_request); + priv->act_request = NULL; + } - if (priv->proxy) - g_object_unref (priv->proxy); - - if (priv->props_proxy) - g_object_unref (priv->props_proxy); + G_OBJECT_CLASS (nm_modem_parent_class)->dispose (object); +} - g_object_unref (priv->dbus_mgr); +static void +finalize (GObject *object) +{ + NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object); - g_free (priv->iface); + g_free (priv->uid); g_free (priv->path); - g_free (priv->device); + g_free (priv->control_port); + g_free (priv->data_port); G_OBJECT_CLASS (nm_modem_parent_class)->finalize (object); } @@ -1022,45 +811,55 @@ nm_modem_class_init (NMModemClass *klass) object_class->constructor = constructor; object_class->set_property = set_property; object_class->get_property = get_property; + object_class->dispose = dispose; object_class->finalize = finalize; - klass->act_stage1_prepare = real_act_stage1_prepare; - klass->deactivate = real_deactivate; + klass->act_stage1_prepare = act_stage1_prepare; + klass->deactivate = deactivate; /* Properties */ + + g_object_class_install_property + (object_class, PROP_UID, + g_param_spec_string (NM_MODEM_UID, + "UID", + "Modem unique ID", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_PATH, g_param_spec_string (NM_MODEM_PATH, - "DBus path", - "DBus path", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + "DBus path", + "DBus path", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property - (object_class, PROP_DEVICE, - g_param_spec_string (NM_MODEM_DEVICE, - "Device", - "Master modem parent device", + (object_class, PROP_CONTROL_PORT, + g_param_spec_string (NM_MODEM_CONTROL_PORT, + "Control port", + "The port controlling the modem", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property - (object_class, PROP_IFACE, - g_param_spec_string (NM_MODEM_IFACE, - "Interface", - "Modem command interface", + (object_class, PROP_DATA_PORT, + g_param_spec_string (NM_MODEM_DATA_PORT, + "Data port", + "The port to connect to", NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, PROP_IP_METHOD, g_param_spec_uint (NM_MODEM_IP_METHOD, - "IP method", - "IP method", - MM_MODEM_IP_METHOD_PPP, - MM_MODEM_IP_METHOD_DHCP, - MM_MODEM_IP_METHOD_PPP, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + "IP method", + "IP method", + MM_MODEM_IP_METHOD_PPP, + MM_MODEM_IP_METHOD_DHCP, + MM_MODEM_IP_METHOD_PPP, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_IP_TIMEOUT, @@ -1068,7 +867,7 @@ nm_modem_class_init (NMModemClass *klass) "IP timeout", "IP timeout", 0, 360, 20, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_ENABLED, @@ -1076,62 +875,70 @@ nm_modem_class_init (NMModemClass *klass) "Enabled", "Enabled", TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + G_PARAM_READWRITE)); + + g_object_class_install_property + (object_class, PROP_CONNECTED, + g_param_spec_boolean (NM_MODEM_CONNECTED, + "Connected", + "Connected", + TRUE, + G_PARAM_READWRITE)); /* Signals */ + signals[PPP_STATS] = g_signal_new ("ppp-stats", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMModemClass, ppp_stats), - NULL, NULL, - _nm_marshal_VOID__UINT_UINT, - G_TYPE_NONE, 2, - G_TYPE_UINT, G_TYPE_UINT); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMModemClass, ppp_stats), + NULL, NULL, + _nm_marshal_VOID__UINT_UINT, + G_TYPE_NONE, 2, + G_TYPE_UINT, G_TYPE_UINT); signals[PPP_FAILED] = g_signal_new ("ppp-failed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMModemClass, ppp_failed), - NULL, NULL, - g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMModemClass, ppp_failed), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT); signals[IP4_CONFIG_RESULT] = g_signal_new (NM_MODEM_IP4_CONFIG_RESULT, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMModemClass, ip4_config_result), - NULL, NULL, - _nm_marshal_VOID__STRING_OBJECT_POINTER, - G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_OBJECT, G_TYPE_POINTER); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMModemClass, ip4_config_result), + NULL, NULL, + _nm_marshal_VOID__OBJECT_POINTER, + G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_POINTER); signals[PREPARE_RESULT] = g_signal_new (NM_MODEM_PREPARE_RESULT, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMModemClass, prepare_result), - NULL, NULL, - _nm_marshal_VOID__BOOLEAN_UINT, - G_TYPE_NONE, 2, G_TYPE_BOOLEAN, G_TYPE_UINT); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMModemClass, prepare_result), + NULL, NULL, + _nm_marshal_VOID__BOOLEAN_UINT, + G_TYPE_NONE, 2, G_TYPE_BOOLEAN, G_TYPE_UINT); signals[AUTH_REQUESTED] = g_signal_new (NM_MODEM_AUTH_REQUESTED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMModemClass, auth_requested), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMModemClass, auth_requested), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[AUTH_RESULT] = g_signal_new (NM_MODEM_AUTH_RESULT, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMModemClass, auth_result), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMModemClass, auth_result), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); } - diff --git a/src/modem-manager/nm-modem.h b/src/modem-manager/nm-modem.h index 8fe52bc05..d01aaf2cb 100644 --- a/src/modem-manager/nm-modem.h +++ b/src/modem-manager/nm-modem.h @@ -29,19 +29,21 @@ G_BEGIN_DECLS -#define NM_TYPE_MODEM (nm_modem_get_type ()) -#define NM_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM, NMModem)) -#define NM_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM, NMModemClass)) -#define NM_IS_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM)) -#define NM_IS_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM)) -#define NM_MODEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM, NMModemClass)) - -#define NM_MODEM_PATH "path" -#define NM_MODEM_DEVICE "device" -#define NM_MODEM_IFACE "iface" -#define NM_MODEM_IP_METHOD "ip-method" -#define NM_MODEM_IP_TIMEOUT "ip-timeout" -#define NM_MODEM_ENABLED "enabled" +#define NM_TYPE_MODEM (nm_modem_get_type ()) +#define NM_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM, NMModem)) +#define NM_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MODEM, NMModemClass)) +#define NM_IS_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM)) +#define NM_IS_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_MODEM)) +#define NM_MODEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MODEM, NMModemClass)) + +#define NM_MODEM_UID "uid" +#define NM_MODEM_PATH "path" +#define NM_MODEM_CONTROL_PORT "control-port" +#define NM_MODEM_DATA_PORT "data-port" +#define NM_MODEM_IP_METHOD "ip-method" +#define NM_MODEM_IP_TIMEOUT "ip-timeout" +#define NM_MODEM_ENABLED "enabled" +#define NM_MODEM_CONNECTED "connected" #define NM_MODEM_PPP_STATS "ppp-stats" #define NM_MODEM_PPP_FAILED "ppp-failed" @@ -50,6 +52,10 @@ G_BEGIN_DECLS #define NM_MODEM_AUTH_REQUESTED "auth-requested" #define NM_MODEM_AUTH_RESULT "auth-result" +#define MM_MODEM_IP_METHOD_PPP 0 +#define MM_MODEM_IP_METHOD_STATIC 1 +#define MM_MODEM_IP_METHOD_DHCP 2 + typedef struct { GObject parent; } NMModem; @@ -83,6 +89,14 @@ typedef struct { const char **out_setting_name, NMDeviceStateReason *reason); + NMActStageReturn (*static_stage3_ip4_config_start) (NMModem *self, + NMActRequest *req, + NMDeviceStateReason *reason); + + void (*set_mm_enabled) (NMModem *self, gboolean enabled); + + void (*disconnect) (NMModem *self, gboolean warn); + void (*deactivate) (NMModem *self, NMDevice *device); /* Signals */ @@ -90,7 +104,7 @@ typedef struct { void (*ppp_failed) (NMModem *self, NMDeviceStateReason reason); void (*prepare_result) (NMModem *self, gboolean success, NMDeviceStateReason reason); - void (*ip4_config_result) (NMModem *self, const char *iface, NMIP4Config *config, GError *error); + void (*ip4_config_result) (NMModem *self, NMIP4Config *config, GError *error); void (*auth_requested) (NMModem *self); void (*auth_result) (NMModem *self, GError *error); @@ -98,11 +112,10 @@ typedef struct { GType nm_modem_get_type (void); -/* Protected */ - -DBusGProxy * nm_modem_get_proxy (NMModem *modem, const char *interface); -const char * nm_modem_get_iface (NMModem *modem); -const char * nm_modem_get_path (NMModem *modem); +const char *nm_modem_get_path (NMModem *modem); +const char *nm_modem_get_uid (NMModem *modem); +const char *nm_modem_get_control_port (NMModem *modem); +const char *nm_modem_get_data_port (NMModem *modem); NMConnection *nm_modem_get_best_auto_connection (NMModem *self, GSList *connections, @@ -135,6 +148,8 @@ NMActStageReturn nm_modem_stage3_ip6_config_start (NMModem *modem, NMDeviceClass *device_class, NMDeviceStateReason *reason); +void nm_modem_ip4_pre_commit (NMModem *modem, NMDevice *device, NMIP4Config *config); + gboolean nm_modem_get_secrets (NMModem *modem, const char *setting_name, gboolean request_new, @@ -147,14 +162,12 @@ void nm_modem_device_state_changed (NMModem *modem, NMDeviceState old_state, NMDeviceStateReason reason); -gboolean nm_modem_hw_is_up (NMModem *modem, NMDevice *device); - -gboolean nm_modem_hw_bring_up (NMModem *modem, NMDevice *device, gboolean *no_firmware); - gboolean nm_modem_get_mm_enabled (NMModem *self); void nm_modem_set_mm_enabled (NMModem *self, gboolean enabled); +gboolean nm_modem_get_mm_connected (NMModem *self); + G_END_DECLS #endif /* NM_MODEM_H */ diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c index 1a3cb77a6..88504ce0d 100644 --- a/src/nm-activation-request.c +++ b/src/nm-activation-request.c @@ -28,11 +28,9 @@ #include <dbus/dbus-glib.h> #include "nm-activation-request.h" -#include "nm-marshal.h" #include "nm-logging.h" #include "nm-setting-wireless-security.h" #include "nm-setting-8021x.h" -#include "nm-dbus-manager.h" #include "nm-device.h" #include "nm-active-connection.h" #include "nm-settings-connection.h" @@ -51,35 +49,32 @@ typedef struct { } ShareRule; typedef struct { - gboolean disposed; - NMConnection *connection; - - GSList *secrets_calls; - NMDevice *device; - gboolean user_requested; - gulong user_uid; - - NMActiveConnection *dep; - guint dep_state_id; - + guint device_state_id; + char *dbus_sender; + GSList *secrets_calls; gboolean shared; GSList *share_rules; - - gboolean assumed; } NMActRequestPrivate; -enum { - PROP_MASTER = 2000, -}; +/*******************************************************************/ + +NMConnection * +nm_act_request_get_connection (NMActRequest *req) +{ + g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL); + + return nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (req)); +} -enum { - DEP_RESULT, +const char * +nm_act_request_get_dbus_sender (NMActRequest *req) +{ + g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL); - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; + return NM_ACT_REQUEST_GET_PRIVATE (req)->dbus_sender; +} /*******************************************************************/ @@ -119,6 +114,8 @@ nm_act_request_get_secrets (NMActRequest *self, NMActRequestPrivate *priv; GetSecretsInfo *info; guint32 call_id; + NMConnection *connection; + gboolean user_requested; g_return_val_if_fail (self, 0); g_return_val_if_fail (NM_IS_ACT_REQUEST (self), 0); @@ -130,12 +127,14 @@ nm_act_request_get_secrets (NMActRequest *self, info->callback = callback; info->callback_data = callback_data; - if (priv->user_requested) + user_requested = nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)); + if (user_requested) flags |= NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED; - call_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (priv->connection), - priv->user_requested, - priv->user_uid, + connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (self)); + call_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (connection), + user_requested, + nm_active_connection_get_user_uid (NM_ACTIVE_CONNECTION (self)), setting_name, flags, hint, @@ -178,67 +177,6 @@ nm_act_request_cancel_secrets (NMActRequest *self, guint32 call_id) } } -/*******************************************************************/ - -NMConnection * -nm_act_request_get_connection (NMActRequest *req) -{ - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL); - - return NM_ACT_REQUEST_GET_PRIVATE (req)->connection; -} - -gboolean -nm_act_request_get_user_requested (NMActRequest *req) -{ - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); - - return NM_ACT_REQUEST_GET_PRIVATE (req)->user_requested; -} - -GObject * -nm_act_request_get_device (NMActRequest *req) -{ - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL); - - return G_OBJECT (NM_ACT_REQUEST_GET_PRIVATE (req)->device); -} - -gboolean -nm_act_request_get_assumed (NMActRequest *req) -{ - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); - - return NM_ACT_REQUEST_GET_PRIVATE (req)->assumed; -} - -NMActiveConnection * -nm_act_request_get_dependency (NMActRequest *req) -{ - return NM_ACT_REQUEST_GET_PRIVATE (req)->dep; -} - -static NMActRequestDependencyResult -ac_state_to_dep_result (NMActiveConnection *ac) -{ - NMActiveConnectionState state = nm_active_connection_get_state (ac); - - if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING) - return NM_ACT_REQUEST_DEP_RESULT_WAIT; - else if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) - return NM_ACT_REQUEST_DEP_RESULT_READY; - - return NM_ACT_REQUEST_DEP_RESULT_FAILED; -} - -NMActRequestDependencyResult -nm_act_request_get_dependency_result (NMActRequest *req) -{ - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (req); - - return priv->dep ? ac_state_to_dep_result (priv->dep) : NM_ACT_REQUEST_DEP_RESULT_READY; -} - /********************************************************************/ static void @@ -357,76 +295,45 @@ nm_act_request_add_share_rule (NMActRequest *req, /********************************************************************/ static void -device_state_changed (NMDevice *device, - NMDeviceState new_state, - NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) +device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self) { - NMActRequest *self = NM_ACT_REQUEST (user_data); - NMActiveConnectionState new_ac_state; + NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; /* Set NMActiveConnection state based on the device's state */ - switch (new_state) { + switch (nm_device_get_state (device)) { case NM_DEVICE_STATE_PREPARE: case NM_DEVICE_STATE_CONFIG: case NM_DEVICE_STATE_NEED_AUTH: case NM_DEVICE_STATE_IP_CONFIG: case NM_DEVICE_STATE_IP_CHECK: case NM_DEVICE_STATE_SECONDARIES: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING; + ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING; break; case NM_DEVICE_STATE_ACTIVATED: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED; + ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED; break; case NM_DEVICE_STATE_DEACTIVATING: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING; + ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING; + break; + case NM_DEVICE_STATE_FAILED: + case NM_DEVICE_STATE_DISCONNECTED: + ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED; break; default: - new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; + break; + } + + if ( ac_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED + || ac_state == NM_ACTIVE_CONNECTION_STATE_UNKNOWN) { nm_active_connection_set_default (NM_ACTIVE_CONNECTION (self), FALSE); nm_active_connection_set_default6 (NM_ACTIVE_CONNECTION (self), FALSE); - break; } - nm_active_connection_set_state (NM_ACTIVE_CONNECTION (self), new_ac_state); + nm_active_connection_set_state (NM_ACTIVE_CONNECTION (self), ac_state); } /********************************************************************/ -static void -dep_gone (NMActRequest *self, GObject *ignored) -{ - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); - - g_warn_if_fail (G_OBJECT (priv->dep) == ignored); - - /* Dependent connection is gone; clean up and fail */ - priv->dep = NULL; - priv->dep_state_id = 0; - g_signal_emit (self, signals[DEP_RESULT], 0, NM_ACT_REQUEST_DEP_RESULT_FAILED); -} - -static void -dep_state_changed (NMActiveConnection *dep, - GParamSpec *pspec, - NMActRequest *self) -{ - NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self); - NMActRequestDependencyResult result; - - g_warn_if_fail (priv->dep == dep); - - result = ac_state_to_dep_result (priv->dep); - if (result == NM_ACT_REQUEST_DEP_RESULT_FAILED) { - g_object_weak_unref (G_OBJECT (priv->dep), (GWeakNotify) dep_gone, self); - g_signal_handler_disconnect (priv->dep, priv->dep_state_id); - priv->dep = NULL; - priv->dep_state_id = 0; - } - g_signal_emit (self, signals[DEP_RESULT], 0, result); -} - /** * nm_act_request_new: * @@ -436,13 +343,14 @@ dep_state_changed (NMActiveConnection *dep, * @user_requested: pass %TRUE if the activation was requested via D-Bus, * otherwise %FALSE if requested internally by NM (ie, autoconnect) * @user_uid: if @user_requested is %TRUE, the Unix UID of the user that requested + * @dbus_sender: if @user_requested is %TRUE, the D-BUS sender that requested * the activation * @assumed: pass %TRUE if the activation should "assume" (ie, taking over) an * existing connection made before this instance of NM started * @device: the device/interface to configure according to @connection - * @dependency: if the activation depends on another device (ie, VLAN slave, - * bond slave, etc) pass the #NMActiveConnection that this activation request - * should wait for before proceeding + * @master: if the activation depends on another device (ie, bond or bridge + * master to which this device will be enslaved) pass the #NMDevice that this + * activation request be enslaved to * * Begins activation of @device using the given @connection and other details. * @@ -453,48 +361,28 @@ nm_act_request_new (NMConnection *connection, const char *specific_object, gboolean user_requested, gulong user_uid, + const char *dbus_sender, gboolean assumed, - gpointer *device, - NMActiveConnection *dependency) + NMDevice *device, + NMDevice *master) { GObject *object; - NMActRequestPrivate *priv; g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_DEVICE (device), NULL); object = g_object_new (NM_TYPE_ACT_REQUEST, + NM_ACTIVE_CONNECTION_INT_CONNECTION, connection, + NM_ACTIVE_CONNECTION_INT_DEVICE, device, NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, specific_object, + NM_ACTIVE_CONNECTION_INT_USER_REQUESTED, user_requested, + NM_ACTIVE_CONNECTION_INT_USER_UID, user_uid, + NM_ACTIVE_CONNECTION_INT_ASSUMED, assumed, + NM_ACTIVE_CONNECTION_INT_MASTER, master, NULL); - if (!object) - return NULL; - - priv = NM_ACT_REQUEST_GET_PRIVATE (object); - - priv->connection = g_object_ref (connection); - priv->device = NM_DEVICE (device); - g_signal_connect (device, "state-changed", - G_CALLBACK (device_state_changed), - NM_ACT_REQUEST (object)); - - priv->user_uid = user_uid; - priv->user_requested = user_requested; - priv->assumed = assumed; - - if (dependency) { - priv->dep = dependency; - g_object_weak_ref (G_OBJECT (dependency), (GWeakNotify) dep_gone, object); - priv->dep_state_id = g_signal_connect (dependency, - "notify::" NM_ACTIVE_CONNECTION_STATE, - G_CALLBACK (dep_state_changed), - object); - } - - if (!nm_active_connection_export (NM_ACTIVE_CONNECTION (object), - connection, - nm_device_get_path (NM_DEVICE (device)))) { - g_object_unref (object); - object = NULL; + if (object) { + nm_active_connection_export (NM_ACTIVE_CONNECTION (object)); + NM_ACT_REQUEST_GET_PRIVATE (object)->dbus_sender = g_strdup (dbus_sender); } return (NMActRequest *) object; @@ -506,24 +394,24 @@ nm_act_request_init (NMActRequest *req) } static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) +constructed (GObject *object) { NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); - NMDevice *master; - - switch (prop_id) { - case PROP_MASTER: - if (priv->dep && NM_IS_ACT_REQUEST (priv->dep)) { - master = NM_DEVICE (nm_act_request_get_device (NM_ACT_REQUEST (priv->dep))); - g_assert (master); - g_value_set_boxed (value, nm_device_get_path (master)); - } else - g_value_set_boxed (value, "/"); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; + NMConnection *connection; + NMDevice *device; + + G_OBJECT_CLASS (nm_act_request_parent_class)->constructed (object); + + connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (object)); + priv->connection = g_object_ref (connection); + + device = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object)); + if (device) { + priv->device = g_object_ref (device); + priv->device_state_id = g_signal_connect (priv->device, + "notify::" NM_DEVICE_STATE, + G_CALLBACK (device_state_changed), + NM_ACT_REQUEST (object)); } } @@ -533,50 +421,38 @@ dispose (GObject *object) NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object); GSList *iter; - if (priv->disposed) { - G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); - return; + if (priv->device && priv->device_state_id) { + g_signal_handler_disconnect (priv->device, priv->device_state_id); + priv->device_state_id = 0; } - priv->disposed = TRUE; - - g_signal_handlers_disconnect_by_func (G_OBJECT (priv->device), - G_CALLBACK (device_state_changed), - NM_ACT_REQUEST (object)); /* Clear any share rules */ - nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE); + if (priv->share_rules) { + nm_act_request_set_shared (NM_ACT_REQUEST (object), FALSE); + clear_share_rules (NM_ACT_REQUEST (object)); + } /* Kill any in-progress secrets requests */ - g_assert (priv->connection); for (iter = priv->secrets_calls; iter; iter = g_slist_next (iter)) { GetSecretsInfo *info = iter->data; + g_assert (priv->connection); nm_settings_connection_cancel_secrets (NM_SETTINGS_CONNECTION (priv->connection), info->call_id); g_free (info); } g_slist_free (priv->secrets_calls); + priv->secrets_calls = NULL; - g_object_unref (priv->connection); + g_free (priv->dbus_sender); + priv->dbus_sender = NULL; - if (priv->dep) { - g_object_weak_unref (G_OBJECT (priv->dep), (GWeakNotify) dep_gone, object); - g_signal_handler_disconnect (priv->dep, priv->dep_state_id); - priv->dep = NULL; - priv->dep_state_id = 0; - } + g_clear_object (&priv->device); + g_clear_object (&priv->connection); G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object); } static void -finalize (GObject *object) -{ - clear_share_rules (NM_ACT_REQUEST (object)); - - G_OBJECT_CLASS (nm_act_request_parent_class)->finalize (object); -} - -static void nm_act_request_class_init (NMActRequestClass *req_class) { GObjectClass *object_class = G_OBJECT_CLASS (req_class); @@ -584,18 +460,7 @@ nm_act_request_class_init (NMActRequestClass *req_class) g_type_class_add_private (req_class, sizeof (NMActRequestPrivate)); /* virtual methods */ - object_class->get_property = get_property; + object_class->constructed = constructed; object_class->dispose = dispose; - object_class->finalize = finalize; - - g_object_class_override_property (object_class, PROP_MASTER, NM_ACTIVE_CONNECTION_MASTER); - - signals[DEP_RESULT] = - g_signal_new (NM_ACT_REQUEST_DEPENDENCY_RESULT, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); } diff --git a/src/nm-activation-request.h b/src/nm-activation-request.h index 16467f9c3..159710949 100644 --- a/src/nm-activation-request.h +++ b/src/nm-activation-request.h @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2005 - 2010 Red Hat, Inc. + * (C) Copyright 2005 - 2012 Red Hat, Inc. */ #ifndef NM_ACTIVATION_REQUEST_H @@ -23,6 +23,7 @@ #include <glib.h> #include <glib-object.h> +#include "nm-types.h" #include "nm-connection.h" #include "nm-active-connection.h" #include "nm-settings-flags.h" @@ -34,26 +35,15 @@ #define NM_IS_ACT_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACT_REQUEST)) #define NM_ACT_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACT_REQUEST, NMActRequestClass)) -typedef enum { - NM_ACT_REQUEST_DEP_RESULT_UNKNOWN, - NM_ACT_REQUEST_DEP_RESULT_WAIT, - NM_ACT_REQUEST_DEP_RESULT_READY, - NM_ACT_REQUEST_DEP_RESULT_FAILED, -} NMActRequestDependencyResult; - -#define NM_ACT_REQUEST_DEPENDENCY_RESULT "dependency-result" - typedef struct { - GObject parent; + NMActiveConnection parent; } NMActRequest; typedef struct { - GObjectClass parent; + NMActiveConnectionClass parent; /* Signals */ void (*properties_changed) (NMActRequest *req, GHashTable *properties); - - void (*dependency_result) (NMActRequest *req, NMActRequestDependencyResult result); } NMActRequestClass; GType nm_act_request_get_type (void); @@ -62,13 +52,16 @@ NMActRequest *nm_act_request_new (NMConnection *connection, const char *specific_object, gboolean user_requested, gulong user_uid, + const char *dbus_sender, gboolean assumed, - gpointer *device, /* An NMDevice */ - NMActiveConnection *dependency); + NMDevice *device, + NMDevice *master); + +NMConnection *nm_act_request_get_connection (NMActRequest *req); -NMConnection *nm_act_request_get_connection (NMActRequest *req); +gulong nm_act_request_get_user_uid (NMActRequest *req); -gboolean nm_act_request_get_user_requested (NMActRequest *req); +const char *nm_act_request_get_dbus_sender (NMActRequest *req); gboolean nm_act_request_get_shared (NMActRequest *req); @@ -78,14 +71,6 @@ void nm_act_request_add_share_rule (NMActRequest *req, const char *table, const char *rule); -GObject * nm_act_request_get_device (NMActRequest *req); - -gboolean nm_act_request_get_assumed (NMActRequest *req); - -NMActiveConnection * nm_act_request_get_dependency (NMActRequest *req); - -NMActRequestDependencyResult nm_act_request_get_dependency_result (NMActRequest *req); - /* Secrets handling */ typedef void (*NMActRequestSecretsFunc) (NMActRequest *req, diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index 2de621970..15b4b4855 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -19,12 +19,15 @@ */ #include <glib.h> +#include "nm-types.h" #include "nm-active-connection.h" #include "NetworkManager.h" #include "nm-logging.h" #include "nm-dbus-glib-types.h" #include "nm-dbus-manager.h" #include "nm-properties-changed-signal.h" +#include "nm-device.h" +#include "nm-settings-connection.h" #include "nm-active-connection-glue.h" @@ -36,16 +39,20 @@ G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, G_TYPE_OBJECT) NMActiveConnectionPrivate)) typedef struct { - gboolean disposed; - NMConnection *connection; char *path; char *specific_object; - char *device_path; + NMDevice *device; + gboolean is_default; gboolean is_default6; NMActiveConnectionState state; gboolean vpn; + + gboolean user_requested; + gulong user_uid; + gboolean assumed; + NMDevice *master; } NMActiveConnectionPrivate; enum { @@ -60,6 +67,13 @@ enum { PROP_VPN, PROP_MASTER, + PROP_INT_CONNECTION, + PROP_INT_DEVICE, + PROP_INT_USER_REQUESTED, + PROP_INT_USER_UID, + PROP_INT_ASSUMED, + PROP_INT_MASTER, + LAST_PROP }; @@ -82,13 +96,30 @@ nm_active_connection_set_state (NMActiveConnection *self, NMActiveConnectionState new_state) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); + NMActiveConnectionState old_state; - if (priv->state != new_state) { - priv->state = new_state; - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); + if (priv->state == new_state) + return; + + old_state = priv->state; + priv->state = new_state; + g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE); + + if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED + || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (priv->connection), + (guint64) time (NULL), TRUE); } } +const char * +nm_active_connection_get_name (NMActiveConnection *self) +{ + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), NULL); + + return nm_connection_get_id (NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->connection); +} + NMConnection * nm_active_connection_get_connection (NMActiveConnection *self) { @@ -167,51 +198,65 @@ nm_active_connection_get_default6 (NMActiveConnection *self) return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->is_default6; } -gboolean -nm_active_connection_export (NMActiveConnection *self, - NMConnection *connection, - const char *devpath) +void +nm_active_connection_export (NMActiveConnection *self) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); NMDBusManager *dbus_mgr; static guint32 counter = 0; - g_return_val_if_fail (connection != NULL, FALSE); - g_return_val_if_fail (devpath != NULL, FALSE); - - priv->connection = g_object_ref (connection); priv->path = g_strdup_printf (NM_DBUS_PATH "/ActiveConnection/%d", counter++); - priv->device_path = g_strdup (devpath); - dbus_mgr = nm_dbus_manager_get (); dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (dbus_mgr), priv->path, G_OBJECT (self)); g_object_unref (dbus_mgr); - return TRUE; } -/****************************************************************/ +gboolean +nm_active_connection_get_user_requested (NMActiveConnection *self) +{ + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), FALSE); -static void -nm_active_connection_init (NMActiveConnection *self) + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->user_requested; +} + +gulong +nm_active_connection_get_user_uid (NMActiveConnection *self) { + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), G_MAXULONG); + + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->user_uid; } -static void -dispose (GObject *object) +gboolean +nm_active_connection_get_assumed (NMActiveConnection *self) { - NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), FALSE); - if (!priv->disposed) { - priv->disposed = TRUE; + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->assumed; +} - g_free (priv->path); - g_free (priv->specific_object); - g_free (priv->device_path); - g_object_unref (priv->connection); - } +NMDevice * +nm_active_connection_get_device (NMActiveConnection *self) +{ + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), NULL); - G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object); + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->device; +} + +NMDevice * +nm_active_connection_get_master (NMActiveConnection *self) +{ + g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (self), NULL); + + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->master; +} + +/****************************************************************/ + +static void +nm_active_connection_init (NMActiveConnection *self) +{ } static void @@ -221,6 +266,31 @@ set_property (GObject *object, guint prop_id, NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); switch (prop_id) { + case PROP_INT_CONNECTION: + g_warn_if_fail (priv->connection == NULL); + priv->connection = g_value_dup_object (value); + break; + case PROP_INT_DEVICE: + g_warn_if_fail (priv->device == NULL); + priv->device = g_value_dup_object (value); + if (priv->device) + g_warn_if_fail (priv->device != priv->master); + break; + case PROP_INT_USER_REQUESTED: + priv->user_requested = g_value_get_boolean (value); + break; + case PROP_INT_USER_UID: + priv->user_uid = g_value_get_ulong (value); + break; + case PROP_INT_ASSUMED: + priv->assumed = g_value_get_boolean (value); + break; + case PROP_INT_MASTER: + g_warn_if_fail (priv->master == NULL); + priv->master = g_value_dup_object (value); + if (priv->master) + g_warn_if_fail (priv->master != priv->device); + break; case PROP_SPECIFIC_OBJECT: priv->specific_object = g_value_dup_boxed (value); break; @@ -233,6 +303,8 @@ set_property (GObject *object, guint prop_id, case PROP_VPN: priv->vpn = g_value_get_boolean (value); break; + case PROP_MASTER: + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -258,7 +330,8 @@ get_property (GObject *object, guint prop_id, break; case PROP_DEVICES: devices = g_ptr_array_sized_new (1); - g_ptr_array_add (devices, g_strdup (priv->device_path)); + if (priv->device) + g_ptr_array_add (devices, g_strdup (nm_device_get_path (priv->device))); g_value_take_boxed (value, devices); break; case PROP_STATE: @@ -274,6 +347,7 @@ get_property (GObject *object, guint prop_id, g_value_set_boolean (value, priv->vpn); break; case PROP_MASTER: + g_value_set_boxed (value, priv->master ? nm_device_get_path (priv->master) : "/"); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -282,6 +356,23 @@ get_property (GObject *object, guint prop_id, } static void +dispose (GObject *object) +{ + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object); + + g_free (priv->path); + priv->path = NULL; + g_free (priv->specific_object); + priv->specific_object = NULL; + + g_clear_object (&priv->connection); + g_clear_object (&priv->device); + g_clear_object (&priv->master); + + G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object); +} + +static void nm_active_connection_class_init (NMActiveConnectionClass *vpn_class) { GObjectClass *object_class = G_OBJECT_CLASS (vpn_class); @@ -293,7 +384,7 @@ nm_active_connection_class_init (NMActiveConnectionClass *vpn_class) object_class->set_property = set_property; object_class->dispose = dispose; - /* properties */ + /* D-Bus exported properties */ g_object_class_install_property (object_class, PROP_CONNECTION, g_param_spec_boxed (NM_ACTIVE_CONNECTION_CONNECTION, "Connection", @@ -359,6 +450,49 @@ nm_active_connection_class_init (NMActiveConnectionClass *vpn_class) DBUS_TYPE_G_OBJECT_PATH, G_PARAM_READABLE)); + /* Internal properties */ + g_object_class_install_property (object_class, PROP_INT_CONNECTION, + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_CONNECTION, + "Internal Connection", + "Internal connection", + NM_TYPE_CONNECTION, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + + g_object_class_install_property (object_class, PROP_INT_DEVICE, + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_DEVICE, + "Internal device", + "Internal device", + NM_TYPE_DEVICE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + + g_object_class_install_property (object_class, PROP_INT_USER_REQUESTED, + g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_USER_REQUESTED, + "User requested", + "User requested", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + + g_object_class_install_property (object_class, PROP_INT_USER_UID, + g_param_spec_ulong (NM_ACTIVE_CONNECTION_INT_USER_UID, + "User UID", + "User UID (if user requested)", + 0, G_MAXULONG, 0, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + + g_object_class_install_property (object_class, PROP_INT_ASSUMED, + g_param_spec_boolean (NM_ACTIVE_CONNECTION_INT_ASSUMED, + "Assumed", + "Assumed", + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + + g_object_class_install_property (object_class, PROP_INT_MASTER, + g_param_spec_object (NM_ACTIVE_CONNECTION_INT_MASTER, + "Internal master device", + "Internal device", + NM_TYPE_DEVICE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT)); + /* Signals */ signals[PROPERTIES_CHANGED] = nm_properties_changed_signal_new (object_class, diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index 49ff5adcd..2f17c5834 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -22,6 +22,7 @@ #define NM_ACTIVE_CONNECTION_H #include <glib-object.h> +#include "nm-types.h" #include "nm-connection.h" #define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type ()) @@ -31,7 +32,7 @@ #define NM_IS_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACTIVE_CONNECTION)) #define NM_ACTIVE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass)) -/* Properties */ +/* D-Bus Exported Properties */ #define NM_ACTIVE_CONNECTION_CONNECTION "connection" #define NM_ACTIVE_CONNECTION_UUID "uuid" #define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object" @@ -42,6 +43,15 @@ #define NM_ACTIVE_CONNECTION_VPN "vpn" #define NM_ACTIVE_CONNECTION_MASTER "master" +/* Internal non-exported construct-time properties */ +#define NM_ACTIVE_CONNECTION_INT_CONNECTION "int-connection" +#define NM_ACTIVE_CONNECTION_INT_DEVICE "int-device" +#define NM_ACTIVE_CONNECTION_INT_USER_REQUESTED "int-user-requested" +#define NM_ACTIVE_CONNECTION_INT_USER_UID "int-user-uid" +#define NM_ACTIVE_CONNECTION_INT_ASSUMED "int-assumed" +#define NM_ACTIVE_CONNECTION_INT_MASTER "int-master" + + typedef struct { GObject parent; } NMActiveConnection; @@ -50,16 +60,15 @@ typedef struct { GObjectClass parent; /* Signals */ - void (*properties_changed) (NMActiveConnection *req, GHashTable *properties); + void (*properties_changed) (NMActiveConnection *active, GHashTable *properties); } NMActiveConnectionClass; GType nm_active_connection_get_type (void); -gboolean nm_active_connection_export (NMActiveConnection *self, - NMConnection *connection, - const char *devpath); +void nm_active_connection_export (NMActiveConnection *self); NMConnection *nm_active_connection_get_connection (NMActiveConnection *self); +const char * nm_active_connection_get_name (NMActiveConnection *self); const char * nm_active_connection_get_path (NMActiveConnection *self); @@ -83,4 +92,14 @@ NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *self void nm_active_connection_set_state (NMActiveConnection *self, NMActiveConnectionState state); +NMDevice * nm_active_connection_get_device (NMActiveConnection *self); + +gboolean nm_active_connection_get_user_requested (NMActiveConnection *self); + +gulong nm_active_connection_get_user_uid (NMActiveConnection *self); + +gboolean nm_active_connection_get_assumed (NMActiveConnection *self); + +NMDevice * nm_active_connection_get_master (NMActiveConnection *self); + #endif /* NM_ACTIVE_CONNECTION_H */ diff --git a/src/nm-config.c b/src/nm-config.c index 1efad4511..6e801d353 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -24,8 +24,8 @@ #include "nm-config.h" -#define NM_DEFAULT_SYSTEM_CONF_FILE SYSCONFDIR"/NetworkManager/NetworkManager.conf" -#define NM_OLD_SYSTEM_CONF_FILE SYSCONFDIR"/NetworkManager/nm-system-settings.conf" +#define NM_DEFAULT_SYSTEM_CONF_FILE NMCONFDIR "/NetworkManager.conf" +#define NM_OLD_SYSTEM_CONF_FILE NMCONFDIR "/nm-system-settings.conf" struct NMConfig { char *path; diff --git a/src/nm-crash-logger.c b/src/nm-crash-logger.c index e0e7cbf6a..f10e9ffe0 100644 --- a/src/nm-crash-logger.c +++ b/src/nm-crash-logger.c @@ -39,8 +39,8 @@ int main (int argc, char ** argv) char * args[] = { BINDIR "/gdb", "--batch", "--quiet", - "--command=" DATADIR "/NetworkManager/gdb-cmd", - SBINDIR "/NetworkManager", + "--command=" NMDATADIR "/gdb-cmd", + NMBINARY, NULL, NULL }; snprintf (nm_pid, sizeof (nm_pid), "%d", getppid ()); diff --git a/src/nm-device-adsl.c b/src/nm-device-adsl.c index e171b46e1..29d30cd01 100644 --- a/src/nm-device-adsl.c +++ b/src/nm-device-adsl.c @@ -101,7 +101,7 @@ enum { /**************************************************************/ static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { guint32 caps = NM_DEVICE_CAP_NM_SUPPORTED; caps |= NM_DEVICE_CAP_CARRIER_DETECT; @@ -109,7 +109,7 @@ real_get_generic_capabilities (NMDevice *dev) } static gboolean -real_can_interrupt_activation (NMDevice *dev) +can_interrupt_activation (NMDevice *dev) { NMDeviceAdsl *self = NM_DEVICE_ADSL (dev); gboolean interrupt = FALSE; @@ -124,7 +124,7 @@ real_can_interrupt_activation (NMDevice *dev) } static gboolean -real_is_available (NMDevice *dev) +is_available (NMDevice *dev) { NMDeviceAdsl *self = NM_DEVICE_ADSL (dev); @@ -136,9 +136,9 @@ real_is_available (NMDevice *dev) } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMSettingAdsl *s_adsl; const char *protocol; @@ -171,11 +171,11 @@ real_check_connection_compatible (NMDevice *device, } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMSettingAdsl *s_adsl; @@ -199,9 +199,9 @@ real_complete_connection (NMDevice *device, } static NMConnection * -real_get_best_auto_connection (NMDevice *dev, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) { GSList *iter; @@ -418,7 +418,7 @@ netlink_notification (NMNetlinkMonitor *monitor, } static NMActStageReturn -real_act_stage2_config (NMDevice *device, NMDeviceStateReason *out_reason) +act_stage2_config (NMDevice *device, NMDeviceStateReason *out_reason) { NMDeviceAdsl *self = NM_DEVICE_ADSL (device); NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self); @@ -505,9 +505,9 @@ ppp_ip4_config (NMPPPManager *ppp_manager, } static NMActStageReturn -real_act_stage3_ip4_config_start (NMDevice *device, - NMIP4Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip4_config_start (NMDevice *device, + NMIP4Config **out_config, + NMDeviceStateReason *reason) { NMDeviceAdsl *self = NM_DEVICE_ADSL (device); NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self); @@ -563,7 +563,7 @@ real_act_stage3_ip4_config_start (NMDevice *device, } static void -real_deactivate (NMDevice *device) +deactivate (NMDevice *device) { NMDeviceAdsl *self = NM_DEVICE_ADSL (device); NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self); @@ -810,17 +810,17 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass) object_class->get_property = get_property; object_class->set_property = set_property; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->can_interrupt_activation = real_can_interrupt_activation; - parent_class->is_available = real_is_available; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->can_interrupt_activation = can_interrupt_activation; + parent_class->is_available = is_available; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->get_best_auto_connection = real_get_best_auto_connection; - parent_class->complete_connection = real_complete_connection; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->complete_connection = complete_connection; - parent_class->act_stage2_config = real_act_stage2_config; - parent_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start; - parent_class->deactivate = real_deactivate; + parent_class->act_stage2_config = act_stage2_config; + parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + parent_class->deactivate = deactivate; /* properties */ g_object_class_install_property diff --git a/src/nm-device-bond.c b/src/nm-device-bond.c index 22f781457..30df94fa2 100644 --- a/src/nm-device-bond.c +++ b/src/nm-device-bond.c @@ -46,7 +46,8 @@ G_DEFINE_TYPE (NMDeviceBond, nm_device_bond, NM_TYPE_DEVICE_WIRED) #define NM_BOND_ERROR (nm_bond_error_quark ()) typedef struct { - GSList *slaves; + gboolean ip4_waiting; + gboolean ip6_waiting; } NMDeviceBondPrivate; enum { @@ -83,17 +84,23 @@ static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) + NMDeviceStateReason reason) { + NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device); + if (new_state == NM_DEVICE_STATE_UNAVAILABLE) { /* Use NM_DEVICE_STATE_REASON_CARRIER to make sure num retries is reset */ nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER); } + + if (new_state <= NM_DEVICE_STATE_DISCONNECTED || new_state > NM_DEVICE_STATE_ACTIVATED) { + priv->ip4_waiting = FALSE; + priv->ip6_waiting = FALSE; + } } static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { const guint8 *hw_addr; guint8 old_addr[NM_UTILS_HWADDR_LEN_MAX]; @@ -115,7 +122,7 @@ real_update_hw_address (NMDevice *dev) } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return NM_DEVICE_CAP_CARRIER_DETECT | NM_DEVICE_CAP_NM_SUPPORTED; } @@ -147,9 +154,9 @@ match_bond_connection (NMDevice *device, NMConnection *connection, GError **erro } static NMConnection * -real_get_best_auto_connection (NMDevice *dev, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) { GSList *iter; @@ -167,19 +174,19 @@ real_get_best_auto_connection (NMDevice *dev, } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { return match_bond_connection (device, connection, error); } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMSettingBond *s_bond, *tmp; guint32 i = 0; @@ -295,7 +302,7 @@ connection_match_config (NMDevice *self, const GSList *connections) /******************************************************************/ static NMActStageReturn -real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) { NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; NMConnection *connection; @@ -304,6 +311,9 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); + NM_DEVICE_BOND_GET_PRIVATE (dev)->ip4_waiting = FALSE; + NM_DEVICE_BOND_GET_PRIVATE (dev)->ip6_waiting = FALSE; + ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage1_prepare (dev, reason); if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { connection = nm_device_get_connection (dev); @@ -322,120 +332,145 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) return ret; } -static void -slave_state_changed (NMDevice *slave, - NMDeviceState new_state, - NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) +static gboolean +enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection) { - NMDeviceBond *self = NM_DEVICE_BOND (user_data); - - nm_log_dbg (LOGD_DEVICE, "(%s): slave %s state change %d -> %d", - nm_device_get_iface (NM_DEVICE (self)), - nm_device_get_iface (slave), - old_state, - new_state); - - if ( old_state > NM_DEVICE_STATE_DISCONNECTED - && new_state <= NM_DEVICE_STATE_DISCONNECTED) { - /* Slave is no longer available or managed; can't use it */ - nm_device_release_slave (NM_DEVICE (self), slave); - } -} + NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device); + gboolean success, no_firmware = FALSE; + const char *iface = nm_device_get_ip_iface (device); + const char *slave_iface = nm_device_get_ip_iface (slave); -typedef struct { - NMDevice *slave; - guint state_id; -} SlaveInfo; + nm_device_hw_take_down (slave, TRUE); -static SlaveInfo * -find_slave_info_by_device (NMDeviceBond *self, NMDevice *slave) -{ - NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (self); - GSList *iter; + success = nm_system_bond_enslave (nm_device_get_ip_ifindex (device), + iface, + nm_device_get_ip_ifindex (slave), + slave_iface); + + nm_device_hw_bring_up (slave, TRUE, &no_firmware); + + if (success) { + nm_log_info (LOGD_BOND, "(%s): enslaved bond slave %s", iface, slave_iface); + g_object_notify (G_OBJECT (device), "slaves"); - for (iter = priv->slaves; iter; iter = g_slist_next (iter)) { - if (((SlaveInfo *) iter->data)->slave == slave) - return iter->data; + /* If waiting for a slave to continue with IP config, start now */ + if (priv->ip4_waiting) { + nm_log_info (LOGD_BOND | LOGD_IP4, "(%s): retrying IPv4 config with first slave", iface); + priv->ip4_waiting = FALSE; + nm_device_activate_stage3_ip4_start (device); + } + + if (priv->ip6_waiting) { + nm_log_info (LOGD_BOND | LOGD_IP6, "(%s): retrying IPv6 config with first slave", iface); + priv->ip6_waiting = FALSE; + nm_device_activate_stage3_ip6_start (device); + } } - return NULL; + + return success; } -static void -free_slave_info (SlaveInfo *sinfo) +static gboolean +release_slave (NMDevice *device, NMDevice *slave) { - g_return_if_fail (sinfo != NULL); - g_return_if_fail (sinfo->slave != NULL); + gboolean success; - g_signal_handler_disconnect (sinfo->slave, sinfo->state_id); - g_object_unref (sinfo->slave); - memset (sinfo, 0, sizeof (*sinfo)); - g_free (sinfo); + success = nm_system_bond_release (nm_device_get_ip_ifindex (device), + nm_device_get_ip_iface (device), + nm_device_get_ip_ifindex (slave), + nm_device_get_ip_iface (slave)); + nm_log_info (LOGD_BOND, "(%s): released bond slave %s (success %d)", + nm_device_get_ip_iface (device), + nm_device_get_ip_iface (slave), + success); + g_object_notify (G_OBJECT (device), "slaves"); + return success; } -static gboolean -enslave_slave (NMDevice *device, NMDevice *slave) +static NMActStageReturn +act_stage3_ip4_config_start (NMDevice *device, + NMIP4Config **out_config, + NMDeviceStateReason *reason) { - NMDeviceBond *self = NM_DEVICE_BOND (device); - NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (self); - gboolean success, no_firmware = FALSE; + NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device); + NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; + NMConnection *connection; + NMSettingIP4Config *s_ip4; + const char *method = NULL; + GSList *slaves; - if (find_slave_info_by_device (self, slave)) - return TRUE; + priv->ip4_waiting = FALSE; - nm_device_hw_take_down (slave, TRUE); + slaves = nm_device_master_get_slaves (device); + if (slaves == NULL) { + connection = nm_device_get_connection (device); + g_assert (connection); - success = nm_system_iface_enslave (nm_device_get_ip_ifindex (device), - nm_device_get_ip_iface (device), - nm_device_get_ip_ifindex (slave), - nm_device_get_ip_iface (slave)); - if (success) { - SlaveInfo *sinfo; - - sinfo = g_malloc0 (sizeof (*slave)); - sinfo->slave = g_object_ref (slave); - sinfo->state_id = g_signal_connect (slave, - "state-changed", - (GCallback) slave_state_changed, - self); - priv->slaves = g_slist_append (priv->slaves, sinfo); - - nm_log_dbg (LOGD_DEVICE, "(%s): enslaved bond slave %s", - nm_device_get_ip_iface (device), - nm_device_get_ip_iface (slave)); - g_object_notify (G_OBJECT (device), "slaves"); - } + s_ip4 = nm_connection_get_setting_ip4_config (connection); + if (s_ip4) + method = nm_setting_ip4_config_get_method (s_ip4); - nm_device_hw_bring_up (slave, TRUE, &no_firmware); + if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) + priv->ip4_waiting = TRUE; + } + g_slist_free (slaves); + + if (priv->ip4_waiting) { + ret = NM_ACT_STAGE_RETURN_WAIT; + nm_log_info (LOGD_BOND | LOGD_IP4, "(%s): IPv4 config waiting until slaves are present", + nm_device_get_ip_iface (device)); + } else { + /* We have slaves; proceed with normal IPv4 configuration */ + ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage3_ip4_config_start (device, out_config, reason); + } - return success; + return ret; } -static gboolean -release_slave (NMDevice *device, NMDevice *slave) +static NMActStageReturn +act_stage3_ip6_config_start (NMDevice *device, + NMIP6Config **out_config, + NMDeviceStateReason *reason) { - NMDeviceBond *self = NM_DEVICE_BOND (device); - NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (self); - gboolean success; - SlaveInfo *sinfo; + NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device); + NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; + NMConnection *connection; + NMSettingIP6Config *s_ip6; + const char *method = NULL; + GSList *slaves; - sinfo = find_slave_info_by_device (self, slave); - if (!sinfo) - return FALSE; + priv->ip6_waiting = FALSE; - success = nm_system_iface_release (nm_device_get_ip_ifindex (device), - nm_device_get_ip_iface (device), - nm_device_get_ip_ifindex (slave), - nm_device_get_ip_iface (slave)); - nm_log_dbg (LOGD_DEVICE, "(%s): released bond slave %s (success %d)", - nm_device_get_ip_iface (device), - nm_device_get_ip_iface (slave), - success); - priv->slaves = g_slist_remove (priv->slaves, sinfo); - free_slave_info (sinfo); - g_object_notify (G_OBJECT (device), "slaves"); - return success; + slaves = nm_device_master_get_slaves (device); + if (slaves == NULL) { + connection = nm_device_get_connection (device); + g_assert (connection); + + s_ip6 = nm_connection_get_setting_ip6_config (connection); + if (s_ip6) + method = nm_setting_ip6_config_get_method (s_ip6); + + /* SLAAC, DHCP, and Link-Local depend on connectivity (and thus slaves) + * to complete addressing. SLAAC and DHCP obviously need a peer to + * provide a prefix, while Link-Local must perform DAD on the local link. + */ + if ( !g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) + || !g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) + || !g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) + priv->ip6_waiting = TRUE; + } + g_slist_free (slaves); + + if (priv->ip6_waiting) { + ret = NM_ACT_STAGE_RETURN_WAIT; + nm_log_info (LOGD_BOND | LOGD_IP6, "(%s): IPv6 config waiting until slaves are present", + nm_device_get_ip_iface (device)); + } else { + /* We have slaves; proceed with normal IPv6 configuration */ + ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage3_ip6_config_start (device, out_config, reason); + } + + return ret; } /******************************************************************/ @@ -460,7 +495,7 @@ constructed (GObject *object) { G_OBJECT_CLASS (nm_device_bond_parent_class)->constructed (object); - nm_log_dbg (LOGD_HW | LOGD_DEVICE, "(%s): kernel ifindex %d", + nm_log_dbg (LOGD_HW | LOGD_BOND, "(%s): kernel ifindex %d", nm_device_get_iface (NM_DEVICE (object)), nm_device_get_ifindex (NM_DEVICE (object))); } @@ -468,19 +503,15 @@ constructed (GObject *object) static void nm_device_bond_init (NMDeviceBond * self) { - g_signal_connect (self, "state-changed", G_CALLBACK (device_state_changed), NULL); } static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - NMDeviceBond *self = NM_DEVICE_BOND (object); - NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (self); const guint8 *current_addr; GPtrArray *slaves; - GSList *iter; - SlaveInfo *info; + GSList *list, *iter; switch (prop_id) { case PROP_HW_ADDRESS: @@ -492,10 +523,10 @@ get_property (GObject *object, guint prop_id, break; case PROP_SLAVES: slaves = g_ptr_array_new (); - for (iter = priv->slaves; iter; iter = iter->next) { - info = iter->data; - g_ptr_array_add (slaves, g_strdup (nm_device_get_path (info->slave))); - } + list = nm_device_master_get_slaves (NM_DEVICE (object)); + for (iter = list; iter; iter = iter->next) + g_ptr_array_add (slaves, g_strdup (nm_device_get_path (NM_DEVICE (iter->data)))); + g_slist_free (list); g_value_take_boxed (value, slaves); break; default: @@ -516,21 +547,6 @@ set_property (GObject *object, guint prop_id, } static void -dispose (GObject *object) -{ - NMDeviceBond *self = NM_DEVICE_BOND (object); - NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (self); - GSList *iter; - - for (iter = priv->slaves; iter; iter = g_slist_next (iter)) - release_slave (NM_DEVICE (self), ((SlaveInfo *) iter->data)->slave); - g_slist_free (priv->slaves); - priv->slaves = NULL; - - G_OBJECT_CLASS (nm_device_bond_parent_class)->dispose (object); -} - -static void nm_device_bond_class_init (NMDeviceBondClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -542,21 +558,24 @@ nm_device_bond_class_init (NMDeviceBondClass *klass) object_class->constructed = constructed; object_class->get_property = get_property; object_class->set_property = set_property; - object_class->dispose = dispose; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->update_hw_address = real_update_hw_address; - parent_class->get_best_auto_connection = real_get_best_auto_connection; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->complete_connection = real_complete_connection; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->update_hw_address = update_hw_address; + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->complete_connection = complete_connection; parent_class->spec_match_list = spec_match_list; parent_class->connection_match_config = connection_match_config; - parent_class->act_stage1_prepare = real_act_stage1_prepare; + parent_class->act_stage1_prepare = act_stage1_prepare; + parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + parent_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start; parent_class->enslave_slave = enslave_slave; parent_class->release_slave = release_slave; + parent_class->state_changed = device_state_changed; + /* properties */ g_object_class_install_property (object_class, PROP_HW_ADDRESS, diff --git a/src/nm-device-bridge.c b/src/nm-device-bridge.c new file mode 100644 index 000000000..6f3d70e4b --- /dev/null +++ b/src/nm-device-bridge.c @@ -0,0 +1,683 @@ +/* -*- 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 2011 - 2012 Red Hat, Inc. + */ + +#include "config.h" + +#include <glib.h> +#include <glib/gi18n.h> + +#include <netinet/ether.h> + +#include "nm-device-bridge.h" +#include "nm-logging.h" +#include "nm-properties-changed-signal.h" +#include "nm-utils.h" +#include "NetworkManagerUtils.h" +#include "nm-device-private.h" +#include "nm-netlink-monitor.h" +#include "nm-dbus-glib-types.h" +#include "nm-enum-types.h" +#include "nm-system.h" + +#include "nm-device-bridge-glue.h" + + +G_DEFINE_TYPE (NMDeviceBridge, nm_device_bridge, NM_TYPE_DEVICE_WIRED) + +#define NM_DEVICE_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgePrivate)) + +#define NM_BRIDGE_ERROR (nm_bridge_error_quark ()) + +typedef struct { + gboolean ip4_waiting; + gboolean ip6_waiting; +} NMDeviceBridgePrivate; + +enum { + PROPERTIES_CHANGED, + + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +enum { + PROP_0, + PROP_HW_ADDRESS, + PROP_CARRIER, + PROP_SLAVES, + + LAST_PROP +}; + +/******************************************************************/ + +static GQuark +nm_bridge_error_quark (void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_static_string ("nm-bridge-error"); + return quark; +} + +/******************************************************************/ + +static void +device_state_changed (NMDevice *device, + NMDeviceState new_state, + NMDeviceState old_state, + NMDeviceStateReason reason) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device); + + if (new_state == NM_DEVICE_STATE_UNAVAILABLE) { + /* Use NM_DEVICE_STATE_REASON_CARRIER to make sure num retries is reset */ + nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER); + } + + if (new_state <= NM_DEVICE_STATE_DISCONNECTED || new_state > NM_DEVICE_STATE_ACTIVATED) { + priv->ip4_waiting = FALSE; + priv->ip6_waiting = FALSE; + } +} + +static void +update_hw_address (NMDevice *dev) +{ + const guint8 *hw_addr; + guint8 old_addr[NM_UTILS_HWADDR_LEN_MAX]; + int addrtype, addrlen; + + addrtype = nm_device_wired_get_hwaddr_type (NM_DEVICE_WIRED (dev)); + g_assert (addrtype >= 0); + addrlen = nm_utils_hwaddr_len (addrtype); + g_assert (addrlen > 0); + + hw_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (dev)); + memcpy (old_addr, hw_addr, addrlen); + + NM_DEVICE_CLASS (nm_device_bridge_parent_class)->update_hw_address (dev); + + hw_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (dev)); + if (memcmp (old_addr, hw_addr, addrlen)) + g_object_notify (G_OBJECT (dev), NM_DEVICE_BRIDGE_HW_ADDRESS); +} + +static guint32 +get_generic_capabilities (NMDevice *dev) +{ + return NM_DEVICE_CAP_CARRIER_DETECT | NM_DEVICE_CAP_NM_SUPPORTED; +} + +static gboolean +is_available (NMDevice *dev) +{ + if (NM_DEVICE_GET_CLASS (dev)->hw_is_up) + return NM_DEVICE_GET_CLASS (dev)->hw_is_up (dev); + return FALSE; +} + +static gboolean +match_bridge_connection (NMDevice *device, NMConnection *connection, GError **error) +{ + const char *iface; + NMSettingBridge *s_bridge; + + s_bridge = nm_connection_get_setting_bridge (connection); + if (!s_bridge || !nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) { + g_set_error (error, NM_BRIDGE_ERROR, NM_BRIDGE_ERROR_CONNECTION_NOT_BRIDGE, + "The connection was not a bridge connection."); + return FALSE; + } + + /* Bridge connections must specify the virtual interface name */ + iface = nm_connection_get_virtual_iface_name (connection); + if (!iface || strcmp (nm_device_get_iface (device), iface)) { + g_set_error (error, NM_BRIDGE_ERROR, NM_BRIDGE_ERROR_CONNECTION_INVALID, + "The bridge connection virtual interface name did not match."); + return FALSE; + } + + return TRUE; +} + +static NMConnection * +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) +{ + GSList *iter; + + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMConnection *connection = NM_CONNECTION (iter->data); + NMSettingConnection *s_con; + + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + if ( nm_setting_connection_get_autoconnect (s_con) + && match_bridge_connection (dev, connection, NULL)) + return connection; + } + return NULL; +} + +static gboolean +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) +{ + return match_bridge_connection (device, connection, error); +} + +static gboolean +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) +{ + NMSettingBridge *s_bridge, *tmp; + guint32 i = 0; + char *name; + const GSList *iter; + gboolean found; + + nm_utils_complete_generic (connection, + NM_SETTING_BRIDGE_SETTING_NAME, + existing_connections, + _("Bridge connection %d"), + NULL, + TRUE); + + s_bridge = nm_connection_get_setting_bridge (connection); + if (!s_bridge) { + s_bridge = (NMSettingBridge *) nm_setting_bridge_new (); + nm_connection_add_setting (connection, NM_SETTING (s_bridge)); + } + + /* Grab the first name that doesn't exist in either our connections + * or a device on the system. + */ + while (i < 500 && !nm_setting_bridge_get_interface_name (s_bridge)) { + name = g_strdup_printf ("br%u", i); + /* check interface names */ + if (nm_netlink_iface_to_index (name) < 0) { + /* check existing bridge connections */ + for (iter = existing_connections, found = FALSE; iter; iter = g_slist_next (iter)) { + NMConnection *candidate = iter->data; + + tmp = nm_connection_get_setting_bridge (candidate); + if (tmp && nm_connection_is_type (candidate, NM_SETTING_BRIDGE_SETTING_NAME)) { + if (g_strcmp0 (nm_setting_bridge_get_interface_name (tmp), name) == 0) { + found = TRUE; + break; + } + } + } + + if (!found) + g_object_set (G_OBJECT (s_bridge), NM_SETTING_BRIDGE_INTERFACE_NAME, name, NULL); + } + + g_free (name); + i++; + } + + return TRUE; +} + +static gboolean +spec_match_list (NMDevice *device, const GSList *specs) +{ + char *hwaddr; + gboolean matched; + + hwaddr = nm_utils_hwaddr_ntoa (nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (device)), ARPHRD_ETHER); + matched = nm_match_spec_hwaddr (specs, hwaddr); + g_free (hwaddr); + + return matched; +} + +static gboolean +bridge_match_config (NMDevice *self, NMConnection *connection) +{ + NMSettingBridge *s_bridge; + const char *ifname; + + s_bridge = nm_connection_get_setting_bridge (connection); + if (!s_bridge) + return FALSE; + + /* Interface name */ + ifname = nm_setting_bridge_get_interface_name (s_bridge); + if (g_strcmp0 (ifname, nm_device_get_ip_iface (self)) != 0) + return FALSE; + + return TRUE; +} + +static NMConnection * +connection_match_config (NMDevice *self, const GSList *connections) +{ + const GSList *iter; + GSList *bridge_matches; + NMConnection *match; + + /* First narrow @connections down to those that match in their + * NMSettingBridge configuration. + */ + bridge_matches = NULL; + for (iter = connections; iter; iter = iter->next) { + NMConnection *candidate = NM_CONNECTION (iter->data); + + if (!nm_connection_is_type (candidate, NM_SETTING_BRIDGE_SETTING_NAME)) + continue; + if (!bridge_match_config (self, candidate)) + continue; + + bridge_matches = g_slist_prepend (bridge_matches, candidate); + } + + /* Now pass those to the super method, which will check IP config */ + bridge_matches = g_slist_reverse (bridge_matches); + match = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->connection_match_config (self, bridge_matches); + g_slist_free (bridge_matches); + + return match; +} + +/******************************************************************/ + +static void +set_sysfs_uint (const char *iface, + GObject *obj, + const char *obj_prop, + const char *sysfs_prop, + gboolean default_if_zero, + gboolean user_hz_compensate) +{ + char *path, *s; + GParamSpec *pspec; + GValue val = { 0 }; + guint32 uval = 0; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), obj_prop); + g_return_if_fail (pspec != NULL); + + /* Get the property's value */ + g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec)); + g_object_get_property (obj, obj_prop, &val); + if (G_VALUE_HOLDS_BOOLEAN (&val)) + uval = g_value_get_boolean (&val) ? 1 : 0; + else if (G_VALUE_HOLDS_UINT (&val)) { + uval = g_value_get_uint (&val); + + /* zero means "unspecified" for some NM properties but isn't in the + * allowed kernel range, so reset the property to the default value. + */ + if (default_if_zero && uval == 0) { + g_value_unset (&val); + g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec)); + g_param_value_set_default (pspec, &val); + uval = g_value_get_uint (&val); + } + } else + g_assert_not_reached (); + + g_value_unset (&val); + + /* Linux kernel bridge interfaces use 'centiseconds' for time-based values. + * In reality it's not centiseconds, but depends on HZ and USER_HZ, which + * is almost always works out to be a multiplier of 100, so we can assume + * centiseconds. See clock_t_to_jiffies(). + */ + if (user_hz_compensate) + uval *= 100; + + path = g_strdup_printf ("/sys/class/net/%s/bridge/%s", iface, sysfs_prop); + s = g_strdup_printf ("%u", uval); + /* FIXME: how should failure be handled? */ + nm_utils_do_sysctl (path, s); + g_free (path); + g_free (s); +} + +static NMActStageReturn +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +{ + NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; + NMConnection *connection; + NMSettingBridge *s_bridge; + const char *iface; + + g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); + + NM_DEVICE_BRIDGE_GET_PRIVATE (dev)->ip4_waiting = FALSE; + NM_DEVICE_BRIDGE_GET_PRIVATE (dev)->ip6_waiting = FALSE; + + ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage1_prepare (dev, reason); + if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { + connection = nm_device_get_connection (dev); + g_assert (connection); + + s_bridge = nm_connection_get_setting_bridge (connection); + g_assert (s_bridge); + + iface = nm_device_get_ip_iface (dev); + g_assert (iface); + + set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_STP, "stp_state", FALSE, FALSE); + set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_PRIORITY, "priority", TRUE, FALSE); + set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY, "forward_delay", TRUE, TRUE); + set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_HELLO_TIME, "hello_time", TRUE, TRUE); + set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_MAX_AGE, "max_age", TRUE, TRUE); + set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_AGEING_TIME, "ageing_time", TRUE, TRUE); + } + return ret; +} + +static gboolean +enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device); + gboolean success; + NMSettingBridgePort *s_port; + const char *iface = nm_device_get_ip_iface (device); + const char *slave_iface = nm_device_get_ip_iface (slave); + + success = nm_system_bridge_attach (nm_device_get_ip_ifindex (device), + iface, + nm_device_get_ip_ifindex (slave), + slave_iface); + if (!success) + return FALSE; + + /* Set port properties */ + s_port = nm_connection_get_setting_bridge_port (connection); + if (s_port) { + set_sysfs_uint (slave_iface, G_OBJECT (s_port), NM_SETTING_BRIDGE_PORT_PRIORITY, "priority", TRUE, FALSE); + set_sysfs_uint (slave_iface, G_OBJECT (s_port), NM_SETTING_BRIDGE_PORT_PATH_COST, "path_cost", TRUE, FALSE); + set_sysfs_uint (slave_iface, G_OBJECT (s_port), NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, "hairpin_mode", FALSE, FALSE); + } + + nm_log_info (LOGD_DEVICE, "(%s): attached bridge port %s", iface, slave_iface); + + g_object_notify (G_OBJECT (device), NM_DEVICE_BRIDGE_SLAVES); + + /* If waiting for a slave to continue with IP config, start now */ + if (priv->ip4_waiting) { + nm_log_info (LOGD_DEVICE | LOGD_IP4, "(%s): retrying IPv4 config with first slave", iface); + priv->ip4_waiting = FALSE; + nm_device_activate_stage3_ip4_start (device); + } + + if (priv->ip6_waiting) { + nm_log_info (LOGD_DEVICE | LOGD_IP6, "(%s): retrying IPv6 config with first slave", iface); + priv->ip6_waiting = FALSE; + nm_device_activate_stage3_ip6_start (device); + } + + return TRUE; +} + +static gboolean +release_slave (NMDevice *device, NMDevice *slave) +{ + gboolean success; + + success = nm_system_bridge_detach (nm_device_get_ip_ifindex (device), + nm_device_get_ip_iface (device), + nm_device_get_ip_ifindex (slave), + nm_device_get_ip_iface (slave)); + nm_log_info (LOGD_DEVICE, "(%s): detached bridge port %s (success %d)", + nm_device_get_ip_iface (device), + nm_device_get_ip_iface (slave), + success); + g_object_notify (G_OBJECT (device), NM_DEVICE_BRIDGE_SLAVES); + return success; +} + +static NMActStageReturn +act_stage3_ip4_config_start (NMDevice *device, + NMIP4Config **out_config, + NMDeviceStateReason *reason) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device); + NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; + NMConnection *connection; + NMSettingIP4Config *s_ip4; + const char *method = NULL; + GSList *slaves; + + priv->ip4_waiting = FALSE; + + slaves = nm_device_master_get_slaves (device); + if (slaves == NULL) { + connection = nm_device_get_connection (device); + g_assert (connection); + + s_ip4 = nm_connection_get_setting_ip4_config (connection); + if (s_ip4) + method = nm_setting_ip4_config_get_method (s_ip4); + + if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) + priv->ip4_waiting = TRUE; + } + g_slist_free (slaves); + + if (priv->ip4_waiting) { + ret = NM_ACT_STAGE_RETURN_WAIT; + nm_log_info (LOGD_DEVICE | LOGD_IP4, "(%s): IPv4 config waiting until slaves are present", + nm_device_get_ip_iface (device)); + } else { + /* We have slaves; proceed with normal IPv4 configuration */ + ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage3_ip4_config_start (device, out_config, reason); + } + + return ret; +} + +static NMActStageReturn +act_stage3_ip6_config_start (NMDevice *device, + NMIP6Config **out_config, + NMDeviceStateReason *reason) +{ + NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device); + NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; + NMConnection *connection; + NMSettingIP6Config *s_ip6; + const char *method = NULL; + GSList *slaves; + + priv->ip6_waiting = FALSE; + + slaves = nm_device_master_get_slaves (device); + if (slaves == NULL) { + connection = nm_device_get_connection (device); + g_assert (connection); + + s_ip6 = nm_connection_get_setting_ip6_config (connection); + if (s_ip6) + method = nm_setting_ip6_config_get_method (s_ip6); + + /* SLAAC, DHCP, and Link-Local depend on connectivity (and thus slaves) + * to complete addressing. SLAAC and DHCP obviously need a peer to + * provide a prefix, while Link-Local must perform DAD on the local link. + */ + if ( !g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) + || !g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) + || !g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) + priv->ip6_waiting = TRUE; + } + g_slist_free (slaves); + + if (priv->ip6_waiting) { + ret = NM_ACT_STAGE_RETURN_WAIT; + nm_log_info (LOGD_DEVICE | LOGD_IP6, "(%s): IPv6 config waiting until slaves are present", + nm_device_get_ip_iface (device)); + } else { + /* We have slaves; proceed with normal IPv6 configuration */ + ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage3_ip6_config_start (device, out_config, reason); + } + + return ret; +} + +/******************************************************************/ + +NMDevice * +nm_device_bridge_new (const char *udi, const char *iface) +{ + g_return_val_if_fail (udi != NULL, NULL); + g_return_val_if_fail (iface != NULL, NULL); + + return (NMDevice *) g_object_new (NM_TYPE_DEVICE_BRIDGE, + NM_DEVICE_UDI, udi, + NM_DEVICE_IFACE, iface, + NM_DEVICE_DRIVER, "bridge", + NM_DEVICE_TYPE_DESC, "Bridge", + NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BRIDGE, + NULL); +} + +static void +constructed (GObject *object) +{ + G_OBJECT_CLASS (nm_device_bridge_parent_class)->constructed (object); + + nm_log_dbg (LOGD_HW | LOGD_DEVICE, "(%s): kernel ifindex %d", + nm_device_get_iface (NM_DEVICE (object)), + nm_device_get_ifindex (NM_DEVICE (object))); +} + +static void +nm_device_bridge_init (NMDeviceBridge * self) +{ +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + const guint8 *current_addr; + GPtrArray *slaves; + GSList *list, *iter; + + switch (prop_id) { + case PROP_HW_ADDRESS: + current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (object)); + g_value_take_string (value, nm_utils_hwaddr_ntoa (current_addr, ARPHRD_ETHER)); + break; + case PROP_CARRIER: + g_value_set_boolean (value, nm_device_wired_get_carrier (NM_DEVICE_WIRED (object))); + break; + case PROP_SLAVES: + slaves = g_ptr_array_new (); + list = nm_device_master_get_slaves (NM_DEVICE (object)); + for (iter = list; iter; iter = iter->next) + g_ptr_array_add (slaves, g_strdup (nm_device_get_path (NM_DEVICE (iter->data)))); + g_slist_free (list); + g_value_take_boxed (value, slaves); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_device_bridge_class_init (NMDeviceBridgeClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (NMDeviceBridgePrivate)); + + /* virtual methods */ + object_class->constructed = constructed; + object_class->get_property = get_property; + object_class->set_property = set_property; + + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->update_hw_address = update_hw_address; + parent_class->is_available = is_available; + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->complete_connection = complete_connection; + + parent_class->spec_match_list = spec_match_list; + parent_class->connection_match_config = connection_match_config; + + parent_class->act_stage1_prepare = act_stage1_prepare; + parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + parent_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start; + parent_class->enslave_slave = enslave_slave; + parent_class->release_slave = release_slave; + + parent_class->state_changed = device_state_changed; + + /* properties */ + g_object_class_install_property + (object_class, PROP_HW_ADDRESS, + g_param_spec_string (NM_DEVICE_BRIDGE_HW_ADDRESS, + "Active MAC Address", + "Currently set hardware MAC address", + NULL, + G_PARAM_READABLE)); + + g_object_class_install_property + (object_class, PROP_CARRIER, + g_param_spec_boolean (NM_DEVICE_BRIDGE_CARRIER, + "Carrier", + "Carrier", + FALSE, + G_PARAM_READABLE)); + + g_object_class_install_property + (object_class, PROP_SLAVES, + g_param_spec_boxed (NM_DEVICE_BRIDGE_SLAVES, + "Slaves", + "Slaves", + DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, + G_PARAM_READABLE)); + + /* Signals */ + signals[PROPERTIES_CHANGED] = + nm_properties_changed_signal_new (object_class, + G_STRUCT_OFFSET (NMDeviceBridgeClass, properties_changed)); + + dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), + &dbus_glib_nm_device_bridge_object_info); + + dbus_g_error_domain_register (NM_BRIDGE_ERROR, NULL, NM_TYPE_BRIDGE_ERROR); +} diff --git a/src/nm-device-bridge.h b/src/nm-device-bridge.h new file mode 100644 index 000000000..bf0ed01e8 --- /dev/null +++ b/src/nm-device-bridge.h @@ -0,0 +1,66 @@ +/* -*- 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 2012 Red Hat, Inc. + */ + +#ifndef NM_DEVICE_BRIDGE_H +#define NM_DEVICE_BRIDGE_H + +#include <glib-object.h> + +#include "nm-device-wired.h" + +G_BEGIN_DECLS + +#define NM_TYPE_DEVICE_BRIDGE (nm_device_bridge_get_type ()) +#define NM_DEVICE_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridge)) +#define NM_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass)) +#define NM_IS_DEVICE_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_BRIDGE)) +#define NM_IS_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BRIDGE)) +#define NM_DEVICE_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass)) + +typedef enum { + NM_BRIDGE_ERROR_CONNECTION_NOT_BRIDGE = 0, /*< nick=ConnectionNotBridge >*/ + NM_BRIDGE_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ + NM_BRIDGE_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ +} NMBridgeError; + +#define NM_DEVICE_BRIDGE_HW_ADDRESS "hw-address" +#define NM_DEVICE_BRIDGE_CARRIER "carrier" +#define NM_DEVICE_BRIDGE_SLAVES "slaves" + +typedef struct { + NMDeviceWired parent; +} NMDeviceBridge; + +typedef struct { + NMDeviceWiredClass parent; + + /* Signals */ + void (*properties_changed) (NMDeviceBridge *device, GHashTable *properties); +} NMDeviceBridgeClass; + + +GType nm_device_bridge_get_type (void); + +NMDevice *nm_device_bridge_new (const char *udi, + const char *iface); + +G_END_DECLS + +#endif /* NM_DEVICE_BRIDGE_H */ diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c index f61aeb578..cadedcf7b 100644 --- a/src/nm-device-bt.c +++ b/src/nm-device-bt.c @@ -47,6 +47,8 @@ #include "nm-enum-types.h" #include "nm-utils.h" +#define MM_OLD_DBUS_SERVICE "org.freedesktop.ModemManager" +#define MM_NEW_DBUS_SERVICE "org.freedesktop.ModemManager1" #define BLUETOOTH_DUN_UUID "dun" #define BLUETOOTH_NAP_UUID "nap" @@ -57,6 +59,10 @@ G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE) static gboolean modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason); typedef struct { + NMDBusManager *dbus_mgr; + guint mm_watch_id; + gboolean mm_running; + char *bdaddr; char *name; guint32 capabilities; @@ -141,9 +147,9 @@ get_connection_bt_type (NMConnection *connection) } static NMConnection * -real_get_best_auto_connection (NMDevice *device, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *device, + GSList *connections, + char **specific_object) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); GSList *iter; @@ -166,15 +172,19 @@ real_get_best_auto_connection (NMDevice *device, if (!(bt_type & priv->capabilities)) continue; + /* Can't auto-activate a DUN connection without ModemManager */ + if (bt_type == NM_BT_CAPABILITY_DUN && priv->mm_running == FALSE) + continue; + return connection; } return NULL; } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); NMSettingConnection *s_con; @@ -228,11 +238,28 @@ real_check_connection_compatible (NMDevice *device, } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +check_connection_available (NMDevice *device, NMConnection *connection) +{ + NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); + guint32 bt_type; + + bt_type = get_connection_bt_type (connection); + if (!(bt_type & priv->capabilities)) + return FALSE; + + /* DUN connections aren't available without ModemManager */ + if (bt_type == NM_BT_CAPABILITY_DUN && priv->mm_running == FALSE) + return FALSE; + + return TRUE; +} + +static gboolean +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); NMSettingBluetooth *s_bt; @@ -369,7 +396,7 @@ real_complete_connection (NMDevice *device, } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return NM_DEVICE_CAP_NM_SUPPORTED; } @@ -517,8 +544,7 @@ static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) + NMDeviceStateReason reason) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); @@ -528,7 +554,6 @@ device_state_changed (NMDevice *device, static void modem_ip4_config_result (NMModem *self, - const char *iface, NMIP4Config *config, GError *error, gpointer user_data) @@ -545,12 +570,16 @@ modem_ip4_config_result (NMModem *self, error && error->message ? error->message : "(unknown)"); nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); - } else { - if (iface) - nm_device_set_ip_iface (device, iface); - + } else nm_device_activate_schedule_ip4_config_result (device, config); - } +} + +static void +data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data) +{ + NMDevice *self = NM_DEVICE (user_data); + + nm_device_set_ip_iface (self, nm_modem_get_data_port (modem)); } static gboolean @@ -586,7 +615,8 @@ nm_device_bt_modem_added (NMDeviceBt *self, const char *driver) { NMDeviceBtPrivate *priv; - const char *modem_iface; + const gchar *modem_data_port; + const gchar *modem_control_port; char *base; NMDeviceState state; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; @@ -597,14 +627,15 @@ nm_device_bt_modem_added (NMDeviceBt *self, g_return_val_if_fail (NM_IS_MODEM (modem), FALSE); priv = NM_DEVICE_BT_GET_PRIVATE (self); - modem_iface = nm_modem_get_iface (modem); - g_return_val_if_fail (modem_iface != NULL, FALSE); + modem_data_port = nm_modem_get_data_port (modem); + modem_control_port = nm_modem_get_control_port (modem); + g_return_val_if_fail (modem_data_port != NULL || modem_control_port != NULL, FALSE); if (!priv->rfcomm_iface) return FALSE; base = g_path_get_basename (priv->rfcomm_iface); - if (strcmp (base, modem_iface)) { + if (g_strcmp0 (base, modem_data_port) && g_strcmp0 (base, modem_control_port)) { g_free (base); return FALSE; } @@ -645,6 +676,13 @@ nm_device_bt_modem_added (NMDeviceBt *self, g_signal_connect (modem, NM_MODEM_AUTH_REQUESTED, G_CALLBACK (modem_auth_requested), self); g_signal_connect (modem, NM_MODEM_AUTH_RESULT, G_CALLBACK (modem_auth_result), self); + /* In the old ModemManager the data port is known from the very beginning; + * while in the new ModemManager the data port is set afterwards when the bearer gets + * created */ + if (modem_data_port) + nm_device_set_ip_iface (NM_DEVICE (self), modem_data_port); + g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self); + /* Kick off the modem connection */ if (!modem_stage1 (self, modem, &reason)) nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, reason); @@ -854,11 +892,10 @@ bt_connect_timeout (gpointer user_data) } static NMActStageReturn -real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); - NMDBusManager *dbus_mgr; - DBusGConnection *g_connection; + DBusGConnection *bus; gboolean dun = FALSE; NMConnection *connection; @@ -870,9 +907,10 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) return NM_ACT_STAGE_RETURN_FAILURE; } - dbus_mgr = nm_dbus_manager_get (); - g_connection = nm_dbus_manager_get_connection (dbus_mgr); - g_object_unref (dbus_mgr); + if (priv->bt_type == NM_BT_CAPABILITY_DUN && !priv->mm_running) { + *reason = NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE; + return NM_ACT_STAGE_RETURN_FAILURE; + } if (priv->bt_type == NM_BT_CAPABILITY_DUN) dun = TRUE; @@ -881,10 +919,11 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) else g_assert_not_reached (); - priv->dev_proxy = dbus_g_proxy_new_for_name (g_connection, - BLUEZ_SERVICE, - nm_device_get_udi (device), - BLUEZ_DEVICE_INTERFACE); + bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + priv->dev_proxy = dbus_g_proxy_new_for_name (bus, + BLUEZ_SERVICE, + nm_device_get_udi (device), + BLUEZ_DEVICE_INTERFACE); if (!priv->dev_proxy) { // FIXME: set a reason code return NM_ACT_STAGE_RETURN_FAILURE; @@ -900,7 +939,7 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) dbus_g_proxy_connect_signal (priv->dev_proxy, "PropertyChanged", G_CALLBACK (bluez_property_changed), device, NULL); - priv->type_proxy = dbus_g_proxy_new_for_name (g_connection, + priv->type_proxy = dbus_g_proxy_new_for_name (bus, BLUEZ_SERVICE, nm_device_get_udi (device), dun ? BLUEZ_SERIAL_INTERFACE : BLUEZ_NETWORK_INTERFACE); @@ -929,9 +968,9 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) } static NMActStageReturn -real_act_stage3_ip4_config_start (NMDevice *device, - NMIP4Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip4_config_start (NMDevice *device, + NMIP4Config **out_config, + NMDeviceStateReason *reason) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); NMActStageReturn ret; @@ -948,9 +987,9 @@ real_act_stage3_ip4_config_start (NMDevice *device, } static NMActStageReturn -real_act_stage3_ip6_config_start (NMDevice *device, - NMIP6Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip6_config_start (NMDevice *device, + NMIP6Config **out_config, + NMDeviceStateReason *reason) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); NMActStageReturn ret; @@ -967,7 +1006,7 @@ real_act_stage3_ip6_config_start (NMDevice *device, } static void -real_deactivate (NMDevice *device) +deactivate (NMDevice *device) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); @@ -1032,6 +1071,109 @@ real_deactivate (NMDevice *device) /*****************************************************************************/ +static gboolean +is_available (NMDevice *dev) +{ + NMDeviceBt *self = NM_DEVICE_BT (dev); + NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self); + + /* PAN doesn't need ModemManager, so devices that support it are always available */ + if (priv->capabilities & NM_BT_CAPABILITY_NAP) + return TRUE; + + /* DUN requires ModemManager */ + return priv->mm_running; +} + +static void +handle_availability_change (NMDeviceBt *self, + gboolean old_available, + NMDeviceStateReason unavailable_reason) +{ + NMDevice *device = NM_DEVICE (self); + NMDeviceState state; + gboolean available; + + state = nm_device_get_state (device); + if (state < NM_DEVICE_STATE_UNAVAILABLE) { + nm_log_dbg (LOGD_BT, "(%s): availability blocked by UNMANAGED state", + nm_device_get_iface (device)); + return; + } + + available = nm_device_is_available (device); + if (available == old_available) + return; + + if (available) { + if (state != NM_DEVICE_STATE_UNAVAILABLE) + nm_log_warn (LOGD_CORE | LOGD_BT, "not in expected unavailable state!"); + + nm_device_state_changed (device, + NM_DEVICE_STATE_DISCONNECTED, + NM_DEVICE_STATE_REASON_NONE); + } else { + nm_device_state_changed (device, + NM_DEVICE_STATE_UNAVAILABLE, + unavailable_reason); + } +} + +static void +set_mm_running (NMDeviceBt *self, gboolean running) +{ + NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self); + gboolean old_available; + + if (priv->mm_running == running) + return; + + nm_log_dbg (LOGD_BT, "(%s): ModemManager now %s", + nm_device_get_iface (NM_DEVICE (self)), + running ? "available" : "unavailable"); + + old_available = nm_device_is_available (NM_DEVICE (self)); + priv->mm_running = running; + handle_availability_change (self, old_available, NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE); + + /* Need to recheck available connections whenever MM appears or disappears, + * since the device could be both DUN and NAP capable and thus may not + * change state (which rechecks available connections) when MM comes and goes. + */ + if (priv->capabilities & NM_BT_CAPABILITY_DUN) + nm_device_recheck_available_connections (NM_DEVICE (self)); +} + +static void +mm_name_owner_changed (NMDBusManager *dbus_mgr, + const char *name, + const char *old_owner, + const char *new_owner, + NMDeviceBt *self) +{ + gboolean old_owner_good; + gboolean new_owner_good; + + /* Can't handle the signal if its not from the modem service */ + if (strcmp (MM_OLD_DBUS_SERVICE, name) != 0) + return; + +#if WITH_MODEM_MANAGER_1 + if (strcmp (MM_NEW_DBUS_SERVICE, name) != 0) + return; +#endif + + old_owner_good = (old_owner && strlen (old_owner)); + new_owner_good = (new_owner && strlen (new_owner)); + + if (!old_owner_good && new_owner_good) + set_mm_running (self, TRUE); + else if (old_owner_good && !new_owner_good) + set_mm_running (self, FALSE); +} + +/*****************************************************************************/ + NMDevice * nm_device_bt_new (const char *udi, const char *bdaddr, @@ -1039,33 +1181,44 @@ nm_device_bt_new (const char *udi, guint32 capabilities, gboolean managed) { - NMDevice *device; - g_return_val_if_fail (udi != NULL, NULL); g_return_val_if_fail (bdaddr != NULL, NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (capabilities != NM_BT_CAPABILITY_NONE, NULL); - device = (NMDevice *) g_object_new (NM_TYPE_DEVICE_BT, - NM_DEVICE_UDI, udi, - NM_DEVICE_IFACE, bdaddr, - NM_DEVICE_DRIVER, "bluez", - NM_DEVICE_BT_HW_ADDRESS, bdaddr, - NM_DEVICE_BT_NAME, name, - NM_DEVICE_BT_CAPABILITIES, capabilities, - NM_DEVICE_MANAGED, managed, - NM_DEVICE_TYPE_DESC, "Bluetooth", - NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BT, - NULL); - if (device) - g_signal_connect (device, "state-changed", G_CALLBACK (device_state_changed), device); - - return device; + return (NMDevice *) g_object_new (NM_TYPE_DEVICE_BT, + NM_DEVICE_UDI, udi, + NM_DEVICE_IFACE, bdaddr, + NM_DEVICE_DRIVER, "bluez", + NM_DEVICE_BT_HW_ADDRESS, bdaddr, + NM_DEVICE_BT_NAME, name, + NM_DEVICE_BT_CAPABILITIES, capabilities, + NM_DEVICE_MANAGED, managed, + NM_DEVICE_TYPE_DESC, "Bluetooth", + NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BT, + NULL); } static void nm_device_bt_init (NMDeviceBt *self) { + NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self); + gboolean mm_running; + + priv->dbus_mgr = nm_dbus_manager_get (); + + priv->mm_watch_id = g_signal_connect (priv->dbus_mgr, + NM_DBUS_MANAGER_NAME_OWNER_CHANGED, + G_CALLBACK (mm_name_owner_changed), + self); + + /* Initial check to see if ModemManager is running */ + mm_running = nm_dbus_manager_name_has_owner (priv->dbus_mgr, MM_OLD_DBUS_SERVICE); +#if WITH_MODEM_MANAGER_1 + if (!mm_running) + mm_running = nm_dbus_manager_name_has_owner (priv->dbus_mgr, MM_NEW_DBUS_SERVICE); +#endif + set_mm_running (self, mm_running); } static void @@ -1116,7 +1269,7 @@ get_property (GObject *object, guint prop_id, } static void -finalize (GObject *object) +dispose (GObject *object) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object); @@ -1125,14 +1278,23 @@ finalize (GObject *object) priv->timeout_id = 0; } - if (priv->type_proxy) - g_object_unref (priv->type_proxy); + if (priv->dbus_mgr && priv->mm_watch_id) { + g_signal_handler_disconnect (priv->dbus_mgr, priv->mm_watch_id); + priv->mm_watch_id = 0; + } + g_clear_object (&priv->dbus_mgr); - if (priv->dev_proxy) - g_object_unref (priv->dev_proxy); + g_clear_object (&priv->type_proxy); + g_clear_object (&priv->dev_proxy); + g_clear_object (&priv->modem); - if (priv->modem) - g_object_unref (priv->modem); + G_OBJECT_CLASS (nm_device_bt_parent_class)->dispose (object); +} + +static void +finalize (GObject *object) +{ + NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object); g_free (priv->rfcomm_iface); g_free (priv->bdaddr); @@ -1151,17 +1313,22 @@ nm_device_bt_class_init (NMDeviceBtClass *klass) object_class->get_property = get_property; object_class->set_property = set_property; + object_class->dispose = dispose; object_class->finalize = finalize; - device_class->get_best_auto_connection = real_get_best_auto_connection; - device_class->get_generic_capabilities = real_get_generic_capabilities; - device_class->deactivate = real_deactivate; - device_class->act_stage2_config = real_act_stage2_config; - device_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start; - device_class->act_stage3_ip6_config_start = real_act_stage3_ip6_config_start; - device_class->check_connection_compatible = real_check_connection_compatible; - device_class->complete_connection = real_complete_connection; + device_class->get_best_auto_connection = get_best_auto_connection; + device_class->get_generic_capabilities = get_generic_capabilities; + device_class->deactivate = deactivate; + device_class->act_stage2_config = act_stage2_config; + device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start; + device_class->check_connection_compatible = check_connection_compatible; + device_class->check_connection_available = check_connection_available; + device_class->complete_connection = complete_connection; device_class->hwaddr_matches = hwaddr_matches; + device_class->is_available = is_available; + + device_class->state_changed = device_state_changed; /* Properties */ g_object_class_install_property @@ -1199,7 +1366,7 @@ nm_device_bt_class_init (NMDeviceBtClass *klass) G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); - signals[PROPERTIES_CHANGED] = + signals[PROPERTIES_CHANGED] = nm_properties_changed_signal_new (object_class, G_STRUCT_OFFSET (NMDeviceBtClass, properties_changed)); diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c index ede31cc1f..4b8f9497f 100644 --- a/src/nm-device-ethernet.c +++ b/src/nm-device-ethernet.c @@ -283,8 +283,7 @@ static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) + NMDeviceStateReason reason) { switch (new_state) { case NM_DEVICE_STATE_ACTIVATED: @@ -300,11 +299,10 @@ device_state_changed (NMDevice *device, static void nm_device_ethernet_init (NMDeviceEthernet * self) { - g_signal_connect (self, "state-changed", G_CALLBACK (device_state_changed), NULL); } static gboolean -real_is_up (NMDevice *device) +is_up (NMDevice *device) { if (!NM_DEVICE_ETHERNET_GET_PRIVATE (device)->supplicant.mgr) return FALSE; @@ -313,7 +311,7 @@ real_is_up (NMDevice *device) } static gboolean -real_bring_up (NMDevice *dev) +bring_up (NMDevice *dev) { NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev); @@ -323,7 +321,7 @@ real_bring_up (NMDevice *dev) } static void -real_take_down (NMDevice *dev) +take_down (NMDevice *dev) { NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (dev); @@ -408,7 +406,7 @@ _set_hw_addr (NMDeviceEthernet *self, const guint8 *addr, const char *detail) } static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { const guint8 *hw_addr; guint8 old_addr[ETH_ALEN]; @@ -424,7 +422,7 @@ real_update_hw_address (NMDevice *dev) } static void -real_update_permanent_hw_address (NMDevice *dev) +update_permanent_hw_address (NMDevice *dev) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); @@ -468,7 +466,7 @@ real_update_permanent_hw_address (NMDevice *dev) } static void -real_update_initial_hw_address (NMDevice *dev) +update_initial_hw_address (NMDevice *dev) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); @@ -482,7 +480,7 @@ real_update_initial_hw_address (NMDevice *dev) */ current_addr = nm_device_wired_get_hwaddr (NM_DEVICE_WIRED (self)); if (!memcmp (current_addr, &zero, ETH_ALEN)) - real_update_hw_address (dev); + update_hw_address (dev); if (memcmp (&priv->initial_hw_addr, current_addr, ETH_ALEN)) memcpy (&priv->initial_hw_addr, current_addr, ETH_ALEN); @@ -497,7 +495,7 @@ real_update_initial_hw_address (NMDevice *dev) } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); guint32 caps = NM_DEVICE_CAP_NONE; @@ -620,9 +618,9 @@ match_ethernet_connection (NMDevice *device, NMConnection *connection, } static NMConnection * -real_get_best_auto_connection (NMDevice *dev, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) { GSList *iter; @@ -826,6 +824,7 @@ static void supplicant_iface_state_cb (NMSupplicantInterface *iface, guint32 new_state, guint32 old_state, + int disconnect_reason, gpointer user_data) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (user_data); @@ -1029,7 +1028,7 @@ supplicant_interface_init (NMDeviceEthernet *self) /* Listen for it's state signals */ priv->supplicant.iface_state_id = g_signal_connect (priv->supplicant.iface, - "state", + NM_SUPPLICANT_INTERFACE_STATE, G_CALLBACK (supplicant_iface_state_cb), self); @@ -1046,7 +1045,7 @@ supplicant_interface_init (NMDeviceEthernet *self) } static NMActStageReturn -real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); NMActRequest *req; @@ -1197,7 +1196,7 @@ pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reas } static NMActStageReturn -real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) { NMSettingConnection *s_con; const char *connection_type; @@ -1224,9 +1223,9 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) } static NMActStageReturn -real_act_stage3_ip4_config_start (NMDevice *device, - NMIP4Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip4_config_start (NMDevice *device, + NMIP4Config **out_config, + NMDeviceStateReason *reason) { NMSettingConnection *s_con; const char *connection_type; @@ -1244,7 +1243,7 @@ real_act_stage3_ip4_config_start (NMDevice *device, } static void -real_ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) +ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) { NMConnection *connection; NMSettingWired *s_wired; @@ -1266,7 +1265,7 @@ real_ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) } static void -real_deactivate (NMDevice *device) +deactivate (NMDevice *device) { NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device); NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); @@ -1291,19 +1290,19 @@ real_deactivate (NMDevice *device) } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { return match_ethernet_connection (device, connection, TRUE, error); } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device); NMSettingWired *s_wired; @@ -1513,26 +1512,28 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass) object_class->get_property = get_property; object_class->set_property = set_property; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->is_up = real_is_up; - parent_class->bring_up = real_bring_up; - parent_class->take_down = real_take_down; - parent_class->update_hw_address = real_update_hw_address; - parent_class->update_permanent_hw_address = real_update_permanent_hw_address; - parent_class->update_initial_hw_address = real_update_initial_hw_address; - parent_class->get_best_auto_connection = real_get_best_auto_connection; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->complete_connection = real_complete_connection; - - parent_class->act_stage1_prepare = real_act_stage1_prepare; - parent_class->act_stage2_config = real_act_stage2_config; - parent_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start; - parent_class->ip4_config_pre_commit = real_ip4_config_pre_commit; - parent_class->deactivate = real_deactivate; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->is_up = is_up; + parent_class->bring_up = bring_up; + parent_class->take_down = take_down; + parent_class->update_hw_address = update_hw_address; + parent_class->update_permanent_hw_address = update_permanent_hw_address; + parent_class->update_initial_hw_address = update_initial_hw_address; + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->complete_connection = complete_connection; + + parent_class->act_stage1_prepare = act_stage1_prepare; + parent_class->act_stage2_config = act_stage2_config; + parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + parent_class->ip4_config_pre_commit = ip4_config_pre_commit; + parent_class->deactivate = deactivate; parent_class->spec_match_list = spec_match_list; parent_class->connection_match_config = connection_match_config; parent_class->hwaddr_matches = hwaddr_matches; + parent_class->state_changed = device_state_changed; + /* properties */ g_object_class_install_property (object_class, PROP_HW_ADDRESS, diff --git a/src/nm-device-infiniband.c b/src/nm-device-infiniband.c index 5e43f0604..b2915f9ee 100644 --- a/src/nm-device-infiniband.c +++ b/src/nm-device-infiniband.c @@ -122,7 +122,7 @@ nm_device_infiniband_new (const char *udi, static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { const guint8 *hw_addr; guint8 old_addr[INFINIBAND_ALEN]; @@ -138,15 +138,15 @@ real_update_hw_address (NMDevice *dev) } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return NM_DEVICE_CAP_CARRIER_DETECT | NM_DEVICE_CAP_NM_SUPPORTED; } static NMConnection * -real_get_best_auto_connection (NMDevice *dev, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) { GSList *iter; @@ -182,13 +182,13 @@ real_get_best_auto_connection (NMDevice *dev, } static NMActStageReturn -real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) { NMActRequest *req; NMConnection *connection; NMSettingInfiniband *s_infiniband; const char *transport_mode; - char *mode_path, *mode_value; + char *mode_path; gboolean ok; g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); @@ -215,9 +215,7 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) } } - mode_value = g_strdup_printf ("%s\n", transport_mode); - ok = nm_utils_do_sysctl (mode_path, mode_value); - g_free (mode_value); + ok = nm_utils_do_sysctl (mode_path, transport_mode); g_free (mode_path); if (!ok) { @@ -229,7 +227,7 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) } static void -real_ip4_config_pre_commit (NMDevice *self, NMIP4Config *config) +ip4_config_pre_commit (NMDevice *self, NMIP4Config *config) { NMConnection *connection; NMSettingInfiniband *s_infiniband; @@ -247,9 +245,9 @@ real_ip4_config_pre_commit (NMDevice *self, NMIP4Config *config) } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMSettingInfiniband *s_infiniband; const GByteArray *mac; @@ -287,11 +285,11 @@ real_check_connection_compatible (NMDevice *device, } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMSettingInfiniband *s_infiniband; const GByteArray *setting_mac; @@ -476,14 +474,14 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass) object_class->get_property = get_property; object_class->set_property = set_property; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->update_hw_address = real_update_hw_address; - parent_class->get_best_auto_connection = real_get_best_auto_connection; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->complete_connection = real_complete_connection; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->update_hw_address = update_hw_address; + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->complete_connection = complete_connection; - parent_class->act_stage1_prepare = real_act_stage1_prepare; - parent_class->ip4_config_pre_commit = real_ip4_config_pre_commit; + parent_class->act_stage1_prepare = act_stage1_prepare; + parent_class->ip4_config_pre_commit = ip4_config_pre_commit; parent_class->spec_match_list = spec_match_list; parent_class->connection_match_config = connection_match_config; parent_class->hwaddr_matches = hwaddr_matches; diff --git a/src/nm-device-modem.c b/src/nm-device-modem.c index e7cd9259b..57f0bf8ef 100644 --- a/src/nm-device-modem.c +++ b/src/nm-device-modem.c @@ -18,6 +18,8 @@ * Copyright (C) 2009 - 2011 Red Hat, Inc. */ +#include "config.h" + #include <glib.h> #include "nm-device-modem.h" @@ -29,6 +31,11 @@ #include "nm-rfkill.h" #include "nm-marshal.h" #include "nm-logging.h" +#include "nm-system.h" + +#if WITH_MODEM_MANAGER_1 +#include "nm-modem-broadband.h" +#endif G_DEFINE_TYPE (NMDeviceModem, nm_device_modem, NM_TYPE_DEVICE) @@ -56,7 +63,7 @@ enum { }; static guint signals[LAST_SIGNAL] = { 0 }; -static void real_set_enabled (NMDevice *device, gboolean enabled); +static void set_enabled (NMDevice *device, gboolean enabled); /*****************************************************************************/ @@ -132,7 +139,6 @@ modem_auth_result (NMModem *modem, GError *error, gpointer user_data) static void modem_ip4_config_result (NMModem *self, - const char *iface, NMIP4Config *config, GError *error, gpointer user_data) @@ -147,12 +153,18 @@ modem_ip4_config_result (NMModem *self, error && error->message ? error->message : "(unknown)"); nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); - } else { - if (iface) - nm_device_set_ip_iface (device, iface); - + } else nm_device_activate_schedule_ip4_config_result (device, config); - } +} + +static void +data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data) +{ + NMDevice *self = NM_DEVICE (user_data); + + /* We set the IP iface in the device as soon as we know it, so that we + * properly ifup it if needed */ + nm_device_set_ip_iface (self, nm_modem_get_data_port (modem)); } static void @@ -161,11 +173,24 @@ modem_enabled_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data) NMDeviceModem *self = NM_DEVICE_MODEM (user_data); NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (self); - real_set_enabled (NM_DEVICE (self), nm_modem_get_mm_enabled (priv->modem)); + set_enabled (NM_DEVICE (self), nm_modem_get_mm_enabled (priv->modem)); g_signal_emit (G_OBJECT (self), signals[ENABLE_CHANGED], 0); } +static void +modem_connected_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data) +{ + NMDeviceModem *self = NM_DEVICE_MODEM (user_data); + NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (self); + + if ( nm_device_get_state (NM_DEVICE (self)) == NM_DEVICE_STATE_ACTIVATED + && !nm_modem_get_mm_connected (priv->modem)) { + /* Fail the device if the modem disconnects unexpectedly */ + nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER); + } +} + /*****************************************************************************/ NMModem * @@ -183,8 +208,7 @@ static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) + NMDeviceStateReason reason) { nm_modem_device_state_changed (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, new_state, @@ -193,15 +217,15 @@ device_state_changed (NMDevice *device, } static guint32 -real_get_generic_capabilities (NMDevice *device) +get_generic_capabilities (NMDevice *device) { return NM_DEVICE_CAP_NM_SUPPORTED; } static NMConnection * -real_get_best_auto_connection (NMDevice *device, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *device, + GSList *connections, + char **specific_object) { NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device); @@ -209,9 +233,9 @@ real_get_best_auto_connection (NMDevice *device, } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device); @@ -219,11 +243,11 @@ real_check_connection_compatible (NMDevice *device, } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device); @@ -231,25 +255,29 @@ real_complete_connection (NMDevice *device, } static gboolean -real_hw_is_up (NMDevice *device) +hw_is_up (NMDevice *device) { - return nm_modem_hw_is_up (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device); + int ifindex = nm_device_get_ip_ifindex (device); + + return ifindex > 0 ? nm_system_iface_is_up (ifindex) : TRUE; } static gboolean -real_hw_bring_up (NMDevice *device, gboolean *no_firmware) +hw_bring_up (NMDevice *device, gboolean *no_firmware) { - return nm_modem_hw_bring_up (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device, no_firmware); + int ifindex = nm_device_get_ip_ifindex (device); + + return ifindex > 0 ? nm_system_iface_set_up (ifindex, TRUE, no_firmware) : TRUE; } static void -real_deactivate (NMDevice *device) +deactivate (NMDevice *device) { nm_modem_deactivate (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device); } static NMActStageReturn -real_act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) { NMActRequest *req; @@ -260,7 +288,7 @@ real_act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) } static NMActStageReturn -real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) { NMActRequest *req; @@ -271,9 +299,9 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) } static NMActStageReturn -real_act_stage3_ip4_config_start (NMDevice *device, - NMIP4Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip4_config_start (NMDevice *device, + NMIP4Config **out_config, + NMDeviceStateReason *reason) { return nm_modem_stage3_ip4_config_start (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device, @@ -281,10 +309,16 @@ real_act_stage3_ip4_config_start (NMDevice *device, reason); } +static void +ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) +{ + nm_modem_ip4_pre_commit (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device, config); +} + static NMActStageReturn -real_act_stage3_ip6_config_start (NMDevice *device, - NMIP6Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip6_config_start (NMDevice *device, + NMIP6Config **out_config, + NMDeviceStateReason *reason) { return nm_modem_stage3_ip6_config_start (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, device, @@ -295,13 +329,13 @@ real_act_stage3_ip6_config_start (NMDevice *device, /*****************************************************************************/ static gboolean -real_get_enabled (NMDevice *device) +get_enabled (NMDevice *device) { return nm_modem_get_mm_enabled (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem); } static void -real_set_enabled (NMDevice *device, gboolean enabled) +set_enabled (NMDevice *device, gboolean enabled) { NMDeviceModem *self = NM_DEVICE_MODEM (device); NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (self); @@ -328,7 +362,9 @@ NMDevice * nm_device_modem_new (NMModem *modem, const char *driver) { NMDeviceModemCapabilities caps = NM_DEVICE_MODEM_CAPABILITY_NONE; - const char *type_desc = NULL; + NMDeviceModemCapabilities current_caps = NM_DEVICE_MODEM_CAPABILITY_NONE; + const gchar *type_desc = NULL; + const gchar *ip_iface = NULL; g_return_val_if_fail (modem != NULL, NULL); g_return_val_if_fail (NM_IS_MODEM (modem), NULL); @@ -336,18 +372,31 @@ nm_device_modem_new (NMModem *modem, const char *driver) if (NM_IS_MODEM_CDMA (modem)) { caps = NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO; + current_caps = caps; type_desc = "CDMA/EVDO"; + ip_iface = nm_modem_get_data_port (modem); } else if (NM_IS_MODEM_GSM (modem)) { caps = NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS; + current_caps = caps; type_desc = "GSM/UMTS"; - } else { + ip_iface = nm_modem_get_data_port (modem); + } +#if WITH_MODEM_MANAGER_1 + else if (NM_IS_MODEM_BROADBAND (modem)) { + nm_modem_broadband_get_capabilities (NM_MODEM_BROADBAND (modem), &caps, ¤t_caps); + type_desc = "Broadband"; + /* data port not yet known in broadband modems */ + } +#endif + else { nm_log_warn (LOGD_MB, "unhandled modem type %s", G_OBJECT_TYPE_NAME (modem)); return NULL; } return (NMDevice *) g_object_new (NM_TYPE_DEVICE_MODEM, NM_DEVICE_UDI, nm_modem_get_path (modem), - NM_DEVICE_IFACE, nm_modem_get_iface (modem), + NM_DEVICE_IFACE, nm_modem_get_uid (modem), + NM_DEVICE_IP_IFACE, ip_iface, NM_DEVICE_DRIVER, driver, NM_DEVICE_TYPE_DESC, type_desc, NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_MODEM, @@ -361,7 +410,6 @@ nm_device_modem_new (NMModem *modem, const char *driver) static void nm_device_modem_init (NMDeviceModem *self) { - g_signal_connect (self, "state-changed", G_CALLBACK (device_state_changed), self); } static void @@ -379,6 +427,12 @@ set_modem (NMDeviceModem *self, NMModem *modem) g_signal_connect (modem, NM_MODEM_AUTH_REQUESTED, G_CALLBACK (modem_auth_requested), self); g_signal_connect (modem, NM_MODEM_AUTH_RESULT, G_CALLBACK (modem_auth_result), self); g_signal_connect (modem, "notify::" NM_MODEM_ENABLED, G_CALLBACK (modem_enabled_cb), self); + g_signal_connect (modem, "notify::" NM_MODEM_CONNECTED, G_CALLBACK (modem_connected_cb), self); + + /* In the old ModemManager the data port is known from the very beginning; + * while in the new ModemManager the data port is set afterwards when the bearer gets + * created */ + g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self); } static void @@ -450,19 +504,22 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass) object_class->get_property = get_property; object_class->set_property = set_property; - device_class->get_generic_capabilities = real_get_generic_capabilities; - device_class->get_best_auto_connection = real_get_best_auto_connection; - device_class->check_connection_compatible = real_check_connection_compatible; - device_class->complete_connection = real_complete_connection; - device_class->hw_is_up = real_hw_is_up; - device_class->hw_bring_up = real_hw_bring_up; - device_class->deactivate = real_deactivate; - device_class->act_stage1_prepare = real_act_stage1_prepare; - device_class->act_stage2_config = real_act_stage2_config; - device_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start; - device_class->act_stage3_ip6_config_start = real_act_stage3_ip6_config_start; - device_class->get_enabled = real_get_enabled; - device_class->set_enabled = real_set_enabled; + device_class->get_generic_capabilities = get_generic_capabilities; + device_class->get_best_auto_connection = get_best_auto_connection; + device_class->check_connection_compatible = check_connection_compatible; + device_class->complete_connection = complete_connection; + device_class->hw_is_up = hw_is_up; + device_class->hw_bring_up = hw_bring_up; + device_class->deactivate = deactivate; + device_class->act_stage1_prepare = act_stage1_prepare; + device_class->act_stage2_config = act_stage2_config; + device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start; + device_class->ip4_config_pre_commit = ip4_config_pre_commit; + device_class->get_enabled = get_enabled; + device_class->set_enabled = set_enabled; + + device_class->state_changed = device_state_changed; /* Properties */ g_object_class_install_property @@ -488,7 +545,7 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /* Signals */ - signals[PROPERTIES_CHANGED] = + signals[PROPERTIES_CHANGED] = nm_properties_changed_signal_new (object_class, G_STRUCT_OFFSET (NMDeviceModemClass, properties_changed)); @@ -503,4 +560,3 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass) dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (mclass), &dbus_glib_nm_device_modem_object_info); } - diff --git a/src/nm-device-olpc-mesh.c b/src/nm-device-olpc-mesh.c index b3d8b794a..289e5be39 100644 --- a/src/nm-device-olpc-mesh.c +++ b/src/nm-device-olpc-mesh.c @@ -112,6 +112,9 @@ struct _NMDeviceOlpcMeshPrivate guint cmp_autoconnect_allowed_id; }; +static void state_changed (NMDevice *device, NMDeviceState new_state, + NMDeviceState old_state, NMDeviceStateReason reason); + static GQuark nm_olpc_mesh_error_quark (void) { @@ -122,7 +125,7 @@ nm_olpc_mesh_error_quark (void) } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return NM_DEVICE_CAP_NM_SUPPORTED; } @@ -184,25 +187,25 @@ constructor (GType type, } static gboolean -real_hw_is_up (NMDevice *device) +hw_is_up (NMDevice *device) { return nm_system_iface_is_up (nm_device_get_ip_ifindex (device)); } static gboolean -real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) +hw_bring_up (NMDevice *dev, gboolean *no_firmware) { return nm_system_iface_set_up (nm_device_get_ip_ifindex (dev), TRUE, no_firmware); } static void -real_hw_take_down (NMDevice *dev) +hw_take_down (NMDevice *dev) { nm_system_iface_set_up (nm_device_get_ip_ifindex (dev), FALSE, NULL); } static gboolean -real_is_up (NMDevice *device) +is_up (NMDevice *device) { NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device); NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self); @@ -211,7 +214,7 @@ real_is_up (NMDevice *device) } static gboolean -real_bring_up (NMDevice *dev) +bring_up (NMDevice *dev) { NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (dev); NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self); @@ -233,15 +236,15 @@ device_cleanup (NMDeviceOlpcMesh *self) } static void -real_take_down (NMDevice *dev) +take_down (NMDevice *dev) { device_cleanup (NM_DEVICE_OLPC_MESH (dev)); } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMSettingConnection *s_con; NMSettingOlpcMesh *s_mesh; @@ -270,11 +273,11 @@ real_check_connection_compatible (NMDevice *device, #define DEFAULT_SSID "olpc-mesh" static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMSettingOlpcMesh *s_mesh; GByteArray *tmp; @@ -332,7 +335,7 @@ nm_device_olpc_mesh_get_address (NMDeviceOlpcMesh *self, /****************************************************************************/ static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (dev); NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self); @@ -365,7 +368,7 @@ out: static NMActStageReturn -real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) { NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (dev); gboolean scanning; @@ -407,7 +410,7 @@ _mesh_set_channel (NMDeviceOlpcMesh *self, guint32 channel) } static NMActStageReturn -real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) { NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (dev); NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self); @@ -550,19 +553,21 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass) object_class->dispose = dispose; parent_class->get_type_capabilities = NULL; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->hw_is_up = real_hw_is_up; - parent_class->hw_bring_up = real_hw_bring_up; - parent_class->hw_take_down = real_hw_take_down; - parent_class->is_up = real_is_up; - parent_class->bring_up = real_bring_up; - parent_class->take_down = real_take_down; - parent_class->update_hw_address = real_update_hw_address; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->complete_connection = real_complete_connection; - - parent_class->act_stage1_prepare = real_act_stage1_prepare; - parent_class->act_stage2_config = real_act_stage2_config; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->hw_is_up = hw_is_up; + parent_class->hw_bring_up = hw_bring_up; + parent_class->hw_take_down = hw_take_down; + parent_class->is_up = is_up; + parent_class->bring_up = bring_up; + parent_class->take_down = take_down; + parent_class->update_hw_address = update_hw_address; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->complete_connection = complete_connection; + + parent_class->act_stage1_prepare = act_stage1_prepare; + parent_class->act_stage2_config = act_stage2_config; + + parent_class->state_changed = state_changed; /* Properties */ g_object_class_install_property @@ -771,15 +776,16 @@ check_companion_cb (gpointer user_data) } static void -state_changed_cb (NMDevice *device, NMDeviceState state, gpointer user_data) +state_changed (NMDevice *device, NMDeviceState new_state, + NMDeviceState old_state, NMDeviceStateReason reason) { NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device); - switch (state) { + switch (new_state) { case NM_DEVICE_STATE_UNMANAGED: break; case NM_DEVICE_STATE_UNAVAILABLE: - /* If transitioning to UNAVAILBLE and the companion device is known then + /* If transitioning to UNAVAILABLE and the companion device is known then * transition to DISCONNECTED otherwise wait for our companion. */ g_idle_add (check_companion_cb, self); @@ -801,23 +807,15 @@ nm_device_olpc_mesh_new (const char *udi, const char *iface, const char *driver) { - GObject *obj; - g_return_val_if_fail (udi != NULL, NULL); g_return_val_if_fail (iface != NULL, NULL); g_return_val_if_fail (driver != NULL, NULL); - obj = g_object_new (NM_TYPE_DEVICE_OLPC_MESH, - NM_DEVICE_UDI, udi, - NM_DEVICE_IFACE, iface, - NM_DEVICE_DRIVER, driver, - NM_DEVICE_TYPE_DESC, "802.11 OLPC Mesh", - NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_OLPC_MESH, - NULL); - if (obj == NULL) - return NULL; - - g_signal_connect (obj, "state-changed", G_CALLBACK (state_changed_cb), NULL); - - return NM_DEVICE (obj); + return (NMDevice *) g_object_new (NM_TYPE_DEVICE_OLPC_MESH, + NM_DEVICE_UDI, udi, + NM_DEVICE_IFACE, iface, + NM_DEVICE_DRIVER, driver, + NM_DEVICE_TYPE_DESC, "802.11 OLPC Mesh", + NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_OLPC_MESH, + NULL); } diff --git a/src/nm-device-private.h b/src/nm-device-private.h index 0320a7222..57e16c0f8 100644 --- a/src/nm-device-private.h +++ b/src/nm-device-private.h @@ -28,15 +28,20 @@ enum NMActStageReturn { NM_ACT_STAGE_RETURN_FAILURE = 0, - NM_ACT_STAGE_RETURN_SUCCESS, - NM_ACT_STAGE_RETURN_POSTPONE, - NM_ACT_STAGE_RETURN_STOP /* This activation chain is done */ + NM_ACT_STAGE_RETURN_SUCCESS, /* Activation stage done */ + NM_ACT_STAGE_RETURN_POSTPONE, /* Long-running operation in progress */ + NM_ACT_STAGE_RETURN_WAIT, /* Not ready to start stage; wait */ + NM_ACT_STAGE_RETURN_STOP /* Activation stage done; nothing to do */ }; void nm_device_set_ip_iface (NMDevice *self, const char *iface); void nm_device_activate_schedule_stage3_ip_config_start (NMDevice *device); +gboolean nm_device_activate_stage3_ip4_start (NMDevice *self); + +gboolean nm_device_activate_stage3_ip6_start (NMDevice *self); + gboolean nm_device_hw_bring_up (NMDevice *self, gboolean wait, gboolean *no_firmware); void nm_device_hw_take_down (NMDevice *self, gboolean block); @@ -69,6 +74,8 @@ gboolean nm_device_match_ip_config (NMDevice *device, NMConnection *connection); NMConnectionProvider *nm_device_get_connection_provider (NMDevice *device); +void nm_device_recheck_available_connections (NMDevice *device); + void nm_device_queued_state_clear (NMDevice *device); NMDeviceState nm_device_queued_state_peek (NMDevice *device); diff --git a/src/nm-device-vlan.c b/src/nm-device-vlan.c index fe3548d7f..f22d47d83 100644 --- a/src/nm-device-vlan.c +++ b/src/nm-device-vlan.c @@ -100,7 +100,7 @@ nm_vlan_error_quark (void) /******************************************************************/ static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { /* We assume VLAN interfaces always support carrier detect */ return NM_DEVICE_CAP_CARRIER_DETECT | NM_DEVICE_CAP_NM_SUPPORTED; @@ -118,7 +118,7 @@ get_carrier_sync (NMDeviceVlan *self) nm_device_get_ip_ifindex (NM_DEVICE (self)), &ifflags, &error)) { - nm_log_warn (LOGD_HW | LOGD_DEVICE, + nm_log_warn (LOGD_HW | LOGD_VLAN, "(%s): couldn't get carrier state: (%d) %s", nm_device_get_ip_iface (NM_DEVICE (self)), error ? error->code : -1, @@ -130,13 +130,13 @@ get_carrier_sync (NMDeviceVlan *self) } static gboolean -real_hw_is_up (NMDevice *device) +hw_is_up (NMDevice *device) { return nm_system_iface_is_up (nm_device_get_ip_ifindex (device)); } static gboolean -real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) +hw_bring_up (NMDevice *dev, gboolean *no_firmware) { gboolean success = FALSE, carrier; guint i = 20; @@ -163,13 +163,13 @@ real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) } static void -real_hw_take_down (NMDevice *dev) +hw_take_down (NMDevice *dev) { nm_system_iface_set_up (nm_device_get_ip_ifindex (dev), FALSE, NULL); } static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { NMDeviceVlan *self = NM_DEVICE_VLAN (dev); NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (self); @@ -178,7 +178,7 @@ real_update_hw_address (NMDevice *dev) rtnl = nm_netlink_index_to_rtnl_link (nm_device_get_ip_ifindex (dev)); if (!rtnl) { - nm_log_err (LOGD_HW | LOGD_DEVICE, + nm_log_err (LOGD_HW | LOGD_VLAN, "(%s) failed to read hardware address (error %d)", nm_device_get_iface (dev), errno); return; @@ -186,14 +186,14 @@ real_update_hw_address (NMDevice *dev) addr = rtnl_link_get_addr (rtnl); if (!addr) { - nm_log_err (LOGD_HW | LOGD_DEVICE, + nm_log_err (LOGD_HW | LOGD_VLAN, "(%s) no hardware address?", nm_device_get_iface (dev)); goto out; } if (nl_addr_get_len (addr) > sizeof (priv->hw_addr)) { - nm_log_err (LOGD_HW | LOGD_DEVICE, + nm_log_err (LOGD_HW | LOGD_VLAN, "(%s) hardware address is wrong length (got %d max %zd)", nm_device_get_iface (dev), nl_addr_get_len (addr), @@ -209,14 +209,14 @@ out: } static gboolean -real_can_interrupt_activation (NMDevice *dev) +can_interrupt_activation (NMDevice *dev) { /* Can interrupt activation if the carrier drops while activating */ return NM_DEVICE_VLAN_GET_PRIVATE (dev)->carrier ? FALSE : TRUE; } static gboolean -real_is_available (NMDevice *dev) +is_available (NMDevice *dev) { return NM_DEVICE_VLAN_GET_PRIVATE (dev)->carrier ? TRUE : FALSE; } @@ -319,9 +319,9 @@ match_vlan_connection (NMDeviceVlan *self, NMConnection *connection, GError **er } static NMConnection * -real_get_best_auto_connection (NMDevice *dev, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) { GSList *iter; @@ -339,19 +339,19 @@ real_get_best_auto_connection (NMDevice *dev, } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { return match_vlan_connection (NM_DEVICE_VLAN (device), connection, error); } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device); NMSettingVlan *s_vlan; @@ -521,7 +521,7 @@ set_carrier (NMDeviceVlan *self, g_object_notify (G_OBJECT (self), NM_DEVICE_VLAN_CARRIER); state = nm_device_get_state (NM_DEVICE (self)); - nm_log_info (LOGD_HW | LOGD_DEVICE, + nm_log_info (LOGD_HW | LOGD_VLAN, "(%s): carrier now %s (device state %d%s)", nm_device_get_iface (NM_DEVICE (self)), carrier ? "ON" : "OFF", @@ -577,7 +577,7 @@ carrier_watch_init (NMDeviceVlan *self) priv->carrier = get_carrier_sync (NM_DEVICE_VLAN (self)); - nm_log_info (LOGD_HW | LOGD_DEVICE, "(%s): carrier is %s", + nm_log_info (LOGD_HW | LOGD_VLAN, "(%s): carrier is %s", nm_device_get_iface (NM_DEVICE (self)), priv->carrier ? "ON" : "OFF"); @@ -637,13 +637,13 @@ nm_device_vlan_new (const char *udi, const char *iface, NMDevice *parent) itype = nm_system_get_iface_type (ifindex, iface); if (itype != NM_IFACE_TYPE_VLAN) { - nm_log_err (LOGD_DEVICE, "(%s): failed to get VLAN interface type.", iface); + nm_log_err (LOGD_VLAN, "(%s): failed to get VLAN interface type.", iface); g_object_unref (device); return NULL; } if (!nm_system_get_iface_vlan_info (ifindex, &parent_ifindex, &vlan_id)) { - nm_log_warn (LOGD_DEVICE, "(%s): failed to get VLAN interface info.", iface); + nm_log_warn (LOGD_VLAN, "(%s): failed to get VLAN interface info.", iface); g_object_unref (device); return NULL; } @@ -651,7 +651,7 @@ nm_device_vlan_new (const char *udi, const char *iface, NMDevice *parent) if ( parent_ifindex < 0 || parent_ifindex != nm_device_get_ip_ifindex (parent) || vlan_id < 0) { - nm_log_warn (LOGD_DEVICE, "(%s): VLAN parent ifindex (%d) or VLAN ID (%d) invalid.", + nm_log_warn (LOGD_VLAN, "(%s): VLAN parent ifindex (%d) or VLAN ID (%d) invalid.", iface, parent_ifindex, priv->vlan_id); g_object_unref (device); return NULL; @@ -758,17 +758,17 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass) object_class->set_property = set_property; object_class->dispose = dispose; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->update_hw_address = real_update_hw_address; - parent_class->hw_is_up = real_hw_is_up; - parent_class->hw_bring_up = real_hw_bring_up; - parent_class->hw_take_down = real_hw_take_down; - parent_class->can_interrupt_activation = real_can_interrupt_activation; - parent_class->is_available = real_is_available; - - parent_class->get_best_auto_connection = real_get_best_auto_connection; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->complete_connection = real_complete_connection; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->update_hw_address = update_hw_address; + parent_class->hw_is_up = hw_is_up; + parent_class->hw_bring_up = hw_bring_up; + parent_class->hw_take_down = hw_take_down; + parent_class->can_interrupt_activation = can_interrupt_activation; + parent_class->is_available = is_available; + + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->complete_connection = complete_connection; parent_class->spec_match_list = spec_match_list; parent_class->connection_match_config = connection_match_config; diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c index 0f57727d7..eb5ac1aa4 100644 --- a/src/nm-device-wifi.c +++ b/src/nm-device-wifi.c @@ -150,6 +150,8 @@ struct _NMDeviceWifiPrivate { Supplicant supplicant; WifiData * wifi_data; + gboolean ssid_found; + NM80211Mode mode; guint32 failed_link_count; guint periodic_source_id; @@ -172,6 +174,7 @@ static void remove_supplicant_timeouts (NMDeviceWifi *self); static void supplicant_iface_state_cb (NMSupplicantInterface *iface, guint32 new_state, guint32 old_state, + int disconnect_reason, gpointer user_data); static void supplicant_iface_new_bss_cb (NMSupplicantInterface * iface, @@ -276,7 +279,7 @@ ipw_rfkill_state_work (gpointer user_data) /*****************************************************************/ static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return NM_DEVICE_CAP_NM_SUPPORTED; } @@ -315,7 +318,7 @@ constructor (GType type, priv->capabilities = wifi_utils_get_caps (priv->wifi_data); if (priv->capabilities & NM_WIFI_DEVICE_CAP_AP) { - nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): driver supports Access Point (AP) mode", + nm_log_info (LOGD_HW | LOGD_WIFI, "(%s): driver supports Access Point (AP) mode", nm_device_get_iface (NM_DEVICE (self))); } @@ -653,7 +656,7 @@ update_seen_bssids_cache (NMDeviceWifi *self, NMAccessPoint *ap) } static void -set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap) +set_active_ap (NMDeviceWifi *self, NMAccessPoint *new_ap) { NMDeviceWifiPrivate *priv; char *old_path = NULL; @@ -705,6 +708,7 @@ periodic_update (gpointer user_data) NMAccessPoint *new_ap; guint32 new_rate, percent; NMDeviceState state; + guint32 supplicant_state; /* BSSID and signal strength have meaningful values only if the device * is activated and not scanning. @@ -713,7 +717,18 @@ periodic_update (gpointer user_data) if (state != NM_DEVICE_STATE_ACTIVATED) return TRUE; - if (nm_supplicant_interface_get_scanning (priv->supplicant.iface)) + /* Only update current AP if we're actually talking to something, otherwise + * assume the old one (if any) is still valid until we're told otherwise or + * the connection fails. + */ + supplicant_state = nm_supplicant_interface_get_state (priv->supplicant.iface); + if ( supplicant_state < NM_SUPPLICANT_INTERFACE_STATE_AUTHENTICATING + || supplicant_state > NM_SUPPLICANT_INTERFACE_STATE_COMPLETED + || nm_supplicant_interface_get_scanning (priv->supplicant.iface)) + return TRUE; + + /* In AP mode we currently have nothing to do. */ + if (priv->mode == NM_802_11_MODE_AP) return TRUE; /* In IBSS mode, most newer firmware/drivers do "BSS coalescing" where @@ -776,7 +791,7 @@ periodic_update (gpointer user_data) g_free (old_addr); g_free (new_addr); - set_current_ap (self, new_ap); + set_active_ap (self, new_ap); } new_rate = wifi_utils_get_rate (priv->wifi_data); @@ -789,13 +804,13 @@ periodic_update (gpointer user_data) } static gboolean -real_hw_is_up (NMDevice *device) +hw_is_up (NMDevice *device) { return nm_system_iface_is_up (nm_device_get_ip_ifindex (device)); } static gboolean -real_hw_bring_up (NMDevice *device, gboolean *no_firmware) +hw_bring_up (NMDevice *device, gboolean *no_firmware) { if (!NM_DEVICE_WIFI_GET_PRIVATE (device)->enabled) return FALSE; @@ -804,13 +819,13 @@ real_hw_bring_up (NMDevice *device, gboolean *no_firmware) } static void -real_hw_take_down (NMDevice *device) +hw_take_down (NMDevice *device) { nm_system_iface_set_up (nm_device_get_ip_ifindex (device), FALSE, NULL); } static gboolean -real_is_up (NMDevice *device) +is_up (NMDevice *device) { if (!NM_DEVICE_WIFI_GET_PRIVATE (device)->periodic_source_id) return FALSE; @@ -819,7 +834,7 @@ real_is_up (NMDevice *device) } static gboolean -real_bring_up (NMDevice *dev) +bring_up (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -865,7 +880,7 @@ _set_hw_addr (NMDeviceWifi *self, const guint8 *addr, const char *detail) } /* Can't change MAC address while device is up */ - real_hw_take_down (dev); + hw_take_down (dev); success = nm_system_iface_set_mac (nm_device_get_ip_ifindex (dev), (struct ether_addr *) addr); if (success) { @@ -877,16 +892,22 @@ _set_hw_addr (NMDeviceWifi *self, const guint8 *addr, const char *detail) nm_log_warn (LOGD_DEVICE | LOGD_ETHER, "(%s): failed to %s MAC address to %s", iface, detail, mac_str); } - real_hw_bring_up (dev, NULL); + hw_bring_up (dev, NULL); g_free (mac_str); return success; } static void -access_point_removed (NMDeviceWifi *device, NMAccessPoint *ap) +remove_access_point (NMDeviceWifi *device, NMAccessPoint *ap) { + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device); + g_signal_emit (device, signals[ACCESS_POINT_REMOVED], 0, ap); + priv->ap_list = g_slist_remove (priv->ap_list, ap); + g_object_unref (ap); + + nm_device_recheck_available_connections (NM_DEVICE (device)); } static void @@ -897,17 +918,14 @@ remove_all_aps (NMDeviceWifi *self) /* Remove outdated APs */ while (g_slist_length (priv->ap_list)) { NMAccessPoint *ap = NM_AP (priv->ap_list->data); - - access_point_removed (self, ap); - priv->ap_list = g_slist_remove (priv->ap_list, ap); - g_object_unref (ap); + remove_access_point (self, ap); } g_slist_free (priv->ap_list); priv->ap_list = NULL; } static void -real_take_down (NMDevice *dev) +take_down (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -918,18 +936,19 @@ real_take_down (NMDevice *dev) } cleanup_association_attempt (self, TRUE); - set_current_ap (self, NULL); + set_active_ap (self, NULL); remove_all_aps (self); } static void -real_deactivate (NMDevice *dev) +deactivate (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); NMAccessPoint *orig_ap = nm_device_wifi_get_activation_ap (self); NMActRequest *req; NMConnection *connection; + NM80211Mode old_mode = priv->mode; req = nm_device_get_act_request (dev); if (req) { @@ -940,7 +959,7 @@ real_deactivate (NMDevice *dev) cleanup_association_attempt (self, TRUE); - set_current_ap (self, NULL); + set_active_ap (self, NULL); priv->rate = 0; /* If the AP is 'fake', i.e. it wasn't actually found from @@ -952,9 +971,7 @@ real_deactivate (NMDevice *dev) * and thus the AP culling never happens. (bgo #569241) */ if (orig_ap && nm_ap_get_fake (orig_ap)) { - access_point_removed (self, orig_ap); - priv->ap_list = g_slist_remove (priv->ap_list, orig_ap); - g_object_unref (orig_ap); + remove_access_point (self, orig_ap); } /* Reset MAC address back to initial address */ @@ -963,7 +980,22 @@ real_deactivate (NMDevice *dev) /* Ensure we're in infrastructure mode after deactivation; some devices * (usually older ones) don't scan well in adhoc mode. */ - wifi_utils_set_mode (priv->wifi_data, NM_802_11_MODE_INFRA); + if (wifi_utils_get_mode (priv->wifi_data) != NM_802_11_MODE_INFRA) { + nm_device_hw_take_down (NM_DEVICE (self), TRUE); + wifi_utils_set_mode (priv->wifi_data, NM_802_11_MODE_INFRA); + nm_device_hw_bring_up (NM_DEVICE (self), TRUE, NULL); + } + + if (priv->mode != NM_802_11_MODE_INFRA) { + priv->mode = NM_802_11_MODE_INFRA; + g_object_notify (G_OBJECT (self), NM_DEVICE_WIFI_MODE); + } + + /* Ensure we trigger a scan after deactivating a Hotspot */ + if (old_mode == NM_802_11_MODE_AP) { + cancel_pending_scan (self); + request_wireless_scan (self); + } } static gboolean @@ -997,9 +1029,9 @@ is_adhoc_wpa (NMConnection *connection) } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMDeviceWifi *self = NM_DEVICE_WIFI (device); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -1062,6 +1094,32 @@ real_check_connection_compatible (NMDevice *device, return FALSE; } + /* Early exit if supplicant or device don't support AP mode */ + if (g_strcmp0 (nm_setting_wireless_get_mode (s_wireless), NM_SETTING_WIRELESS_MODE_AP) == 0) { + if (!(priv->capabilities & NM_WIFI_DEVICE_CAP_AP)) { + g_set_error_literal (error, + NM_WIFI_ERROR, + NM_WIFI_ERROR_AP_MODE_UNSUPPORTED, + "Access Point (AP) mode is not supported by this device."); + return FALSE; + } + + if (priv->supplicant.iface) { + switch (nm_supplicant_interface_get_ap_support (priv->supplicant.iface)) { + case AP_SUPPORT_NO: + g_set_error_literal (error, + NM_WIFI_ERROR, + NM_WIFI_ERROR_AP_MODE_UNSUPPORTED, + "Access Point (AP) mode is not supported by the supplicant."); + return FALSE; + case AP_SUPPORT_YES: + case AP_SUPPORT_UNKNOWN: + default: + break; + } + } + } + // FIXME: check channel/freq/band against bands the hardware supports // FIXME: check encryption against device capabilities // FIXME: check bitrate against device capabilities @@ -1069,6 +1127,37 @@ real_check_connection_compatible (NMDevice *device, return TRUE; } + +static gboolean +check_connection_available (NMDevice *device, NMConnection *connection) +{ + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device); + NMSettingWireless *s_wifi; + const char *mode; + GSList *ap_iter = NULL; + + s_wifi = nm_connection_get_setting_wireless (connection); + + /* Ad-Hoc connections are always available because they may be started + * at any time. + */ + mode = nm_setting_wireless_get_mode (s_wifi); + if (g_strcmp0 (mode, "adhoc") == 0) + return TRUE; + + /* Hidden SSIDs obviously don't always appear in the scan list either */ + if (nm_setting_wireless_get_hidden (s_wifi)) + return TRUE; + + /* check if its visible */ + for (ap_iter = priv->ap_list; ap_iter; ap_iter = g_slist_next (ap_iter)) { + if (nm_ap_check_compatible (NM_AP (ap_iter->data), connection)) + return TRUE; + } + + return FALSE; +} + /* * List of manufacturer default SSIDs that are often unchanged by users. * @@ -1106,11 +1195,11 @@ is_manf_default_ssid (const GByteArray *ssid) } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMDeviceWifi *self = NM_DEVICE_WIFI (device); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -1278,7 +1367,7 @@ real_complete_connection (NMDevice *device, } static gboolean -real_is_available (NMDevice *dev) +is_available (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -1299,7 +1388,8 @@ real_is_available (NMDevice *dev) } state = nm_supplicant_interface_get_state (sup_iface); - if (state != NM_SUPPLICANT_INTERFACE_STATE_READY) { + if ( state < NM_SUPPLICANT_INTERFACE_STATE_READY + || state > NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) { nm_log_dbg (LOGD_WIFI, "(%s): not available because supplicant interface not ready", nm_device_get_iface (dev)); return FALSE; @@ -1309,9 +1399,9 @@ real_is_available (NMDevice *dev) } static NMConnection * -real_get_best_auto_connection (NMDevice *dev, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -1326,6 +1416,7 @@ real_get_best_auto_connection (NMDevice *dev, gboolean mac_blacklist_found = FALSE; NMSettingIP4Config *s_ip4; const char *method = NULL; + guint64 timestamp = 0; s_con = nm_connection_get_setting_connection (connection); if (s_con == NULL) @@ -1335,6 +1426,15 @@ real_get_best_auto_connection (NMDevice *dev, if (!nm_setting_connection_get_autoconnect (s_con)) continue; + /* Don't autoconnect to networks that have been tried at least once + * but haven't been successful, since these are often accidental choices + * from the menu and the user may not know the password. + */ + if (nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), ×tamp)) { + if (timestamp == 0) + continue; + } + s_wireless = nm_connection_get_setting_wireless (connection); if (!s_wireless) continue; @@ -1521,6 +1621,10 @@ scanning_allowed (NMDeviceWifi *self) g_return_val_if_fail (priv->supplicant.iface != NULL, FALSE); + /* Scanning not done in AP mode */ + if (priv->mode == NM_802_11_MODE_AP) + return FALSE; + switch (nm_device_get_state (NM_DEVICE (self))) { case NM_DEVICE_STATE_UNKNOWN: case NM_DEVICE_STATE_UNMANAGED: @@ -1903,6 +2007,7 @@ merge_scanned_ap (NMDeviceWifi *self, priv->ap_list = g_slist_prepend (priv->ap_list, merge_ap); nm_ap_export_to_dbus (merge_ap); g_signal_emit (self, signals[ACCESS_POINT_ADDED], 0, merge_ap); + nm_device_recheck_available_connections (NM_DEVICE (self)); } } @@ -1965,9 +2070,7 @@ cull_scan_list (NMDeviceWifi *self) ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)", ssid ? "'" : ""); - access_point_removed (self, outdated_ap); - priv->ap_list = g_slist_remove (priv->ap_list, outdated_ap); - g_object_unref (outdated_ap); + remove_access_point (self, outdated_ap); removed++; } g_slist_free (outdated_list); @@ -1978,6 +2081,9 @@ cull_scan_list (NMDeviceWifi *self) ap_list_dump (self); + if(removed > 0) + nm_device_recheck_available_connections (NM_DEVICE (self)); + return FALSE; } @@ -2005,10 +2111,12 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface, g_return_if_fail (properties != NULL); g_return_if_fail (iface != NULL); - /* Ignore new APs when unavailable or unamnaged */ + /* Ignore new APs when unavailable, unmanaged, or in AP mode */ state = nm_device_get_state (NM_DEVICE (self)); if (state <= NM_DEVICE_STATE_UNAVAILABLE) return; + if (NM_DEVICE_WIFI_GET_PRIVATE (self)->mode == NM_802_11_MODE_AP) + return; ap = nm_ap_new_from_properties (object_path, properties); if (ap) { @@ -2127,6 +2235,9 @@ static gboolean link_timeout_cb (gpointer user_data) { NMDevice *dev = NM_DEVICE (user_data); + NMDeviceWifi *self = NM_DEVICE_WIFI (dev); + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + NMAccessPoint *ap; nm_log_warn (LOGD_WIFI, "(%s): link timed out.", nm_device_get_iface (dev)); @@ -2136,65 +2247,134 @@ link_timeout_cb (gpointer user_data) * to reassociate within the timeout period, so the connection must * fail. */ - if (nm_device_get_state (dev) == NM_DEVICE_STATE_ACTIVATED) { - nm_device_state_changed (dev, - NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT); - } + if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED) + return FALSE; + + /* Remove whatever access point we used to be connected to from the list + * since it failed and might no longer be visible. If it's actually still + * there, we'll find it in the next scan. + */ + if (priv->current_ap) { + ap = priv->current_ap; + priv->current_ap = NULL; + } else + ap = nm_device_wifi_get_activation_ap (self); + if (ap) + remove_access_point (self, ap); + + nm_device_state_changed (dev, + NM_DEVICE_STATE_FAILED, + priv->ssid_found ? NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT : + NM_DEVICE_STATE_REASON_SSID_NOT_FOUND); return FALSE; } static gboolean -handle_8021x_auth_fail (NMDeviceWifi *self, guint32 new_state, guint32 old_state) +need_new_8021x_secrets (NMDeviceWifi *self, + guint32 old_state, + const char **setting_name) { - NMDevice *device = NM_DEVICE (self); NMSetting8021x *s_8021x; NMSettingWirelessSecurity *s_wsec; NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE; - NMActRequest *req; NMConnection *connection; - const char *setting_name = NULL; - gboolean handled = FALSE; - g_return_val_if_fail (new_state == NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED, FALSE); + g_assert (setting_name != NULL); + + connection = nm_device_get_connection (NM_DEVICE (self)); + g_return_val_if_fail (connection != NULL, FALSE); - /* Only care about ASSOCIATED -> DISCONNECTED transitions since 802.1x stuff - * happens between the ASSOCIATED and AUTHENTICATED states. + /* 802.1x stuff only happens in the supplicant's ASSOCIATED state when it's + * attempting to authenticate with the AP. */ if (old_state != NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED) return FALSE; - req = nm_device_get_act_request (NM_DEVICE (self)); - g_return_val_if_fail (req != NULL, FALSE); - - connection = nm_act_request_get_connection (req); - g_return_val_if_fail (connection != NULL, FALSE); - /* If it's an 802.1x or LEAP connection with "always ask"/unsaved secrets * then we need to ask again because it might be an OTP token and the PIN * may have changed. */ - s_8021x = nm_connection_get_setting_802_1x (connection); - s_wsec = nm_connection_get_setting_wireless_security (connection); + s_8021x = nm_connection_get_setting_802_1x (connection); if (s_8021x) { nm_setting_get_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_PASSWORD, &secret_flags, NULL); - setting_name = NM_SETTING_802_1X_SETTING_NAME; - } else if (s_wsec) { + if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) + *setting_name = NM_SETTING_802_1X_SETTING_NAME; + return *setting_name ? TRUE : FALSE; + } + + s_wsec = nm_connection_get_setting_wireless_security (connection); + if (s_wsec) { nm_setting_get_secret_flags (NM_SETTING (s_wsec), NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, &secret_flags, NULL); - setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME; + if (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) + *setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME; + return *setting_name ? TRUE : FALSE; + } + + /* Not a LEAP or 802.1x connection */ + return FALSE; +} + +static gboolean +need_new_wpa_psk (NMDeviceWifi *self, + guint32 old_state, + const char **setting_name) +{ + NMSettingWirelessSecurity *s_wsec; + NMConnection *connection; + const char *key_mgmt = NULL; + + g_assert (setting_name != NULL); + + connection = nm_device_get_connection (NM_DEVICE (self)); + g_return_val_if_fail (connection != NULL, FALSE); + + /* A bad PSK will cause the supplicant to disconnect during the 4-way handshake */ + if (old_state != NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE) + return FALSE; + + s_wsec = nm_connection_get_setting_wireless_security (connection); + if (s_wsec) + key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec); + + if (g_strcmp0 (key_mgmt, "wpa-psk") == 0) { + *setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME; + return TRUE; } - if (setting_name && (secret_flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)) { - NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION - | NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; + /* Not a WPA-PSK connection */ + return FALSE; +} + +static gboolean +handle_8021x_or_psk_auth_fail (NMDeviceWifi *self, + guint32 new_state, + guint32 old_state, + int disconnect_reason) +{ + NMDevice *device = NM_DEVICE (self); + NMActRequest *req; + NMConnection *connection; + const char *setting_name = NULL; + gboolean handled = FALSE; + + g_return_val_if_fail (new_state == NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED, FALSE); + + req = nm_device_get_act_request (NM_DEVICE (self)); + g_return_val_if_fail (req != NULL, FALSE); + + connection = nm_act_request_get_connection (req); + g_assert (connection); + + if ( need_new_8021x_secrets (self, old_state, &setting_name) + || need_new_wpa_psk (self, old_state, &setting_name)) { nm_connection_clear_secrets (connection); @@ -2204,7 +2384,13 @@ handle_8021x_auth_fail (NMDeviceWifi *self, guint32 new_state, guint32 old_state cleanup_association_attempt (self, TRUE); nm_device_state_changed (device, NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT); - nm_act_request_get_secrets (req, setting_name, flags, NULL, wifi_secrets_cb, self); + nm_act_request_get_secrets (req, + setting_name, + NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION + | NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW, + NULL, + wifi_secrets_cb, + self); handled = TRUE; } @@ -2215,6 +2401,7 @@ static void supplicant_iface_state_cb (NMSupplicantInterface *iface, guint32 new_state, guint32 old_state, + int disconnect_reason, gpointer user_data) { NMDeviceWifi *self = NM_DEVICE_WIFI (user_data); @@ -2235,6 +2422,11 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, devstate = nm_device_get_state (device); scanning = nm_supplicant_interface_get_scanning (iface); + /* In these states we know the supplicant is actually talking to something */ + if ( new_state >= NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING + && new_state <= NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) + priv->ssid_found = TRUE; + switch (new_state) { case NM_SUPPLICANT_INTERFACE_STATE_READY: priv->scan_interval = SCAN_INTERVAL_MIN; @@ -2269,20 +2461,24 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, nm_log_info (LOGD_DEVICE | LOGD_WIFI, "Activation (%s/wireless) Stage 2 of 5 (Device Configure) " - "successful. Connected to wireless network '%s'.", + "successful. %s '%s'.", nm_device_get_iface (device), + priv->mode == NM_802_11_MODE_AP ? "Started Wi-Fi Hotspot" : + "Connected to wireless network", ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)"); nm_device_activate_schedule_stage3_ip_config_start (device); - } + } else if (devstate == NM_DEVICE_STATE_ACTIVATED) + periodic_update (self); break; case NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED: if ((devstate == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating (device)) { - /* Disconnect of an 802.1x/LEAP connection during authentication - * means secrets might be wrong. Not always the case, but until we + /* Disconnect of an 802.1x/LEAP connection during authentication, + * or disconnect of a WPA-PSK connection during the 4-way handshake, + * often means secrets are wrong. Not always the case, but until we * have more information from wpa_supplicant about why the * disconnect happened this is the best we can do. */ - if (handle_8021x_auth_fail (self, new_state, old_state)) + if (handle_8021x_or_psk_auth_fail (self, new_state, old_state, disconnect_reason)) break; } @@ -2292,8 +2488,10 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, * the scan but will be re-established when the scan is done. */ if (devstate == NM_DEVICE_STATE_ACTIVATED) { - if (priv->link_timeout_id == 0) + if (priv->link_timeout_id == 0) { priv->link_timeout_id = g_timeout_add_seconds (scanning ? 30 : 15, link_timeout_cb, self); + priv->ssid_found = FALSE; + } } break; case NM_SUPPLICANT_INTERFACE_STATE_DOWN: @@ -2388,6 +2586,7 @@ supplicant_iface_notify_scanning_cb (NMSupplicantInterface *iface, GParamSpec *pspec, NMDeviceWifi *self) { + NMDeviceState state; gboolean scanning; scanning = nm_supplicant_interface_get_scanning (iface); @@ -2396,6 +2595,11 @@ supplicant_iface_notify_scanning_cb (NMSupplicantInterface *iface, scanning ? "scanning" : "idle"); g_object_notify (G_OBJECT (self), "scanning"); + + /* Run a quick update of current AP when coming out of a scan */ + state = nm_device_get_state (NM_DEVICE (self)); + if (!scanning && state == NM_DEVICE_STATE_ACTIVATED) + periodic_update (self); } static void @@ -2444,10 +2648,7 @@ handle_auth_or_fail (NMDeviceWifi *self, if (setting_name) { NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION; - /* If the caller doesn't necessarily want completely new secrets, - * only ask for new secrets after the first failure. - */ - if (new_secrets || tries) + if (new_secrets) flags |= NM_SETTINGS_GET_SECRETS_FLAG_REQUEST_NEW; nm_act_request_get_secrets (req, setting_name, flags, NULL, wifi_secrets_cb, self); @@ -2493,6 +2694,7 @@ supplicant_connection_timeout_cb (gpointer user_data) { NMDevice *dev = NM_DEVICE (user_data); NMDeviceWifi *self = NM_DEVICE_WIFI (user_data); + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); NMAccessPoint *ap; NMActRequest *req; NMConnection *connection; @@ -2514,24 +2716,30 @@ supplicant_connection_timeout_cb (gpointer user_data) connection = nm_act_request_get_connection (req); g_assert (connection); - ap = nm_device_wifi_get_activation_ap (self); - g_assert (ap); - - if (nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) { - /* In Ad-Hoc mode there's nothing to check the encryption key (if any) - * so supplicant timeouts here are almost certainly the wifi driver - * being really stupid. + if ( priv->mode == NM_802_11_MODE_ADHOC + || priv->mode == NM_802_11_MODE_AP) { + /* In Ad-Hoc and AP modes there's nothing to check the encryption key + * (if any), so supplicant timeouts here are almost certainly the wifi + * driver being really stupid. */ nm_log_warn (LOGD_DEVICE | LOGD_WIFI, - "Activation (%s/wireless): Ad-Hoc network creation took " + "Activation (%s/wireless): %s network creation took " "too long, failing activation.", - nm_device_get_iface (dev)); + nm_device_get_iface (dev), + priv->mode == NM_802_11_MODE_ADHOC ? "Ad-Hoc" : "Hotspot"); nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT); return FALSE; } - if (is_encrypted (ap, connection)) { + g_assert (priv->mode == NM_802_11_MODE_INFRA); + ap = nm_device_wifi_get_activation_ap (self); + g_assert (ap); + + if (priv->ssid_found && is_encrypted (ap, connection)) { + guint64 timestamp = 0; + gboolean new_secrets = TRUE; + /* Connection failed; either driver problems, the encryption key is * wrong, or the passwords or certificates were wrong. */ @@ -2539,7 +2747,15 @@ supplicant_connection_timeout_cb (gpointer user_data) "Activation (%s/wireless): association took too long.", nm_device_get_iface (dev)); - if (handle_auth_or_fail (self, req, TRUE) == NM_ACT_STAGE_RETURN_POSTPONE) { + /* Ask for new secrets only if we've never activated this connection + * before. If we've connected before, don't bother the user with + * dialogs, just retry or fail, and if we never connect the user can + * fix the password somewhere else. + */ + if (nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), ×tamp)) + new_secrets = !timestamp; + + if (handle_auth_or_fail (self, req, new_secrets) == NM_ACT_STAGE_RETURN_POSTPONE) { nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "Activation (%s/wireless): asking for new secrets", nm_device_get_iface (dev)); @@ -2553,7 +2769,8 @@ supplicant_connection_timeout_cb (gpointer user_data) "failing activation.", nm_device_get_iface (dev)); nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED, - NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT); + priv->ssid_found ? NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT : + NM_DEVICE_STATE_REASON_SSID_NOT_FOUND); } return FALSE; @@ -2602,7 +2819,6 @@ build_supplicant_config (NMDeviceWifi *self, NMSupplicantConfig *config = NULL; NMSettingWireless *s_wireless; NMSettingWirelessSecurity *s_wireless_sec; - guint32 adhoc_freq = 0; g_return_val_if_fail (self != NULL, NULL); @@ -2613,35 +2829,16 @@ build_supplicant_config (NMDeviceWifi *self, if (!config) return NULL; - /* Supplicant requires an initial frequency for Ad-Hoc networks; if the user - * didn't specify one and we didn't find an AP that matched the connection, - * just pick a frequency the device supports. - */ - if (nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) { - const char *band = nm_setting_wireless_get_band (s_wireless); - const guint32 a_freqs[] = { 5180, 5200, 5220, 5745, 5765, 5785, 5805, 0 }; - const guint32 bg_freqs[] = { 2412, 2437, 2462, 2472, 0 }; - - adhoc_freq = nm_ap_get_freq (ap); - if (!adhoc_freq) { - if (g_strcmp0 (band, "a") == 0) - adhoc_freq = wifi_utils_find_freq (priv->wifi_data, a_freqs); - else - adhoc_freq = wifi_utils_find_freq (priv->wifi_data, bg_freqs); - } - - if (!adhoc_freq) { - if (g_strcmp0 (band, "a") == 0) - adhoc_freq = 5180; - else - adhoc_freq = 2462; - } + /* Warn if AP mode may not be supported */ + if ( g_strcmp0 (nm_setting_wireless_get_mode (s_wireless), NM_SETTING_WIRELESS_MODE_AP) == 0 + && nm_supplicant_interface_get_ap_support (priv->supplicant.iface) == AP_SUPPORT_UNKNOWN) { + nm_log_warn (LOGD_WIFI, "Supplicant may not support AP mode; connection may time out."); } if (!nm_supplicant_config_add_setting_wireless (config, s_wireless, nm_ap_get_broadcast (ap), - adhoc_freq, + nm_ap_get_freq (ap), wifi_utils_can_scan_ssid (priv->wifi_data))) { nm_log_err (LOGD_WIFI, "Couldn't add 802-11-wireless setting to supplicant config."); goto error; @@ -2679,7 +2876,7 @@ error: /****************************************************************************/ static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); struct ifreq req; @@ -2704,7 +2901,7 @@ real_update_hw_address (NMDevice *dev) } static void -real_update_permanent_hw_address (NMDevice *dev) +update_permanent_hw_address (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -2746,7 +2943,7 @@ real_update_permanent_hw_address (NMDevice *dev) } static void -real_update_initial_hw_address (NMDevice *dev) +update_initial_hw_address (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -2758,7 +2955,7 @@ real_update_initial_hw_address (NMDevice *dev) * be called from NMDevice constructor() to really get the initial address. */ if (!memcmp (&priv->hw_addr, &zero, ETH_ALEN)) - real_update_hw_address (dev); + update_hw_address (dev); if (memcmp (&priv->initial_hw_addr, &priv->hw_addr, ETH_ALEN)) memcpy (&priv->initial_hw_addr, &priv->hw_addr, ETH_ALEN); @@ -2773,7 +2970,7 @@ real_update_initial_hw_address (NMDevice *dev) } static NMActStageReturn -real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -2783,6 +2980,7 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) NMSettingWireless *s_wireless; const GByteArray *cloned_mac; GSList *iter; + const char *mode; req = nm_device_get_act_request (NM_DEVICE (self)); g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE); @@ -2790,6 +2988,22 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) connection = nm_act_request_get_connection (req); g_return_val_if_fail (connection != NULL, NM_ACT_STAGE_RETURN_FAILURE); + s_wireless = nm_connection_get_setting_wireless (connection); + g_assert (s_wireless); + + mode = nm_setting_wireless_get_mode (s_wireless); + if (g_strcmp0 (mode, "infra") == 0) + priv->mode = NM_802_11_MODE_INFRA; + else if (g_strcmp0 (mode, "adhoc") == 0) + priv->mode = NM_802_11_MODE_ADHOC; + else if (g_strcmp0 (mode, "ap") == 0) { + priv->mode = NM_802_11_MODE_AP; + + /* Scanning not done in AP mode; clear the scan list */ + remove_all_aps (self); + } + g_object_notify (G_OBJECT (self), NM_DEVICE_WIFI_MODE); + /* The kernel doesn't support Ad-Hoc WPA connections well at this time, * and turns them into open networks. It's been this way since at least * 2.6.30 or so; until that's fixed, disable WPA-protected Ad-Hoc networks. @@ -2801,34 +3015,32 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) } /* Set spoof MAC to the interface */ - s_wireless = nm_connection_get_setting_wireless (connection); - g_assert (s_wireless); - cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless); if (cloned_mac && (cloned_mac->len == ETH_ALEN)) _set_hw_addr (self, (const guint8 *) cloned_mac->data, "set"); - /* If the user is trying to connect to an AP that NM doesn't yet know about - * (hidden network or something), create an fake AP from the security - * settings in the connection to use until the AP is recognized from the - * scan list, which should show up when the connection is successful. - */ - ap = nm_device_wifi_get_activation_ap (self); - if (ap) - goto done; + /* AP mode never uses a specific object or existing scanned AP */ + if (priv->mode != NM_802_11_MODE_AP) { + ap = nm_device_wifi_get_activation_ap (self); + if (ap) + goto done; - /* Find a compatible AP in the scan list */ - for (iter = priv->ap_list; iter; iter = g_slist_next (iter)) { - NMAccessPoint *candidate = NM_AP (iter->data); + /* Find a compatible AP in the scan list */ + for (iter = priv->ap_list; iter; iter = g_slist_next (iter)) { + NMAccessPoint *candidate = NM_AP (iter->data); - if (nm_ap_check_compatible (candidate, connection)) { - ap = candidate; - break; + if (nm_ap_check_compatible (candidate, connection)) { + ap = candidate; + break; + } } } - /* If no compatible AP was found, create a fake AP (network is likely - * hidden) and try to use that. + /* If the user is trying to connect to an AP that NM doesn't yet know about + * (hidden network or something) or starting a Hotspot, create an fake AP + * from the security settings in the connection. This "fake" AP gets used + * until the real one is found in the scan list (Ad-Hoc or Hidden), or until + * the device is deactivated (Hotspot). */ if (!ap) { ap = nm_ap_new_fake_from_connection (connection); @@ -2836,21 +3048,51 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) if (nm_ap_get_mode (ap) == NM_802_11_MODE_INFRA) nm_ap_set_broadcast (ap, FALSE); + else if (nm_ap_is_hotspot (ap)) + nm_ap_set_address (ap, (const struct ether_addr *) &priv->hw_addr); priv->ap_list = g_slist_prepend (priv->ap_list, ap); nm_ap_export_to_dbus (ap); g_signal_emit (self, signals[ACCESS_POINT_ADDED], 0, ap); + nm_device_recheck_available_connections (NM_DEVICE (self)); } nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), nm_ap_get_dbus_path (ap)); done: - set_current_ap (self, ap); + set_active_ap (self, ap); return NM_ACT_STAGE_RETURN_SUCCESS; } +static void +ensure_hotspot_frequency (NMDeviceWifi *self, + NMSettingWireless *s_wifi, + NMAccessPoint *ap) +{ + NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + const char *band = nm_setting_wireless_get_band (s_wifi); + const guint32 a_freqs[] = { 5180, 5200, 5220, 5745, 5765, 5785, 5805, 0 }; + const guint32 bg_freqs[] = { 2412, 2437, 2462, 2472, 0 }; + guint32 freq = 0; + + g_assert (ap); + + if (nm_ap_get_freq (ap)) + return; + + if (g_strcmp0 (band, "a") == 0) + freq = wifi_utils_find_freq (priv->wifi_data, a_freqs); + else + freq = wifi_utils_find_freq (priv->wifi_data, bg_freqs); + + if (!freq) + freq = (g_strcmp0 (band, "a") == 0) ? 5180 : 2462; + + nm_ap_set_freq (ap, freq); +} + static NMActStageReturn -real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -2907,6 +3149,16 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) iface, nm_connection_get_id (connection)); } + priv->ssid_found = FALSE; + + /* Supplicant requires an initial frequency for Ad-Hoc and Hotspot; if the user + * didn't specify one and we didn't find an AP that matched the connection, + * just pick a frequency the device supports. + */ + if ((nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) || nm_ap_is_hotspot (ap)) + ensure_hotspot_frequency (self, s_wireless, ap); + + /* Build up the supplicant configuration */ config = build_supplicant_config (self, connection, ap); if (config == NULL) { nm_log_err (LOGD_DEVICE | LOGD_WIFI, @@ -2953,7 +3205,7 @@ out: } static void -real_ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) +ip4_config_pre_commit (NMDevice *device, NMIP4Config *config) { NMConnection *connection; NMSettingWireless *s_wifi; @@ -3011,6 +3263,11 @@ handle_ip_config_timeout (NMDeviceWifi *self, g_return_val_if_fail (connection != NULL, NM_ACT_STAGE_RETURN_FAILURE); + if (NM_DEVICE_WIFI_GET_PRIVATE (self)->mode == NM_802_11_MODE_AP) { + *chain_up = TRUE; + return ret; + } + ap = nm_device_wifi_get_activation_ap (self); g_assert (ap); @@ -3047,7 +3304,7 @@ handle_ip_config_timeout (NMDeviceWifi *self, static NMActStageReturn -real_act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason) +act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason) { NMConnection *connection; NMSettingIP4Config *s_ip4; @@ -3069,7 +3326,7 @@ real_act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason) } static NMActStageReturn -real_act_stage4_ip6_config_timeout (NMDevice *dev, NMDeviceStateReason *reason) +act_stage4_ip6_config_timeout (NMDevice *dev, NMDeviceStateReason *reason) { NMConnection *connection; NMSettingIP6Config *s_ip6; @@ -3163,7 +3420,6 @@ static void activation_failure_handler (NMDevice *dev) { NMDeviceWifi *self = NM_DEVICE_WIFI (dev); - NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); NMAccessPoint *ap; NMConnection *connection; @@ -3181,15 +3437,13 @@ activation_failure_handler (NMDevice *dev) * list because we don't have any scan or capability info * for it, and they are pretty much useless. */ - access_point_removed (self, ap); - priv->ap_list = g_slist_remove (priv->ap_list, ap); - g_object_unref (ap); + remove_access_point (self, ap); } } } static gboolean -real_can_interrupt_activation (NMDevice *dev) +can_interrupt_activation (NMDevice *dev) { if (nm_device_get_state (dev) == NM_DEVICE_STATE_NEED_AUTH) return TRUE; @@ -3199,7 +3453,7 @@ real_can_interrupt_activation (NMDevice *dev) static guint32 -real_get_type_capabilities (NMDevice *dev) +get_type_capabilities (NMDevice *dev) { return NM_DEVICE_WIFI_GET_PRIVATE (dev)->capabilities; } @@ -3252,8 +3506,7 @@ static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) + NMDeviceStateReason reason) { NMDeviceWifi *self = NM_DEVICE_WIFI (device); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -3306,7 +3559,10 @@ device_state_changed (NMDevice *device, activation_failure_handler (device); break; case NM_DEVICE_STATE_DISCONNECTED: - // FIXME: ensure that the activation request is destroyed + /* Kick off a scan to get latest results */ + priv->scan_interval = SCAN_INTERVAL_MIN; + cancel_pending_scan (self); + request_wireless_scan (self); break; default: break; @@ -3334,7 +3590,7 @@ nm_device_wifi_get_activation_ap (NMDeviceWifi *self) } static void -real_set_enabled (NMDevice *device, gboolean enabled) +set_enabled (NMDevice *device, gboolean enabled) { NMDeviceWifi *self = NM_DEVICE_WIFI (device); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); @@ -3413,9 +3669,9 @@ nm_device_wifi_new (const char *udi, } static void -nm_device_wifi_init (NMDeviceWifi * self) +nm_device_wifi_init (NMDeviceWifi *self) { - g_signal_connect (self, "state-changed", G_CALLBACK (device_state_changed), NULL); + NM_DEVICE_WIFI_GET_PRIVATE (self)->mode = NM_802_11_MODE_INFRA; } static void @@ -3444,7 +3700,7 @@ dispose (GObject *object) priv->supplicant.mgr = NULL; } - set_current_ap (self, NULL); + set_active_ap (self, NULL); remove_all_aps (self); if (priv->wifi_data) @@ -3474,7 +3730,7 @@ get_property (GObject *object, guint prop_id, g_value_take_string (value, nm_utils_hwaddr_ntoa (&priv->perm_hw_addr, ARPHRD_ETHER)); break; case PROP_MODE: - g_value_set_uint (value, wifi_utils_get_mode (priv->wifi_data)); + g_value_set_uint (value, priv->mode); break; case PROP_BITRATE: g_value_set_uint (value, priv->rate); @@ -3531,33 +3787,36 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) object_class->set_property = set_property; object_class->dispose = dispose; - parent_class->get_type_capabilities = real_get_type_capabilities; - parent_class->get_generic_capabilities = real_get_generic_capabilities; - parent_class->hw_is_up = real_hw_is_up; - parent_class->hw_bring_up = real_hw_bring_up; - parent_class->hw_take_down = real_hw_take_down; - parent_class->is_up = real_is_up; - parent_class->bring_up = real_bring_up; - parent_class->take_down = real_take_down; - parent_class->update_hw_address = real_update_hw_address; - parent_class->update_permanent_hw_address = real_update_permanent_hw_address; - parent_class->update_initial_hw_address = real_update_initial_hw_address; - parent_class->get_best_auto_connection = real_get_best_auto_connection; - parent_class->is_available = real_is_available; - parent_class->check_connection_compatible = real_check_connection_compatible; - parent_class->complete_connection = real_complete_connection; - parent_class->set_enabled = real_set_enabled; - - parent_class->act_stage1_prepare = real_act_stage1_prepare; - parent_class->act_stage2_config = real_act_stage2_config; - parent_class->ip4_config_pre_commit = real_ip4_config_pre_commit; - parent_class->act_stage4_ip4_config_timeout = real_act_stage4_ip4_config_timeout; - parent_class->act_stage4_ip6_config_timeout = real_act_stage4_ip6_config_timeout; - parent_class->deactivate = real_deactivate; - parent_class->can_interrupt_activation = real_can_interrupt_activation; + parent_class->get_type_capabilities = get_type_capabilities; + parent_class->get_generic_capabilities = get_generic_capabilities; + parent_class->hw_is_up = hw_is_up; + parent_class->hw_bring_up = hw_bring_up; + parent_class->hw_take_down = hw_take_down; + parent_class->is_up = is_up; + parent_class->bring_up = bring_up; + parent_class->take_down = take_down; + parent_class->update_hw_address = update_hw_address; + parent_class->update_permanent_hw_address = update_permanent_hw_address; + parent_class->update_initial_hw_address = update_initial_hw_address; + parent_class->get_best_auto_connection = get_best_auto_connection; + parent_class->is_available = is_available; + parent_class->check_connection_compatible = check_connection_compatible; + parent_class->check_connection_available = check_connection_available; + parent_class->complete_connection = complete_connection; + parent_class->set_enabled = set_enabled; + + parent_class->act_stage1_prepare = act_stage1_prepare; + parent_class->act_stage2_config = act_stage2_config; + parent_class->ip4_config_pre_commit = ip4_config_pre_commit; + parent_class->act_stage4_ip4_config_timeout = act_stage4_ip4_config_timeout; + parent_class->act_stage4_ip6_config_timeout = act_stage4_ip6_config_timeout; + parent_class->deactivate = deactivate; + parent_class->can_interrupt_activation = can_interrupt_activation; parent_class->spec_match_list = spec_match_list; parent_class->hwaddr_matches = hwaddr_matches; + parent_class->state_changed = device_state_changed; + klass->scanning_allowed = scanning_allowed; /* Properties */ @@ -3580,7 +3839,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) "Mode", "Mode", NM_802_11_MODE_UNKNOWN, - NM_802_11_MODE_INFRA, + NM_802_11_MODE_AP, NM_802_11_MODE_INFRA, G_PARAM_READABLE)); @@ -3634,7 +3893,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) g_signal_new ("access-point-removed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_removed), + 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, diff --git a/src/nm-device-wifi.h b/src/nm-device-wifi.h index b22c78b3a..26d66ffcf 100644 --- a/src/nm-device-wifi.h +++ b/src/nm-device-wifi.h @@ -47,6 +47,7 @@ typedef enum { NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND, /*< nick=AccessPointNotFound >*/ NM_WIFI_ERROR_SCAN_NOT_ALLOWED, /*< nick=ScanNotAllowed >*/ + NM_WIFI_ERROR_AP_MODE_UNSUPPORTED, /*< nick=ApModeUnsupported >*/ } NMWifiError; #define NM_DEVICE_WIFI_HW_ADDRESS "hw-address" diff --git a/src/nm-device-wired.c b/src/nm-device-wired.c index c1122e550..44510fc63 100644 --- a/src/nm-device-wired.c +++ b/src/nm-device-wired.c @@ -311,6 +311,9 @@ constructor (GType type, /* We may not know the hardware address type until a slave is added */ priv->hw_addr_type = ARPHRD_ETHER; priv->hw_addr_len = ETH_ALEN; + } else if (nm_device_get_device_type (self) == NM_DEVICE_TYPE_BRIDGE) { + priv->hw_addr_type = ARPHRD_ETHER; + priv->hw_addr_len = ETH_ALEN; } else g_assert_not_reached (); @@ -354,13 +357,13 @@ nm_device_wired_init (NMDeviceWired * self) } static gboolean -real_hw_is_up (NMDevice *device) +hw_is_up (NMDevice *device) { return nm_system_iface_is_up (nm_device_get_ip_ifindex (device)); } static gboolean -real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) +hw_bring_up (NMDevice *dev, gboolean *no_firmware) { gboolean success, carrier; guint32 caps; @@ -377,13 +380,13 @@ real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) } static void -real_hw_take_down (NMDevice *dev) +hw_take_down (NMDevice *dev) { nm_system_iface_set_up (nm_device_get_ip_ifindex (dev), FALSE, NULL); } static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { NMDeviceWired *self = NM_DEVICE_WIRED (dev); NMDeviceWiredPrivate *priv = NM_DEVICE_WIRED_GET_PRIVATE (self); @@ -421,7 +424,7 @@ real_update_hw_address (NMDevice *dev) } static gboolean -real_can_interrupt_activation (NMDevice *dev) +can_interrupt_activation (NMDevice *dev) { NMDeviceWired *self = NM_DEVICE_WIRED (dev); gboolean interrupt = FALSE; @@ -437,7 +440,7 @@ real_can_interrupt_activation (NMDevice *dev) } static gboolean -real_is_available (NMDevice *dev) +is_available (NMDevice *dev) { NMDeviceWired *self = NM_DEVICE_WIRED (dev); @@ -502,12 +505,12 @@ nm_device_wired_class_init (NMDeviceWiredClass *klass) object_class->constructor = constructor; object_class->dispose = dispose; - parent_class->hw_is_up = real_hw_is_up; - parent_class->hw_bring_up = real_hw_bring_up; - parent_class->hw_take_down = real_hw_take_down; - parent_class->can_interrupt_activation = real_can_interrupt_activation; - parent_class->update_hw_address = real_update_hw_address; - parent_class->is_available = real_is_available; + parent_class->hw_is_up = hw_is_up; + parent_class->hw_bring_up = hw_bring_up; + parent_class->hw_take_down = hw_take_down; + parent_class->can_interrupt_activation = can_interrupt_activation; + parent_class->update_hw_address = update_hw_address; + parent_class->is_available = is_available; parent_class->connection_match_config = connection_match_config; } diff --git a/src/nm-device.c b/src/nm-device.c index cfd3ba566..c4cfbce03 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -40,7 +40,7 @@ #include "nm-glib-compat.h" #include "nm-device.h" #include "nm-device-private.h" -#include "backends/nm-backend.h" +#include "nm-device-ethernet.h" #include "NetworkManagerUtils.h" #include "nm-system.h" #include "nm-dhcp-manager.h" @@ -65,6 +65,8 @@ #include "nm-connection-provider.h" #include "nm-posix-signals.h" #include "nm-manager-auth.h" +#include "nm-dbus-glib-types.h" +#include "nm-dispatcher.h" static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context); @@ -123,6 +125,7 @@ enum { PROP_TYPE_DESC, PROP_RFKILL_TYPE, PROP_IFINDEX, + PROP_AVAILABLE_CONNECTIONS, LAST_PROP }; @@ -136,6 +139,7 @@ G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, G_TYPE_OBJECT) typedef enum { IP_NONE = 0, + IP_WAIT, IP_CONF, IP_DONE } IpState; @@ -147,6 +151,12 @@ typedef struct { } QueuedState; typedef struct { + NMDevice *slave; + gboolean enslaved; + guint watch_id; +} SlaveInfo; + +typedef struct { gboolean disposed; gboolean initialized; @@ -169,6 +179,7 @@ typedef struct { gboolean managed; /* whether managed by NM or not */ RfKillType rfkill_type; gboolean firmware_missing; + GHashTable * available_connections; guint32 ip4_address; @@ -177,8 +188,6 @@ typedef struct { gpointer act_source_func; guint act_source6_id; gpointer act_source6_func; - guint act_dep_result_id; - guint act_dep_timeout_id; gulong secrets_updated_id; gulong secrets_failed_id; @@ -237,10 +246,20 @@ typedef struct { /* allow autoconnect feature */ gboolean autoconnect; - /* master interface for bridge, bond, vlan, etc */ - NMDevice * master; + /* master interface for bridge/bond slave */ + NMDevice * master; + gboolean enslaved; + + /* list of SlaveInfo for bond/bridge master */ + GSList * slaves; NMConnectionProvider *con_provider; + + /* connection provider signals for available connections property */ + guint cp_added_id; + guint cp_loaded_id; + guint cp_removed_id; + guint cp_updated_id; } NMDevicePrivate; static void nm_device_take_down (NMDevice *dev, gboolean wait, NMDeviceStateReason reason); @@ -258,10 +277,21 @@ static gboolean nm_device_set_ip6_config (NMDevice *dev, static gboolean nm_device_activate_ip6_config_commit (gpointer user_data); +static gboolean check_connection_available (NMDevice *device, NMConnection *connection); + +static void _clear_available_connections (NMDevice *device, gboolean do_signal); + static void dhcp4_cleanup (NMDevice *self, gboolean stop, gboolean release); static const char *reason_to_string (NMDeviceStateReason reason); +static void cp_connection_added (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data); +static void cp_connections_loaded (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data); +static void cp_connection_removed (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data); +static void cp_connection_updated (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data); + +static const char *state_to_string (NMDeviceState state); + static void nm_device_init (NMDevice *self) { @@ -274,6 +304,7 @@ nm_device_init (NMDevice *self) priv->dhcp_timeout = 0; priv->rfkill_type = RFKILL_TYPE_UNKNOWN; priv->autoconnect = DEFAULT_AUTOCONNECT; + priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); } static void @@ -468,7 +499,7 @@ nm_device_hw_is_up (NMDevice *self) } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return 0; } @@ -685,7 +716,7 @@ nm_device_get_type_capabilities (NMDevice *self) } static guint32 -real_get_type_capabilities (NMDevice *self) +get_type_capabilities (NMDevice *self) { return NM_DEVICE_CAP_NONE; } @@ -713,6 +744,25 @@ nm_device_set_connection_provider (NMDevice *device, g_return_if_fail (priv->con_provider == NULL); priv->con_provider = provider; + priv->cp_added_id = g_signal_connect (priv->con_provider, + NM_CP_SIGNAL_CONNECTION_ADDED, + G_CALLBACK (cp_connection_added), + device); + + priv->cp_loaded_id = g_signal_connect (priv->con_provider, + NM_CP_SIGNAL_CONNECTIONS_LOADED, + G_CALLBACK (cp_connections_loaded), + device); + + priv->cp_removed_id = g_signal_connect (priv->con_provider, + NM_CP_SIGNAL_CONNECTION_REMOVED, + G_CALLBACK (cp_connection_removed), + device); + + priv->cp_updated_id = g_signal_connect (priv->con_provider, + NM_CP_SIGNAL_CONNECTION_UPDATED, + G_CALLBACK (cp_connection_updated), + device); } NMConnectionProvider * @@ -723,10 +773,35 @@ nm_device_get_connection_provider (NMDevice *device) return NM_DEVICE_GET_PRIVATE (device)->con_provider; } +static SlaveInfo * +find_slave_info (NMDevice *self, NMDevice *slave) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + SlaveInfo *info; + GSList *iter; + + for (iter = priv->slaves; iter; iter = g_slist_next (iter)) { + info = iter->data; + if (info->slave == slave) + return info; + } + return NULL; +} + +static void +free_slave_info (SlaveInfo *info) +{ + g_signal_handler_disconnect (info->slave, info->watch_id); + g_clear_object (&info->slave); + memset (info, 0, sizeof (*info)); + g_free (info); +} + /** * nm_device_enslave_slave: * @dev: the master device * @slave: the slave device to enslave + * @connection: the slave device's connection * * If @dev is capable of enslaving other devices (ie it's a bridge, bond, etc) * then this function enslaves @slave. @@ -734,22 +809,35 @@ nm_device_get_connection_provider (NMDevice *device) * Returns: %TRUE on success, %FALSE on failure or if this device cannot enslave * other devices. */ -gboolean -nm_device_enslave_slave (NMDevice *dev, NMDevice *slave) +static gboolean +nm_device_enslave_slave (NMDevice *dev, NMDevice *slave, NMConnection *connection) { + SlaveInfo *info; + gboolean success = FALSE; + g_return_val_if_fail (dev != NULL, FALSE); g_return_val_if_fail (slave != NULL, FALSE); g_return_val_if_fail (nm_device_get_state (slave) >= NM_DEVICE_STATE_DISCONNECTED, FALSE); + g_return_val_if_fail (NM_DEVICE_GET_CLASS (dev)->enslave_slave != NULL, FALSE); - if (NM_DEVICE_GET_CLASS (dev)->enslave_slave) - return NM_DEVICE_GET_CLASS (dev)->enslave_slave (dev, slave); - return FALSE; + info = find_slave_info (dev, slave); + if (!info) + return FALSE; + + g_warn_if_fail (info->enslaved == FALSE); + success = NM_DEVICE_GET_CLASS (dev)->enslave_slave (dev, slave, connection); + if (success) { + info->enslaved = TRUE; + nm_device_slave_notify_enslaved (info->slave, TRUE, FALSE); + } + return success; } /** - * nm_device_release_slave: + * nm_device_release_one_slave: * @dev: the master device * @slave: the slave device to release + * @failed: %TRUE if the release was unexpected, ie the master failed * * If @dev is capable of enslaving other devices (ie it's a bridge, bond, etc) * then this function releases the previously enslaved @slave. @@ -757,15 +845,197 @@ nm_device_enslave_slave (NMDevice *dev, NMDevice *slave) * Returns: %TRUE on success, %FALSE on failure, if this device cannot enslave * other devices, or if @slave was never enslaved. */ +static gboolean +nm_device_release_one_slave (NMDevice *dev, NMDevice *slave, gboolean failed) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + SlaveInfo *info; + gboolean success = FALSE; + + g_return_val_if_fail (slave != NULL, FALSE); + g_return_val_if_fail (NM_DEVICE_GET_CLASS (dev)->release_slave != NULL, FALSE); + + info = find_slave_info (dev, slave); + if (!info) + return FALSE; + + if (info->enslaved) { + success = NM_DEVICE_GET_CLASS (dev)->release_slave (dev, slave); + g_warn_if_fail (success); + } + nm_device_slave_notify_enslaved (info->slave, FALSE, failed); + + priv->slaves = g_slist_remove (priv->slaves, info); + free_slave_info (info); + return success; +} + +static void +slave_state_changed (NMDevice *slave, + NMDeviceState slave_new_state, + NMDeviceState slave_old_state, + NMDeviceStateReason reason, + NMDevice *self) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + gboolean release = FALSE; + + nm_log_dbg (LOGD_DEVICE, "(%s): slave %s state change %d (%s) -> %d (%s)", + nm_device_get_iface (self), + nm_device_get_iface (slave), + slave_old_state, + state_to_string (slave_old_state), + slave_new_state, + state_to_string (slave_new_state)); + + g_assert (priv->state > NM_DEVICE_STATE_DISCONNECTED); + g_assert (priv->state <= NM_DEVICE_STATE_ACTIVATED); + + /* Don't try to enslave slaves until the master is ready */ + if (priv->state < NM_DEVICE_STATE_CONFIG) + return; + + if (slave_new_state == NM_DEVICE_STATE_IP_CONFIG) + nm_device_enslave_slave (self, slave, nm_device_get_connection (slave)); + else if (slave_new_state > NM_DEVICE_STATE_ACTIVATED) + release = TRUE; + else if ( slave_new_state <= NM_DEVICE_STATE_DISCONNECTED + && slave_old_state > NM_DEVICE_STATE_DISCONNECTED) { + /* Catch failures due to unavailable or unmanaged */ + release = TRUE; + } + + if (release) { + nm_device_release_one_slave (self, slave, FALSE); + if (priv->slaves == NULL) { + /* FIXME: all slaves gone; do something? */ + } + } +} + +/** + * nm_device_master_add_slave: + * @dev: the master device + * @slave: the slave device to enslave + * + * If @dev is capable of enslaving other devices (ie it's a bridge, bond, etc) + * then this function adds @slave to the slave list for later enslavement. + * + * Returns: %TRUE on success, %FALSE on failure + */ gboolean -nm_device_release_slave (NMDevice *dev, NMDevice *slave) +nm_device_master_add_slave (NMDevice *dev, NMDevice *slave) { + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + SlaveInfo *info; + g_return_val_if_fail (dev != NULL, FALSE); g_return_val_if_fail (slave != NULL, FALSE); + g_return_val_if_fail (nm_device_get_state (slave) >= NM_DEVICE_STATE_DISCONNECTED, FALSE); + g_return_val_if_fail (NM_DEVICE_GET_CLASS (dev)->enslave_slave != NULL, FALSE); + + if (!find_slave_info (dev, slave)) { + info = g_malloc0 (sizeof (SlaveInfo)); + info->slave = g_object_ref (slave); + info->watch_id = g_signal_connect (slave, "state-changed", + G_CALLBACK (slave_state_changed), dev); + priv->slaves = g_slist_prepend (priv->slaves, info); + } - if (NM_DEVICE_GET_CLASS (dev)->release_slave) - return NM_DEVICE_GET_CLASS (dev)->release_slave (dev, slave); - return FALSE; + return TRUE; +} + + +/** + * nm_device_master_get_slaves: + * @dev: the master device + * + * Returns: any slaves of which @device is the master. Caller owns returned list. + */ +GSList * +nm_device_master_get_slaves (NMDevice *dev) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + GSList *slaves = NULL, *iter; + + for (iter = priv->slaves; iter; iter = g_slist_next (iter)) + slaves = g_slist_prepend (slaves, ((SlaveInfo *) iter->data)->slave); + + return slaves; +} + +/* release all slaves */ +static void +nm_device_master_release_slaves (NMDevice *self, gboolean failed) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + GSList *iter; + + for (iter = priv->slaves; iter; iter = g_slist_next (iter)) + nm_device_release_one_slave (self, ((SlaveInfo *) iter->data)->slave, failed); + g_slist_free (priv->slaves); + priv->slaves = NULL; +} + + +/** + * nm_device_slave_notify_enslaved: + * @dev: the slave device + * @enslaved: %TRUE if the device is now enslaved, %FALSE if released + * @master_failed: if released, indicates whether the release was unexpected, + * ie the master device failed. + * + * Notifies a slave that it has been enslaved or released. If released, provides + * information on whether the release was expected or not, and thus whether the + * slave should fail it's activation or gracefully deactivate. + */ +void +nm_device_slave_notify_enslaved (NMDevice *dev, + gboolean enslaved, + gboolean master_failed) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMConnection *connection = nm_device_get_connection (dev); + + g_assert (priv->master); + + if (enslaved) { + g_warn_if_fail (priv->enslaved == FALSE); + g_warn_if_fail (priv->state == NM_DEVICE_STATE_IP_CONFIG); + + nm_log_info (LOGD_DEVICE, + "Activation (%s) connection '%s' enslaved, continuing activation", + nm_device_get_iface (dev), + nm_connection_get_id (connection)); + + /* Now that we're enslaved, proceed with activation. Remember, slaves + * don't have any IP configuration, so they skip directly to SECONDARIES. + */ + priv->enslaved = TRUE; + priv->ip4_state = IP_DONE; + priv->ip6_state = IP_DONE; + nm_device_queue_state (dev, NM_DEVICE_STATE_SECONDARIES, NM_DEVICE_STATE_REASON_NONE); + } else { + NMDeviceState new_state = NM_DEVICE_STATE_DISCONNECTED; + NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; + + if (master_failed) { + new_state = NM_DEVICE_STATE_FAILED; + reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; + + nm_log_warn (LOGD_DEVICE, + "Activation (%s) connection '%s' master failed", + nm_device_get_iface (dev), + nm_connection_get_id (connection)); + } else { + nm_log_dbg (LOGD_DEVICE, + "Activation (%s) connection '%s' master deactivated", + nm_device_get_iface (dev), + nm_connection_get_id (connection)); + } + + nm_device_queue_state (dev, new_state, reason); + } } /* @@ -1055,28 +1325,9 @@ ip6_method_matches (NMConnection *connection, const char *match) } static NMActStageReturn -real_act_stage1_prepare (NMDevice *self, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *self, NMDeviceStateReason *reason) { - NMActRequest *req; - NMActiveConnection *master_ac; - NMDevice *master; - NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; - - req = nm_device_get_act_request (self); - g_assert (req); - - /* If the interface is going to be a slave, let the master enslave it here */ - master_ac = nm_act_request_get_dependency (req); - if (master_ac && NM_IS_ACT_REQUEST (master_ac)) { - /* FIXME: handle VPNs here too */ - - master = NM_DEVICE (nm_act_request_get_device (NM_ACT_REQUEST (master_ac))); - g_assert (master); - if (!nm_device_enslave_slave (master, self)) - ret = NM_ACT_STAGE_RETURN_FAILURE; - } - - return ret; + return NM_ACT_STAGE_RETURN_SUCCESS; } /* @@ -1097,11 +1348,6 @@ nm_device_activate_stage1_device_prepare (gpointer user_data) /* Clear the activation source ID now that this stage has run */ activation_source_clear (self, FALSE, 0); - if (priv->act_dep_timeout_id) { - g_source_remove (priv->act_dep_timeout_id); - priv->act_dep_timeout_id = 0; - } - priv->ip4_state = priv->ip6_state = IP_NONE; iface = nm_device_get_iface (self); @@ -1148,8 +1394,19 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self) } static NMActStageReturn -real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) { + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + GSList *iter; + + /* If we have slaves that aren't yet enslaved, do that now */ + for (iter = priv->slaves; iter; iter = g_slist_next (iter)) { + SlaveInfo *info = iter->data; + + if (nm_device_get_state (info->slave) == NM_DEVICE_STATE_IP_CONFIG) + nm_device_enslave_slave (dev, info->slave, nm_device_get_connection (info->slave)); + } + /* Nothing to do */ return NM_ACT_STAGE_RETURN_SUCCESS; } @@ -1550,14 +1807,14 @@ dhcp4_lease_change (NMDevice *device, NMIP4Config *config) nm_utils_merge_ip4_config (config, nm_connection_get_setting_ip4_config (connection)); if (!nm_device_set_ip4_config (device, config, FALSE, &reason)) { - nm_log_warn (LOGD_DHCP6, "(%s): failed to update IPv4 config in response to DHCP event.", + nm_log_warn (LOGD_DHCP4, "(%s): failed to update IPv4 config in response to DHCP event.", nm_device_get_ip_iface (device)); nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason); return; } /* Notify dispatcher scripts of new DHCP4 config */ - nm_utils_call_dispatcher ("dhcp4-change", connection, device, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_DHCP4_CHANGE, connection, device, NULL, NULL); } static void @@ -1770,9 +2027,9 @@ shared4_new_config (NMDevice *self, NMDeviceStateReason *reason) /*********************************************/ static NMActStageReturn -real_act_stage3_ip4_config_start (NMDevice *self, - NMIP4Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip4_config_start (NMDevice *self, + NMIP4Config **out_config, + NMDeviceStateReason *reason) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection; @@ -1932,7 +2189,7 @@ dhcp6_lease_change (NMDevice *device) nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason); } else { /* Notify dispatcher scripts of new DHCPv6 config */ - nm_utils_call_dispatcher ("dhcp6-change", connection, device, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_DHCP6_CHANGE, connection, device, NULL, NULL); } } @@ -2030,8 +2287,6 @@ dhcp6_start (NMDevice *self, NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE; guint8 *anycast = NULL; const char *ip_iface; - const struct in6_addr dest = { { { 0xFF,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; - int err; if (!connection) { connection = nm_device_get_connection (self); @@ -2054,18 +2309,6 @@ dhcp6_start (NMDevice *self, priv->dhcp6_ip6_config = NULL; } - /* DHCPv6 communicates with the DHCPv6 server via two multicast addresses, - * ff02::1:2 (link-scope) and ff05::1:3 (site-scope). Make sure we have - * a multicast route (ff00::/8) for client <-> server communication. - */ - err = nm_system_set_ip6_route (priv->ip_iface ? priv->ip_ifindex : priv->ifindex, - &dest, 8, NULL, 256, 0, RTPROT_BOOT, RT_TABLE_LOCAL, NULL); - if (err && (err != -NLE_EXIST)) { - nm_log_err (LOGD_DEVICE | LOGD_IP6, - "(%s): failed to add IPv6 multicast route: %s", - priv->ip_iface ? priv->ip_iface : priv->iface, nl_geterror (err)); - } - ip_iface = nm_device_get_ip_iface (self); priv->dhcp6_client = nm_dhcp_manager_start_ip6 (priv->dhcp_manager, ip_iface, @@ -2270,10 +2513,52 @@ addrconf6_cleanup (NMDevice *self) /******************************************/ +/* Get net.ipv6.conf.default.use_tempaddr value from /etc/sysctl.conf or + * /lib/sysctl.d/sysctl.conf + */ +static int +ip6_use_tempaddr (void) +{ + char *contents = NULL; + gsize len = 0; + const char *group_name = "[forged_group]\n"; + char *sysctl_data = NULL; + GKeyFile *keyfile; + GError *error = NULL; + int tmp, ret = -1; + + /* Read file contents to a string. */ + if (!g_file_get_contents ("/etc/sysctl.conf", &contents, &len, NULL)) + if (!g_file_get_contents ("/lib/sysctl.d/sysctl.conf", &contents, &len, NULL)) + return -1; + + /* Prepend a group so that we can use GKeyFile parser. */ + sysctl_data = g_strdup_printf ("%s%s", group_name, contents); + + keyfile = g_key_file_new (); + if (keyfile == NULL) + goto done; + + if (!g_key_file_load_from_data (keyfile, sysctl_data, len + strlen (group_name), G_KEY_FILE_NONE, NULL)) + goto done; + + tmp = g_key_file_get_integer (keyfile, "forged_group", "net.ipv6.conf.default.use_tempaddr", &error); + if (error == NULL) + ret = tmp; + +done: + g_free (contents); + g_free (sysctl_data); + g_clear_error (&error); + g_key_file_free (keyfile); + + return ret; +} + static NMActStageReturn -real_act_stage3_ip6_config_start (NMDevice *self, - NMIP6Config **out_config, - NMDeviceStateReason *reason) +act_stage3_ip6_config_start (NMDevice *self, + NMIP6Config **out_config, + NMDeviceStateReason *reason) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); const char *ip_iface; @@ -2306,7 +2591,7 @@ real_act_stage3_ip6_config_start (NMDevice *self, } else if (ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { /* Router advertisements shouldn't be used in pure DHCP mode */ if (priv->ip6_accept_ra_path) - nm_utils_do_sysctl (priv->ip6_accept_ra_path, "0\n"); + nm_utils_do_sysctl (priv->ip6_accept_ra_path, "0"); priv->dhcp6_mode = IP6_DHCP_OPT_MANAGED; ret = dhcp6_start (self, connection, priv->dhcp6_mode, reason); @@ -2314,7 +2599,7 @@ real_act_stage3_ip6_config_start (NMDevice *self, /* reset the saved RA value when ipv6 is ignored */ if (priv->ip6_accept_ra_path) { nm_utils_do_sysctl (priv->ip6_accept_ra_path, - priv->ip6_accept_ra_save ? "1\n" : "0\n"); + priv->ip6_accept_ra_save ? "1" : "0"); } ret = NM_ACT_STAGE_RETURN_STOP; } else if (ip6_method_matches (connection, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { @@ -2324,7 +2609,7 @@ real_act_stage3_ip6_config_start (NMDevice *self, /* Router advertisements shouldn't be used in manual mode */ if (priv->ip6_accept_ra_path) - nm_utils_do_sysctl (priv->ip6_accept_ra_path, "0\n"); + nm_utils_do_sysctl (priv->ip6_accept_ra_path, "0"); ret = NM_ACT_STAGE_RETURN_SUCCESS; } else { nm_log_warn (LOGD_IP6, "(%s): unhandled IPv6 config method; will fail", @@ -2337,7 +2622,7 @@ real_act_stage3_ip6_config_start (NMDevice *self, * If a global value is configured by sysadmin (e.g. /etc/sysctl.conf), * use that value instead of per-connection value. */ - conf_use_tempaddr = nm_backend_ipv6_use_tempaddr (); + conf_use_tempaddr = ip6_use_tempaddr (); if (conf_use_tempaddr >= 0) ip6_privacy = conf_use_tempaddr; else { @@ -2350,13 +2635,13 @@ real_act_stage3_ip6_config_start (NMDevice *self, switch (ip6_privacy) { case NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN: case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED: - ip6_privacy_str = "0\n"; + ip6_privacy_str = "0"; break; case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR: - ip6_privacy_str = "1\n"; + ip6_privacy_str = "1"; break; case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR: - ip6_privacy_str = "2\n"; + ip6_privacy_str = "2"; break; } if (priv->ip6_privacy_tempaddr_path) @@ -2365,39 +2650,23 @@ real_act_stage3_ip6_config_start (NMDevice *self, return ret; } - -/* - * nm_device_activate_stage3_ip_config_start - * - * Begin automatic/manual IP configuration +/** + * nm_device_activate_stage3_ip4_start: + * @self: the device * + * Try starting IPv4 configuration. */ -static gboolean -nm_device_activate_stage3_ip_config_start (gpointer user_data) +gboolean +nm_device_activate_stage3_ip4_start (NMDevice *self) { - NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - const char *iface; NMActStageReturn ret; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; NMIP4Config *ip4_config = NULL; - NMIP6Config *ip6_config = NULL; - int ifindex; - /* Clear the activation source ID now that this stage has run */ - activation_source_clear (self, FALSE, 0); - - iface = nm_device_get_iface (self); - nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 3 of 5 (IP Configure Start) started...", iface); - nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE); - - /* Make sure the interface is up before trying to do anything with it */ - ifindex = nm_device_get_ip_ifindex (self); - if ((ifindex > 0) && (nm_system_iface_is_up (ifindex) == FALSE)) - nm_system_iface_set_up (ifindex, TRUE, NULL); - - priv->ip4_state = priv->ip6_state = IP_CONF; + g_assert (priv->ip4_state == IP_WAIT); + priv->ip4_state = IP_CONF; ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &reason); if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { g_assert (ip4_config); @@ -2405,13 +2674,36 @@ nm_device_activate_stage3_ip_config_start (gpointer user_data) g_object_unref (ip4_config); } else if (ret == NM_ACT_STAGE_RETURN_FAILURE) { nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return FALSE; } else if (ret == NM_ACT_STAGE_RETURN_STOP) { - /* Nothing to do */ + /* Early finish */ priv->ip4_state = IP_DONE; + } else if (ret == NM_ACT_STAGE_RETURN_WAIT) { + /* Wait for something to try IP config again */ + priv->ip4_state = IP_WAIT; } else g_assert (ret == NM_ACT_STAGE_RETURN_POSTPONE); + return TRUE; +} + +/** + * nm_device_activate_stage3_ip6_start: + * @self: the device + * + * Try starting IPv6 configuration. + */ +gboolean +nm_device_activate_stage3_ip6_start (NMDevice *self) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMActStageReturn ret; + NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; + NMIP6Config *ip6_config = NULL; + + g_assert (priv->ip6_state == IP_WAIT); + + priv->ip6_state = IP_CONF; ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &reason); if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { g_assert (ip6_config); @@ -2419,24 +2711,77 @@ nm_device_activate_stage3_ip_config_start (gpointer user_data) g_object_unref (ip6_config); } else if (ret == NM_ACT_STAGE_RETURN_FAILURE) { nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); - goto out; + return FALSE; } else if (ret == NM_ACT_STAGE_RETURN_STOP) { - /* Nothing to do */ + /* Early finish */ priv->ip6_state = IP_DONE; + } else if (ret == NM_ACT_STAGE_RETURN_WAIT) { + /* Wait for something to try IP config again */ + priv->ip6_state = IP_WAIT; } else g_assert (ret == NM_ACT_STAGE_RETURN_POSTPONE); -out: - nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 3 of 5 (IP Configure Start) complete.", iface); + return TRUE; +} - /* Handle interfaces (bond slaves, etc) that won't have any IP config; they - * need to move to ACTIVATED. +/* + * nm_device_activate_stage3_ip_config_start + * + * Begin automatic/manual IP configuration + * + */ +static gboolean +nm_device_activate_stage3_ip_config_start (gpointer user_data) +{ + NMDevice *self = NM_DEVICE (user_data); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + const char *iface; + int ifindex; + NMDevice *master; + + /* Clear the activation source ID now that this stage has run */ + activation_source_clear (self, FALSE, 0); + + iface = nm_device_get_iface (self); + nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 3 of 5 (IP Configure Start) started...", iface); + nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE); + + /* Make sure the interface is up before trying to do anything with it */ + ifindex = nm_device_get_ip_ifindex (self); + if ((ifindex > 0) && (nm_system_iface_is_up (ifindex) == FALSE)) + nm_system_iface_set_up (ifindex, TRUE, NULL); + + priv->ip4_state = priv->ip6_state = IP_WAIT; + + /* If the device is a slave, then we don't do any IP configuration but we + * use the IP config stage to indicate to the master we're ready for + * enslavement. Either the master has already enslaved us, in which case + * our state transition to SECONDARIES is already queued courtesy of + * nm_device_slave_notify_enslaved(), or the master is still activating, + * in which case we postpone activation here until the master enslaves us, + * which calls nm_device_slave_notify_enslaved(). */ - if (priv->ip4_state == IP_DONE && priv->ip6_state == IP_DONE) { - /* FIXME: call layer2 stuff to set MTU? */ - nm_device_state_changed (self, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE); + master = nm_active_connection_get_master (NM_ACTIVE_CONNECTION (priv->act_request)); + if (master) { + if (priv->enslaved == FALSE) { + nm_log_info (LOGD_DEVICE, "Activation (%s) connection '%s' waiting on master '%s'", + nm_device_get_iface (self), + nm_connection_get_id (nm_device_get_connection (self)), + nm_device_get_iface (master)); + } + goto out; } + /* IPv4 */ + if (!nm_device_activate_stage3_ip4_start (self)) + goto out; + + /* IPv6 */ + if (!nm_device_activate_stage3_ip6_start (self)) + goto out; + +out: + nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 3 of 5 (IP Configure Start) complete.", iface); return FALSE; } @@ -2479,7 +2824,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) g_return_if_fail (priv->act_request); state = nm_device_get_state (self); - if (nm_act_request_get_assumed (priv->act_request) == FALSE) + if (nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (priv->act_request)) == FALSE) g_warn_if_fail (state >= NM_DEVICE_STATE_PREPARE && state <= NM_DEVICE_STATE_NEED_AUTH); /* Add the interface to the specified firewall zone */ @@ -2499,7 +2844,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self) } static NMActStageReturn -real_act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *reason) +act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *reason) { if (nm_device_ip_config_should_fail (self, FALSE)) { *reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE; @@ -2583,7 +2928,7 @@ nm_device_activate_schedule_ip4_config_timeout (NMDevice *self) static NMActStageReturn -real_act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *reason) +act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *reason) { if (nm_device_ip_config_should_fail (self, TRUE)) { *reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE; @@ -2685,13 +3030,13 @@ share_init (void) NULL }; char **iter; - if (!nm_utils_do_sysctl ("/proc/sys/net/ipv4/ip_forward", "1\n")) { + if (!nm_utils_do_sysctl ("/proc/sys/net/ipv4/ip_forward", "1")) { nm_log_err (LOGD_SHARING, "Error starting IP forwarding: (%d) %s", errno, strerror (errno)); return FALSE; } - if (!nm_utils_do_sysctl ("/proc/sys/net/ipv4/ip_dynaddr", "1\n")) { + if (!nm_utils_do_sysctl ("/proc/sys/net/ipv4/ip_dynaddr", "1")) { nm_log_err (LOGD_SHARING, "error starting IP forwarding: (%d) %s", errno, strerror (errno)); } @@ -2777,7 +3122,8 @@ start_sharing (NMDevice *self, NMIP4Config *config) if (!nm_dnsmasq_manager_start (priv->dnsmasq_manager, config, &error)) { nm_log_err (LOGD_SHARING, "(%s/%s): failed to start dnsmasq: %s", - nm_device_get_iface (self), ip_iface, error->message); + nm_device_get_iface (self), ip_iface, + (error && error->message) ? error->message : "(unknown)"); g_error_free (error); nm_act_request_set_shared (req, FALSE); return FALSE; @@ -2830,7 +3176,7 @@ nm_device_activate_ip4_config_commit (gpointer user_data) /* Merge with user overrides */ nm_utils_merge_ip4_config (config, nm_connection_get_setting_ip4_config (connection)); - assumed = nm_act_request_get_assumed (priv->act_request); + assumed = nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (priv->act_request)); if (!nm_device_set_ip4_config (self, config, assumed, &reason)) { nm_log_info (LOGD_DEVICE | LOGD_IP4, "Activation (%s) Stage 5 of 5 (IPv4 Commit) failed", @@ -2852,10 +3198,10 @@ nm_device_activate_ip4_config_commit (gpointer user_data) } } - /* Enter the ACTIVATED state if this is the first method to complete */ + /* Enter the SECONDARIES state if this is the first method to complete */ priv->ip4_state = IP_DONE; if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG) - nm_device_state_changed (self, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE); + nm_device_state_changed (self, NM_DEVICE_STATE_SECONDARIES, NM_DEVICE_STATE_REASON_NONE); out: nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv4 Commit) complete.", @@ -2938,10 +3284,10 @@ nm_device_activate_ip6_config_commit (gpointer user_data) NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self, config); if (ip6_config_merge_and_apply (self, config, &reason)) { - /* Enter the ACTIVATED state if this is the first method to complete */ + /* Enter the SECONDARIES state if this is the first method to complete */ priv->ip6_state = IP_DONE; if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG) - nm_device_state_changed (self, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE); + nm_device_state_changed (self, NM_DEVICE_STATE_SECONDARIES, NM_DEVICE_STATE_REASON_NONE); } else { nm_log_info (LOGD_DEVICE | LOGD_IP6, "Activation (%s) Stage 5 of 5 (IPv6 Commit) failed", @@ -3181,15 +3527,6 @@ nm_device_deactivate (NMDevice *self, NMDeviceStateReason reason) activation_source_clear (self, TRUE, AF_INET); activation_source_clear (self, TRUE, AF_INET6); - if (priv->act_dep_result_id) { - g_source_remove (priv->act_dep_result_id); - priv->act_dep_result_id = 0; - } - if (priv->act_dep_timeout_id) { - g_source_remove (priv->act_dep_timeout_id); - priv->act_dep_timeout_id = 0; - } - /* Clear any queued transitions */ nm_device_queued_state_clear (self); @@ -3205,16 +3542,23 @@ nm_device_deactivate (NMDevice *self, NMDeviceStateReason reason) /* Turn off router advertisements until they are needed */ if (priv->ip6_accept_ra_path) - nm_utils_do_sysctl (priv->ip6_accept_ra_path, "0\n"); + nm_utils_do_sysctl (priv->ip6_accept_ra_path, "0"); /* Turn off IPv6 privacy extensions */ if (priv->ip6_privacy_tempaddr_path) - nm_utils_do_sysctl (priv->ip6_privacy_tempaddr_path, "0\n"); + nm_utils_do_sysctl (priv->ip6_privacy_tempaddr_path, "0"); /* Call device type-specific deactivation */ if (NM_DEVICE_GET_CLASS (self)->deactivate) NM_DEVICE_GET_CLASS (self)->deactivate (self); + /* master: release slaves */ + g_clear_object (&priv->master); + nm_device_master_release_slaves (self, FALSE); + + /* slave: mark no longer enslaved */ + priv->enslaved = FALSE; + /* Tear down an existing activation request */ clear_act_request (self); @@ -3284,71 +3628,16 @@ impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context) NULL); } -static gboolean -act_dep_timeout_cb (gpointer user_data) -{ - NMDevice *self = NM_DEVICE (user_data); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - NMConnection *connection; - - connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (priv->act_request)); - nm_log_warn (LOGD_DEVICE, - "Activation (%s) connection '%s' dependency timed out", - nm_device_get_iface (self), - nm_connection_get_id (connection)); - - nm_device_queue_state (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); - return FALSE; -} - -static void -act_dep_result_cb (NMActRequest *req, - NMActRequestDependencyResult result, - NMDevice *self) -{ - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - NMConnection *connection; - - connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (priv->act_request)); - - switch (result) { - case NM_ACT_REQUEST_DEP_RESULT_FAILED: - g_source_remove (priv->act_dep_result_id); - priv->act_dep_result_id = 0; - - nm_log_warn (LOGD_DEVICE, - "Activation (%s) connection '%s' dependency failed", - nm_device_get_iface (self), - nm_connection_get_id (connection)); - nm_device_queue_state (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); - break; - case NM_ACT_REQUEST_DEP_RESULT_READY: - g_warn_if_fail (priv->state == NM_DEVICE_STATE_PREPARE); - if (priv->state == NM_DEVICE_STATE_PREPARE) { - nm_log_info (LOGD_DEVICE, - "Activation (%s) connection '%s' dependency ready, continuing activation", - nm_device_get_iface (self), - nm_connection_get_id (connection)); - nm_device_activate_schedule_stage1_device_prepare (self); - } - break; - case NM_ACT_REQUEST_DEP_RESULT_WAIT: - default: - g_assert_not_reached (); - break; - } -} - -gboolean -nm_device_activate (NMDevice *self, NMActRequest *req, GError **error) +void +nm_device_activate (NMDevice *self, NMActRequest *req) { NMDevicePrivate *priv; NMConnection *connection; - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); - g_return_val_if_fail (req != NULL, FALSE); - g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE); + g_return_if_fail (self != NULL); + g_return_if_fail (NM_IS_DEVICE (self)); + g_return_if_fail (req != NULL); + g_return_if_fail (NM_IS_ACT_REQUEST (req)); priv = NM_DEVICE_GET_PRIVATE (self); @@ -3359,27 +3648,20 @@ nm_device_activate (NMDevice *self, NMActRequest *req, GError **error) nm_device_get_iface (self), nm_connection_get_id (connection)); - /* Make sure this connection isn't activated already, or in the process of - * being activated. - */ - if ( nm_device_is_activating (self) - || (nm_device_get_state (self) == NM_DEVICE_STATE_ACTIVATED)) { - NMConnection *new = nm_act_request_get_connection (req); - NMConnection *current = nm_act_request_get_connection (priv->act_request); - - if (new == current) { - g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CONNECTION_ACTIVATING, - "Connection is already activating"); - return FALSE; - } - } + g_warn_if_fail (priv->state == NM_DEVICE_STATE_DISCONNECTED); priv->act_request = g_object_ref (req); g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION); - if (!nm_act_request_get_assumed (req)) { - NMActiveConnection *dep_ac; - NMConnection *dep_con; + if (nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (req))) { + /* If it's an assumed connection, let the device subclass short-circuit + * the normal connection process and just copy its IP configs from the + * interface. + */ + nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE); + nm_device_activate_schedule_stage3_ip_config_start (self); + } else { + NMDevice *master; /* HACK: update the state a bit early to avoid a race between the * scheduled stage1 handler and nm_policy_device_change_check() thinking @@ -3389,43 +3671,18 @@ nm_device_activate (NMDevice *self, NMActRequest *req, GError **error) nm_device_state_changed (self, NM_DEVICE_STATE_PREPARE, NM_DEVICE_STATE_REASON_NONE); /* Handle any dependencies this connection might have */ - switch (nm_act_request_get_dependency_result (priv->act_request)) { - case NM_ACT_REQUEST_DEP_RESULT_FAILED: - nm_device_queue_state (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); - break; - case NM_ACT_REQUEST_DEP_RESULT_WAIT: - dep_ac = nm_act_request_get_dependency (priv->act_request); - g_assert (dep_ac); - dep_con = nm_active_connection_get_connection (dep_ac); - g_assert (dep_con); - nm_log_info (LOGD_DEVICE, "Activation (%s) connection '%s' waiting on dependency '%s'", - nm_device_get_iface (self), - nm_connection_get_id (connection), - nm_connection_get_id (dep_con)); - - priv->act_dep_result_id = g_signal_connect (priv->act_request, - NM_ACT_REQUEST_DEPENDENCY_RESULT, - G_CALLBACK (act_dep_result_cb), - self); - priv->act_dep_timeout_id = g_timeout_add_seconds (60, act_dep_timeout_cb, self); - break; - default: - g_warn_if_reached (); - /* fall through */ - case NM_ACT_REQUEST_DEP_RESULT_READY: - nm_device_activate_schedule_stage1_device_prepare (self); - break; + master = nm_active_connection_get_master (NM_ACTIVE_CONNECTION (req)); + if (master) { + /* Master should at least already be activating */ + g_assert (nm_device_get_state (master) > NM_DEVICE_STATE_DISCONNECTED); + + g_assert (priv->master == NULL); + priv->master = g_object_ref (master); + nm_device_master_add_slave (master, self); } - } else { - /* If it's an assumed connection, let the device subclass short-circuit - * the normal connection process and just copy its IP configs from the - * interface. - */ - nm_device_state_changed (self, NM_DEVICE_STATE_IP_CONFIG, NM_DEVICE_STATE_REASON_NONE); - nm_device_activate_schedule_stage3_ip_config_start (self); - } - return TRUE; + nm_device_activate_schedule_stage1_device_prepare (self); + } } /* @@ -3743,7 +4000,6 @@ dispose (GObject *object) connection = nm_device_get_connection (self); if (connection) { - /* Only static or DHCP IPv4 connections can be left up. * All IPv6 connections can be left up, so we don't have * to check that. @@ -3753,7 +4009,8 @@ dispose (GObject *object) method = nm_setting_ip4_config_get_method (s_ip4); if ( !method || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) - || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) + || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) + || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) take_down = FALSE; } } @@ -3767,6 +4024,8 @@ dispose (GObject *object) addrconf6_cleanup (self); dnsmasq_cleanup (self); + g_warn_if_fail (priv->slaves == NULL); + /* Take the device itself down and clear its IPv4 configuration */ if (priv->managed && take_down) { NMDeviceStateReason ignored = NM_DEVICE_STATE_REASON_NONE; @@ -3778,7 +4037,7 @@ dispose (GObject *object) /* reset the saved RA value */ if (priv->ip6_accept_ra_path) { nm_utils_do_sysctl (priv->ip6_accept_ra_path, - priv->ip6_accept_ra_save ? "1\n" : "0\n"); + priv->ip6_accept_ra_save ? "1" : "0"); } g_free (priv->ip6_accept_ra_path); @@ -3786,11 +4045,33 @@ dispose (GObject *object) if (priv->ip6_privacy_tempaddr_path) { char tmp[16]; - snprintf (tmp, sizeof (tmp), "%d\n", priv->ip6_privacy_tempaddr_save); + snprintf (tmp, sizeof (tmp), "%d", priv->ip6_privacy_tempaddr_save); nm_utils_do_sysctl (priv->ip6_privacy_tempaddr_path, tmp); } g_free (priv->ip6_privacy_tempaddr_path); + if (priv->cp_added_id) { + g_signal_handler_disconnect (priv->con_provider, priv->cp_added_id); + priv->cp_added_id = 0; + } + + if (priv->cp_loaded_id) { + g_signal_handler_disconnect (priv->con_provider, priv->cp_loaded_id); + priv->cp_loaded_id = 0; + } + + if (priv->cp_removed_id) { + g_signal_handler_disconnect (priv->con_provider, priv->cp_removed_id); + priv->cp_removed_id = 0; + } + + if (priv->cp_updated_id) { + g_signal_handler_disconnect (priv->con_provider, priv->cp_updated_id); + priv->cp_updated_id = 0; + } + + g_hash_table_unref (priv->available_connections); + activation_source_clear (self, TRUE, AF_INET); activation_source_clear (self, TRUE, AF_INET6); @@ -3916,6 +4197,9 @@ get_property (GObject *object, guint prop_id, NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDeviceState state; const char *ac_path = NULL; + GPtrArray *array; + GHashTableIter iter; + NMConnection *connection; state = nm_device_get_state (self); @@ -4008,6 +4292,13 @@ get_property (GObject *object, guint prop_id, case PROP_RFKILL_TYPE: g_value_set_uint (value, priv->rfkill_type); break; + case PROP_AVAILABLE_CONNECTIONS: + array = g_ptr_array_sized_new (g_hash_table_size (priv->available_connections)); + g_hash_table_iter_init (&iter, priv->available_connections); + while (g_hash_table_iter_next (&iter, (gpointer) &connection, NULL)) + g_ptr_array_add (array, g_strdup (nm_connection_get_path (connection))); + g_value_take_boxed (value, array); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -4030,14 +4321,15 @@ nm_device_class_init (NMDeviceClass *klass) object_class->constructor = constructor; object_class->constructed = constructed; - klass->get_type_capabilities = real_get_type_capabilities; - klass->get_generic_capabilities = real_get_generic_capabilities; - klass->act_stage1_prepare = real_act_stage1_prepare; - klass->act_stage2_config = real_act_stage2_config; - klass->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start; - klass->act_stage3_ip6_config_start = real_act_stage3_ip6_config_start; - klass->act_stage4_ip4_config_timeout = real_act_stage4_ip4_config_timeout; - klass->act_stage4_ip6_config_timeout = real_act_stage4_ip6_config_timeout; + klass->get_type_capabilities = get_type_capabilities; + klass->get_generic_capabilities = get_generic_capabilities; + klass->act_stage1_prepare = act_stage1_prepare; + klass->act_stage2_config = act_stage2_config; + klass->act_stage3_ip4_config_start = act_stage3_ip4_config_start; + klass->act_stage3_ip6_config_start = act_stage3_ip6_config_start; + klass->act_stage4_ip4_config_timeout = act_stage4_ip4_config_timeout; + klass->act_stage4_ip6_config_timeout = act_stage4_ip6_config_timeout; + klass->check_connection_available = check_connection_available; /* Properties */ g_object_class_install_property @@ -4217,12 +4509,21 @@ nm_device_class_init (NMDeviceClass *klass) 0, G_MAXINT, 0, G_PARAM_READABLE | NM_PROPERTY_PARAM_NO_EXPORT)); + g_object_class_install_property + (object_class, PROP_AVAILABLE_CONNECTIONS, + g_param_spec_boxed (NM_DEVICE_AVAILABLE_CONNECTIONS, + "AvailableConnections", + "AvailableConnections", + DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, + G_PARAM_READABLE)); + /* Signals */ signals[STATE_CHANGED] = g_signal_new ("state-changed", G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMDeviceClass, state_changed), + NULL, NULL, _nm_marshal_VOID__UINT_UINT_UINT, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); @@ -4427,7 +4728,13 @@ reason_to_string (NMDeviceStateReason reason) case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED: return "dependency-failed"; case NM_DEVICE_STATE_REASON_BR2684_FAILED: - return "br2684 bridge failed"; + return "br2684-bridge-failed"; + case NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE: + return "modem-manager-unavailable"; + case NM_DEVICE_STATE_REASON_SSID_NOT_FOUND: + return "SSID not found"; + case NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED: + return "secondary-connection-failed"; default: break; } @@ -4445,6 +4752,12 @@ nm_device_state_changed (NMDevice *device, gboolean no_firmware = FALSE; NMConnection *connection; + /* Track re-entry */ + static gboolean in_state_changed = FALSE; + + g_warn_if_fail (in_state_changed == FALSE); + in_state_changed = TRUE; + g_return_if_fail (NM_IS_DEVICE (device)); /* Do nothing if state isn't changing, but as a special case allow @@ -4452,8 +4765,10 @@ nm_device_state_changed (NMDevice *device, * can retry device initialization. */ if ( (priv->state == state) - && !(state == NM_DEVICE_STATE_UNAVAILABLE && priv->firmware_missing)) + && !(state == NM_DEVICE_STATE_UNAVAILABLE && priv->firmware_missing)) { + in_state_changed = FALSE; return; + } old_state = priv->state; priv->state = state; @@ -4474,14 +4789,13 @@ nm_device_state_changed (NMDevice *device, /* Cache the activation request for the dispatcher */ req = priv->act_request ? g_object_ref (priv->act_request) : NULL; - /* Update connection timestamps; do this before possibly deactivating the - * device since that will clear the activation request and thus the - * connection, which we need. - */ - if (state == NM_DEVICE_STATE_ACTIVATED || old_state == NM_DEVICE_STATE_ACTIVATED) { - nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (nm_act_request_get_connection (req)), - (guint64) time (NULL), TRUE); - } + if (state <= NM_DEVICE_STATE_UNAVAILABLE) + _clear_available_connections (device, TRUE); + + /* Update the available connections list when a device first becomes available */ + if ( state >= NM_DEVICE_STATE_DISCONNECTED + && old_state < NM_DEVICE_STATE_DISCONNECTED) + nm_device_recheck_available_connections (device); /* Handle the new state here; but anything that could trigger * another state change should be done below. @@ -4541,7 +4855,7 @@ nm_device_state_changed (NMDevice *device, case NM_DEVICE_STATE_ACTIVATED: nm_log_info (LOGD_DEVICE, "Activation (%s) successful, device activated.", nm_device_get_iface (device)); - nm_utils_call_dispatcher ("up", nm_act_request_get_connection (req), device, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_UP, nm_act_request_get_connection (req), device, NULL, NULL); break; case NM_DEVICE_STATE_FAILED: connection = nm_act_request_get_connection (req); @@ -4549,22 +4863,43 @@ nm_device_state_changed (NMDevice *device, "Activation (%s) failed for connection '%s'", nm_device_get_iface (device), nm_connection_get_id (connection)); + + /* Notify any slaves of the unexpected failure */ + nm_device_master_release_slaves (device, TRUE); + + /* If the connection doesn't yet have a timestamp, set it to zero so that + * we can distinguish between connections we've tried to activate and have + * failed (zero timestamp), connections that succeeded (non-zero timestamp), + * and those we haven't tried yet (no timestamp). + */ + if (!nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (connection), NULL)) { + nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (connection), + (guint64) 0, + TRUE); + } + /* Schedule the transition to DISCONNECTED. The device can't transition * immediately because we can't change states again from the state * handler for a variety of reasons. */ nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); break; + case NM_DEVICE_STATE_SECONDARIES: + nm_log_dbg (LOGD_DEVICE, "(%s): device entered SECONDARIES state", + nm_device_get_iface (device)); + break; default: break; } if (old_state == NM_DEVICE_STATE_ACTIVATED) - nm_utils_call_dispatcher ("down", nm_act_request_get_connection (req), device, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), device, NULL, NULL); /* Dispose of the cached activation request */ if (req) g_object_unref (req); + + in_state_changed = FALSE; } static gboolean @@ -4572,16 +4907,28 @@ queued_set_state (gpointer user_data) { NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMDeviceState new_state; + NMDeviceStateReason new_reason; if (priv->queued_state.id) { nm_log_dbg (LOGD_DEVICE, "(%s): running queued state change to %s (id %d)", nm_device_get_iface (self), state_to_string (priv->queued_state.state), priv->queued_state.id); + + /* Clear queued state struct before triggering state change, since + * the state change may queue another state. + */ priv->queued_state.id = 0; - nm_device_state_changed (self, priv->queued_state.state, priv->queued_state.reason); + new_state = priv->queued_state.state; + new_reason = priv->queued_state.reason; + nm_device_queued_state_clear (self); + + nm_device_state_changed (self, new_state, new_reason); + } else { + g_warn_if_fail (priv->queued_state.state == NM_DEVICE_STATE_UNKNOWN); + g_warn_if_fail (priv->queued_state.reason == NM_DEVICE_STATE_REASON_NONE); } - nm_device_queued_state_clear (self); return FALSE; } @@ -4707,7 +5054,8 @@ ip4_match_config (NMDevice *self, NMConnection *connection) dhcp_mgr = nm_dhcp_manager_get (); leases = nm_dhcp_manager_get_lease_config (dhcp_mgr, nm_device_get_iface (self), - nm_connection_get_uuid (connection)); + nm_connection_get_uuid (connection), + FALSE); g_object_unref (dhcp_mgr); method = s_ip4 ? nm_setting_ip4_config_get_method (s_ip4) : NM_SETTING_IP4_CONFIG_METHOD_AUTO; @@ -4869,3 +5217,119 @@ nm_device_get_autoconnect (NMDevice *device) return NM_DEVICE_GET_PRIVATE (device)->autoconnect; } +static void +_signal_available_connections_changed (NMDevice *device) +{ + g_object_notify (G_OBJECT (device), NM_DEVICE_AVAILABLE_CONNECTIONS); +} + +static void +_clear_available_connections (NMDevice *device, gboolean do_signal) +{ + g_hash_table_remove_all (NM_DEVICE_GET_PRIVATE (device)->available_connections); + if (do_signal == TRUE) + _signal_available_connections_changed (device); +} + +static gboolean +_try_add_available_connection (NMDevice *self, NMConnection *connection) +{ + if (nm_device_get_state (self) < NM_DEVICE_STATE_DISCONNECTED) + return FALSE; + + if (nm_device_check_connection_compatible (self, connection, NULL)) { + /* Let subclasses implement additional checks on the connection */ + if ( NM_DEVICE_GET_CLASS (self)->check_connection_available + && NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection)) { + + g_hash_table_insert (NM_DEVICE_GET_PRIVATE (self)->available_connections, + g_object_ref (connection), + GUINT_TO_POINTER (1)); + } + } + return FALSE; +} + +static gboolean +_del_available_connection (NMDevice *device, NMConnection *connection) +{ + return g_hash_table_remove (NM_DEVICE_GET_PRIVATE (device)->available_connections, connection); +} + +static gboolean +check_connection_available (NMDevice *device, NMConnection *connection) +{ + /* Default is to assume the connection is available unless a subclass + * overrides this with more specific checks. + */ + return TRUE; +} + +void +nm_device_recheck_available_connections (NMDevice *device) +{ + NMDevicePrivate *priv; + const GSList *connections, *iter; + + g_return_if_fail (device != NULL); + g_return_if_fail (NM_IS_DEVICE (device)); + + priv = NM_DEVICE_GET_PRIVATE(device); + + _clear_available_connections (device, FALSE); + + connections = nm_connection_provider_get_connections (priv->con_provider); + for (iter = connections; iter; iter = g_slist_next (iter)) + _try_add_available_connection (device, NM_CONNECTION (iter->data)); + + _signal_available_connections_changed (device); +} + +static void +cp_connection_added (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data) +{ + if (_try_add_available_connection (NM_DEVICE (user_data), connection)) + _signal_available_connections_changed (NM_DEVICE (user_data)); +} + +static void +cp_connections_loaded (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data) +{ + const GSList *connections, *iter; + gboolean added = FALSE; + + connections = nm_connection_provider_get_connections (cp); + for (iter = connections; iter; iter = g_slist_next (iter)) + added |= _try_add_available_connection (NM_DEVICE (user_data), NM_CONNECTION (iter->data)); + + if (added) + _signal_available_connections_changed (NM_DEVICE (user_data)); +} + +static void +cp_connection_removed (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data) +{ + if (_del_available_connection (NM_DEVICE (user_data), connection)) + _signal_available_connections_changed (NM_DEVICE (user_data)); +} + +static void +cp_connection_updated (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data) +{ + gboolean added, deleted; + + /* FIXME: don't remove it from the hash if it's just going to get re-added */ + deleted = _del_available_connection (NM_DEVICE (user_data), connection); + added = _try_add_available_connection (NM_DEVICE (user_data), connection); + + /* Only signal if the connection was removed OR added, but not both */ + if (added != deleted) + _signal_available_connections_changed (NM_DEVICE (user_data)); +} + +gboolean +nm_device_supports_vlans (NMDevice *device) +{ + /* At the moment, NM's VLAN code assumes all VLANs are over ethernet. */ + return NM_IS_DEVICE_ETHERNET (device); +} diff --git a/src/nm-device.h b/src/nm-device.h index 91d9166af..05b396225 100644 --- a/src/nm-device.h +++ b/src/nm-device.h @@ -27,6 +27,7 @@ #include <netinet/in.h> #include "NetworkManager.h" +#include "nm-types.h" #include "nm-activation-request.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" @@ -59,6 +60,7 @@ #define NM_DEVICE_TYPE_DESC "type-desc" /* Internal only */ #define NM_DEVICE_RFKILL_TYPE "rfkill-type" /* Internal only */ #define NM_DEVICE_IFINDEX "ifindex" /* Internal only */ +#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections" /* Internal signals */ #define NM_DEVICE_AUTH_REQUEST "auth-request" @@ -83,9 +85,9 @@ typedef enum { NM_DEVICE_ERROR_NOT_ACTIVE, /*< nick=NotActive >*/ } NMDeviceError; -typedef struct { +struct _NMDevice { GObject parent; -} NMDevice; +}; typedef struct { GObjectClass parent; @@ -124,10 +126,21 @@ typedef struct { GSList *connections, char **specific_object); + /* Checks whether the connection is compatible with the device using + * only the devices type and characteristics. Does not use any live + * network information like WiFi/WiMAX scan lists etc. + */ gboolean (* check_connection_compatible) (NMDevice *self, NMConnection *connection, GError **error); + /* Checks whether the connection is likely available to be activated, + * including any live network information like scan lists. Returns + * TRUE if the connection is available; FALSE if not. + */ + gboolean (* check_connection_available) (NMDevice *self, + NMConnection *connection); + gboolean (* complete_connection) (NMDevice *self, NMConnection *connection, const char *specific_object, @@ -168,7 +181,8 @@ typedef struct { gboolean fail_if_no_hwaddr); gboolean (* enslave_slave) (NMDevice *self, - NMDevice *slave); + NMDevice *slave, + NMConnection *connection); gboolean (* release_slave) (NMDevice *self, NMDevice *slave); @@ -204,8 +218,14 @@ NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *dev); NMIP4Config * nm_device_get_ip4_config (NMDevice *dev); NMIP6Config * nm_device_get_ip6_config (NMDevice *dev); -gboolean nm_device_enslave_slave (NMDevice *dev, NMDevice *slave); -gboolean nm_device_release_slave (NMDevice *dev, NMDevice *slave); +/* Master */ +gboolean nm_device_master_add_slave (NMDevice *dev, NMDevice *slave); +GSList * nm_device_master_get_slaves (NMDevice *dev); + +/* Slave */ +void nm_device_slave_notify_enslaved (NMDevice *dev, + gboolean enslaved, + gboolean master_failed); NMActRequest * nm_device_get_act_request (NMDevice *dev); NMConnection * nm_device_get_connection (NMDevice *dev); @@ -272,10 +292,12 @@ void nm_device_queue_state (NMDevice *self, gboolean nm_device_get_firmware_missing (NMDevice *self); -gboolean nm_device_activate (NMDevice *device, NMActRequest *req, GError **error); +void nm_device_activate (NMDevice *device, NMActRequest *req); void nm_device_set_connection_provider (NMDevice *device, NMConnectionProvider *provider); +gboolean nm_device_supports_vlans (NMDevice *device); + G_END_DECLS #endif /* NM_DEVICE_H */ diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c new file mode 100644 index 000000000..61dfd7c07 --- /dev/null +++ b/src/nm-dispatcher.c @@ -0,0 +1,396 @@ +/* -*- 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) 2004 - 2012 Red Hat, Inc. + * Copyright (C) 2005 - 2008 Novell, Inc. + */ + +#include <glib.h> +#include <string.h> + +#include "nm-dispatcher.h" +#include "nm-dispatcher-action.h" +#include "NetworkManagerUtils.h" +#include "nm-utils.h" +#include "nm-logging.h" +#include "nm-dbus-manager.h" +#include "nm-dbus-glib-types.h" + +static GSList *requests = NULL; + +static void +dump_object_to_props (GObject *object, GHashTable *hash) +{ + GParamSpec **pspecs; + guint len = 0, i; + + pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &len); + for (i = 0; i < len; i++) { + value_hash_add_object_property (hash, + pspecs[i]->name, + object, + pspecs[i]->name, + pspecs[i]->value_type); + } + g_free (pspecs); +} + +static void +dump_dhcp4_to_props (NMDHCP4Config *config, GHashTable *hash) +{ + GSList *options, *iter; + + options = nm_dhcp4_config_list_options (config); + for (iter = options; iter; iter = g_slist_next (iter)) { + const char *option = (const char *) iter->data; + const char *val; + + val = nm_dhcp4_config_get_option (config, option); + value_hash_add_str (hash, option, val); + } + g_slist_free (options); +} + +static void +dump_dhcp6_to_props (NMDHCP6Config *config, GHashTable *hash) +{ + GSList *options, *iter; + + options = nm_dhcp6_config_list_options (config); + for (iter = options; iter; iter = g_slist_next (iter)) { + const char *option = (const char *) iter->data; + const char *val; + + val = nm_dhcp6_config_get_option (config, option); + value_hash_add_str (hash, option, val); + } + g_slist_free (options); +} + +static void +fill_device_props (NMDevice *device, + GHashTable *dev_hash, + GHashTable *ip4_hash, + GHashTable *ip6_hash, + GHashTable *dhcp4_hash, + GHashTable *dhcp6_hash) +{ + NMIP4Config *ip4_config; + NMIP6Config *ip6_config; + NMDHCP4Config *dhcp4_config; + NMDHCP6Config *dhcp6_config; + + /* If the action is for a VPN, send the VPN's IP interface instead of the device's */ + value_hash_add_str (dev_hash, NMD_DEVICE_PROPS_IP_INTERFACE, nm_device_get_ip_iface (device)); + value_hash_add_str (dev_hash, NMD_DEVICE_PROPS_INTERFACE, nm_device_get_iface (device)); + value_hash_add_uint (dev_hash, NMD_DEVICE_PROPS_TYPE, nm_device_get_device_type (device)); + value_hash_add_uint (dev_hash, NMD_DEVICE_PROPS_STATE, nm_device_get_state (device)); + value_hash_add_object_path (dev_hash, NMD_DEVICE_PROPS_PATH, nm_device_get_path (device)); + + ip4_config = nm_device_get_ip4_config (device); + if (ip4_config) + dump_object_to_props (G_OBJECT (ip4_config), ip4_hash); + + ip6_config = nm_device_get_ip6_config (device); + if (ip6_config) + dump_object_to_props (G_OBJECT (ip6_config), ip6_hash); + + dhcp4_config = nm_device_get_dhcp4_config (device); + if (dhcp4_config) + dump_dhcp4_to_props (dhcp4_config, dhcp4_hash); + + dhcp6_config = nm_device_get_dhcp6_config (device); + if (dhcp6_config) + dump_dhcp6_to_props (dhcp6_config, dhcp6_hash); +} + +static void +fill_vpn_props (NMIP4Config *ip4_config, + NMIP6Config *ip6_config, + GHashTable *ip4_hash, + GHashTable *ip6_hash) +{ + if (ip4_config) + dump_object_to_props (G_OBJECT (ip4_config), ip4_hash); + if (ip6_config) + dump_object_to_props (G_OBJECT (ip6_config), ip6_hash); +} + +typedef struct { + DispatcherFunc callback; + gpointer user_data; + NMDBusManager *dbus_mgr; +} DispatchInfo; + +static void +dispatcher_info_free (DispatchInfo *info) +{ + requests = g_slist_remove (requests, info); + g_object_unref (info->dbus_mgr); + g_free (info); +} + +static const char * +dispatch_result_to_string (DispatchResult result) +{ + switch (result) { + case DISPATCH_RESULT_UNKNOWN: + return "unknown"; + case DISPATCH_RESULT_SUCCESS: + return "success"; + case DISPATCH_RESULT_EXEC_FAILED: + return "exec failed"; + case DISPATCH_RESULT_FAILED: + return "failed"; + case DISPATCH_RESULT_TIMEOUT: + return "timed out"; + } + g_assert_not_reached (); +} + +static void +dispatcher_done_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) +{ + DispatchInfo *info = user_data; + GError *error = NULL; + GPtrArray *results = NULL; + guint i; + + if (dbus_g_proxy_end_call (proxy, call, &error, + DISPATCHER_TYPE_RESULT_ARRAY, &results, + G_TYPE_INVALID)) { + for (i = 0; results && (i < results->len); i++) { + GValueArray *item = g_ptr_array_index (results, i); + GValue *tmp; + const char *script, *err; + DispatchResult result; + + if ( (G_VALUE_TYPE (g_value_array_get_nth (item, 0)) == G_TYPE_STRING) + && (G_VALUE_TYPE (g_value_array_get_nth (item, 1)) == G_TYPE_UINT) + && (G_VALUE_TYPE (g_value_array_get_nth (item, 2)) == G_TYPE_STRING)) { + /* result */ + tmp = g_value_array_get_nth (item, 1); + result = g_value_get_uint (tmp); + if (result != DISPATCH_RESULT_SUCCESS) { + /* script */ + tmp = g_value_array_get_nth (item, 0); + script = g_value_get_string (tmp); + + /* error */ + tmp = g_value_array_get_nth (item, 2); + err = g_value_get_string (tmp); + + nm_log_warn (LOGD_CORE, "Dispatcher script %s: %s", + dispatch_result_to_string (result), err); + } + } else + nm_log_dbg (LOGD_CORE, "Dispatcher result element %d invalid type", i); + + g_value_array_free (item); + } + g_ptr_array_free (results, TRUE); + } else { + g_assert (error); + nm_log_warn (LOGD_CORE, "Dispatcher failed: (%d) %s", error->code, error->message); + } + + if (info->callback) + info->callback (info, info->user_data); + + g_clear_error (&error); + g_object_unref (proxy); +} + +static const char * +action_to_string (DispatcherAction action) +{ + switch (action) { + case DISPATCHER_ACTION_HOSTNAME: + return "hostname"; + case DISPATCHER_ACTION_UP: + return "up"; + case DISPATCHER_ACTION_PRE_DOWN: + return "pre-down"; + case DISPATCHER_ACTION_DOWN: + return "down"; + case DISPATCHER_ACTION_VPN_UP: + return "vpn-up"; + case DISPATCHER_ACTION_VPN_PRE_DOWN: + return "vpn-pre-down"; + case DISPATCHER_ACTION_VPN_DOWN: + return "vpn-down"; + case DISPATCHER_ACTION_DHCP4_CHANGE: + return "dhcp4-change"; + case DISPATCHER_ACTION_DHCP6_CHANGE: + return "dhcp6-change"; + default: + break; + } + g_assert_not_reached (); +} + +static gconstpointer +_dispatcher_call (DispatcherAction action, + NMConnection *connection, + NMDevice *device, + const char *vpn_iface, + NMIP4Config *vpn_ip4_config, + NMIP6Config *vpn_ip6_config, + DispatcherFunc callback, + gpointer user_data) +{ + NMDBusManager *dbus_mgr; + DBusGProxy *proxy; + DBusGConnection *g_connection; + GHashTable *connection_hash; + GHashTable *connection_props; + GHashTable *device_props; + GHashTable *device_ip4_props; + GHashTable *device_ip6_props; + GHashTable *device_dhcp4_props; + GHashTable *device_dhcp6_props; + GHashTable *vpn_ip4_props; + GHashTable *vpn_ip6_props; + DBusGProxyCall *call; + DispatchInfo *info; + + /* All actions except 'hostname' require a device */ + if (action != DISPATCHER_ACTION_HOSTNAME) + g_return_val_if_fail (NM_IS_DEVICE (device), NULL); + /* VPN actions require at least an IPv4 config (for now) */ + if (action == DISPATCHER_ACTION_VPN_UP) + g_return_val_if_fail (vpn_ip4_config != NULL, NULL); + + dbus_mgr = nm_dbus_manager_get (); + g_connection = nm_dbus_manager_get_connection (dbus_mgr); + proxy = dbus_g_proxy_new_for_name (g_connection, + NM_DISPATCHER_DBUS_SERVICE, + NM_DISPATCHER_DBUS_PATH, + NM_DISPATCHER_DBUS_IFACE); + if (!proxy) { + nm_log_err (LOGD_CORE, "could not get dispatcher proxy!"); + g_object_unref (dbus_mgr); + return NULL; + } + + if (connection) { + connection_hash = nm_connection_to_hash (connection, NM_SETTING_HASH_FLAG_NO_SECRETS); + + connection_props = value_hash_create (); + value_hash_add_object_path (connection_props, + NMD_CONNECTION_PROPS_PATH, + nm_connection_get_path (connection)); + } else { + connection_hash = value_hash_create (); + connection_props = value_hash_create (); + } + + device_props = value_hash_create (); + device_ip4_props = value_hash_create (); + device_ip6_props = value_hash_create (); + device_dhcp4_props = value_hash_create (); + device_dhcp6_props = value_hash_create (); + vpn_ip4_props = value_hash_create (); + vpn_ip6_props = value_hash_create (); + + /* hostname actions only send the hostname */ + if (action != DISPATCHER_ACTION_HOSTNAME) { + fill_device_props (device, + device_props, + device_ip4_props, + device_ip6_props, + device_dhcp4_props, + device_dhcp6_props); + if (vpn_iface) + fill_vpn_props (vpn_ip4_config, NULL, vpn_ip4_props, vpn_ip6_props); + } + + info = g_malloc0 (sizeof (*info)); + info->callback = callback; + info->user_data = user_data; + info->dbus_mgr = dbus_mgr; + + /* Send the action to the dispatcher */ + call = dbus_g_proxy_begin_call_with_timeout (proxy, "Action", + dispatcher_done_cb, + info, + (GDestroyNotify) dispatcher_info_free, + 15000, + G_TYPE_STRING, action_to_string (action), + DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, connection_hash, + DBUS_TYPE_G_MAP_OF_VARIANT, connection_props, + DBUS_TYPE_G_MAP_OF_VARIANT, device_props, + DBUS_TYPE_G_MAP_OF_VARIANT, device_ip4_props, + DBUS_TYPE_G_MAP_OF_VARIANT, device_ip6_props, + DBUS_TYPE_G_MAP_OF_VARIANT, device_dhcp4_props, + DBUS_TYPE_G_MAP_OF_VARIANT, device_dhcp6_props, + G_TYPE_STRING, vpn_iface ? vpn_iface : "", + DBUS_TYPE_G_MAP_OF_VARIANT, vpn_ip4_props, + DBUS_TYPE_G_MAP_OF_VARIANT, vpn_ip6_props, + G_TYPE_INVALID); + g_hash_table_destroy (connection_hash); + g_hash_table_destroy (connection_props); + g_hash_table_destroy (device_props); + g_hash_table_destroy (device_ip4_props); + g_hash_table_destroy (device_ip6_props); + g_hash_table_destroy (device_dhcp4_props); + g_hash_table_destroy (device_dhcp6_props); + g_hash_table_destroy (vpn_ip4_props); + g_hash_table_destroy (vpn_ip6_props); + + /* Track the request in case of cancelation */ + requests = g_slist_append (requests, info); + + return info; +} + +gconstpointer +nm_dispatcher_call (DispatcherAction action, + NMConnection *connection, + NMDevice *device, + DispatcherFunc callback, + gpointer user_data) +{ + return _dispatcher_call (action, connection, device, NULL, NULL, NULL, callback, user_data); +} + +gconstpointer +nm_dispatcher_call_vpn (DispatcherAction action, + NMConnection *connection, + NMDevice *device, + const char *vpn_iface, + NMIP4Config *vpn_ip4_config, + NMIP6Config *vpn_ip6_config, + DispatcherFunc callback, + gpointer user_data) +{ + return _dispatcher_call (action, connection, device, vpn_iface, vpn_ip4_config, vpn_ip6_config, callback, user_data); +} + +void +nm_dispatcher_call_cancel (gconstpointer call) +{ + /* 'call' is really a DispatchInfo pointer, just opaque to callers. + * Look it up in our requests list, but don't access it directly before + * we've made sure it's a valid request,since it may have long since been + * freed. Canceling just means the callback doesn't get called, so set + * the DispatcherInfo's callback to NULL. + */ + if (g_slist_find (requests, call)) + ((DispatchInfo *) call)->callback = NULL; +} + diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h new file mode 100644 index 000000000..05a6c8751 --- /dev/null +++ b/src/nm-dispatcher.h @@ -0,0 +1,64 @@ +/* -*- 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) 2004 - 2012 Red Hat, Inc. + * Copyright (C) 2005 - 2008 Novell, Inc. + */ + +#ifndef NM_DISPATCHER_H +#define NM_DISPATCHER_H + +#include <glib.h> +#include <stdio.h> + +#include "nm-device.h" +#include "nm-ip4-config.h" +#include "nm-ip6-config.h" +#include "nm-connection.h" + +typedef enum { + DISPATCHER_ACTION_HOSTNAME, + DISPATCHER_ACTION_UP, + DISPATCHER_ACTION_PRE_DOWN, + DISPATCHER_ACTION_DOWN, + DISPATCHER_ACTION_VPN_UP, + DISPATCHER_ACTION_VPN_PRE_DOWN, + DISPATCHER_ACTION_VPN_DOWN, + DISPATCHER_ACTION_DHCP4_CHANGE, + DISPATCHER_ACTION_DHCP6_CHANGE +} DispatcherAction; + +typedef void (*DispatcherFunc) (gconstpointer call, gpointer user_data); + +gconstpointer nm_dispatcher_call (DispatcherAction action, + NMConnection *connection, + NMDevice *device, + DispatcherFunc callback, + gpointer user_data); + +gconstpointer nm_dispatcher_call_vpn (DispatcherAction action, + NMConnection *connection, + NMDevice *device, + const char *vpn_iface, + NMIP4Config *vpn_ip4_config, + NMIP6Config *vpn_ip6_config, + DispatcherFunc callback, + gpointer user_data); + +void nm_dispatcher_call_cancel (gconstpointer call); + +#endif /* NM_DISPATCHER_H */ diff --git a/src/nm-manager.c b/src/nm-manager.c index 22c3bd43e..fbc9d23d3 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -47,6 +47,7 @@ #include "nm-device-modem.h" #include "nm-device-infiniband.h" #include "nm-device-bond.h" +#include "nm-device-bridge.h" #include "nm-device-vlan.h" #include "nm-device-adsl.h" #include "nm-system.h" @@ -69,6 +70,7 @@ #include "nm-device-factory.h" #include "wifi-utils.h" #include "nm-enum-types.h" +#include "nm-sleep-monitor.h" #if WITH_CONCHECK #include "nm-connectivity.h" @@ -78,8 +80,6 @@ #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" -#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower" - static gboolean impl_manager_get_devices (NMManager *manager, GPtrArray **devices, GError **err); @@ -125,6 +125,10 @@ static gboolean impl_manager_set_logging (NMManager *manager, const char *domains, GError **error); +static void impl_manager_get_logging (NMManager *manager, + char **level, + char **domains); + #include "nm-manager-glue.h" static void bluez_manager_bdaddr_added_cb (NMBluezManager *bluez_mgr, @@ -149,6 +153,7 @@ static NMActiveConnection *internal_activate_device (NMManager *manager, const char *specific_object, gboolean user_requested, gulong sender_uid, + const char *dbus_sender, gboolean assumed, NMActiveConnection *master, GError **error); @@ -198,6 +203,9 @@ typedef struct { typedef struct { char *state_file; + GSList *active_connections; + guint ac_cleanup_id; + GSList *devices; NMState state; #if WITH_CONCHECK @@ -219,15 +227,13 @@ typedef struct { gboolean net_enabled; NMVPNManager *vpn_manager; - gulong vpn_manager_activated_id; - gulong vpn_manager_deactivated_id; NMModemManager *modem_manager; guint modem_added_id; guint modem_removed_id; DBusGProxy *aipd_proxy; - DBusGProxy *upower_proxy; + NMSleepMonitor *sleep_monitor; GSList *auth_chains; @@ -254,6 +260,8 @@ enum { PROPERTIES_CHANGED, CHECK_PERMISSIONS, USER_PERMISSIONS_CHANGED, + ACTIVE_CONNECTION_ADDED, + ACTIVE_CONNECTION_REMOVED, LAST_SIGNAL }; @@ -296,6 +304,102 @@ nm_manager_error_quark (void) /************************************************************************/ +static void active_connection_state_changed (NMActiveConnection *active, + GParamSpec *pspec, + NMManager *self); + +static gboolean +_active_connection_cleanup (gpointer user_data) +{ + NMManager *self = NM_MANAGER (user_data); + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); + GSList *iter; + gboolean changed = FALSE; + + priv->ac_cleanup_id = 0; + + iter = priv->active_connections; + while (iter) { + NMActiveConnection *ac = iter->data; + + iter = iter->next; + if (nm_active_connection_get_state (ac) == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { + priv->active_connections = g_slist_remove (priv->active_connections, ac); + g_signal_emit (self, signals[ACTIVE_CONNECTION_REMOVED], 0, ac); + g_signal_handlers_disconnect_by_func (ac, active_connection_state_changed, self); + g_object_unref (ac); + changed = TRUE; + } + } + + if (changed) + g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); + + return FALSE; +} + +static void +active_connection_state_changed (NMActiveConnection *active, + GParamSpec *pspec, + NMManager *self) +{ + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); + NMActiveConnectionState state; + + state = nm_active_connection_get_state (active); + if (state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { + /* Destroy active connections from an idle handler to ensure that + * their last property change notifications go out, which wouldn't + * happen if we destroyed them immediately when their state was set + * to DEACTIVATED. + */ + if (!priv->ac_cleanup_id) + priv->ac_cleanup_id = g_idle_add (_active_connection_cleanup, self); + } +} + +static void +active_connection_add (NMManager *self, NMActiveConnection *active) +{ + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); + + g_return_if_fail (g_slist_find (priv->active_connections, active) == FALSE); + + priv->active_connections = g_slist_prepend (priv->active_connections, active); + g_signal_connect (active, "notify::" NM_ACTIVE_CONNECTION_STATE, + G_CALLBACK (active_connection_state_changed), + self); + + g_signal_emit (self, signals[ACTIVE_CONNECTION_ADDED], 0, active); + g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); +} + +const GSList * +nm_manager_get_active_connections (NMManager *manager) +{ + return NM_MANAGER_GET_PRIVATE (manager)->active_connections; +} + +static NMActiveConnection * +active_connection_get_by_path (NMManager *manager, const char *path) +{ + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); + GSList *iter; + + g_return_val_if_fail (manager != NULL, NULL); + g_return_val_if_fail (path != NULL, NULL); + + for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { + NMActiveConnection *candidate = iter->data; + + if (strcmp (path, nm_active_connection_get_path (candidate)) == 0) + return candidate; + } + return NULL; +} + +/************************************************************************/ + static NMDevice * nm_manager_get_device_by_udi (NMManager *manager, const char *udi) { @@ -353,29 +457,6 @@ manager_sleeping (NMManager *self) } static void -vpn_manager_connection_activated_cb (NMVPNManager *manager, - NMVPNConnection *vpn, - gpointer user_data) -{ - NMConnection *connection = nm_vpn_connection_get_connection (vpn); - - /* Update timestamp for the VPN connection */ - nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (connection), - (guint64) time (NULL), TRUE); -} - -static void -vpn_manager_connection_deactivated_cb (NMVPNManager *manager, - NMVPNConnection *vpn, - NMVPNConnectionState new_state, - NMVPNConnectionState old_state, - NMVPNConnectionStateReason reason, - gpointer user_data) -{ - g_object_notify (G_OBJECT (user_data), NM_MANAGER_ACTIVE_CONNECTIONS); -} - -static void modem_added (NMModemManager *modem_manager, NMModem *modem, const char *driver, @@ -384,12 +465,16 @@ modem_added (NMModemManager *modem_manager, NMManager *self = NM_MANAGER (user_data); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); NMDevice *replace_device, *device = NULL; - const char *ip_iface; + const char *modem_iface; GSList *iter; - ip_iface = nm_modem_get_iface (modem); + /* Don't rely only on the data port; use the control port if available */ + modem_iface = nm_modem_get_data_port (modem); + if (!modem_iface) + modem_iface = nm_modem_get_control_port (modem); + g_return_if_fail (modem_iface); - replace_device = find_device_by_ip_iface (NM_MANAGER (user_data), ip_iface); + replace_device = find_device_by_ip_iface (NM_MANAGER (user_data), modem_iface); if (replace_device) { priv->devices = remove_one_device (NM_MANAGER (user_data), priv->devices, @@ -410,7 +495,7 @@ modem_added (NMModemManager *modem_manager, * by the Bluetooth code during the connection process. */ if (driver && !strcmp (driver, "bluetooth")) { - nm_log_info (LOGD_MB, "ignoring modem '%s' (no associated Bluetooth device)", ip_iface); + nm_log_info (LOGD_MB, "ignoring modem '%s' (no associated Bluetooth device)", modem_iface); return; } @@ -885,36 +970,6 @@ pending_activation_destroy (PendingActivation *pending, g_slice_free (PendingActivation, pending); } -static GPtrArray * -get_active_connections (NMManager *manager, NMConnection *filter) -{ - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - GPtrArray *active; - GSList *iter; - - active = g_ptr_array_sized_new (3); - - /* Add active device connections */ - for (iter = priv->devices; iter; iter = g_slist_next (iter)) { - NMActRequest *req; - const char *path; - - req = nm_device_get_act_request (NM_DEVICE (iter->data)); - if (!req) - continue; - - if (!filter || (nm_act_request_get_connection (req) == filter)) { - path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (req)); - g_ptr_array_add (active, g_strdup (path)); - } - } - - /* Add active VPN connections */ - nm_vpn_manager_add_active_connections (priv->vpn_manager, filter, active); - - return active; -} - /*******************************************************************/ /* Settings stuff via NMSettings */ /*******************************************************************/ @@ -945,8 +1000,8 @@ find_vlan_parent (NMManager *self, GSList *iter; /* The 'parent' property could be either an interface name, a connection - * UUID, or even given by the MAC address of the connection's ethernet, - * InfiniBand, or WiFi setting. + * UUID, or even given by the MAC address of the connection's ethernet + * or WiFi setting. */ s_vlan = nm_connection_get_setting_vlan (connection); g_return_val_if_fail (s_vlan != NULL, NULL); @@ -1016,6 +1071,9 @@ get_virtual_iface_name (NMManager *self, if (nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME)) return g_strdup (nm_connection_get_virtual_iface_name (connection)); + if (nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) + return g_strdup (nm_connection_get_virtual_iface_name (connection)); + if (nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)) { NMSettingVlan *s_vlan; const char *ifname; @@ -1025,11 +1083,20 @@ get_virtual_iface_name (NMManager *self, parent = find_vlan_parent (self, connection, TRUE); if (parent) { + ifname = nm_connection_get_virtual_iface_name (connection); + + if (!nm_device_supports_vlans (parent)) { + nm_log_warn (LOGD_DEVICE, "(%s): No support for VLANs on interface %s of type %s", + ifname ? ifname : nm_connection_get_id (connection), + nm_device_get_ip_iface (parent), + nm_device_get_type_desc (parent)); + return NULL; + } + /* If the connection doesn't specify the interface name for the VLAN * device, we create one for it using the VLAN ID and the parent * interface's name. */ - ifname = nm_connection_get_virtual_iface_name (connection); if (ifname) vname = g_strdup (ifname); else { @@ -1047,9 +1114,9 @@ get_virtual_iface_name (NMManager *self, static gboolean connection_needs_virtual_device (NMConnection *connection) { - if (nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME)) - return TRUE; - if (nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)) + if ( nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME) + || nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME) + || nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)) return TRUE; return FALSE; @@ -1111,6 +1178,16 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) udi = get_virtual_iface_placeholder_udi (); device = nm_device_bond_new (udi, iface); g_free (udi); + } else if (nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) { + if (!nm_system_create_bridge (iface)) { + nm_log_warn (LOGD_DEVICE, "(%s): failed to add bridging interface for '%s'", + iface, nm_connection_get_id (connection)); + goto out; + } + + udi = get_virtual_iface_placeholder_udi (); + device = nm_device_bridge_new (udi, iface); + g_free (udi); } else if (nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)) { g_return_val_if_fail (parent != NULL, FALSE); @@ -1157,17 +1234,24 @@ system_create_virtual_devices (NMManager *self) static void connection_added (NMSettings *settings, - NMSettingsConnection *connection, + NMSettingsConnection *settings_connection, NMManager *manager) { - if (connection_needs_virtual_device (NM_CONNECTION (connection))) - system_create_virtual_device (manager, NM_CONNECTION (connection)); + NMConnection *connection = NM_CONNECTION (settings_connection); + + if (connection_needs_virtual_device (connection)) { + NMSettingConnection *s_con = nm_connection_get_setting_connection (connection); + + g_assert (s_con); + if (nm_setting_connection_get_autoconnect (s_con)) + system_create_virtual_device (manager, connection); + } } static void connection_changed (NMSettings *settings, - NMSettingsConnection *connection, - NMManager *manager) + NMSettingsConnection *connection, + NMManager *manager) { /* FIXME: Some virtual devices may need to be updated in the future. */ } @@ -1528,7 +1612,7 @@ manager_ipw_rfkill_state_changed (NMDeviceWifi *device, } static void -manager_modem_enabled_changed (NMModem *device, gpointer user_data) +manager_modem_enabled_changed (NMDevice *device, gpointer user_data) { nm_manager_rfkill_update (NM_MANAGER (user_data), RFKILL_TYPE_WWAN); } @@ -1759,9 +1843,9 @@ add_device (NMManager *self, NMDevice *device) nm_log_dbg (LOGD_DEVICE, "(%s): will attempt to assume existing connection", nm_device_get_iface (device)); - ac = internal_activate_device (self, device, existing, NULL, FALSE, 0, TRUE, NULL, &error); + ac = internal_activate_device (self, device, existing, NULL, FALSE, 0, NULL, TRUE, NULL, &error); if (ac) - g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS); + active_connection_add (self, ac); else { nm_log_warn (LOGD_DEVICE, "assumed connection %s failed to activate: (%d) %s", nm_connection_get_path (existing), @@ -2007,6 +2091,12 @@ is_bond (int ifindex) } static gboolean +is_bridge (int ifindex) +{ + return (nm_system_get_iface_type (ifindex, NULL) == NM_IFACE_TYPE_BRIDGE); +} + +static gboolean is_vlan (int ifindex) { return (nm_system_get_iface_type (ifindex, NULL) == NM_IFACE_TYPE_VLAN); @@ -2085,6 +2175,8 @@ udev_device_added_cb (NMUdevManager *udev_mgr, device = nm_device_infiniband_new (sysfs_path, iface, driver); else if (is_bond (ifindex)) device = nm_device_bond_new (sysfs_path, iface); + else if (is_bridge (ifindex)) + device = nm_device_bridge_new (sysfs_path, iface); else if (is_vlan (ifindex)) { int parent_ifindex = -1; NMDevice *parent; @@ -2203,37 +2295,6 @@ impl_manager_get_device_by_ip_iface (NMManager *self, return path ? TRUE : FALSE; } -static NMActRequest * -nm_manager_get_act_request_by_path (NMManager *manager, - const char *path, - NMDevice **device) -{ - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - GSList *iter; - - g_return_val_if_fail (manager != NULL, NULL); - g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (device != NULL, NULL); - g_return_val_if_fail (*device == NULL, NULL); - - for (iter = priv->devices; iter; iter = g_slist_next (iter)) { - NMActRequest *req; - const char *ac_path; - - req = nm_device_get_act_request (NM_DEVICE (iter->data)); - if (!req) - continue; - - ac_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (req)); - if (!strcmp (path, ac_path)) { - *device = NM_DEVICE (iter->data); - return req; - } - } - - return NULL; -} - static NMActiveConnection * internal_activate_device (NMManager *manager, NMDevice *device, @@ -2241,12 +2302,13 @@ internal_activate_device (NMManager *manager, const char *specific_object, gboolean user_requested, gulong sender_uid, + const char *dbus_sender, gboolean assumed, NMActiveConnection *master, GError **error) { NMActRequest *req; - gboolean success; + NMDevice *master_device = NULL; g_return_val_if_fail (NM_IS_MANAGER (manager), NULL); g_return_val_if_fail (NM_IS_DEVICE (device), NULL); @@ -2265,17 +2327,21 @@ internal_activate_device (NMManager *manager, NM_DEVICE_STATE_REASON_NONE); } + if (master) + master_device = nm_active_connection_get_device (master); + req = nm_act_request_new (connection, specific_object, user_requested, sender_uid, + dbus_sender, assumed, - (gpointer) device, - master); - success = nm_device_activate (device, req, error); - g_object_unref (req); + device, + master_device); + g_assert (req); + nm_device_activate (device, req); - return success ? NM_ACTIVE_CONNECTION (req) : NULL; + return NM_ACTIVE_CONNECTION (req); } /** @@ -2538,48 +2604,50 @@ static NMActiveConnection * activate_vpn_connection (NMManager *self, NMConnection *connection, const char *specific_object, - const char *device_path, gulong sender_uid, GError **error) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); - NMActRequest *parent_req = NULL; + NMActiveConnection *parent = NULL; NMDevice *device = NULL; GSList *iter; if (specific_object) { /* Find the specifc connection the client requested we use */ - parent_req = nm_manager_get_act_request_by_path (self, specific_object, &device); - if (!parent_req) { + parent = active_connection_get_by_path (self, specific_object); + if (!parent) { g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, "Base connection for VPN connection not active."); return NULL; } } else { - /* Just find the current default connection */ - for (iter = priv->devices; iter; iter = g_slist_next (iter)) { - NMDevice *candidate = NM_DEVICE (iter->data); - NMActRequest *candidate_req; + for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { + NMActiveConnection *candidate = iter->data; - candidate_req = nm_device_get_act_request (candidate); - if (candidate_req && nm_active_connection_get_default (NM_ACTIVE_CONNECTION (candidate_req))) { - device = candidate; - parent_req = candidate_req; + if (nm_active_connection_get_default (candidate)) { + parent = candidate; break; } } } - if (!device || !parent_req) { + if (!parent) { + g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION, + "Could not find source connection."); + return NULL; + } + + device = nm_active_connection_get_device (parent); + if (!device) { g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE, - "Could not find source connection, or the source connection had no active device."); + "Source connection had no active device."); return NULL; } return nm_vpn_manager_activate_connection (priv->vpn_manager, connection, device, - nm_active_connection_get_path (NM_ACTIVE_CONNECTION (parent_req)), + nm_active_connection_get_path (parent), TRUE, sender_uid, error); @@ -2601,7 +2669,7 @@ nm_manager_activate_connection (NMManager *manager, char *iface; NMDevice *master_device = NULL; NMConnection *master_connection = NULL; - NMActiveConnection *master_ac = NULL; + NMActiveConnection *master_ac = NULL, *ac = NULL; g_return_val_if_fail (manager != NULL, NULL); g_return_val_if_fail (connection != NULL, NULL); @@ -2626,8 +2694,10 @@ nm_manager_activate_connection (NMManager *manager, } /* VPN ? */ - if (nm_connection_is_type (connection, NM_SETTING_VPN_SETTING_NAME)) - return activate_vpn_connection (manager, connection, specific_object, device_path, sender_uid, error); + if (nm_connection_is_type (connection, NM_SETTING_VPN_SETTING_NAME)) { + ac = activate_vpn_connection (manager, connection, specific_object, sender_uid, error); + goto activated; + } /* Device-based connection */ if (device_path) { @@ -2751,15 +2821,22 @@ nm_manager_activate_connection (NMManager *manager, nm_active_connection_get_path (master_ac)); } - return internal_activate_device (manager, - device, - connection, - specific_object, - dbus_sender ? TRUE : FALSE, - dbus_sender ? sender_uid : 0, - FALSE, - master_ac, - error); + ac = internal_activate_device (manager, + device, + connection, + specific_object, + dbus_sender ? TRUE : FALSE, + dbus_sender ? sender_uid : 0, + dbus_sender, + FALSE, + master_ac, + error); + +activated: + if (ac) + active_connection_add (manager, ac); + + return ac; } /* @@ -2797,9 +2874,7 @@ pending_activate (NMManager *self, PendingActivation *pending) &error); g_free (sender); - if (ac) - g_object_notify (G_OBJECT (pending->manager), NM_MANAGER_ACTIVE_CONNECTIONS); - else { + if (!ac) { nm_log_warn (LOGD_CORE, "connection %s failed to activate: (%d) %s", pending->connection_path, error ? error->code : -1, @@ -2926,41 +3001,35 @@ nm_manager_deactivate_connection (NMManager *manager, GError **error) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - GSList *iter; + NMActiveConnection *active; gboolean success = FALSE; - NMVPNConnectionStateReason vpn_reason = NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED; - /* Check for device connections first */ - for (iter = priv->devices; iter; iter = g_slist_next (iter)) { - NMDevice *device = NM_DEVICE (iter->data); - NMActRequest *req; + active = active_connection_get_by_path (manager, connection_path); + if (!active) { + g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, + "The connection was not active."); + return FALSE; + } - req = nm_device_get_act_request (device); - if (!req) - continue; + if (NM_IS_VPN_CONNECTION (active)) { + NMVPNConnectionStateReason vpn_reason = NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED; - if (!strcmp (connection_path, nm_active_connection_get_path (NM_ACTIVE_CONNECTION (req)))) { - nm_device_state_changed (device, - NM_DEVICE_STATE_DISCONNECTED, - reason); + if (reason == NM_DEVICE_STATE_REASON_CONNECTION_REMOVED) + vpn_reason = NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED; + if (nm_vpn_manager_deactivate_connection (priv->vpn_manager, NM_VPN_CONNECTION (active), vpn_reason)) success = TRUE; - goto done; - } - } - - /* Check for VPN connections next */ - if (reason == NM_DEVICE_STATE_REASON_CONNECTION_REMOVED) - vpn_reason = NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED; - if (nm_vpn_manager_deactivate_connection (priv->vpn_manager, connection_path, vpn_reason)) { - success = TRUE; } else { - g_set_error (error, - NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, - "%s", "The connection was not active."); + g_assert (NM_IS_ACT_REQUEST (active)); + /* FIXME: use DEACTIVATING state */ + nm_device_state_changed (nm_active_connection_get_device (active), + NM_DEVICE_STATE_DISCONNECTED, + reason); + success = TRUE; } -done: - g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS); + if (success) + g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS); + return success; } @@ -3021,25 +3090,16 @@ impl_manager_deactivate_connection (NMManager *self, gulong sender_uid = G_MAXULONG; char *error_desc = NULL; - /* Check for device connections first */ - for (iter = priv->devices; iter; iter = g_slist_next (iter)) { - NMActRequest *req; - const char *req_path = NULL; - - req = nm_device_get_act_request (NM_DEVICE (iter->data)); - if (req) - req_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (req)); + /* Find the connection by its object path */ + for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { + NMActiveConnection *ac = iter->data; - if (req_path && !strcmp (active_path, req_path)) { - connection = nm_act_request_get_connection (req); + if (g_strcmp0 (nm_active_connection_get_path (ac), active_path) == 0) { + connection = nm_active_connection_get_connection (ac); break; } } - /* Maybe it's a VPN */ - if (!connection) - connection = nm_vpn_manager_get_connection_for_active (priv->vpn_manager, active_path); - if (!connection) { error = g_error_new_literal (NM_MANAGER_ERROR, NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, @@ -3275,16 +3335,16 @@ impl_manager_sleep (NMManager *self, } static void -upower_sleeping_cb (DBusGProxy *proxy, gpointer user_data) +sleeping_cb (DBusGProxy *proxy, gpointer user_data) { - nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal"); + nm_log_dbg (LOGD_SUSPEND, "Received sleeping signal"); _internal_sleep (NM_MANAGER (user_data), TRUE); } static void -upower_resuming_cb (DBusGProxy *proxy, gpointer user_data) +resuming_cb (DBusGProxy *proxy, gpointer user_data) { - nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal"); + nm_log_dbg (LOGD_SUSPEND, "Received resuming signal"); _internal_sleep (NM_MANAGER (user_data), FALSE); } @@ -3517,11 +3577,13 @@ impl_manager_set_logging (NMManager *manager, return FALSE; } -GPtrArray * -nm_manager_get_active_connections_by_connection (NMManager *manager, - NMConnection *connection) +static void +impl_manager_get_logging (NMManager *manager, + char **level, + char **domains) { - return get_active_connections (manager, connection); + *level = g_strdup (nm_logging_level_to_string ()); + *domains = g_strdup (nm_logging_domains_to_string ()); } void @@ -3971,6 +4033,7 @@ dispose (GObject *object) NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); DBusGConnection *bus; DBusConnection *dbus_connection; + GSList *iter; if (priv->disposed) { G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object); @@ -3990,6 +4053,17 @@ dispose (GObject *object) TRUE); } + if (priv->ac_cleanup_id) { + g_source_remove (priv->ac_cleanup_id); + priv->ac_cleanup_id = 0; + } + + for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { + g_signal_handlers_disconnect_by_func (iter->data, active_connection_state_changed, object); + g_object_unref (iter->data); + } + g_slist_free (priv->active_connections); + #if WITH_CONCHECK if (priv->connectivity) { g_object_unref (priv->connectivity); @@ -4000,15 +4074,6 @@ dispose (GObject *object) g_free (priv->hostname); g_object_unref (priv->settings); - - if (priv->vpn_manager_activated_id) { - g_source_remove (priv->vpn_manager_activated_id); - priv->vpn_manager_activated_id = 0; - } - if (priv->vpn_manager_deactivated_id) { - g_source_remove (priv->vpn_manager_deactivated_id); - priv->vpn_manager_deactivated_id = 0; - } g_object_unref (priv->vpn_manager); if (priv->modem_added_id) { @@ -4036,8 +4101,8 @@ dispose (GObject *object) if (priv->aipd_proxy) g_object_unref (priv->aipd_proxy); - if (priv->upower_proxy) - g_object_unref (priv->upower_proxy); + if (priv->sleep_monitor) + g_object_unref (priv->sleep_monitor); if (priv->fw_monitor) { if (priv->fw_monitor_id) @@ -4201,6 +4266,9 @@ get_property (GObject *object, guint prop_id, { NMManager *self = NM_MANAGER (object); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); + GSList *iter; + GPtrArray *active; + const char *path; switch (prop_id) { case PROP_VERSION: @@ -4232,7 +4300,12 @@ get_property (GObject *object, guint prop_id, g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WIMAX].hw_enabled); break; case PROP_ACTIVE_CONNECTIONS: - g_value_take_boxed (value, get_active_connections (self, NULL)); + active = g_ptr_array_sized_new (3); + for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { + path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (iter->data)); + g_ptr_array_add (active, g_strdup (path)); + } + g_value_take_boxed (value, active); break; case PROP_HOSTNAME: g_value_set_string (value, priv->hostname); @@ -4251,28 +4324,15 @@ periodic_update_active_connection_timestamps (gpointer user_data) { NMManager *manager = NM_MANAGER (user_data); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - GPtrArray *active; - int i; - - active = get_active_connections (manager, NULL); - - for (i = 0; i < active->len; i++) { - const char *active_path = g_ptr_array_index (active, i); - NMActRequest *req; - NMDevice *device = NULL; + GSList *iter; - req = nm_manager_get_act_request_by_path (manager, active_path, &device); - if (device && nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) - nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (nm_act_request_get_connection (req)), - (guint64) time (NULL), FALSE); - else { - /* The connection is probably VPN */ - NMVPNConnection *vpn_con; + for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) { + NMActiveConnection *ac = iter->data; + NMSettingsConnection *connection; - vpn_con = nm_vpn_manager_get_vpn_connection_for_active (priv->vpn_manager, active_path); - if (vpn_con && nm_vpn_connection_get_vpn_state (vpn_con) == NM_VPN_CONNECTION_STATE_ACTIVATED) - nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (nm_vpn_connection_get_connection (vpn_con)), - (guint64) time (NULL), FALSE); + if (nm_active_connection_get_state (ac) == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + connection = NM_SETTINGS_CONNECTION (nm_active_connection_get_connection (ac)); + nm_settings_connection_update_timestamp (connection, (guint64) time (NULL), FALSE); } } @@ -4329,10 +4389,6 @@ nm_manager_init (NMManager *manager) G_CALLBACK (modem_removed), manager); priv->vpn_manager = nm_vpn_manager_get (); - priv->vpn_manager_activated_id = g_signal_connect (G_OBJECT (priv->vpn_manager), "connection-activated", - G_CALLBACK (vpn_manager_connection_activated_cb), manager); - priv->vpn_manager_deactivated_id = g_signal_connect (G_OBJECT (priv->vpn_manager), "connection-deactivated", - G_CALLBACK (vpn_manager_connection_deactivated_cb), manager); g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr); @@ -4359,23 +4415,12 @@ nm_manager_init (NMManager *manager) } else nm_log_warn (LOGD_AUTOIP4, "could not initialize avahi-autoipd D-Bus proxy"); - /* upower sleep/wake handling */ - priv->upower_proxy = dbus_g_proxy_new_for_name (g_connection, - UPOWER_DBUS_SERVICE, - "/org/freedesktop/UPower", - "org.freedesktop.UPower"); - if (priv->upower_proxy) { - dbus_g_proxy_add_signal (priv->upower_proxy, "Sleeping", G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->upower_proxy, "Sleeping", - G_CALLBACK (upower_sleeping_cb), - manager, NULL); - - dbus_g_proxy_add_signal (priv->upower_proxy, "Resuming", G_TYPE_INVALID); - dbus_g_proxy_connect_signal (priv->upower_proxy, "Resuming", - G_CALLBACK (upower_resuming_cb), - manager, NULL); - } else - nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy"); + /* sleep/wake handling */ + priv->sleep_monitor = nm_sleep_monitor_get (); + g_signal_connect (priv->sleep_monitor, "sleeping", + G_CALLBACK (sleeping_cb), manager); + g_signal_connect (priv->sleep_monitor, "resuming", + G_CALLBACK (resuming_cb), manager); /* Listen for authorization changes */ nm_auth_changed_func_register (authority_changed_cb, manager); @@ -4563,6 +4608,22 @@ nm_manager_class_init (NMManagerClass *manager_class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + signals[ACTIVE_CONNECTION_ADDED] = + g_signal_new (NM_MANAGER_ACTIVE_CONNECTION_ADDED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, G_TYPE_OBJECT); + + signals[ACTIVE_CONNECTION_REMOVED] = + g_signal_new (NM_MANAGER_ACTIVE_CONNECTION_REMOVED, + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, G_TYPE_OBJECT); + dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class), &dbus_glib_nm_manager_object_info); diff --git a/src/nm-manager.h b/src/nm-manager.h index 91d1c4109..66d067831 100644 --- a/src/nm-manager.h +++ b/src/nm-manager.h @@ -63,6 +63,11 @@ typedef enum { #define NM_MANAGER_HOSTNAME "hostname" #define NM_MANAGER_SLEEPING "sleeping" +/* Internal signals */ +#define NM_MANAGER_ACTIVE_CONNECTION_ADDED "active-connection-added" +#define NM_MANAGER_ACTIVE_CONNECTION_REMOVED "active-connection-removed" + + typedef struct { GObject parent; } NMManager; @@ -95,6 +100,8 @@ NMManager *nm_manager_get (void); void nm_manager_start (NMManager *manager); +const GSList *nm_manager_get_active_connections (NMManager *manager); + /* Device handling */ GSList *nm_manager_get_devices (NMManager *manager); @@ -119,7 +126,4 @@ gboolean nm_manager_deactivate_connection (NMManager *manager, NMState nm_manager_get_state (NMManager *manager); -GPtrArray * nm_manager_get_active_connections_by_connection (NMManager *manager, - NMConnection *connection); - #endif /* NM_MANAGER_H */ diff --git a/src/nm-netlink-compat.c b/src/nm-netlink-compat.c index e30ec37a6..68ee12159 100644 --- a/src/nm-netlink-compat.c +++ b/src/nm-netlink-compat.c @@ -29,7 +29,7 @@ #include "nm-logging.h" #include "nm-netlink-compat.h" -#ifndef HAVE_LIBNL1 +#if HAVE_LIBNL != 1 struct rtnl_nexthop * nm_netlink_get_nh (struct rtnl_route * route) { @@ -93,7 +93,7 @@ rtnl_route_get_dst_len(struct rtnl_route * rtnlroute) } #endif -#ifdef HAVE_LIBNL1 +#if HAVE_LIBNL == 1 int nl_compat_error (int err) { diff --git a/src/nm-netlink-compat.h b/src/nm-netlink-compat.h index eb0926ad0..80df09673 100644 --- a/src/nm-netlink-compat.h +++ b/src/nm-netlink-compat.h @@ -43,7 +43,7 @@ #include <config.h> /* libnl-1 API compatibility for libnl-2/3*/ -#ifndef HAVE_LIBNL1 +#if HAVE_LIBNL != 1 struct rtnl_nexthop * nm_netlink_get_nh(struct rtnl_route *); int rtnl_route_get_oif(struct rtnl_route *); @@ -54,7 +54,7 @@ struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *); #endif /* libnl-2 API compatibility for libnl-3 */ -#ifdef HAVE_LIBNL3 +#if HAVE_LIBNL == 3 static inline int __rtnl_link_alloc_cache (struct nl_sock *h, struct nl_cache **cache) { @@ -65,15 +65,15 @@ __rtnl_link_alloc_cache (struct nl_sock *h, struct nl_cache **cache) /* libnl-2.0 compat functions */ -#ifdef HAVE_LIBNL2 +#if HAVE_LIBNL == 2 /* functions with similar prototypes */ #define nlmsg_datalen nlmsg_len -#endif /* HAVE_LIBNL2 */ +#endif /* libnl-1.0 compat functions */ -#ifdef HAVE_LIBNL1 +#if HAVE_LIBNL == 1 #define nl_sock nl_handle @@ -204,10 +204,10 @@ __nl_cache_include (struct nl_cache *cache, struct nl_object *obj, change_func_t #define NLE_PERM 28 #define NLE_PKTLOC_FILE 29 -#endif /* HAVE_LIBNL1 */ +#endif /* Stuff that only libnl3 has */ -#if defined(HAVE_LIBNL1) || defined(HAVE_LIBNL2) +#if HAVE_LIBNL == 1 || HAVE_LIBNL == 2 static inline int rtnl_link_bond_add (struct nl_sock *h, const char *name, void *data) @@ -276,6 +276,6 @@ rtnl_link_delete(struct nl_sock *sk, const struct rtnl_link *l) /* Operation only in libnl3 */ return -NLE_OPNOTSUPP; } -#endif /* HAVE_LIBNL1 || HAVE_LIBNL2 */ +#endif #endif /* NM_NETLINK_COMPAT_H */ diff --git a/src/nm-policy-hostname.c b/src/nm-policy-hostname.c index f98aa9c62..0ea161585 100644 --- a/src/nm-policy-hostname.c +++ b/src/nm-policy-hostname.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2004 - 2011 Red Hat, Inc. + * Copyright (C) 2004 - 2012 Red Hat, Inc. * Copyright (C) 2007 - 2008 Novell, Inc. */ @@ -23,7 +23,6 @@ #include <unistd.h> #include <errno.h> #include <netdb.h> -#include <ctype.h> #include <arpa/inet.h> #include <glib.h> @@ -107,7 +106,7 @@ hostname_thread_worker (gpointer data) nm_log_dbg (LOGD_DNS, "(%p) address reverse-lookup returned hostname '%s'", ht, ht->hostname); for (i = 0; i < strlen (ht->hostname); i++) - ht->hostname[i] = tolower (ht->hostname[i]); + ht->hostname[i] = g_ascii_tolower (ht->hostname[i]); } else { nm_log_dbg (LOGD_DNS, "(%p) address reverse-lookup failed: (%d) %s", ht, ht->ret, gai_strerror (ht->ret)); @@ -140,7 +139,6 @@ hostname4_thread_new (guint32 ip4_addr, gpointer user_data) { HostnameThread *ht; - struct sockaddr_in addr4; char buf[INET_ADDRSTRLEN + 1]; ht = g_malloc0 (sizeof (HostnameThread)); @@ -161,7 +159,7 @@ hostname4_thread_new (guint32 ip4_addr, return NULL; } - if (!inet_ntop (AF_INET, &addr4.sin_addr, buf, sizeof (buf))) + if (!inet_ntop (AF_INET, &ht->addr4.sin_addr, buf, sizeof (buf))) strcpy (buf, "(unknown)"); nm_log_dbg (LOGD_DNS, "(%p) started IPv4 reverse-lookup thread for address '%s'", diff --git a/src/nm-policy.c b/src/nm-policy.c index a6accfcb2..420a94113 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -24,7 +24,6 @@ #include <unistd.h> #include <errno.h> #include <netdb.h> -#include <ctype.h> #include "nm-policy.h" #include "NetworkManagerUtils.h" @@ -41,6 +40,8 @@ #include "nm-policy-hostname.h" #include "nm-manager-auth.h" #include "nm-firewall-manager.h" +#include "nm-dispatcher.h" +#include "nm-utils.h" struct NMPolicy { NMManager *manager; @@ -50,9 +51,7 @@ struct NMPolicy { GSList *settings_ids; GSList *dev_ids; - NMVPNManager *vpn_manager; - gulong vpn_activated_id; - gulong vpn_deactivated_id; + GSList *pending_secondaries; NMFirewallManager *fw_manager; gulong fw_started_id; @@ -103,7 +102,8 @@ get_best_ip4_device (NMManager *manager) gboolean can_default = FALSE; const char *method = NULL; - if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED) + if ( nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED + && nm_device_get_state (dev) != NM_DEVICE_STATE_SECONDARIES) continue; ip4_config = nm_device_get_ip4_config (dev); @@ -175,7 +175,8 @@ get_best_ip6_device (NMManager *manager) gboolean can_default = FALSE; const char *method = NULL; - if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED) + if ( nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED + && nm_device_get_state (dev) != NM_DEVICE_STATE_SECONDARIES) continue; ip6_config = nm_device_get_ip6_config (dev); @@ -259,7 +260,7 @@ _set_hostname (NMPolicy *policy, g_object_unref (dns_mgr); if (nm_policy_set_system_hostname (policy->cur_hostname, msg)) - nm_utils_call_dispatcher ("hostname", NULL, NULL, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_HOSTNAME, NULL, NULL, NULL, NULL); } static void @@ -339,7 +340,7 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6) if (dhcp_hostname && strlen (dhcp_hostname)) { /* Sanity check; strip leading spaces */ while (*p) { - if (!isblank (*p++)) { + if (!g_ascii_isspace (*p++)) { _set_hostname (policy, p-1, "from DHCPv4"); return; } @@ -358,7 +359,7 @@ update_system_hostname (NMPolicy *policy, NMDevice *best4, NMDevice *best6) if (dhcp_hostname && strlen (dhcp_hostname)) { /* Sanity check; strip leading spaces */ while (*p) { - if (!isblank (*p++)) { + if (!g_ascii_isspace (*p++)) { _set_hostname (policy, p-1, "from DHCPv6"); return; } @@ -429,26 +430,17 @@ update_default_ac (NMPolicy *policy, NMActiveConnection *best, void (*set_active_func)(NMActiveConnection*, gboolean)) { - GSList *devices, *vpns, *iter; - NMActRequest *req; + const GSList *connections, *iter; /* Clear the 'default[6]' flag on all active connections that aren't the new * default active connection. We'll set the new default after; this ensures * we don't ever have two marked 'default[6]' simultaneously. */ - devices = nm_manager_get_devices (policy->manager); - for (iter = devices; iter; iter = g_slist_next (iter)) { - req = nm_device_get_act_request (NM_DEVICE (iter->data)); - if (req && (NM_ACTIVE_CONNECTION (req) != best)) - set_active_func (NM_ACTIVE_CONNECTION (req), FALSE); - } - - vpns = nm_vpn_manager_get_active_connections (policy->vpn_manager); - for (iter = vpns; iter; iter = g_slist_next (iter)) { + connections = nm_manager_get_active_connections (policy->manager); + for (iter = connections; iter; iter = g_slist_next (iter)) { if (NM_ACTIVE_CONNECTION (iter->data) != best) set_active_func (NM_ACTIVE_CONNECTION (iter->data), FALSE); } - g_slist_free (vpns); /* Mark new default active connection */ if (best) @@ -464,21 +456,27 @@ get_best_ip4_config (NMPolicy *policy, NMDevice **out_device, NMVPNConnection **out_vpn) { - GSList *vpns, *iter; + const GSList *connections, *iter; NMDevice *device; NMActRequest *req = NULL; NMIP4Config *ip4_config = NULL; /* If a VPN connection is active, it is preferred */ - vpns = nm_vpn_manager_get_active_connections (policy->vpn_manager); - for (iter = vpns; iter; iter = g_slist_next (iter)) { - NMVPNConnection *candidate = NM_VPN_CONNECTION (iter->data); + connections = nm_manager_get_active_connections (policy->manager); + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMActiveConnection *active = NM_ACTIVE_CONNECTION (iter->data); + NMVPNConnection *candidate; NMIP4Config *vpn_ip4; NMConnection *tmp; NMSettingIP4Config *s_ip4; NMVPNConnectionState vpn_state; - tmp = nm_vpn_connection_get_connection (candidate); + if (!NM_IS_VPN_CONNECTION (active)) + continue; + + candidate = NM_VPN_CONNECTION (active); + + tmp = nm_active_connection_get_connection (active); g_assert (tmp); vpn_state = nm_vpn_connection_get_vpn_state (candidate); @@ -504,14 +502,13 @@ get_best_ip4_config (NMPolicy *policy, if (out_vpn) *out_vpn = candidate; if (out_ac) - *out_ac = NM_ACTIVE_CONNECTION (candidate); + *out_ac = active; if (out_ip_iface) *out_ip_iface = nm_vpn_connection_get_ip_iface (candidate); if (out_ip_ifindex) *out_ip_ifindex = nm_vpn_connection_get_ip_ifindex (candidate); break; } - g_slist_free (vpns); /* If no VPN connections, we use the best device instead */ if (!ip4_config) { @@ -629,21 +626,27 @@ get_best_ip6_config (NMPolicy *policy, NMDevice **out_device, NMVPNConnection **out_vpn) { - GSList *vpns, *iter; + const GSList *connections, *iter; NMDevice *device; NMActRequest *req = NULL; NMIP6Config *ip6_config = NULL; /* If a VPN connection is active, it is preferred */ - vpns = nm_vpn_manager_get_active_connections (policy->vpn_manager); - for (iter = vpns; iter; iter = g_slist_next (iter)) { - NMVPNConnection *candidate = NM_VPN_CONNECTION (iter->data); + connections = nm_manager_get_active_connections (policy->manager); + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMActiveConnection *active = NM_ACTIVE_CONNECTION (iter->data); + NMVPNConnection *candidate; NMIP6Config *vpn_ip6; NMConnection *tmp; NMSettingIP6Config *s_ip6; NMVPNConnectionState vpn_state; - tmp = nm_vpn_connection_get_connection (candidate); + if (!NM_IS_VPN_CONNECTION (active)) + continue; + + candidate = NM_VPN_CONNECTION (active); + + tmp = nm_active_connection_get_connection (active); g_assert (tmp); vpn_state = nm_vpn_connection_get_vpn_state (candidate); @@ -676,7 +679,6 @@ get_best_ip6_config (NMPolicy *policy, *out_ip_ifindex = nm_vpn_connection_get_ip_ifindex (candidate); break; } - g_slist_free (vpns); /* If no VPN connections, we use the best device instead */ if (!ip6_config) { @@ -954,101 +956,83 @@ find_pending_activation (GSList *list, NMDevice *device) /*****************************************************************************/ -static void -vpn_connection_activated (NMVPNManager *manager, - NMVPNConnection *vpn, - gpointer user_data) -{ - NMDnsManager *mgr; - NMIP4Config *ip4_config; - NMIP6Config *ip6_config; - const char *ip_iface; - - mgr = nm_dns_manager_get (NULL); - nm_dns_manager_begin_updates (mgr, __func__); - - ip_iface = nm_vpn_connection_get_ip_iface (vpn); - - /* Add the VPN connection's IP configs from DNS */ - - ip4_config = nm_vpn_connection_get_ip4_config (vpn); - if (ip4_config) - nm_dns_manager_add_ip4_config (mgr, ip_iface, ip4_config, NM_DNS_IP_CONFIG_TYPE_VPN); - - ip6_config = nm_vpn_connection_get_ip6_config (vpn); - if (ip6_config) - nm_dns_manager_add_ip6_config (mgr, ip_iface, ip6_config, NM_DNS_IP_CONFIG_TYPE_VPN); +typedef struct { + NMDevice *device; + GSList *secondaries; +} PendingSecondaryData; - update_routing_and_dns ((NMPolicy *) user_data, TRUE); +static PendingSecondaryData * +pending_secondary_data_new (NMDevice *device, GSList *secondaries) +{ + PendingSecondaryData *data; - nm_dns_manager_end_updates (mgr, __func__); + data = g_malloc0 (sizeof (PendingSecondaryData)); + data->device = g_object_ref (device); + data->secondaries = secondaries; + return data; } static void -vpn_connection_deactivated (NMVPNManager *manager, - NMVPNConnection *vpn, - NMVPNConnectionState new_state, - NMVPNConnectionState old_state, - NMVPNConnectionStateReason reason, - gpointer user_data) +pending_secondary_data_free (PendingSecondaryData *data) { - NMDnsManager *mgr; - NMIP4Config *ip4_config, *parent_ip4 = NULL; - NMIP6Config *ip6_config, *parent_ip6 = NULL; - const char *ip_iface; - NMDevice *parent; - - mgr = nm_dns_manager_get (NULL); - nm_dns_manager_begin_updates (mgr, __func__); - - ip_iface = nm_vpn_connection_get_ip_iface (vpn); - parent = nm_vpn_connection_get_parent_device (vpn); - - ip4_config = nm_vpn_connection_get_ip4_config (vpn); - if (ip4_config) { - /* Remove the VPN connection's IP4 config from DNS */ - nm_dns_manager_remove_ip4_config (mgr, ip_iface, ip4_config); - - /* Re-apply routes and addresses of the VPN connection's parent interface, - * which the VPN might have overridden. - */ - if (parent) { - parent_ip4 = nm_device_get_ip4_config (parent); - if (parent_ip4) { - if (!nm_system_apply_ip4_config (nm_device_get_ip_ifindex (parent), - parent_ip4, - nm_device_get_priority (parent), - NM_IP4_COMPARE_FLAG_ADDRESSES | NM_IP4_COMPARE_FLAG_ROUTES)) { - nm_log_err (LOGD_VPN, "failed to re-apply VPN parent device IPv4 addresses and routes."); - } - } - } - } - - ip6_config = nm_vpn_connection_get_ip6_config (vpn); - if (ip6_config) { - /* Remove the VPN connection's IP6 config from DNS */ - nm_dns_manager_remove_ip6_config (mgr, ip_iface, ip6_config); + g_object_unref (data->device); + nm_utils_slist_free (data->secondaries, g_free); + memset (data, 0, sizeof (*data)); + g_free (data); +} - /* Re-apply routes and addresses of the VPN connection's parent interface, - * which the VPN might have overridden. - */ - if (parent) { - parent_ip6 = nm_device_get_ip6_config (parent); - if (parent_ip6) { - if (!nm_system_apply_ip6_config (nm_device_get_ip_ifindex (parent), - parent_ip6, - nm_device_get_priority (parent), - NM_IP6_COMPARE_FLAG_ADDRESSES | NM_IP6_COMPARE_FLAG_ROUTES)) { - nm_log_err (LOGD_VPN, "failed to re-apply VPN parent device IPv6 addresses and routes."); +static void +process_secondaries (NMPolicy *policy, + NMActiveConnection *active, + gboolean connected) +{ + NMDevice *device = NULL; + const char *ac_path; + GSList *iter, *iter2; + + nm_log_dbg (LOGD_DEVICE, "Secondary connection '%s' %s; active path '%s'", + nm_active_connection_get_name (active), + connected ? "SUCCEEDED" : "FAILED", + nm_active_connection_get_path (active)); + + ac_path = nm_active_connection_get_path (active); + + if (NM_IS_VPN_CONNECTION (active)) + device = nm_vpn_connection_get_parent_device (NM_VPN_CONNECTION (active)); + + for (iter = policy->pending_secondaries; iter; iter = g_slist_next (iter)) { + PendingSecondaryData *secondary_data = (PendingSecondaryData *) iter->data; + NMDevice *item_device = secondary_data->device; + + if (!device || item_device == device) { + for (iter2 = secondary_data->secondaries; iter2; iter2 = g_slist_next (iter2)) { + char *list_ac_path = (char *) iter2->data; + + if (g_strcmp0 (ac_path, list_ac_path) == 0) { + if (connected) { + /* Secondary connection activated */ + secondary_data->secondaries = g_slist_remove (secondary_data->secondaries, list_ac_path); + g_free (list_ac_path); + if (!secondary_data->secondaries) { + /* None secondary UUID remained -> remove the secondary data item */ + policy->pending_secondaries = g_slist_remove (policy->pending_secondaries, secondary_data); + pending_secondary_data_free (secondary_data); + nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE); + return; + } + } else { + /* Secondary connection failed -> do not watch other connections */ + policy->pending_secondaries = g_slist_remove (policy->pending_secondaries, secondary_data); + pending_secondary_data_free (secondary_data); + nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED, + NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED); + return; + } } } + return; } } - - update_routing_and_dns ((NMPolicy *) user_data, TRUE); - - nm_dns_manager_end_updates (mgr, __func__); } static void @@ -1204,6 +1188,69 @@ activate_slave_connections (NMPolicy *policy, NMConnection *connection, schedule_activate_all (policy); } +static gboolean +activate_secondary_connections (NMPolicy *policy, + NMConnection *connection, + NMDevice *device) +{ + NMSettingConnection *s_con; + NMSettingsConnection *settings_con; + NMActiveConnection *ac; + PendingSecondaryData *secondary_data; + GSList *secondary_ac_list = NULL; + GError *error = NULL; + guint32 i; + gboolean success = TRUE; + + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + + for (i = 0; i < nm_setting_connection_get_num_secondaries (s_con); i++) { + const char *sec_uuid = nm_setting_connection_get_secondary (s_con, i); + + settings_con = nm_settings_get_connection_by_uuid (policy->settings, sec_uuid); + if (settings_con) { + NMActRequest *req = nm_device_get_act_request (device); + g_assert (req); + + nm_log_dbg (LOGD_DEVICE, "Activating secondary connection '%s (%s)' for base connection '%s (%s)'", + nm_connection_get_id (NM_CONNECTION (settings_con)), sec_uuid, + nm_connection_get_id (connection), nm_connection_get_uuid (connection)); + ac = nm_manager_activate_connection (policy->manager, + NM_CONNECTION (settings_con), + nm_active_connection_get_path (NM_ACTIVE_CONNECTION (req)), + nm_device_get_path (device), + nm_act_request_get_dbus_sender (req), + &error); + if (ac) { + secondary_ac_list = g_slist_append (secondary_ac_list, + g_strdup (nm_active_connection_get_path (ac))); + } else { + nm_log_warn (LOGD_DEVICE, "Secondary connection '%s' auto-activation failed: (%d) %s", + sec_uuid, + error ? error->code : 0, + (error && error->message) ? error->message : "unknown"); + g_clear_error (&error); + success = FALSE; + break; + } + } else { + nm_log_warn (LOGD_DEVICE, "Secondary connection '%s' auto-activation failed: The connection doesn't exist.", + sec_uuid); + success = FALSE; + break; + } + } + + if (success && secondary_ac_list != NULL) { + secondary_data = pending_secondary_data_new (device, secondary_ac_list); + policy->pending_secondaries = g_slist_append (policy->pending_secondaries, secondary_data); + } else + nm_utils_slist_free (secondary_ac_list, g_free); + + return success; +} + static void device_state_changed (NMDevice *device, NMDeviceState new_state, @@ -1216,6 +1263,7 @@ device_state_changed (NMDevice *device, const char *ip_iface = nm_device_get_ip_iface (device); NMIP4Config *ip4_config; NMIP6Config *ip6_config; + NMSettingConnection *s_con; NMDnsManager *dns_mgr; if (connection) @@ -1278,22 +1326,16 @@ device_state_changed (NMDevice *device, nm_dns_manager_begin_updates (dns_mgr, __func__); ip4_config = nm_device_get_ip4_config (device); - if (ip4_config) { + if (ip4_config) nm_dns_manager_add_ip4_config (dns_mgr, ip_iface, ip4_config, NM_DNS_IP_CONFIG_TYPE_DEFAULT); - update_ip4_dns (policy, dns_mgr); - } ip6_config = nm_device_get_ip6_config (device); - if (ip6_config) { + if (ip6_config) nm_dns_manager_add_ip6_config (dns_mgr, ip_iface, ip6_config, NM_DNS_IP_CONFIG_TYPE_DEFAULT); - update_ip6_dns (policy, dns_mgr); - } + + update_routing_and_dns (policy, FALSE); nm_dns_manager_end_updates (dns_mgr, __func__); g_object_unref (dns_mgr); - - /* And make sure the best devices have the default route */ - update_ip4_routing (policy, FALSE); - update_ip6_routing (policy, FALSE); break; case NM_DEVICE_STATE_UNMANAGED: case NM_DEVICE_STATE_UNAVAILABLE: @@ -1318,6 +1360,20 @@ device_state_changed (NMDevice *device, * activation. */ activate_slave_connections (policy, connection, device); break; + case NM_DEVICE_STATE_SECONDARIES: + s_con = nm_connection_get_setting_connection (connection); + if (s_con && nm_setting_connection_get_num_secondaries (s_con) > 0) { + /* Make routes and DNS up-to-date before activating dependent connections */ + update_routing_and_dns (policy, FALSE); + + /* Activate secondary (VPN) connections */ + if (!activate_secondary_connections (policy, connection, device)) + nm_device_queue_state (device, NM_DEVICE_STATE_FAILED, + NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED); + } else + nm_device_queue_state (device, NM_DEVICE_STATE_ACTIVATED, + NM_DEVICE_STATE_REASON_NONE); + break; default: break; @@ -1502,6 +1558,145 @@ device_removed (NMManager *manager, NMDevice *device, gpointer user_data) */ } +/**************************************************************************/ + +static void +vpn_connection_activated (NMPolicy *policy, NMVPNConnection *vpn) +{ + NMDnsManager *mgr; + NMIP4Config *ip4_config; + NMIP6Config *ip6_config; + const char *ip_iface; + + mgr = nm_dns_manager_get (NULL); + nm_dns_manager_begin_updates (mgr, __func__); + + ip_iface = nm_vpn_connection_get_ip_iface (vpn); + + /* Add the VPN connection's IP configs from DNS */ + + ip4_config = nm_vpn_connection_get_ip4_config (vpn); + if (ip4_config) + nm_dns_manager_add_ip4_config (mgr, ip_iface, ip4_config, NM_DNS_IP_CONFIG_TYPE_VPN); + + ip6_config = nm_vpn_connection_get_ip6_config (vpn); + if (ip6_config) + nm_dns_manager_add_ip6_config (mgr, ip_iface, ip6_config, NM_DNS_IP_CONFIG_TYPE_VPN); + + update_routing_and_dns (policy, TRUE); + + nm_dns_manager_end_updates (mgr, __func__); + + process_secondaries (policy, NM_ACTIVE_CONNECTION (vpn), TRUE); +} + +static void +vpn_connection_deactivated (NMPolicy *policy, NMVPNConnection *vpn) +{ + NMDnsManager *mgr; + NMIP4Config *ip4_config, *parent_ip4 = NULL; + NMIP6Config *ip6_config, *parent_ip6 = NULL; + const char *ip_iface; + NMDevice *parent; + + mgr = nm_dns_manager_get (NULL); + nm_dns_manager_begin_updates (mgr, __func__); + + ip_iface = nm_vpn_connection_get_ip_iface (vpn); + parent = nm_vpn_connection_get_parent_device (vpn); + + ip4_config = nm_vpn_connection_get_ip4_config (vpn); + if (ip4_config) { + /* Remove the VPN connection's IP4 config from DNS */ + nm_dns_manager_remove_ip4_config (mgr, ip_iface, ip4_config); + + /* Re-apply routes and addresses of the VPN connection's parent interface, + * which the VPN might have overridden. + */ + if (parent) { + parent_ip4 = nm_device_get_ip4_config (parent); + if (parent_ip4) { + if (!nm_system_apply_ip4_config (nm_device_get_ip_ifindex (parent), + parent_ip4, + nm_device_get_priority (parent), + NM_IP4_COMPARE_FLAG_ADDRESSES | NM_IP4_COMPARE_FLAG_ROUTES)) { + nm_log_err (LOGD_VPN, "failed to re-apply VPN parent device IPv4 addresses and routes."); + } + } + } + } + + ip6_config = nm_vpn_connection_get_ip6_config (vpn); + if (ip6_config) { + /* Remove the VPN connection's IP6 config from DNS */ + nm_dns_manager_remove_ip6_config (mgr, ip_iface, ip6_config); + + /* Re-apply routes and addresses of the VPN connection's parent interface, + * which the VPN might have overridden. + */ + if (parent) { + parent_ip6 = nm_device_get_ip6_config (parent); + if (parent_ip6) { + if (!nm_system_apply_ip6_config (nm_device_get_ip_ifindex (parent), + parent_ip6, + nm_device_get_priority (parent), + NM_IP6_COMPARE_FLAG_ADDRESSES | NM_IP6_COMPARE_FLAG_ROUTES)) { + nm_log_err (LOGD_VPN, "failed to re-apply VPN parent device IPv6 addresses and routes."); + } + } + } + } + + update_routing_and_dns (policy, TRUE); + + nm_dns_manager_end_updates (mgr, __func__); + + process_secondaries (policy, NM_ACTIVE_CONNECTION (vpn), FALSE); +} + +static void +active_connection_state_changed (NMActiveConnection *active, + GParamSpec *pspec, + NMPolicy *policy) +{ + switch (nm_active_connection_get_state (active)) { + case NM_ACTIVE_CONNECTION_STATE_ACTIVATED: + if (NM_IS_VPN_CONNECTION (active)) + vpn_connection_activated (policy, NM_VPN_CONNECTION (active)); + break; + case NM_ACTIVE_CONNECTION_STATE_DEACTIVATED: + if (NM_IS_VPN_CONNECTION (active)) + vpn_connection_deactivated (policy, NM_VPN_CONNECTION (active)); + break; + default: + break; + } +} + +static void +active_connection_added (NMManager *manager, + NMActiveConnection *active, + gpointer user_data) +{ + NMPolicy *policy = (NMPolicy *) user_data; + + g_signal_connect (active, "notify::" NM_ACTIVE_CONNECTION_STATE, + G_CALLBACK (active_connection_state_changed), + policy); +} + +static void +active_connection_removed (NMManager *manager, + NMActiveConnection *active, + gpointer user_data) +{ + g_signal_handlers_disconnect_by_func (active, + active_connection_state_changed, + (NMPolicy *) user_data); +} + +/**************************************************************************/ + static void schedule_activate_all (NMPolicy *policy) { @@ -1614,25 +1809,26 @@ connection_updated (NMSettings *settings, static void _deactivate_if_active (NMManager *manager, NMConnection *connection) { - GPtrArray *list; - int i; + const GSList *active, *iter; - list = nm_manager_get_active_connections_by_connection (manager, connection); - if (!list) - return; - - for (i = 0; i < list->len; i++) { - char *path = g_ptr_array_index (list, i); + active = nm_manager_get_active_connections (manager); + for (iter = active; iter; iter = g_slist_next (iter)) { + NMActiveConnection *ac = iter->data; GError *error = NULL; - if (!nm_manager_deactivate_connection (manager, path, NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, &error)) { - nm_log_warn (LOGD_DEVICE, "Connection '%s' disappeared, but error deactivating it: (%d) %s", - nm_connection_get_id (connection), error->code, error->message); - g_error_free (error); + if (nm_active_connection_get_connection (ac) == connection) { + if (!nm_manager_deactivate_connection (manager, + nm_active_connection_get_path (ac), + NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, + &error)) { + nm_log_warn (LOGD_DEVICE, "Connection '%s' disappeared, but error deactivating it: (%d) %s", + nm_connection_get_id (connection), + error ? error->code : -1, + error ? error->message : "(unknown)"); + g_clear_error (&error); + } } - g_free (path); } - g_ptr_array_free (list, TRUE); } static void @@ -1690,9 +1886,7 @@ _connect_settings_signal (NMPolicy *policy, const char *name, gpointer callback) } NMPolicy * -nm_policy_new (NMManager *manager, - NMVPNManager *vpn_manager, - NMSettings *settings) +nm_policy_new (NMManager *manager, NMSettings *settings) { NMPolicy *policy; static gboolean initialized = FALSE; @@ -1718,14 +1912,6 @@ nm_policy_new (NMManager *manager, policy->orig_hostname = g_strdup (hostname); } - policy->vpn_manager = g_object_ref (vpn_manager); - id = g_signal_connect (policy->vpn_manager, "connection-activated", - G_CALLBACK (vpn_connection_activated), policy); - policy->vpn_activated_id = id; - id = g_signal_connect (policy->vpn_manager, "connection-deactivated", - G_CALLBACK (vpn_connection_deactivated), policy); - policy->vpn_deactivated_id = id; - policy->fw_manager = nm_firewall_manager_get(); id = g_signal_connect (policy->fw_manager, "started", G_CALLBACK (firewall_started), policy); @@ -1737,6 +1923,8 @@ nm_policy_new (NMManager *manager, _connect_manager_signal (policy, "notify::" NM_MANAGER_NETWORKING_ENABLED, sleeping_changed); _connect_manager_signal (policy, "device-added", device_added); _connect_manager_signal (policy, "device-removed", device_removed); + _connect_manager_signal (policy, NM_MANAGER_ACTIVE_CONNECTION_ADDED, active_connection_added); + _connect_manager_signal (policy, NM_MANAGER_ACTIVE_CONNECTION_REMOVED, active_connection_removed); _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED, connections_loaded); _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, connection_added); @@ -1756,7 +1944,7 @@ nm_policy_new (NMManager *manager, void nm_policy_destroy (NMPolicy *policy) { - GSList *iter; + const GSList *connections, *iter; g_return_if_fail (policy != NULL); @@ -1771,9 +1959,8 @@ nm_policy_destroy (NMPolicy *policy) g_slist_foreach (policy->pending_activation_checks, (GFunc) activate_data_free, NULL); g_slist_free (policy->pending_activation_checks); - g_signal_handler_disconnect (policy->vpn_manager, policy->vpn_activated_id); - g_signal_handler_disconnect (policy->vpn_manager, policy->vpn_deactivated_id); - g_object_unref (policy->vpn_manager); + g_slist_foreach (policy->pending_secondaries, (GFunc) pending_secondary_data_free, NULL); + g_slist_free (policy->pending_secondaries); g_signal_handler_disconnect (policy->fw_manager, policy->fw_started_id); g_object_unref (policy->fw_manager); @@ -1794,6 +1981,10 @@ nm_policy_destroy (NMPolicy *policy) } g_slist_free (policy->dev_ids); + connections = nm_manager_get_active_connections (policy->manager); + for (iter = connections; iter; iter = g_slist_next (iter)) + active_connection_removed (policy->manager, NM_ACTIVE_CONNECTION (iter->data), policy); + if (policy->reset_retries_id) g_source_remove (policy->reset_retries_id); diff --git a/src/nm-policy.h b/src/nm-policy.h index 33796bcaa..c00c3ded6 100644 --- a/src/nm-policy.h +++ b/src/nm-policy.h @@ -23,14 +23,11 @@ #define NM_POLICY_H #include "nm-manager.h" -#include "nm-vpn-manager.h" #include "nm-settings.h" typedef struct NMPolicy NMPolicy; -NMPolicy *nm_policy_new (NMManager *manager, - NMVPNManager *vpn_manager, - NMSettings *settings); +NMPolicy *nm_policy_new (NMManager *manager, NMSettings *settings); void nm_policy_destroy (NMPolicy *policy); #endif /* NM_POLICY_H */ diff --git a/src/nm-session-monitor-ck.c b/src/nm-session-monitor-ck.c index 72ffc9ff0..02e2d06ee 100644 --- a/src/nm-session-monitor-ck.c +++ b/src/nm-session-monitor-ck.c @@ -28,8 +28,6 @@ #include "nm-session-utils.h" #include "nm-session-monitor.h" -#define CKDB_PATH "/var/run/ConsoleKit/database" - /* <internal> * SECTION:nm-session-monitor * @title: NMSessionMonitor diff --git a/src/nm-sleep-monitor-systemd.c b/src/nm-sleep-monitor-systemd.c new file mode 100644 index 000000000..576cb1413 --- /dev/null +++ b/src/nm-sleep-monitor-systemd.c @@ -0,0 +1,364 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* 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. + * + * (C) Copyright 2012 Red Hat, Inc. + * Author: Matthias Clasen <mclasen@redhat.com> + */ + +#include "config.h" +#include <errno.h> +#include <string.h> +#include <sys/stat.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus-glib.h> +#include <gio/gio.h> +#include <gio/gunixfdlist.h> + +#include "nm-logging.h" +#include "nm-dbus-manager.h" + +#include "nm-sleep-monitor.h" + +#define SD_NAME "org.freedesktop.login1" +#define SD_PATH "/org/freedesktop/login1" +#define SD_INTERFACE "org.freedesktop.login1.Manager" + +/* Do we have GDBus (glib >= 2.26) and GUnixFDList (glib >= 2.30) support ? */ +#if GLIB_CHECK_VERSION(2,30,0) +#define IS_GDBUS_UNIXFD_AVAILABLE 1 +#endif + + +struct _NMSleepMonitor { + GObject parent_instance; + +#if defined(IS_GDBUS_UNIXFD_AVAILABLE) + GDBusProxy *sd_proxy; +#else + DBusGProxy *sd_proxy; +#endif + gint inhibit_fd; +}; + +struct _NMSleepMonitorClass { + GObjectClass parent_class; + + void (*sleeping) (NMSleepMonitor *monitor); + void (*resuming) (NMSleepMonitor *monitor); +}; + + +enum { + SLEEPING, + RESUMING, + LAST_SIGNAL, +}; +static guint signals[LAST_SIGNAL] = {0}; + +G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); + +/********************************************************************/ + +static gboolean +drop_inhibitor (NMSleepMonitor *self) +{ + if (self->inhibit_fd >= 0) { + nm_log_dbg (LOGD_SUSPEND, "Dropping systemd sleep inhibitor"); + close (self->inhibit_fd); + self->inhibit_fd = -1; + return TRUE; + } + return FALSE; +} + +#if defined(IS_GDBUS_UNIXFD_AVAILABLE) +/* Great! We have GDBus (glib >= 2.26) and GUnixFDList (glib >= 2.30) */ +static void +inhibit_done (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + GDBusProxy *sd_proxy = G_DBUS_PROXY (source); + NMSleepMonitor *self = user_data; + GError *error = NULL; + GVariant *res; + GUnixFDList *fd_list; + + res = g_dbus_proxy_call_with_unix_fd_list_finish (sd_proxy, &fd_list, result, &error); + if (!res) { + nm_log_warn (LOGD_SUSPEND, "Inhibit failed: %s", error->message); + g_error_free (error); + } else { + if (!fd_list || g_unix_fd_list_get_length (fd_list) != 1) + nm_log_warn (LOGD_SUSPEND, "Didn't get a single fd back"); + + self->inhibit_fd = g_unix_fd_list_get (fd_list, 0, NULL); + + nm_log_dbg (LOGD_SUSPEND, "Inhibitor fd is %d", self->inhibit_fd); + g_object_unref (fd_list); + g_variant_unref (res); + } +} + +static void +take_inhibitor (NMSleepMonitor *self) +{ + g_assert (self->inhibit_fd == -1); + + nm_log_dbg (LOGD_SUSPEND, "Taking systemd sleep inhibitor"); + g_dbus_proxy_call_with_unix_fd_list (self->sd_proxy, + "Inhibit", + g_variant_new ("(ssss)", + "sleep", + g_get_user_name (), + "inhibited", + "delay"), + 0, + G_MAXINT, + NULL, + NULL, + inhibit_done, + self); +} + +static void +signal_cb (GDBusProxy *proxy, + const gchar *sendername, + const gchar *signalname, + GVariant *args, + gpointer data) +{ + NMSleepMonitor *self = data; + gboolean is_about_to_suspend; + + if (strcmp (signalname, "PrepareForSleep") != 0) + return; + + g_variant_get (args, "(b)", &is_about_to_suspend); + nm_log_dbg (LOGD_SUSPEND, "Received PrepareForSleep signal: %d", is_about_to_suspend); + + if (is_about_to_suspend) { + g_signal_emit (self, signals[SLEEPING], 0); + drop_inhibitor (self); + } else { + take_inhibitor (self); + g_signal_emit (self, signals[RESUMING], 0); + } +} + +static void +sleep_setup (NMSleepMonitor *self) +{ + GDBusConnection *bus; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + self->sd_proxy = g_dbus_proxy_new_sync (bus, 0, NULL, + SD_NAME, SD_PATH, SD_INTERFACE, + NULL, NULL); + g_object_unref (bus); + g_signal_connect (self->sd_proxy, "g-signal", G_CALLBACK (signal_cb), self); +} + +#else + +/* GDBus nor GUnixFDList available. We have to get by with dbus-glib and libdbus */ +static void +inhibit_done (DBusPendingCall *pending, + gpointer user_data) +{ + NMSleepMonitor *self = user_data; + DBusMessage *reply; + DBusError error; + int mtype; + + dbus_error_init (&error); + reply = dbus_pending_call_steal_reply (pending); + g_assert (reply); + + mtype = dbus_message_get_type (reply); + switch (mtype) { + case DBUS_MESSAGE_TYPE_ERROR: + dbus_set_error_from_message (&error, reply); + nm_log_warn (LOGD_SUSPEND, "Inhibit() failed: %s", error.message ? error.message : "unknown"); + break; + case DBUS_MESSAGE_TYPE_METHOD_RETURN: + if (!dbus_message_get_args (reply, + &error, + DBUS_TYPE_UNIX_FD, &self->inhibit_fd, + DBUS_TYPE_INVALID)) { + nm_log_warn (LOGD_SUSPEND, "Inhibit() reply parsing failed: %s", + error.message ? error.message : "unknown"); + break; + } + nm_log_dbg (LOGD_SUSPEND, "Inhibitor fd is %d", self->inhibit_fd); + break; + default: + nm_log_warn (LOGD_SUSPEND, "Invalid Inhibit() reply message type %d", mtype); + break; + } + + dbus_message_unref (reply); + dbus_error_free (&error); +} + +static void +take_inhibitor (NMSleepMonitor *self) +{ + NMDBusManager *dbus_mgr; + DBusConnection *bus; + DBusMessage *message = NULL; + DBusPendingCall *pending = NULL; + const char *arg_what = "sleep"; + const char *arg_who = g_get_user_name (); + const char *arg_why = "inhibited"; + const char *arg_mode = "delay"; + + g_assert (self->inhibit_fd == -1); + + nm_log_dbg (LOGD_SUSPEND, "Taking systemd sleep inhibitor"); + + dbus_mgr = nm_dbus_manager_get (); + bus = nm_dbus_manager_get_dbus_connection (dbus_mgr); + g_assert (bus); + g_object_unref (dbus_mgr); + + if (!(message = dbus_message_new_method_call (SD_NAME, + SD_PATH, + SD_INTERFACE, + "Inhibit"))) { + nm_log_warn (LOGD_SUSPEND, "Unable to call Inhibit()"); + return; + } + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, &arg_what, + DBUS_TYPE_STRING, &arg_who, + DBUS_TYPE_STRING, &arg_why, + DBUS_TYPE_STRING, &arg_mode, + DBUS_TYPE_INVALID)) { + nm_log_warn (LOGD_SUSPEND, "Unable to call Inhibit()"); + goto done; + } + + if (!dbus_connection_send_with_reply (bus, message, &pending, -1)) + goto done; + + if (!dbus_pending_call_set_notify (pending, inhibit_done, self, NULL)) { + dbus_pending_call_cancel (pending); + dbus_pending_call_unref (pending); + } + +done: + if (message) + dbus_message_unref (message); +} + +static void +signal_cb (DBusGProxy *proxy, gboolean about_to_suspend, gpointer data) +{ + NMSleepMonitor *self = data; + + nm_log_dbg (LOGD_SUSPEND, "Received PrepareForSleep signal: %d", about_to_suspend); + + if (about_to_suspend) { + g_signal_emit (self, signals[SLEEPING], 0); + drop_inhibitor (self); + } else { + take_inhibitor (self); + g_signal_emit (self, signals[RESUMING], 0); + } +} + +static void +sleep_setup (NMSleepMonitor *self) +{ + NMDBusManager *dbus_mgr; + DBusGConnection *bus; + + dbus_mgr = nm_dbus_manager_get (); + bus = nm_dbus_manager_get_connection (dbus_mgr); + self->sd_proxy = dbus_g_proxy_new_for_name (bus, SD_NAME, SD_PATH, SD_INTERFACE); + g_object_unref (dbus_mgr); + + if (self->sd_proxy) { + dbus_g_proxy_add_signal (self->sd_proxy, "PrepareForSleep", G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal (self->sd_proxy, "PrepareForSleep", + G_CALLBACK (signal_cb), + self, NULL); + } else + nm_log_warn (LOGD_SUSPEND, "could not initialize systemd-logind D-Bus proxy"); +} +#endif /* IS_GDBUS_UNIXFD_AVAILABLE */ + +static void +nm_sleep_monitor_init (NMSleepMonitor *self) +{ + self->inhibit_fd = -1; + sleep_setup (self); + take_inhibitor (self); +} + +static void +finalize (GObject *object) +{ + NMSleepMonitor *self = NM_SLEEP_MONITOR (object); + + drop_inhibitor (self); + if (self->sd_proxy) + g_object_unref (self->sd_proxy); + + if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL) + G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object); +} + +static void +nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = finalize; + + signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, + NM_TYPE_SLEEP_MONITOR, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping), + NULL, /* accumulator */ + NULL, /* accumulator data */ + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING, + NM_TYPE_SLEEP_MONITOR, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMSleepMonitorClass, resuming), + NULL, /* accumulator */ + NULL, /* accumulator data */ + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +NMSleepMonitor * +nm_sleep_monitor_get (void) +{ + static NMSleepMonitor *singleton = NULL; + + if (singleton) + return g_object_ref (singleton); + + singleton = NM_SLEEP_MONITOR (g_object_new (NM_TYPE_SLEEP_MONITOR, NULL)); + return singleton; +} + +/* ---------------------------------------------------------------------------------------------------- */ diff --git a/src/nm-sleep-monitor-upower.c b/src/nm-sleep-monitor-upower.c new file mode 100644 index 000000000..3c93f6637 --- /dev/null +++ b/src/nm-sleep-monitor-upower.c @@ -0,0 +1,151 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* 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. + * + * (C) Copyright 2012 Red Hat, Inc. + * Author: Matthias Clasen <mclasen@redhat.com> + */ + +#include "config.h" +#include <errno.h> +#include <string.h> +#include <sys/stat.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus-glib.h> +#include <gio/gio.h> +#include "nm-logging.h" +#include "nm-dbus-manager.h" + +#include "nm-sleep-monitor.h" + +#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower" + +struct _NMSleepMonitor { + GObject parent_instance; + + DBusGProxy *upower_proxy; +}; + +struct _NMSleepMonitorClass { + GObjectClass parent_class; + + void (*sleeping) (NMSleepMonitor *monitor); + void (*resuming) (NMSleepMonitor *monitor); +}; + + +enum { + SLEEPING, + RESUMING, + LAST_SIGNAL, +}; +static guint signals[LAST_SIGNAL] = {0}; + +G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); + +/********************************************************************/ + +static void +upower_sleeping_cb (DBusGProxy *proxy, gpointer user_data) +{ + nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal"); + g_signal_emit (user_data, signals[SLEEPING], 0); +} + +static void +upower_resuming_cb (DBusGProxy *proxy, gpointer user_data) +{ + nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal"); + g_signal_emit (user_data, signals[RESUMING], 0); +} + +static void +nm_sleep_monitor_init (NMSleepMonitor *self) +{ + NMDBusManager *dbus_mgr; + DBusGConnection *bus; + + dbus_mgr = nm_dbus_manager_get (); + bus = nm_dbus_manager_get_connection (dbus_mgr); + self->upower_proxy = dbus_g_proxy_new_for_name (bus, + UPOWER_DBUS_SERVICE, + "/org/freedesktop/UPower", + "org.freedesktop.UPower"); + if (self->upower_proxy) { + dbus_g_proxy_add_signal (self->upower_proxy, "Sleeping", G_TYPE_INVALID); + dbus_g_proxy_connect_signal (self->upower_proxy, "Sleeping", + G_CALLBACK (upower_sleeping_cb), + self, NULL); + + dbus_g_proxy_add_signal (self->upower_proxy, "Resuming", G_TYPE_INVALID); + dbus_g_proxy_connect_signal (self->upower_proxy, "Resuming", + G_CALLBACK (upower_resuming_cb), + self, NULL); + } else + nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy"); + g_object_unref (dbus_mgr); +} + +static void +finalize (GObject *object) +{ + NMSleepMonitor *self = NM_SLEEP_MONITOR (object); + + if (self->upower_proxy) + g_object_unref (self->upower_proxy); + + if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL) + G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object); +} + +static void +nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = finalize; + + signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, + NM_TYPE_SLEEP_MONITOR, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping), + NULL, /* accumulator */ + NULL, /* accumulator data */ + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING, + NM_TYPE_SLEEP_MONITOR, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NMSleepMonitorClass, resuming), + NULL, /* accumulator */ + NULL, /* accumulator data */ + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + +NMSleepMonitor * +nm_sleep_monitor_get (void) +{ + static NMSleepMonitor *singleton = NULL; + + if (singleton) + return g_object_ref (singleton); + + singleton = NM_SLEEP_MONITOR (g_object_new (NM_TYPE_SLEEP_MONITOR, NULL)); + return singleton; +} + +/* ---------------------------------------------------------------------------------------------------- */ diff --git a/src/nm-sleep-monitor.h b/src/nm-sleep-monitor.h new file mode 100644 index 000000000..173e6a136 --- /dev/null +++ b/src/nm-sleep-monitor.h @@ -0,0 +1,46 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* 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. + * + * (C) Copyright 2012 Red Hat, Inc. + * Author: Matthias Clasen <mclasen@redhat.com> + */ + +#ifndef NM_SLEEP_MONITOR_H +#define NM_SLEEP_MONITOR_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define NM_TYPE_SLEEP_MONITOR (nm_sleep_monitor_get_type ()) +#define NM_SLEEP_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_SLEEP_MONITOR, NMSleepMonitor)) +#define NM_SLEEP_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), NM_TYPE_SLEEP_MONITOR, NMSleepMonitorClass)) +#define NM_SLEEP_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_SLEEP_MONITOR, NMSleepMonitorClass)) +#define NM_IS_SLEEP_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_SLEEP_MONITOR)) +#define NM_IS_SLEEP_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_SLEEP_MONITOR)) + +#define NM_SLEEP_MONITOR_SLEEPING "sleeping" +#define NM_SLEEP_MONITOR_RESUMING "resuming" + +typedef struct _NMSleepMonitor NMSleepMonitor; +typedef struct _NMSleepMonitorClass NMSleepMonitorClass; + +GType nm_sleep_monitor_get_type (void) G_GNUC_CONST; +NMSleepMonitor *nm_sleep_monitor_get (void); + +G_END_DECLS + +#endif /* NM_SLEEP_MONITOR_H */ + diff --git a/src/nm-system.c b/src/nm-system.c index 09e1da586..5d1a48953 100644 --- a/src/nm-system.c +++ b/src/nm-system.c @@ -40,11 +40,11 @@ #include <resolv.h> #include <netdb.h> #include <glib.h> -#include <ctype.h> #include <linux/if.h> #include <linux/sockios.h> #include <linux/if_bonding.h> #include <linux/if_vlan.h> +#include <linux/if_bridge.h> #include "nm-system.h" #include "nm-device.h" @@ -61,7 +61,7 @@ #include <netlink/utils.h> #include <netlink/route/link.h> -#ifdef HAVE_LIBNL3 +#if HAVE_LIBNL == 3 #include <netlink/route/link/bonding.h> #include <netlink/route/link/vlan.h> #endif @@ -897,6 +897,50 @@ out: return success; } +/** + * nm_system_iface_set_arp: + * @ifindex: interface index + * @enable: %TRUE to enable ARP, or %FALSE to disable + * + * Sets a flag to indicate that ARP should or should not be used on the + * interface. Point-to-point or IPv4 /32 interfaces often require that ARP + * be disabled. + * + * Returns: %TRUE on success, %FALSE on failure + **/ +gboolean +nm_system_iface_set_arp (int ifindex, gboolean enable) +{ + struct rtnl_link *request = NULL, *old = NULL; + struct nl_sock *nlh; + gboolean success = FALSE; + int err; + + g_return_val_if_fail (ifindex > 0, FALSE); + + if (!(request = rtnl_link_alloc ())) + return FALSE; + + if (enable) + rtnl_link_unset_flags (request, IFF_NOARP); + else + rtnl_link_set_flags (request, IFF_NOARP); + + old = nm_netlink_index_to_rtnl_link (ifindex); + if (old) { + nlh = nm_netlink_get_default_handle (); + if (nlh) { + err = rtnl_link_change (nlh, old, request, 0); + if (err == 0) + success = TRUE; + } + } + + rtnl_link_put (old); + rtnl_link_put (request); + return success; +} + static struct rtnl_route * add_ip4_route_to_gateway (int ifindex, guint32 gw, guint32 mss) { @@ -1160,12 +1204,16 @@ replace_default_ip6_route (int ifindex, const struct in6_addr *gw, int mss) char gw_str[INET6_ADDRSTRLEN + 1]; g_return_val_if_fail (ifindex > 0, FALSE); - g_return_val_if_fail (gw != NULL, FALSE); if (nm_logging_level_enabled (LOGL_DEBUG)) { - memset (gw_str, 0, sizeof (gw_str)); - if (inet_ntop (AF_INET6, gw, gw_str, sizeof (gw_str) - 1)) - nm_log_dbg (LOGD_IP6, "Setting IPv6 default route via %s", gw_str); + if (gw) { + memset (gw_str, 0, sizeof (gw_str)); + if (inet_ntop (AF_INET6, gw, gw_str, sizeof (gw_str) - 1)) + nm_log_dbg (LOGD_IP6, "Setting IPv6 default route via %s", gw_str); + } else { + nm_log_dbg (LOGD_IP6, "Setting IPv6 default route via %s", + nm_netlink_index_to_iface (ifindex)); + } } /* We can't just use NLM_F_REPLACE here like in the IPv4 case, because @@ -1572,7 +1620,7 @@ nm_system_add_bonding_master (const char *iface) } static gboolean -nm_system_iface_compat_enslave (const char *master_iface, const char *slave_iface) +nm_system_bond_compat_enslave (const char *master_iface, const char *slave_iface) { struct ifreq ifr; int fd; @@ -1602,7 +1650,7 @@ nm_system_iface_compat_enslave (const char *master_iface, const char *slave_ifac } /** - * nm_system_iface_enslave: + * nm_system_bond_enslave: * @master_ifindex: master device interface index * @master_iface: master device interface name * @slave_ifindex: slave device interface index @@ -1618,10 +1666,10 @@ nm_system_iface_compat_enslave (const char *master_iface, const char *slave_ifac * Returns: %TRUE on success, or %FALSE */ gboolean -nm_system_iface_enslave (gint master_ifindex, - const char *master_iface, - gint slave_ifindex, - const char *slave_iface) +nm_system_bond_enslave (gint master_ifindex, + const char *master_iface, + gint slave_ifindex, + const char *slave_iface) { struct nl_sock *sock; int err; @@ -1648,7 +1696,7 @@ nm_system_iface_enslave (gint master_ifindex, err = rtnl_link_bond_enslave_ifindex (sock, master_ifindex, slave_ifindex); if (err == -NLE_OPNOTSUPP) - return nm_system_iface_compat_enslave (master_iface, slave_iface); + return nm_system_bond_compat_enslave (master_iface, slave_iface); if (err < 0) { nm_log_err (LOGD_DEVICE, "(%s): error enslaving %s: %d (%s)", @@ -1660,7 +1708,7 @@ nm_system_iface_enslave (gint master_ifindex, } static gboolean -nm_system_iface_compat_release (const char *master_iface, const char *slave_iface) +nm_system_bond_compat_release (const char *master_iface, const char *slave_iface) { struct ifreq ifr; int fd; @@ -1689,7 +1737,7 @@ nm_system_iface_compat_release (const char *master_iface, const char *slave_ifac } /** - * nm_system_iface_release: + * nm_system_bond_release: * @master_ifindex: master device interface index * @master_iface: master device interface name * @slave_ifindex: slave device interface index @@ -1703,10 +1751,10 @@ nm_system_iface_compat_release (const char *master_iface, const char *slave_ifac * Returns: %TRUE on success, or %FALSE */ gboolean -nm_system_iface_release (gint master_ifindex, - const char *master_iface, - gint slave_ifindex, - const char *slave_iface) +nm_system_bond_release (gint master_ifindex, + const char *master_iface, + gint slave_ifindex, + const char *slave_iface) { struct nl_sock *sock; int err; @@ -1724,7 +1772,7 @@ nm_system_iface_release (gint master_ifindex, err = rtnl_link_bond_release_ifindex (sock, slave_ifindex); if (err == -NLE_OPNOTSUPP) - return nm_system_iface_compat_release (master_iface, slave_iface); + return nm_system_bond_compat_release (master_iface, slave_iface); else if (err < 0) { nm_log_err (LOGD_DEVICE, "(%s): error releasing slave %s: %d (%s)", master_iface, slave_iface, err, nl_geterror (err)); @@ -1817,7 +1865,7 @@ nm_system_get_iface_type (int ifindex, const char *name) goto out; /* Prefer interface indexes to names */ - err = rtnl_link_get_kernel (nlh, ifindex, ifindex < 0 ? name : NULL, &result); + err = rtnl_link_get_kernel (nlh, ifindex, ifindex <= 0 ? name : NULL, &result); if (err < 0) { if (err == -NLE_OPNOTSUPP) res = nm_system_compat_get_iface_type (ifindex, name); @@ -1830,6 +1878,8 @@ nm_system_get_iface_type (int ifindex, const char *name) res = NM_IFACE_TYPE_BOND; else if (!g_strcmp0 (type, "vlan")) res = NM_IFACE_TYPE_VLAN; + else if (!g_strcmp0 (type, "bridge")) + res = NM_IFACE_TYPE_BRIDGE; else if (!g_strcmp0 (type, "dummy")) res = NM_IFACE_TYPE_DUMMY; @@ -2266,3 +2316,243 @@ nm_system_del_vlan_iface (const char *iface) nl_cache_free (cache); return (ret == 0) ? TRUE : FALSE; } + +static int +_bridge_create_compat (const char *iface) +{ + int ret = 0, fd; + + if ((fd = socket (AF_LOCAL, SOCK_STREAM, 0)) < 0) { + nm_log_err (LOGD_DEVICE, "couldn't open control socket."); + return -EBADF; + } + + if (ioctl (fd, SIOCBRADDBR, iface) < 0) + ret = -errno; + + close (fd); + return ret; +} + +/** + * nm_system_create_bridge: + * @iface: Name bridging device to create + * + * Creates a new bridging device in the kernel. If a bridging device with + * the specified name already exists, it is being reused. + * + * Returns: %TRUE on success, %FALSE on error. + */ +gboolean +nm_system_create_bridge (const char *iface) +{ + int err; + + /* FIXME: use netlink */ + err = _bridge_create_compat (iface); + if (err < 0 && err != -EEXIST) { + nm_log_err (LOGD_DEVICE, "(%s): error while adding bridge: %s", + iface, strerror (-err)); + return FALSE; + } + return TRUE; +} + +static int +_bridge_del_compat (const char *iface) +{ + int ret = 0, fd; + + if ((fd = socket (AF_LOCAL, SOCK_STREAM, 0)) < 0) { + nm_log_err (LOGD_DEVICE, "couldn't open control socket."); + return -EBADF; + } + + if (ioctl (fd, SIOCBRDELBR, iface) < 0) + ret = -errno; + + close (fd); + return ret; +} + +/** + * nm_system_del_bridge: + * @iface: Name of bridging device to delete + * + * Deletes the specified bridging device in the kernel. + * + * Returns: %TRUE on success, %FALSE on error. + */ +gboolean +nm_system_del_bridge (const char *iface) +{ + int err; + + /* FIXME: use netlink */ + err = _bridge_del_compat (iface); + if (err < 0 && err != -ENXIO) { + nm_log_err (LOGD_DEVICE, "(%s): error while deleting bridge: %s ", + iface, strerror (-err)); + return FALSE; + } + return TRUE; +} + +static int +_bridge_attach_compat (int master_ifindex, + const char *master_iface, + int slave_ifindex, + const char *slave_iface) +{ + int ret = 0, fd; + struct ifreq ifr; + + if ((fd = socket (AF_LOCAL, SOCK_STREAM, 0)) < 0) { + nm_log_err (LOGD_DEVICE, "couldn't open control socket."); + return -EBADF; + } + + memset (&ifr, 0, sizeof (ifr)); + strncpy (ifr.ifr_name, master_iface, IFNAMSIZ); + ifr.ifr_ifindex = slave_ifindex; + if (ioctl (fd, SIOCBRADDIF, &ifr) < 0) + ret = -errno; + + close (fd); + return ret; +} + +static int +_bridge_detach_compat (int master_ifindex, + const char *master_iface, + int slave_ifindex, + const char *slave_iface) +{ + int ret = 0, fd; + struct ifreq ifr; + + if ((fd = socket (AF_LOCAL, SOCK_STREAM, 0)) < 0) { + nm_log_err (LOGD_DEVICE, "couldn't open control socket."); + return -EBADF; + } + + memset (&ifr, 0, sizeof(ifr)); + strncpy (ifr.ifr_name, master_iface, IFNAMSIZ); + ifr.ifr_ifindex = slave_ifindex; + if (ioctl (fd, SIOCBRDELIF, &ifr) < 0) + ret = -errno; + + close (fd); + return ret; +} + +/** + * nm_system_bridge_attach: + * @master_ifindex: master device interface index + * @master_iface: master device interface name + * @slave_ifindex: slave device interface index + * @slave_iface: slave device interface name + * + * Attaches interface 'slave' to bridge 'master' + * + * Returns: %TRUE on success, or %FALSE + */ +gboolean +nm_system_bridge_attach (int master_ifindex, + const char *master_iface, + int slave_ifindex, + const char *slave_iface) +{ + char *mif = NULL, *sif = NULL; + int err = -1; + + g_return_val_if_fail (master_ifindex >= 0, FALSE); + g_return_val_if_fail (slave_ifindex >= 0, FALSE); + + if (!master_iface) { + mif = nm_netlink_index_to_iface (master_ifindex); + if (mif == NULL) { + nm_log_err (LOGD_DEVICE, "interface name lookup failed for index %d", master_ifindex); + goto out; + } + } + + if (!slave_ifindex) { + sif = nm_netlink_index_to_iface (slave_ifindex); + if (sif == NULL) { + nm_log_err (LOGD_DEVICE, "interface name lookup failed for index %d", slave_ifindex); + goto out; + } + } + + /* FIXME: long term plan is to use netlink for this */ + err = _bridge_attach_compat (master_ifindex, + mif ? mif : master_iface, + slave_ifindex, + sif ? sif : slave_iface); + if (err < 0 && err != -EBUSY) { + nm_log_err (LOGD_DEVICE, "(%s): failed to attach slave %s: %s", + master_iface, slave_iface, strerror (-err)); + } + +out: + g_free (sif); + g_free (mif); + return err == 0 ? TRUE : FALSE; +} + +/** + * nm_system_bridge_detach: + * @master_ifindex: master device interface index + * @master_iface: master device interface name + * @slave_ifindex: slave device interface index + * @slave_iface: slave device interface name + * + * Detaches the interface 'slave' from the bridge 'master'. + * + * Returns: %TRUE on success, or %FALSE + */ +gboolean +nm_system_bridge_detach (int master_ifindex, + const char *master_iface, + int slave_ifindex, + const char *slave_iface) +{ + char *mif = NULL, *sif = NULL; + int err = -1; + + g_return_val_if_fail (master_ifindex >= 0, FALSE); + g_return_val_if_fail (slave_ifindex >= 0, FALSE); + + if (!master_iface) { + mif = nm_netlink_index_to_iface (master_ifindex); + if (mif == NULL) { + nm_log_err (LOGD_DEVICE, "interface name lookup failed for index %d", master_ifindex); + goto out; + } + } + + if (!slave_ifindex) { + sif = nm_netlink_index_to_iface (slave_ifindex); + if (sif == NULL) { + nm_log_err (LOGD_DEVICE, "interface name lookup failed for index %d", slave_ifindex); + goto out; + } + } + + /* FIXME: long term plan is to use netlink for this */ + err = _bridge_detach_compat (master_ifindex, + mif ? mif : master_iface, + slave_ifindex, + sif ? sif : slave_iface); + /* Kernel doesn't return an error detaching an already-detached interface */ + if (err < 0) { + nm_log_err (LOGD_DEVICE, "(%s): failed to detach slave %s: %s", + master_iface, slave_iface, strerror (-err)); + } + +out: + g_free (mif); + g_free (sif); + return err == 0 ? TRUE : FALSE; +} diff --git a/src/nm-system.h b/src/nm-system.h index 1acb88538..ca07d0f25 100644 --- a/src/nm-system.h +++ b/src/nm-system.h @@ -33,10 +33,6 @@ #include "nm-setting-bond.h" #include "nm-setting-vlan.h" -/* Prototypes for system/distribution dependent functions, - * implemented in the backend files in backends/ directory - */ - gboolean nm_system_iface_flush_routes (int ifindex, int family); gboolean nm_system_replace_default_ip4_route (int ifindex, @@ -98,15 +94,17 @@ gboolean nm_system_iface_set_mtu (int ifindex, guint32 mtu); gboolean nm_system_iface_set_mac (int ifindex, const struct ether_addr *mac); +gboolean nm_system_iface_set_arp (int ifindex, gboolean arp); + gboolean nm_system_apply_bonding_config (const char *iface, NMSettingBond *s_bond); gboolean nm_system_add_bonding_master (const char *iface); -gboolean nm_system_iface_enslave (gint master_ifindex, +gboolean nm_system_bond_enslave (gint master_ifindex, const char *master_iface, gint slave_ifindex, const char *slave_iface); -gboolean nm_system_iface_release (gint master_ifindex, +gboolean nm_system_bond_release (gint master_ifindex, const char *master_iface, gint slave_ifindex, const char *slave_iface); @@ -115,7 +113,8 @@ enum { NM_IFACE_TYPE_UNSPEC = 0, NM_IFACE_TYPE_BOND, NM_IFACE_TYPE_VLAN, - NM_IFACE_TYPE_DUMMY, + NM_IFACE_TYPE_BRIDGE, + NM_IFACE_TYPE_DUMMY }; int nm_system_get_iface_type (int ifindex, const char *name); @@ -129,4 +128,16 @@ gboolean nm_system_add_vlan_iface (NMConnection *connection, int parent_ifindex); gboolean nm_system_del_vlan_iface (const char *iface); +gboolean nm_system_create_bridge (const char *iface); +gboolean nm_system_del_bridge (const char *iface); + +gboolean nm_system_bridge_attach (int master_ifindex, + const char *master_iface, + int slave_ifindex, + const char *slave_iface); +gboolean nm_system_bridge_detach (int master_ifindex, + const char *master_iface, + int slave_ifindex, + const char *slave_iface); + #endif diff --git a/src/backends/nm-backend.h b/src/nm-types.h index 17d1ff649..c558d7ba5 100644 --- a/src/backends/nm-backend.h +++ b/src/nm-types.h @@ -15,16 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2011 - 2012 Red Hat, Inc. + * Copyright (C) 2012 Red Hat, Inc. */ -#ifndef NM_BACKEND_H -#define NM_BACKEND_H +#ifndef NM_TYPES_H +#define NM_TYPES_H -/* Random disto-specific stuff */ +typedef struct _NMDevice NMDevice; -void nm_backend_enable_loopback (void); -void nm_backend_update_dns (void); -int nm_backend_ipv6_use_tempaddr (void); - -#endif /* NM_BACKEND_H */ +#endif /* NM_TYPES_H */ diff --git a/src/nm-udev-manager.c b/src/nm-udev-manager.c index 792e53bfd..7e8674066 100644 --- a/src/nm-udev-manager.c +++ b/src/nm-udev-manager.c @@ -401,6 +401,9 @@ dev_get_attrs (GUdevDevice *udev_device, case NM_IFACE_TYPE_BOND: driver = "bonding"; break; + case NM_IFACE_TYPE_BRIDGE: + driver = "bridge"; + break; case NM_IFACE_TYPE_VLAN: driver = "8021q"; break; @@ -515,25 +518,35 @@ void nm_udev_manager_query_devices (NMUdevManager *self) { NMUdevManagerPrivate *priv = NM_UDEV_MANAGER_GET_PRIVATE (self); + GUdevEnumerator *enumerator; GList *devices, *iter; g_return_if_fail (self != NULL); g_return_if_fail (NM_IS_UDEV_MANAGER (self)); - devices = g_udev_client_query_by_subsystem (priv->client, "net"); + enumerator = g_udev_enumerator_new (priv->client); + g_udev_enumerator_add_match_subsystem (enumerator, "net"); + g_udev_enumerator_add_match_is_initialized (enumerator); + + devices = g_udev_enumerator_execute (enumerator); for (iter = devices; iter; iter = g_list_next (iter)) { net_add (self, G_UDEV_DEVICE (iter->data)); g_object_unref (G_UDEV_DEVICE (iter->data)); } g_list_free (devices); + g_object_unref (enumerator); - devices = g_udev_client_query_by_subsystem (priv->client, "atm"); + enumerator = g_udev_enumerator_new (priv->client); + g_udev_enumerator_add_match_subsystem (enumerator, "atm"); + g_udev_enumerator_add_match_is_initialized (enumerator); + devices = g_udev_enumerator_execute (enumerator); for (iter = devices; iter; iter = g_list_next (iter)) { adsl_add (self, G_UDEV_DEVICE (iter->data)); g_object_unref (G_UDEV_DEVICE (iter->data)); } g_list_free (devices); + g_object_unref (enumerator); } static void diff --git a/src/nm-wifi-ap-utils.c b/src/nm-wifi-ap-utils.c index 215c4935c..29aa52a4d 100644 --- a/src/nm-wifi-ap-utils.c +++ b/src/nm-wifi-ap-utils.c @@ -514,7 +514,8 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid, gboolean valid = FALSE; /* Make sure the supplied mode matches the AP's */ - if (!strcmp (mode, NM_SETTING_WIRELESS_MODE_INFRA)) { + if ( !strcmp (mode, NM_SETTING_WIRELESS_MODE_INFRA) + || !strcmp (mode, NM_SETTING_WIRELESS_MODE_AP)) { if (ap_mode == NM_802_11_MODE_INFRA) valid = TRUE; } else if (!strcmp (mode, NM_SETTING_WIRELESS_MODE_ADHOC)) { diff --git a/src/nm-wifi-ap.c b/src/nm-wifi-ap.c index 6a607960a..e6db69209 100644 --- a/src/nm-wifi-ap.c +++ b/src/nm-wifi-ap.c @@ -58,6 +58,7 @@ typedef struct /* Non-scanned attributes */ gboolean fake; /* Whether or not the AP is from a scan */ + gboolean hotspot; /* Whether the AP is a local device's hotspot network */ gboolean broadcast; /* Whether or not the AP is broadcasting (hidden) */ glong last_seen; /* Last time the AP was seen in a scan in seconds */ } NMAccessPointPrivate; @@ -650,7 +651,10 @@ nm_ap_new_fake_from_connection (NMConnection *connection) nm_ap_set_mode (ap, NM_802_11_MODE_INFRA); else if (!strcmp (mode, "adhoc")) nm_ap_set_mode (ap, NM_802_11_MODE_ADHOC); - else + else if (!strcmp (mode, "ap")) { + nm_ap_set_mode (ap, NM_802_11_MODE_INFRA); + NM_AP_GET_PRIVATE (ap)->hotspot = TRUE; + } else goto error; } else { nm_ap_set_mode (ap, NM_802_11_MODE_INFRA); @@ -975,6 +979,13 @@ void nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode) } } +gboolean +nm_ap_is_hotspot (NMAccessPoint *ap) +{ + g_return_val_if_fail (NM_IS_AP (ap), FALSE); + + return NM_AP_GET_PRIVATE (ap)->hotspot; +} /* * Get/set functions for strength @@ -1160,6 +1171,9 @@ nm_ap_check_compatible (NMAccessPoint *self, return FALSE; if (!strcmp (mode, "adhoc") && (priv->mode != NM_802_11_MODE_ADHOC)) return FALSE; + if ( !strcmp (mode, "ap") + && (priv->mode != NM_802_11_MODE_INFRA || priv->hotspot != TRUE)) + return FALSE; } band = nm_setting_wireless_get_band (s_wireless); diff --git a/src/nm-wifi-ap.h b/src/nm-wifi-ap.h index 2058deda6..a1a0da920 100644 --- a/src/nm-wifi-ap.h +++ b/src/nm-wifi-ap.h @@ -86,6 +86,8 @@ void nm_ap_set_address (NMAccessPoint *ap, const struct ether_addr *addr); NM80211Mode nm_ap_get_mode (NMAccessPoint *ap); void nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode); +gboolean nm_ap_is_hotspot (NMAccessPoint *ap); + gint8 nm_ap_get_strength (NMAccessPoint *ap); void nm_ap_set_strength (NMAccessPoint *ap, gint8 strength); diff --git a/src/posix-signals/Makefile.am b/src/posix-signals/Makefile.am index 88c3d8d42..183214bd7 100644 --- a/src/posix-signals/Makefile.am +++ b/src/posix-signals/Makefile.am @@ -6,8 +6,7 @@ libnm_posix_signals_la_SOURCES = \ libnm_posix_signals_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DG_DISABLE_DEPRECATED + -DLIBEXECDIR=\"$(libexecdir)\" libnm_posix_signals_la_LIBADD = \ -ldl \ diff --git a/src/posix-signals/Makefile.in b/src/posix-signals/Makefile.in index bdd9cca3e..db24efa64 100644 --- a/src/posix-signals/Makefile.in +++ b/src/posix-signals/Makefile.in @@ -55,16 +55,18 @@ subdir = src/posix-signals DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -128,6 +130,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -142,9 +148,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -154,17 +158,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -205,6 +206,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -221,11 +223,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -240,6 +238,8 @@ 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@ @@ -249,6 +249,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -275,13 +276,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -336,6 +338,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -350,6 +357,10 @@ 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@ noinst_LTLIBRARIES = libnm-posix-signals.la libnm_posix_signals_la_SOURCES = \ nm-posix-signals.c \ @@ -357,8 +368,7 @@ libnm_posix_signals_la_SOURCES = \ libnm_posix_signals_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DG_DISABLE_DEPRECATED + -DLIBEXECDIR=\"$(libexecdir)\" libnm_posix_signals_la_LIBADD = \ -ldl \ @@ -419,25 +429,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_posix_signals_la-nm-posix-signals.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/ppp-manager/Makefile.am b/src/ppp-manager/Makefile.am index 9de581692..7e8102a51 100644 --- a/src/ppp-manager/Makefile.am +++ b/src/ppp-manager/Makefile.am @@ -26,7 +26,6 @@ $(libppp_manager_la_OBJECTS): $(built_sources) libppp_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLIBDIR=\"$(libdir)\" \ -DPLUGINDIR=\"$(PPPD_PLUGIN_DIR)\" diff --git a/src/ppp-manager/Makefile.in b/src/ppp-manager/Makefile.in index f43c4bf52..f53e808bd 100644 --- a/src/ppp-manager/Makefile.in +++ b/src/ppp-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/ppp-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -173,6 +175,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -187,9 +193,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -199,17 +203,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -250,6 +251,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -266,11 +268,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -285,6 +283,8 @@ 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@ @@ -294,6 +294,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -320,13 +321,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -381,6 +383,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -395,6 +402,10 @@ 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@ INCLUDES = \ -I${top_srcdir} \ -I${top_builddir}/include \ @@ -416,7 +427,6 @@ libppp_manager_la_SOURCES = \ built_sources = nm-ppp-manager-glue.h libppp_manager_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DLIBDIR=\"$(libdir)\" \ -DPLUGINDIR=\"$(PPPD_PLUGIN_DIR)\" @@ -538,25 +548,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm_pppd_plugin_la-nm-pppd-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/Makefile.am b/src/settings/Makefile.am index eb6190bbc..6ca7633f7 100644 --- a/src/settings/Makefile.am +++ b/src/settings/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=plugins . tests +SUBDIRS = plugins . tests INCLUDES = -I${top_srcdir} \ -I${top_builddir}/include \ @@ -53,15 +53,13 @@ libsettings_la_SOURCES = \ libsettings_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(POLKIT_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DBINDIR=\"$(bindir)\" \ -DSBINDIR=\"$(sbindir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DDATADIR=\"$(datadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLOCALSTATEDIR=\"$(localstatedir)\" \ + -DNMSTATEDIR=\"$(nmstatedir)\" \ -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ -DPLUGINDIR=\"$(pkglibdir)\" @@ -72,7 +70,6 @@ libsettings_la_LIBADD = \ $(builddir)/plugins/keyfile/libnm-settings-plugin-keyfile.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ $(POLKIT_LIBS) libsettings_la_LDFLAGS = -rdynamic diff --git a/src/settings/Makefile.in b/src/settings/Makefile.in index 50c63cf0f..0c95d9683 100644 --- a/src/settings/Makefile.in +++ b/src/settings/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -79,7 +81,7 @@ libsettings_la_DEPENDENCIES = \ $(top_builddir)/src/logging/libnm-logging.la \ $(builddir)/plugins/keyfile/libnm-settings-plugin-keyfile.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) am_libsettings_la_OBJECTS = libsettings_la-nm-settings.lo \ libsettings_la-nm-inotify-helper.lo \ libsettings_la-nm-settings-error.lo \ @@ -192,6 +194,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -206,9 +212,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -218,17 +222,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -269,6 +270,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -285,11 +287,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -304,6 +302,8 @@ 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@ @@ -313,6 +313,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -339,13 +340,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -400,6 +402,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -414,6 +421,10 @@ 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@ SUBDIRS = plugins . tests INCLUDES = -I${top_srcdir} \ -I${top_builddir}/include \ @@ -467,15 +478,13 @@ libsettings_la_SOURCES = \ libsettings_la_CPPFLAGS = \ $(DBUS_CFLAGS) \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(POLKIT_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DBINDIR=\"$(bindir)\" \ -DSBINDIR=\"$(sbindir)\" \ -DLIBEXECDIR=\"$(libexecdir)\" \ -DDATADIR=\"$(datadir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLOCALSTATEDIR=\"$(localstatedir)\" \ + -DNMSTATEDIR=\"$(nmstatedir)\" \ -DGNOMELOCALEDIR=\"$(datadir)/locale\" \ -DPLUGINDIR=\"$(pkglibdir)\" @@ -486,7 +495,6 @@ libsettings_la_LIBADD = \ $(builddir)/plugins/keyfile/libnm-settings-plugin-keyfile.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ $(POLKIT_LIBS) libsettings_la_LDFLAGS = -rdynamic @@ -560,25 +568,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtest_settings_utils_la-nm-settings-utils.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index b7057400b..d9199f51c 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -20,7 +20,6 @@ #include <config.h> #include <string.h> -#include <ctype.h> #include <pwd.h> #include <glib.h> @@ -166,7 +165,7 @@ validate_identifier (const char *identifier, GError **error) /* FIXME: do complete validation here */ while (p && *p) { - if (!isalnum (*p) && (*p != '_') && (*p != '-') && (*p != '.')) { + if (!g_ascii_isalnum (*p) && (*p != '_') && (*p != '-') && (*p != '.')) { g_set_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER, diff --git a/src/settings/nm-inotify-helper.c b/src/settings/nm-inotify-helper.c index f44fee823..2391d993b 100644 --- a/src/settings/nm-inotify-helper.c +++ b/src/settings/nm-inotify-helper.c @@ -27,6 +27,10 @@ #include "nm-inotify-helper.h" #include "nm-logging.h" +/* NOTE: this code should be killed once we depend on a new enough glib to + * include the patches from https://bugzilla.gnome.org/show_bug.cgi?id=532815 + */ + G_DEFINE_TYPE (NMInotifyHelper, nm_inotify_helper, G_TYPE_OBJECT) #define NM_INOTIFY_HELPER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_INOTIFY_HELPER, NMInotifyHelperPrivate)) diff --git a/src/settings/nm-inotify-helper.h b/src/settings/nm-inotify-helper.h index bdebaf8e4..31e6b9ff8 100644 --- a/src/settings/nm-inotify-helper.h +++ b/src/settings/nm-inotify-helper.h @@ -25,6 +25,10 @@ #include <glib-object.h> #include <sys/inotify.h> +/* NOTE: this code should be killed once we depend on a new enough glib to + * include the patches from https://bugzilla.gnome.org/show_bug.cgi?id=532815 + */ + #define NM_TYPE_INOTIFY_HELPER (nm_inotify_helper_get_type ()) #define NM_INOTIFY_HELPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_INOTIFY_HELPER, NMInotifyHelper)) #define NM_INOTIFY_HELPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_INOTIFY_HELPER, NMInotifyHelperClass)) diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index 94f046e57..e79d4281e 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -30,6 +30,7 @@ #include "NetworkManager.h" #include "nm-secret-agent.h" #include "nm-dbus-glib-types.h" +#include "nm-logging.h" G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT) @@ -296,6 +297,20 @@ nm_secret_agent_get_secrets (NMSecretAgent *self, return r->call; } +static void +cancel_done (DBusGProxy *proxy, DBusGProxyCall *call_id, void *user_data) +{ + GError *error = NULL; + + if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) { + nm_log_dbg (LOGD_AGENTS, "(%s): agent failed to cancel secrets: (%d) %s", + (const char *) user_data, + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); + g_clear_error (&error); + } +} + void nm_secret_agent_cancel_secrets (NMSecretAgent *self, gconstpointer call) { @@ -308,13 +323,16 @@ nm_secret_agent_cancel_secrets (NMSecretAgent *self, gconstpointer call) r = g_hash_table_lookup (priv->requests, call); g_return_if_fail (r != NULL); - dbus_g_proxy_cancel_call (NM_SECRET_AGENT_GET_PRIVATE (self)->proxy, (gpointer) call); + dbus_g_proxy_cancel_call (priv->proxy, (gpointer) call); - dbus_g_proxy_call_no_reply (priv->proxy, - "CancelGetSecrets", - G_TYPE_STRING, r->path, - G_TYPE_STRING, r->setting_name, - G_TYPE_INVALID); + dbus_g_proxy_begin_call (priv->proxy, + "CancelGetSecrets", + cancel_done, + g_strdup (nm_secret_agent_get_description (self)), + g_free, + DBUS_TYPE_G_OBJECT_PATH, r->path, + G_TYPE_STRING, r->setting_name, + G_TYPE_INVALID); g_hash_table_remove (priv->requests, call); } diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index ddc758c71..f0cfc3fc9 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * (C) Copyright 2008 Novell, Inc. - * (C) Copyright 2008 - 2011 Red Hat, Inc. + * (C) Copyright 2008 - 2012 Red Hat, Inc. */ #include "config.h" @@ -28,6 +28,7 @@ #include <dbus/dbus-glib-lowlevel.h> #include <nm-setting-connection.h> #include <nm-setting-vpn.h> +#include <nm-setting-wireless.h> #include <nm-utils.h> #include "nm-settings-connection.h" @@ -41,8 +42,8 @@ #include "nm-agent-manager.h" #include "NetworkManagerUtils.h" -#define SETTINGS_TIMESTAMPS_FILE LOCALSTATEDIR"/lib/NetworkManager/timestamps" -#define SETTINGS_SEEN_BSSIDS_FILE LOCALSTATEDIR"/lib/NetworkManager/seen-bssids" +#define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps" +#define SETTINGS_SEEN_BSSIDS_FILE NMSTATEDIR "/seen-bssids" static void impl_settings_connection_get_settings (NMSettingsConnection *connection, DBusGMethodInvocation *context); @@ -107,6 +108,7 @@ typedef struct { NMConnection *agent_secrets; guint64 timestamp; /* Up-to-date timestamp of connection use */ + gboolean timestamp_set; GHashTable *seen_bssids; /* Up-to-date BSSIDs that's been seen for the connection */ } NMSettingsConnectionPrivate; @@ -572,8 +574,6 @@ do_delete (NMSettingsConnection *connection, /* Remove connection from seen-bssids database file */ remove_entry_from_db (connection, "seen-bssids"); - /* Signal the connection is removed and deleted */ - g_signal_emit (connection, signals[REMOVED], 0); callback (connection, NULL, user_data); g_object_unref (connection); } @@ -1061,7 +1061,9 @@ get_settings_auth_cb (NMSettingsConnection *self, GHashTable *settings; NMConnection *dupl_con; NMSettingConnection *s_con; - guint64 timestamp; + NMSettingWireless *s_wifi; + guint64 timestamp = 0; + GSList *bssid_list; dupl_con = nm_connection_duplicate (NM_CONNECTION (self)); g_assert (dupl_con); @@ -1072,12 +1074,22 @@ get_settings_auth_cb (NMSettingsConnection *self, * timestamps are kept track of in a private variable. So, substitute * timestamp property with the real one here before returning the settings. */ - timestamp = nm_settings_connection_get_timestamp (self); + nm_settings_connection_get_timestamp (self, ×tamp); if (timestamp) { s_con = nm_connection_get_setting_connection (NM_CONNECTION (dupl_con)); g_assert (s_con); g_object_set (s_con, NM_SETTING_CONNECTION_TIMESTAMP, timestamp, NULL); } + /* Seen BSSIDs are not updated in 802-11-wireless 'seen-bssids' property + * from the same reason as timestamp. Thus we put it here to GetSettings() + * return settings too. + */ + bssid_list = nm_settings_connection_get_seen_bssids (self); + s_wifi = nm_connection_get_setting_wireless (NM_CONNECTION (dupl_con)); + if (bssid_list && s_wifi) { + g_object_set (s_wifi, NM_SETTING_WIRELESS_SEEN_BSSIDS, bssid_list, NULL); + nm_utils_slist_free (bssid_list, g_free); + } /* Secrets should *never* be returned by the GetSettings method, they * get returned by the GetSecrets method which can be better @@ -1403,18 +1415,23 @@ nm_settings_connection_signal_remove (NMSettingsConnection *self) /** * nm_settings_connection_get_timestamp: * @connection: the #NMSettingsConnection + * @out_timestamp: the connection's timestamp * - * Returns current connection's timestamp. + * Returns the time (in seconds since the Unix epoch) when the connection + * was last successfully activated. * - * Returns: timestamp of the last connection use (0 when it's not used) + * Returns: %TRUE if the timestamp has ever been set, otherwise %FALSE. **/ -guint64 -nm_settings_connection_get_timestamp (NMSettingsConnection *connection) +gboolean +nm_settings_connection_get_timestamp (NMSettingsConnection *connection, + guint64 *out_timestamp) { g_return_val_if_fail (connection != NULL, 0); g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), 0); - return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp; + if (out_timestamp) + *out_timestamp = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp; + return NM_SETTINGS_CONNECTION_GET_PRIVATE (connection)->timestamp_set; } /** @@ -1440,6 +1457,7 @@ nm_settings_connection_update_timestamp (NMSettingsConnection *connection, /* Update timestamp in private storage */ priv->timestamp = timestamp; + priv->timestamp_set = TRUE; if (flush_to_disk == FALSE) return; @@ -1497,9 +1515,10 @@ nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection } /* Update connection's timestamp */ - if (!err) + if (!err) { priv->timestamp = timestamp; - else { + priv->timestamp_set = TRUE; + } else { nm_log_dbg (LOGD_SETTINGS, "failed to read connection timestamp for '%s': (%d) %s", connection_uuid, err->code, err->message); g_clear_error (&err); @@ -1537,6 +1556,33 @@ mac_dup (const struct ether_addr *old) } /** + * nm_settings_connection_get_seen_bssids: + * @connection: the #NMSettingsConnection + * + * Returns current list of seen BSSIDs for the connection. + * + * Returns: (transfer full) list of seen BSSIDs (in the standard hex-digits-and-colons notation). + * The caller is responsible for freeing the list. + **/ +GSList * +nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection) +{ + NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection); + GHashTableIter iter; + char *bssid_str; + GSList *bssid_list = NULL; + + g_return_val_if_fail (connection != NULL, 0); + g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), NULL); + + g_hash_table_iter_init (&iter, priv->seen_bssids); + while (g_hash_table_iter_next (&iter, NULL, (gpointer) &bssid_str)) + bssid_list = g_slist_prepend (bssid_list, g_strdup (bssid_str)); + + return bssid_list; +} + +/** * nm_settings_connection_has_seen_bssid: * @connection: the #NMSettingsConnection * @bssid: the BSSID to check the seen BSSID list for diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index 9a0e866c4..7875afbe2 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -122,7 +122,8 @@ gboolean nm_settings_connection_check_permission (NMSettingsConnection *self, void nm_settings_connection_signal_remove (NMSettingsConnection *self); -guint64 nm_settings_connection_get_timestamp (NMSettingsConnection *connection); +gboolean nm_settings_connection_get_timestamp (NMSettingsConnection *connection, + guint64 *out_timestamp); void nm_settings_connection_update_timestamp (NMSettingsConnection *connection, guint64 timestamp, @@ -130,6 +131,8 @@ void nm_settings_connection_update_timestamp (NMSettingsConnection *connection, void nm_settings_connection_read_and_fill_timestamp (NMSettingsConnection *connection); +GSList *nm_settings_connection_get_seen_bssids (NMSettingsConnection *connection); + gboolean nm_settings_connection_has_seen_bssid (NMSettingsConnection *connection, const struct ether_addr *bssid); diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index ea0ff31a5..0c139174e 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -27,7 +27,6 @@ #include <unistd.h> #include <string.h> -#include <ctype.h> #include <gmodule.h> #include <net/if_arp.h> #include <pwd.h> @@ -287,7 +286,7 @@ connection_sort (gconstpointer pa, gconstpointer pb) NMSettingConnection *con_a; NMConnection *b = NM_CONNECTION (pb); NMSettingConnection *con_b; - guint64 ts_a, ts_b; + guint64 ts_a = 0, ts_b = 0; con_a = nm_connection_get_setting_connection (a); g_assert (con_a); @@ -300,8 +299,8 @@ connection_sort (gconstpointer pa, gconstpointer pb) return 1; } - ts_a = nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (pa)); - ts_b = nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (pb)); + nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (pa), &ts_a); + nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (pb), &ts_b); if (ts_a > ts_b) return -1; else if (ts_a == ts_b) @@ -596,7 +595,7 @@ load_plugins (NMSettings *self, const char **plugins, GError **error) GObject * (*factory_func) (const char *); /* strip leading spaces */ - while (isblank (*pname)) + while (g_ascii_isspace (*pname)) pname++; /* ifcfg-fedora was renamed ifcfg-rh; handle old configs here */ @@ -1657,7 +1656,7 @@ best_connection_sort (gconstpointer a, gconstpointer b, gpointer user_data) { NMSettingsConnection *ac = (NMSettingsConnection *) a; NMSettingsConnection *bc = (NMSettingsConnection *) b; - guint64 ats, bts; + guint64 ats = 0, bts = 0; if (!ac && bc) return -1; @@ -1669,8 +1668,8 @@ best_connection_sort (gconstpointer a, gconstpointer b, gpointer user_data) g_assert (ac && bc); /* In the future we may use connection priorities in addition to timestamps */ - ats = nm_settings_connection_get_timestamp (ac); - bts = nm_settings_connection_get_timestamp (bc); + nm_settings_connection_get_timestamp (ac, &ats); + nm_settings_connection_get_timestamp (bc, &bts); if (ats < bts) return -1; @@ -1697,6 +1696,8 @@ get_best_connections (NMConnectionProvider *provider, g_hash_table_iter_init (&iter, priv->connections); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &connection)) { + guint64 cur_ts = 0; + if (ctype1 && !nm_connection_is_type (NM_CONNECTION (connection), ctype1)) continue; if (ctype2 && !nm_connection_is_type (NM_CONNECTION (connection), ctype2)) @@ -1705,10 +1706,11 @@ get_best_connections (NMConnectionProvider *provider, continue; /* Don't bother with a connection that's older than the oldest one in the list */ - if ( max_requested - && added >= max_requested - && nm_settings_connection_get_timestamp (connection) <= oldest) - continue; + if (max_requested && added >= max_requested) { + nm_settings_connection_get_timestamp (connection, &cur_ts); + if (cur_ts <= oldest) + continue; + } /* List is sorted with oldest first */ sorted = g_slist_insert_sorted_with_data (sorted, connection, best_connection_sort, NULL); @@ -1720,7 +1722,7 @@ get_best_connections (NMConnectionProvider *provider, added--; } - oldest = nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (sorted->data)); + nm_settings_connection_get_timestamp (NM_SETTINGS_CONNECTION (sorted->data), &oldest); } return g_slist_reverse (sorted); diff --git a/src/settings/plugins/Makefile.am b/src/settings/plugins/Makefile.am index d4ba12f0b..8b39b3fce 100644 --- a/src/settings/plugins/Makefile.am +++ b/src/settings/plugins/Makefile.am @@ -1,21 +1,17 @@ SUBDIRS=keyfile example -if TARGET_REDHAT +if CONFIG_PLUGIN_IFCFG_RH SUBDIRS+=ifcfg-rh endif -if TARGET_SUSE +if CONFIG_PLUGIN_IFCFG_SUSE SUBDIRS+=ifcfg-suse endif -if TARGET_MANDRIVA -SUBDIRS+=ifcfg-rh -endif - -if TARGET_DEBIAN +if CONFIG_PLUGIN_IFUPDOWN SUBDIRS+=ifupdown endif -if TARGET_GENTOO +if CONFIG_PLUGIN_IFNET SUBDIRS+=ifnet endif diff --git a/src/settings/plugins/Makefile.in b/src/settings/plugins/Makefile.in index 2e8dff02f..5642eda70 100644 --- a/src/settings/plugins/Makefile.in +++ b/src/settings/plugins/Makefile.in @@ -50,25 +50,26 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@TARGET_REDHAT_TRUE@am__append_1 = ifcfg-rh -@TARGET_SUSE_TRUE@am__append_2 = ifcfg-suse -@TARGET_MANDRIVA_TRUE@am__append_3 = ifcfg-rh -@TARGET_DEBIAN_TRUE@am__append_4 = ifupdown -@TARGET_GENTOO_TRUE@am__append_5 = ifnet +@CONFIG_PLUGIN_IFCFG_RH_TRUE@am__append_1 = ifcfg-rh +@CONFIG_PLUGIN_IFCFG_SUSE_TRUE@am__append_2 = ifcfg-suse +@CONFIG_PLUGIN_IFUPDOWN_TRUE@am__append_3 = ifupdown +@CONFIG_PLUGIN_IFNET_TRUE@am__append_4 = ifnet subdir = src/settings/plugins DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -141,6 +142,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -155,9 +160,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -167,17 +170,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -218,6 +218,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -234,11 +235,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -253,6 +250,8 @@ 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@ @@ -262,6 +261,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -288,13 +288,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -349,6 +350,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -363,8 +369,12 @@ 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@ SUBDIRS = keyfile example $(am__append_1) $(am__append_2) \ - $(am__append_3) $(am__append_4) $(am__append_5) + $(am__append_3) $(am__append_4) all: all-recursive .SUFFIXES: diff --git a/src/settings/plugins/example/Makefile.am b/src/settings/plugins/example/Makefile.am index 027f6f895..95558b720 100644 --- a/src/settings/plugins/example/Makefile.am +++ b/src/settings/plugins/example/Makefile.am @@ -25,16 +25,12 @@ libnm_settings_plugin_example_la_SOURCES = \ libnm_settings_plugin_example_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_example_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version diff --git a/src/settings/plugins/example/Makefile.in b/src/settings/plugins/example/Makefile.in index 775fabc0d..fcdcd7b36 100644 --- a/src/settings/plugins/example/Makefile.in +++ b/src/settings/plugins/example/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/example DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -74,8 +76,7 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libnm_settings_plugin_example_la_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) am_libnm_settings_plugin_example_la_OBJECTS = \ libnm_settings_plugin_example_la-nm-example-connection.lo \ libnm_settings_plugin_example_la-plugin.lo \ @@ -139,6 +140,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -153,9 +158,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -165,17 +168,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -216,6 +216,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -232,11 +233,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -251,6 +248,8 @@ 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@ @@ -260,6 +259,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -286,13 +286,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -347,6 +348,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -361,6 +367,10 @@ 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@ INCLUDES = \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ @@ -388,16 +398,12 @@ libnm_settings_plugin_example_la_SOURCES = \ libnm_settings_plugin_example_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_example_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) libnm_settings_plugin_example_la_LDFLAGS = -module -avoid-version all: all-am @@ -459,25 +465,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_example_la-writer.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/plugins/example/common.h b/src/settings/plugins/example/common.h index a4197070e..ed0be9a7f 100644 --- a/src/settings/plugins/example/common.h +++ b/src/settings/plugins/example/common.h @@ -31,7 +31,7 @@ #define EXAMPLE_PLUGIN_NAME "example" #define EXAMPLE_PLUGIN_INFO "(c) 2012 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." -#define EXAMPLE_DIR SYSCONFDIR"/NetworkManager/example-plugin" +#define EXAMPLE_DIR NMCONFDIR "/example-plugin" /* Boilerplate stuff for the plugin's error domain. Bits of the code that * create new errors in the plugin's domain will create errors of diff --git a/src/settings/plugins/ifcfg-rh/Makefile.am b/src/settings/plugins/ifcfg-rh/Makefile.am index 68225ba1f..a2c3f0f00 100644 --- a/src/settings/plugins/ifcfg-rh/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. tests +SUBDIRS = . tests nm-ifcfg-rh-glue.h: nm-ifcfg-rh.xml $(AM_V_GEN) dbus-binding-tool --prefix=nm_ifcfg_rh --mode=glib-server --output=$@ $< @@ -29,13 +29,13 @@ INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util libifcfg_rh_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(NSS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" @@ -54,9 +54,7 @@ libnm_settings_plugin_ifcfg_rh_la_SOURCES = \ libnm_settings_plugin_ifcfg_rh_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifcfg_rh_la_LDFLAGS = -module -avoid-version @@ -64,9 +62,7 @@ libnm_settings_plugin_ifcfg_rh_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ libifcfg-rh-io.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = nm-ifcfg-rh.conf diff --git a/src/settings/plugins/ifcfg-rh/Makefile.in b/src/settings/plugins/ifcfg-rh/Makefile.in index 6bdf1cc99..53492e72a 100644 --- a/src/settings/plugins/ifcfg-rh/Makefile.in +++ b/src/settings/plugins/ifcfg-rh/Makefile.in @@ -56,16 +56,18 @@ subdir = src/settings/plugins/ifcfg-rh DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -118,7 +120,6 @@ am__v_lt_0 = --silent libnm_settings_plugin_ifcfg_rh_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la libifcfg-rh-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifcfg_rh_la_OBJECTS = \ libnm_settings_plugin_ifcfg_rh_la-plugin.lo \ @@ -218,6 +219,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -232,9 +237,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -244,17 +247,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -295,6 +295,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -311,11 +312,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -330,6 +327,8 @@ 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@ @@ -339,6 +338,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -365,13 +365,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -426,6 +427,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -440,6 +446,10 @@ 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@ SUBDIRS = . tests BUILT_SOURCES = \ nm-ifcfg-rh-glue.h @@ -465,13 +475,13 @@ INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util libifcfg_rh_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ $(NSS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" @@ -490,9 +500,7 @@ libnm_settings_plugin_ifcfg_rh_la_SOURCES = \ libnm_settings_plugin_ifcfg_rh_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifcfg_rh_la_LDFLAGS = -module -avoid-version @@ -500,9 +508,7 @@ libnm_settings_plugin_ifcfg_rh_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ libifcfg-rh-io.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = nm-ifcfg-rh.conf @@ -607,25 +613,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifcfg_rh_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index 04d5463cd..50cbdf072 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -80,10 +80,12 @@ typedef struct { gulong ih_event_id; int sc_network_wd; + GFileMonitor *hostname_monitor; + guint hostname_monitor_id; char *hostname; - GFileMonitor *monitor; - guint monitor_id; + GFileMonitor *ifcfg_monitor; + guint ifcfg_monitor_id; DBusGConnection *bus; } SCPluginIfcfgPrivate; @@ -325,11 +327,11 @@ connection_new_or_changed (SCPluginIfcfg *self, } static void -dir_changed (GFileMonitor *monitor, - GFile *file, - GFile *other_file, - GFileMonitorEvent event_type, - gpointer user_data) +ifcfg_dir_changed (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + gpointer user_data) { SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); @@ -379,8 +381,9 @@ setup_ifcfg_monitoring (SCPluginIfcfg *plugin) g_object_unref (file); if (monitor) { - priv->monitor_id = g_signal_connect (monitor, "changed", G_CALLBACK (dir_changed), plugin); - priv->monitor = monitor; + priv->ifcfg_monitor_id = g_signal_connect (monitor, "changed", + G_CALLBACK (ifcfg_dir_changed), plugin); + priv->ifcfg_monitor = monitor; } } @@ -463,7 +466,8 @@ add_connection (NMSystemConfigInterface *config, return (NMSettingsConnection *) added; } -#define SC_NETWORK_FILE SYSCONFDIR"/sysconfig/network" +#define SC_NETWORK_FILE "/etc/sysconfig/network" +#define HOSTNAME_FILE "/etc/hostname" static char * plugin_get_hostname (SCPluginIfcfg *plugin) @@ -472,6 +476,11 @@ plugin_get_hostname (SCPluginIfcfg *plugin) char *hostname; gboolean ignore_localhost; + if (g_file_get_contents (HOSTNAME_FILE, &hostname, NULL, NULL)) { + g_strchomp (hostname); + return hostname; + } + network = svNewFile (SC_NETWORK_FILE); if (!network) { PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not get hostname: failed to read " SC_NETWORK_FILE); @@ -500,34 +509,31 @@ plugin_set_hostname (SCPluginIfcfg *plugin, const char *hostname) SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); shvarFile *network; - network = svCreateFile (SC_NETWORK_FILE); - if (!network) { - PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not save hostname: failed to create/open " SC_NETWORK_FILE); + if (!g_file_set_contents (HOSTNAME_FILE, hostname, -1, NULL)) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not save hostname: failed to create/open " HOSTNAME_FILE); return FALSE; } - svSetValue (network, "HOSTNAME", hostname, FALSE); - svWriteFile (network, 0644); - svCloseFile (network); - g_free (priv->hostname); priv->hostname = g_strdup (hostname); + + /* Remove "HOSTNAME" from SC_NETWORK_FILE, if present */ + network = svNewFile (SC_NETWORK_FILE); + if (network) { + svSetValue (network, "HOSTNAME", NULL, FALSE); + svWriteFile (network, 0644); + svCloseFile (network); + } + return TRUE; } static void -sc_network_changed_cb (NMInotifyHelper *ih, - struct inotify_event *evt, - const char *path, - gpointer user_data) +hostname_maybe_changed (SCPluginIfcfg *plugin) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); char *new_hostname; - if (evt->wd != priv->sc_network_wd) - return; - new_hostname = plugin_get_hostname (plugin); if ( (new_hostname && !priv->hostname) || (!new_hostname && priv->hostname) @@ -539,6 +545,33 @@ sc_network_changed_cb (NMInotifyHelper *ih, g_free (new_hostname); } +static void +sc_network_changed_cb (NMInotifyHelper *ih, + struct inotify_event *evt, + const char *path, + gpointer user_data) +{ + SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); + SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + + if (evt->wd != priv->sc_network_wd) + return; + + hostname_maybe_changed (plugin); +} + +static void +hostname_changed_cb (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + gpointer user_data) +{ + SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); + + hostname_maybe_changed (plugin); +} + static gboolean impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin, const char *in_ifcfg, @@ -614,11 +647,29 @@ sc_plugin_ifcfg_init (SCPluginIfcfg *plugin) NMInotifyHelper *ih; GError *error = NULL; gboolean success = FALSE; + GFile *file; + GFileMonitor *monitor; + + /* We watch SC_NETWORK_FILE via NMInotifyHelper (which doesn't track file creation but + * *does* track modifications made via other hard links), since we expect it to always + * exist. But we watch HOSTNAME_FILE via GFileMonitor (which has the opposite + * semantics), since /etc/hostname might not exist, but is unlikely to have hard + * links. bgo 532815 is the bug for being able to just use GFileMonitor for both. + */ ih = nm_inotify_helper_get (); priv->ih_event_id = g_signal_connect (ih, "event", G_CALLBACK (sc_network_changed_cb), plugin); priv->sc_network_wd = nm_inotify_helper_add_watch (ih, SC_NETWORK_FILE); + file = g_file_new_for_path (HOSTNAME_FILE); + monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); + g_object_unref (file); + if (monitor) { + priv->hostname_monitor_id = + g_signal_connect (monitor, "changed", G_CALLBACK (hostname_changed_cb), plugin); + priv->hostname_monitor = monitor; + } + priv->hostname = plugin_get_hostname (plugin); priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); @@ -674,24 +725,35 @@ dispose (GObject *object) priv->bus = NULL; } - ih = nm_inotify_helper_get (); + if (priv->ih_event_id) { + ih = nm_inotify_helper_get (); + + g_signal_handler_disconnect (ih, priv->ih_event_id); + priv->ih_event_id = 0; - g_signal_handler_disconnect (ih, priv->ih_event_id); + if (priv->sc_network_wd >= 0) + nm_inotify_helper_remove_watch (ih, priv->sc_network_wd); + } + + if (priv->hostname_monitor) { + if (priv->hostname_monitor_id) + g_signal_handler_disconnect (priv->hostname_monitor, priv->hostname_monitor_id); - if (priv->sc_network_wd >= 0) - nm_inotify_helper_remove_watch (ih, priv->sc_network_wd); + g_file_monitor_cancel (priv->hostname_monitor); + g_object_unref (priv->hostname_monitor); + } g_free (priv->hostname); if (priv->connections) g_hash_table_destroy (priv->connections); - if (priv->monitor) { - if (priv->monitor_id) - g_signal_handler_disconnect (priv->monitor, priv->monitor_id); + if (priv->ifcfg_monitor) { + if (priv->ifcfg_monitor_id) + g_signal_handler_disconnect (priv->ifcfg_monitor, priv->ifcfg_monitor_id); - g_file_monitor_cancel (priv->monitor); - g_object_unref (priv->monitor); + g_file_monitor_cancel (priv->ifcfg_monitor); + g_object_unref (priv->ifcfg_monitor); } G_OBJECT_CLASS (sc_plugin_ifcfg_parent_class)->dispose (object); diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 6e5ec3c0c..bbe834360 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -25,7 +25,6 @@ #include <sys/socket.h> #include <arpa/inet.h> #include <sys/wait.h> -#include <ctype.h> #include <sys/inotify.h> #include <errno.h> #include <sys/ioctl.h> @@ -45,6 +44,8 @@ #include <nm-setting-wireless.h> #include <nm-setting-8021x.h> #include <nm-setting-bond.h> +#include <nm-setting-bridge.h> +#include <nm-setting-bridge-port.h> #include <nm-utils.h> #include "wifi-utils.h" @@ -66,12 +67,27 @@ static gboolean get_int (const char *str, int *value) { char *e; + long int tmp; errno = 0; - *value = strtol (str, &e, 0); + tmp = strtol (str, &e, 0); if (errno || *e != '\0') return FALSE; + *value = (int) tmp; + return TRUE; +} + +static gboolean +get_uint (const char *str, guint32 *value) +{ + char *e; + long unsigned int tmp; + errno = 0; + tmp = strtoul (str, &e, 0); + if (errno || *e != '\0') + return FALSE; + *value = (guint32) tmp; return TRUE; } @@ -168,6 +184,39 @@ make_connection_setting (const char *file, g_object_set (s_con, NM_SETTING_CONNECTION_ZONE, zone, NULL); g_free (zone); + value = svGetValue (ifcfg, "SECONDARY_UUIDS", FALSE); + if (value) { + char **items, **iter; + + items = g_strsplit_set (value, " \t", -1); + for (iter = items; iter && *iter; iter++) { + if (strlen (*iter)) { + if (!nm_setting_connection_add_secondary (s_con, *iter)) + PLUGIN_WARN (IFCFG_PLUGIN_NAME, + " warning: secondary connection UUID '%s' already added", *iter); + } + } + g_free (value); + g_strfreev (items); + } + + value = svGetValue (ifcfg, "BRIDGE", FALSE); + if (value) { + const char *bridge; + + if ((bridge = nm_setting_connection_get_master (s_con))) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, + " warning: Already configured as slave of %s. " + "Ignoring BRIDGE=\"%s\"", bridge, value); + g_free (value); + } + + g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); + g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE, + NM_SETTING_BRIDGE_SETTING_NAME, NULL); + g_free (value); + } + return NM_SETTING (s_con); } @@ -1590,8 +1639,13 @@ make_ip6_setting (shvarFile *ifcfg, nm_ip6_address_unref (addr); } g_strfreev (list); - } else if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { - /* TODO - autoconf or DHCPv6 stuff goes here */ + } else if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) + || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { + /* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */ + value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE); + if (value && value[0]) + g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, value, NULL); + g_free (value); } /* DNS servers @@ -1647,6 +1701,22 @@ error: return NULL; } +static void +check_if_bond_slave (shvarFile *ifcfg, + NMSettingConnection *s_con) +{ + char *value; + + value = svGetValue (ifcfg, "MASTER", FALSE); + if (value) { + g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); + g_object_set (s_con, + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BOND_SETTING_NAME, + NULL); + g_free (value); + } +} + static gboolean add_one_wep_key (shvarFile *ifcfg, const char *shvar_key, @@ -1699,7 +1769,7 @@ add_one_wep_key (shvarFile *ifcfg, char *p = value + 2; while (*p) { - if (!isascii ((int) (*p))) { + if (!g_ascii_isprint ((int) (*p))) { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid ASCII WEP key."); goto out; @@ -1997,7 +2067,7 @@ parse_wpa_psk (shvarFile *ifcfg, if (!quoted && (strlen (psk) == 64)) { /* Verify the hex PSK; 64 digits */ while (*p) { - if (!isxdigit (*p++)) { + if (!g_ascii_isxdigit (*p++)) { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid WPA_PSK (contains non-hexadecimal characters)"); goto out; @@ -2978,7 +3048,7 @@ make_wireless_setting (shvarFile *ifcfg, p = value + 2; while (*p) { - if (!isxdigit (*p)) { + if (!g_ascii_isxdigit (*p)) { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid SSID '%s' character (looks like hex SSID but '%c' isn't a hex digit)", value, *p); @@ -3249,7 +3319,7 @@ make_wired_setting (shvarFile *ifcfg, /* basic sanity checks */ while (*p) { - if (!isxdigit (*p) && (*p != ',') && (*p != '.')) { + if (!g_ascii_isxdigit (*p) && (*p != ',') && (*p != '.')) { PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid SUBCHANNELS '%s'", value); success = FALSE; break; @@ -3401,7 +3471,6 @@ wired_connection_from_ifcfg (const char *file, NMSetting *con_setting = NULL; NMSetting *wired_setting = NULL; NMSetting8021x *s_8021x = NULL; - char *value; g_return_val_if_fail (file != NULL, NULL); g_return_val_if_fail (ifcfg != NULL, NULL); @@ -3420,18 +3489,9 @@ wired_connection_from_ifcfg (const char *file, g_object_unref (connection); return NULL; } + check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting)); nm_connection_add_setting (connection, con_setting); - /* Might be a bond slave; handle master device or connection */ - value = svGetValue (ifcfg, "MASTER", FALSE); - if (value) { - g_object_set (con_setting, NM_SETTING_CONNECTION_MASTER, value, NULL); - g_object_set (con_setting, - NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BOND_SETTING_NAME, - NULL); - g_free (value); - } - wired_setting = make_wired_setting (ifcfg, file, nm_controlled, unmanaged, &s_8021x, error); if (!wired_setting) { g_object_unref (connection); @@ -3537,6 +3597,7 @@ infiniband_connection_from_ifcfg (const char *file, g_object_unref (connection); return NULL; } + check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting)); nm_connection_add_setting (connection, con_setting); infiniband_setting = make_infiniband_setting (ifcfg, file, nm_controlled, unmanaged, error); @@ -3672,6 +3733,232 @@ bond_connection_from_ifcfg (const char *file, return connection; } +typedef void (*BridgeOptFunc) (NMSetting *setting, + gboolean stp, + const char *key, + const char *value); + +static void +handle_bridge_option (NMSetting *setting, + gboolean stp, + const char *key, + const char *value) +{ + guint32 u = 0; + + if (!strcmp (key, "priority")) { + if (stp == FALSE) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: 'priority' invalid when STP is disabled"); + } else if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_PRIORITY, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid priority value '%s'", value); + } else if (!strcmp (key, "hello_time")) { + if (stp == FALSE) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: 'hello_time' invalid when STP is disabled"); + } else if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_HELLO_TIME, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid hello_time value '%s'", value); + } else if (!strcmp (key, "max_age")) { + if (stp == FALSE) { + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: 'max_age' invalid when STP is disabled"); + } else if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_MAX_AGE, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid max_age value '%s'", value); + } else if (!strcmp (key, "ageing_time")) { + if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_AGEING_TIME, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid ageing_time value '%s'", value); + } else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: unhandled bridge option '%s'", key); +} + +static void +handle_bridging_opts (NMSetting *setting, + gboolean stp, + const char *value, + BridgeOptFunc func) +{ + char **items, **iter; + + items = g_strsplit_set (value, " ", -1); + for (iter = items; iter && *iter; iter++) { + if (strlen (*iter)) { + char **keys, *key, *val; + + keys = g_strsplit_set (*iter, "=", 2); + if (keys && *keys) { + key = *keys; + val = *(keys + 1); + if (val && strlen(key) && strlen(val)) + func (setting, stp, key, val); + } + + g_strfreev (keys); + } + } + g_strfreev (items); +} + +static NMSetting * +make_bridge_setting (shvarFile *ifcfg, + const char *file, + gboolean nm_controlled, + char **unmanaged, + GError **error) +{ + NMSettingBridge *s_bridge; + char *value; + guint32 u; + gboolean stp = FALSE; + + s_bridge = NM_SETTING_BRIDGE (nm_setting_bridge_new ()); + + value = svGetValue (ifcfg, "DEVICE", FALSE); + if (!value || !strlen (value)) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "mandatory DEVICE keyword missing"); + goto error; + } + + g_object_set (s_bridge, NM_SETTING_BRIDGE_INTERFACE_NAME, value, NULL); + g_free (value); + + value = svGetValue (ifcfg, "STP", FALSE); + if (value) { + if (!strcasecmp (value, "on") || !strcasecmp (value, "yes")) { + g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, TRUE, NULL); + stp = TRUE; + } else if (!strcasecmp (value, "off") || !strcasecmp (value, "no")) + g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, FALSE, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid STP value '%s'", value); + g_free (value); + } + + value = svGetValue (ifcfg, "DELAY", FALSE); + if (value) { + if (stp) { + if (get_uint (value, &u)) + g_object_set (s_bridge, NM_SETTING_BRIDGE_FORWARD_DELAY, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid forward delay value '%s'", value); + } else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: DELAY invalid when STP is disabled"); + g_free (value); + } + + value = svGetValue (ifcfg, "BRIDGING_OPTS", FALSE); + if (value) { + handle_bridging_opts (NM_SETTING (s_bridge), stp, value, handle_bridge_option); + g_free (value); + } + + return (NMSetting *) s_bridge; + +error: + g_object_unref (s_bridge); + return NULL; +} + +static NMConnection * +bridge_connection_from_ifcfg (const char *file, + shvarFile *ifcfg, + gboolean nm_controlled, + char **unmanaged, + GError **error) +{ + NMConnection *connection = NULL; + NMSetting *con_setting = NULL; + NMSetting *bridge_setting = NULL; + + g_return_val_if_fail (file != NULL, NULL); + g_return_val_if_fail (ifcfg != NULL, NULL); + + connection = nm_connection_new (); + if (!connection) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, + "Failed to allocate new connection for %s.", file); + return NULL; + } + + con_setting = make_connection_setting (file, ifcfg, NM_SETTING_BRIDGE_SETTING_NAME, NULL, _("Bridge")); + if (!con_setting) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, + "Failed to create connection setting."); + g_object_unref (connection); + return NULL; + } + nm_connection_add_setting (connection, con_setting); + + bridge_setting = make_bridge_setting (ifcfg, file, nm_controlled, unmanaged, error); + if (!bridge_setting) { + g_object_unref (connection); + return NULL; + } + nm_connection_add_setting (connection, bridge_setting); + + if (!nm_connection_verify (connection, error)) { + g_object_unref (connection); + return NULL; + } + + return connection; +} + +static void +handle_bridge_port_option (NMSetting *setting, + gboolean stp, + const char *key, + const char *value) +{ + guint32 u = 0; + + if (!strcmp (key, "priority")) { + if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_PRIORITY, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid priority value '%s'", value); + } else if (!strcmp (key, "path_cost")) { + if (get_uint (value, &u)) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_PATH_COST, u, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid path_cost value '%s'", value); + } else if (!strcmp (key, "hairpin_mode")) { + if (!strcasecmp (value, "on") || !strcasecmp (value, "yes") || !strcmp (value, "1")) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, TRUE, NULL); + else if (!strcasecmp (value, "off") || !strcasecmp (value, "no")) + g_object_set (setting, NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, FALSE, NULL); + else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid hairpin_mode value '%s'", value); + } else + PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: unhandled bridge port option '%s'", key); +} + +static NMSetting * +make_bridge_port_setting (shvarFile *ifcfg, GError **error) +{ + NMSetting *s_port; + char *value; + + value = svGetValue (ifcfg, "BRIDGE", FALSE); + if (!value) + return NULL; + g_free (value); + + s_port = nm_setting_bridge_port_new (); + + value = svGetValue (ifcfg, "BRIDGING_OPTS", FALSE); + if (value) { + handle_bridging_opts (s_port, FALSE, value, handle_bridge_port_option); + g_free (value); + } + + return s_port; +} + static gboolean is_bond_device (const char *name, shvarFile *parsed) { @@ -3904,11 +4191,6 @@ vlan_connection_from_ifcfg (const char *file, return connection; } -enum { - IGNORE_REASON_NONE = 0x00, - IGNORE_REASON_BRIDGE = 0x01, -}; - NMConnection * connection_from_file (const char *filename, const char *network_file, /* for unit tests only */ @@ -3923,13 +4205,12 @@ connection_from_file (const char *filename, { NMConnection *connection = NULL; shvarFile *parsed; - char *type, *nmc = NULL, *bootproto, *tmp; - NMSetting *s_ip4, *s_ip6; + char *type, *nmc = NULL, *bootproto; + NMSetting *s_ip4, *s_ip6, *s_port; const char *ifcfg_name = NULL; gboolean nm_controlled = TRUE; gboolean can_disable_ip4 = FALSE; GError *error = NULL; - guint32 ignore_reason = IGNORE_REASON_NONE; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (unmanaged != NULL, NULL); @@ -4028,14 +4309,6 @@ connection_from_file (const char *filename, goto done; } - /* Ignore BRIDGE= connections for now too (rh #619863) */ - tmp = svGetValue (parsed, "BRIDGE", FALSE); - if (tmp) { - g_free (tmp); - nm_controlled = FALSE; - ignore_reason = IGNORE_REASON_BRIDGE; - } - /* Construct the connection */ if (!strcasecmp (type, TYPE_ETHERNET)) connection = wired_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, &error); @@ -4048,8 +4321,7 @@ connection_from_file (const char *filename, else if (!strcasecmp (type, TYPE_VLAN)) connection = vlan_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, &error); else if (!strcasecmp (type, TYPE_BRIDGE)) - g_set_error (&error, IFCFG_PLUGIN_ERROR, 0, - "Bridge connections are not yet supported"); + connection = bridge_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, &error); else { g_set_error (&error, IFCFG_PLUGIN_ERROR, 0, "Unknown connection type '%s'", type); @@ -4063,24 +4335,8 @@ connection_from_file (const char *filename, g_free (type); /* Don't bother reading the connection fully if it's unmanaged or ignored */ - if (!connection || *unmanaged || ignore_reason) { - if (connection && !*unmanaged) { - /* However,BRIDGE and VLAN connections that don't have HWADDR won't - * be unmanaged because the unmanaged state is keyed off HWADDR. - * They willl still be tagged 'ignore' from code that checks BRIDGE - * and VLAN above. Since they aren't marked unmanaged, kill them - * completely. - */ - if (ignore_reason) { - g_object_unref (connection); - connection = NULL; - g_set_error (&error, IFCFG_PLUGIN_ERROR, 0, - "%s connections are not yet supported", - ignore_reason == IGNORE_REASON_BRIDGE ? "Bridge" : "VLAN"); - } - } + if (!connection || *unmanaged) goto done; - } s_ip6 = make_ip6_setting (parsed, network_file, iscsiadm_path, &error); if (error) { @@ -4110,6 +4366,15 @@ connection_from_file (const char *filename, } else if (s_ip4) nm_connection_add_setting (connection, s_ip4); + /* Bridge port? */ + s_port = make_bridge_port_setting (parsed, &error); + if (error) { + g_object_unref (connection); + connection = NULL; + goto done; + } else if (s_port) + nm_connection_add_setting (connection, s_port); + /* iSCSI / ibft connections are read-only since their settings are * stored in NVRAM and can only be changed in BIOS. */ diff --git a/src/settings/plugins/ifcfg-rh/tests/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/Makefile.am index 5b34ffe3d..9aec92fe7 100644 --- a/src/settings/plugins/ifcfg-rh/tests/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/tests/Makefile.am @@ -1,9 +1,12 @@ +if ENABLE_TESTS + SUBDIRS=network-scripts INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -I$(srcdir)/../ @@ -35,14 +38,10 @@ test_ifcfg_rh_utils_CPPFLAGS = \ test_ifcfg_rh_utils_LDADD = \ $(builddir)/../libifcfg-rh-io.la -if WITH_TESTS - check-local: test-ifcfg-rh $(abs_builddir)/test-ifcfg-rh-utils $(abs_builddir)/test-ifcfg-rh -endif - EXTRA_DIST = \ iscsiadm-test-dhcp \ iscsiadm-test-static \ @@ -53,4 +52,5 @@ EXTRA_DIST = \ iscsiadm-test-bad-entry \ iscsiadm-test-bad-record +endif diff --git a/src/settings/plugins/ifcfg-rh/tests/Makefile.in b/src/settings/plugins/ifcfg-rh/tests/Makefile.in index 24855a7b3..155cb672e 100644 --- a/src/settings/plugins/ifcfg-rh/tests/Makefile.in +++ b/src/settings/plugins/ifcfg-rh/tests/Makefile.in @@ -51,21 +51,24 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-ifcfg-rh$(EXEEXT) test-ifcfg-rh-utils$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-ifcfg-rh$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-ifcfg-rh-utils$(EXEEXT) subdir = src/settings/plugins/ifcfg-rh/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,20 +76,25 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_ifcfg_rh_OBJECTS = test_ifcfg_rh-test-ifcfg-rh.$(OBJEXT) +am__test_ifcfg_rh_SOURCES_DIST = test-ifcfg-rh.c +@ENABLE_TESTS_TRUE@am_test_ifcfg_rh_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test_ifcfg_rh-test-ifcfg-rh.$(OBJEXT) test_ifcfg_rh_OBJECTS = $(am_test_ifcfg_rh_OBJECTS) am__DEPENDENCIES_1 = -test_ifcfg_rh_DEPENDENCIES = $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/wifi/libwifi-utils.la \ - $(builddir)/../libifcfg-rh-io.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_ifcfg_rh_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/wifi/libwifi-utils.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am_test_ifcfg_rh_utils_OBJECTS = \ - test_ifcfg_rh_utils-test-ifcfg-rh-utils.$(OBJEXT) +am__test_ifcfg_rh_utils_SOURCES_DIST = test-ifcfg-rh-utils.c +@ENABLE_TESTS_TRUE@am_test_ifcfg_rh_utils_OBJECTS = test_ifcfg_rh_utils-test-ifcfg-rh-utils.$(OBJEXT) test_ifcfg_rh_utils_OBJECTS = $(am_test_ifcfg_rh_utils_OBJECTS) -test_ifcfg_rh_utils_DEPENDENCIES = $(builddir)/../libifcfg-rh-io.la +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -114,7 +122,8 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_ifcfg_rh_SOURCES) $(test_ifcfg_rh_utils_SOURCES) -DIST_SOURCES = $(test_ifcfg_rh_SOURCES) $(test_ifcfg_rh_utils_SOURCES) +DIST_SOURCES = $(am__test_ifcfg_rh_SOURCES_DIST) \ + $(am__test_ifcfg_rh_utils_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -134,7 +143,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = network-scripts DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -173,6 +182,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -187,9 +200,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -199,17 +210,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -250,6 +258,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -266,11 +275,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -285,6 +290,8 @@ 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@ @@ -294,6 +301,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -320,13 +328,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -381,6 +390,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -395,48 +409,53 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = network-scripts -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(srcdir)/../ - -test_ifcfg_rh_SOURCES = \ - test-ifcfg-rh.c - -test_ifcfg_rh_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DTEST_IFCFG_DIR=\"$(abs_srcdir)\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/\" - -test_ifcfg_rh_LDADD = \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/wifi/libwifi-utils.la \ - $(builddir)/../libifcfg-rh-io.la \ - $(LIBM) - -test_ifcfg_rh_utils_SOURCES = \ - test-ifcfg-rh-utils.c - -test_ifcfg_rh_utils_CPPFLAGS = \ - $(GLIB_CFLAGS) - -test_ifcfg_rh_utils_LDADD = \ - $(builddir)/../libifcfg-rh-io.la - -EXTRA_DIST = \ - iscsiadm-test-dhcp \ - iscsiadm-test-static \ - iscsiadm-test-bad-ipaddr \ - iscsiadm-test-bad-gateway \ - iscsiadm-test-bad-dns1 \ - iscsiadm-test-bad-dns2 \ - iscsiadm-test-bad-entry \ - iscsiadm-test-bad-record +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@SUBDIRS = network-scripts +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(srcdir)/../ + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-ifcfg-rh.c + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_IFCFG_DIR=\"$(abs_srcdir)\" \ +@ENABLE_TESTS_TRUE@ -DTEST_SCRATCH_DIR=\"$(abs_builddir)/\" + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/wifi/libwifi-utils.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la \ +@ENABLE_TESTS_TRUE@ $(LIBM) + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-ifcfg-rh-utils.c + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) + +@ENABLE_TESTS_TRUE@test_ifcfg_rh_utils_LDADD = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifcfg-rh-io.la + +@ENABLE_TESTS_TRUE@EXTRA_DIST = \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-dhcp \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-static \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-ipaddr \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-gateway \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-dns1 \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-dns2 \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-entry \ +@ENABLE_TESTS_TRUE@ iscsiadm-test-bad-record all: all-recursive @@ -498,25 +517,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ifcfg_rh_utils-test-ifcfg-rh-utils.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -745,7 +761,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive @@ -871,11 +887,11 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am - $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) -@WITH_TESTS_TRUE@check-local: test-ifcfg-rh -@WITH_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh-utils -@WITH_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh +@ENABLE_TESTS_TRUE@check-local: test-ifcfg-rh +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh-utils +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-ifcfg-rh # 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. diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am index f4d416bf6..94d8d8347 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am @@ -91,7 +91,8 @@ EXTRA_DIST = \ keys-test-wifi-dynamic-wep-leap \ ifcfg-test-infiniband \ ifcfg-test-bond-main \ - ifcfg-test-bond-slave + ifcfg-test-bond-slave \ + ifcfg-test-bond-slave-ib check-local: @for f in $(EXTRA_DIST); do \ diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in index cb78cea2e..43b0aadb6 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in @@ -54,16 +54,18 @@ subdir = src/settings/plugins/ifcfg-rh/tests/network-scripts DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -96,6 +98,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -110,9 +116,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -122,17 +126,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -173,6 +174,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -189,11 +191,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -208,6 +206,8 @@ 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@ @@ -217,6 +217,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -243,13 +244,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -304,6 +306,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -318,6 +325,10 @@ 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@ EXTRA_DIST = \ ifcfg-test-minimal \ ifcfg-test-variables-corner-cases-1 \ @@ -411,7 +422,8 @@ EXTRA_DIST = \ keys-test-wifi-dynamic-wep-leap \ ifcfg-test-infiniband \ ifcfg-test-bond-main \ - ifcfg-test-bond-slave + ifcfg-test-bond-slave \ + ifcfg-test-bond-slave-ib all: all-am diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib new file mode 100644 index 000000000..5bd9a3a85 --- /dev/null +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib @@ -0,0 +1,7 @@ +TYPE=InfiniBand +DEVICE=ib0 +HWADDR=80:00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22 +ONBOOT=no +MASTER=bond0 +# This should be ignored +BOOTPROTO=dhcp diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component index f586637ec..24b512218 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-component @@ -2,4 +2,4 @@ DEVICE=eth0 HWADDR=00:22:15:59:62:97 ONBOOT=no BRIDGE=br0 - +BRIDGING_OPTS="priority=28 hairpin_mode=1 path_cost=100" diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main index c5caf3fc9..c406bbb34 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bridge-main @@ -4,4 +4,4 @@ TYPE=Bridge BOOTPROTO=dhcp STP=on DELAY=0 - +BRIDGING_OPTS="priority=32744 hello_time=7 max_age=39 ageing_time=235352" diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index f5cf32e1c..fcad1707b 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -11929,6 +11929,7 @@ static void test_read_bridge_main (void) { NMConnection *connection; + NMSettingBridge *s_bridge; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; @@ -11946,13 +11947,140 @@ test_read_bridge_main (void) &route6file, &error, &ignore_error); - ASSERT (connection == NULL, - "bridge-main-read", "unexpected success reading %s", TEST_IFCFG_BRIDGE_MAIN); + g_assert (connection); + g_assert (nm_connection_verify (connection, &error)); + g_assert_no_error (error); + + /* ===== Bridging SETTING ===== */ + + s_bridge = nm_connection_get_setting_bridge (connection); + g_assert (s_bridge); + g_assert_cmpstr (nm_setting_bridge_get_interface_name (s_bridge), ==, "br0"); + g_assert_cmpuint (nm_setting_bridge_get_forward_delay (s_bridge), ==, 0); + g_assert_cmpuint (nm_setting_bridge_get_stp (s_bridge), ==, TRUE); + g_assert_cmpuint (nm_setting_bridge_get_priority (s_bridge), ==, 32744); + g_assert_cmpuint (nm_setting_bridge_get_hello_time (s_bridge), ==, 7); + g_assert_cmpuint (nm_setting_bridge_get_max_age (s_bridge), ==, 39); + g_assert_cmpuint (nm_setting_bridge_get_ageing_time (s_bridge), ==, 235352); + + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); +} + +static void +test_write_bridge_main (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingBridge *s_bridge; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + char *uuid; + const guint32 ip1 = htonl (0x01010103); + const guint32 gw = htonl (0x01010101); + const guint32 prefix = 24; + NMIP4Address *addr; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Main", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* bridge setting */ + s_bridge = (NMSettingBridge *) nm_setting_bridge_new (); + g_assert (s_bridge); + nm_connection_add_setting (connection, NM_SETTING (s_bridge)); + + g_object_set (s_bridge, + NM_SETTING_BRIDGE_INTERFACE_NAME, "br0", + NULL); + + /* IP4 setting */ + s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + g_assert (s_ip4); + nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + + g_object_set (s_ip4, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NULL); + + addr = nm_ip4_address_new (); + nm_ip4_address_set_address (addr, ip1); + nm_ip4_address_set_prefix (addr, prefix); + nm_ip4_address_set_gateway (addr, gw); + nm_setting_ip4_config_add_address (s_ip4, addr); + nm_ip4_address_unref (addr); + + /* IP6 setting */ + s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + g_assert (s_ip6); + nm_connection_add_setting (connection, NM_SETTING (s_ip6)); + + g_object_set (s_ip6, + NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NULL); + + g_assert (nm_connection_verify (connection, &error)); + g_assert_no_error (error); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + g_assert (success); + g_assert_cmpstr (testfile, !=, NULL); + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + TYPE_BRIDGE, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + g_assert (reread); + g_assert (nm_connection_verify (reread, &error)); + g_assert_no_error (error); + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + g_free (testfile); g_free (unmanaged); g_free (keyfile); g_free (routefile); g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); } #define TEST_IFCFG_BRIDGE_COMPONENT TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-component" @@ -11961,12 +12089,15 @@ static void test_read_bridge_component (void) { NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridgePort *s_port; char *unmanaged = NULL; char *keyfile = NULL; char *routefile = NULL; char *route6file = NULL; gboolean ignore_error = FALSE; GError *error = NULL; + gboolean success; connection = connection_from_file (TEST_IFCFG_BRIDGE_COMPONENT, NULL, @@ -11978,14 +12109,22 @@ test_read_bridge_component (void) &route6file, &error, &ignore_error); - ASSERT (connection != NULL, - "bridge-component-read", "unexpected failure reading %s", TEST_IFCFG_BRIDGE_COMPONENT); + g_assert (connection); - ASSERT (unmanaged != NULL, - "bridge-component-read", "missing unmanaged spec from %s", TEST_IFCFG_BRIDGE_COMPONENT); + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); - ASSERT (g_strcmp0 (unmanaged, "mac:00:22:15:59:62:97") == 0, - "bridge-component-read", "unexpected unmanaged spec from %s", TEST_IFCFG_BRIDGE_COMPONENT); + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_master (s_con), ==, "br0"); + g_assert_cmpstr (nm_setting_connection_get_slave_type (s_con), ==, NM_SETTING_BRIDGE_SETTING_NAME); + + s_port = nm_connection_get_setting_bridge_port (connection); + g_assert (s_port); + g_assert (nm_setting_bridge_port_get_hairpin_mode (s_port)); + g_assert_cmpuint (nm_setting_bridge_port_get_priority (s_port), ==, 28); + g_assert_cmpuint (nm_setting_bridge_port_get_path_cost (s_port), ==, 100); g_free (unmanaged); g_free (keyfile); @@ -11994,6 +12133,113 @@ test_read_bridge_component (void) g_object_unref (connection); } +static void +test_write_bridge_component (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingWired *s_wired; + NMSetting *s_port; + static unsigned char tmpmac[] = { 0x31, 0x33, 0x33, 0x37, 0xbe, 0xcd }; + GByteArray *mac; + guint32 mtu = 1492; + char *uuid; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Component", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NM_SETTING_CONNECTION_MASTER, "br0", + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* Wired setting */ + s_wired = (NMSettingWired *) nm_setting_wired_new (); + g_assert (s_wired); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + + mac = g_byte_array_sized_new (sizeof (tmpmac)); + g_byte_array_append (mac, &tmpmac[0], sizeof (tmpmac)); + + g_object_set (s_wired, + NM_SETTING_WIRED_MAC_ADDRESS, mac, + NM_SETTING_WIRED_MTU, mtu, + NULL); + g_byte_array_free (mac, TRUE); + + /* Bridge port */ + s_port = nm_setting_bridge_port_new (); + nm_connection_add_setting (connection, s_port); + g_object_set (s_port, + NM_SETTING_BRIDGE_PORT_PRIORITY, 50, + NM_SETTING_BRIDGE_PORT_PATH_COST, 33, + NULL); + + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + g_assert_no_error (error); + g_assert (success); + g_assert (testfile); + + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + TYPE_ETHERNET, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + g_assert (reread); + + success = nm_connection_verify (reread, &error); + g_assert_no_error (error); + + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + if (route6file) + unlink (route6file); + + g_free (testfile); + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); +} + #define TEST_IFCFG_VLAN_INTERFACE TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-interface" static void @@ -12262,6 +12508,124 @@ test_write_vlan_only_vlanid (void) g_object_unref (reread); } +static void +test_write_ethernet_missing_ipv6 (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingWired *s_wired; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + char *uuid; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Ethernet Without IPv6 Setting", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NULL); + g_free (uuid); + + /* Wired setting */ + s_wired = (NMSettingWired *) nm_setting_wired_new (); + g_assert (s_wired); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + + /* IP4 setting */ + s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + g_assert (s_ip4); + nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + g_object_set (s_ip4, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, "random-client-id-00:22:33", + NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TRUE, + NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TRUE, + NULL); + + /* IP6 setting */ + /* + * We intentionally don't add IPv6 setting here. ifcfg-rh plugin should regard + * missing IPv6 as IPv6 with NM_SETTING_IP6_CONFIG_METHOD_AUTO method. + */ + + ASSERT (nm_connection_verify (connection, &error) == TRUE, + "ethernet-missing-ipv6", "failed to verify connection: %s", + (error && error->message) ? error->message : "(unknown)"); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + ASSERT (success == TRUE, + "ethernet-missing-ipv6", "failed to write connection to disk: %s", + (error && error->message) ? error->message : "(unknown)"); + + ASSERT (testfile != NULL, + "ethernet-missing-ipv6", "didn't get ifcfg file path back after writing connection"); + + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + TYPE_ETHERNET, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + ASSERT (reread != NULL, + "ethernet-missing-ipv6-reread", "failed to read %s: %s", testfile, error->message); + + ASSERT (nm_connection_verify (reread, &error), + "ethernet-missing-ipv6-reread-verify", "failed to verify %s: %s", testfile, error->message); + + /* + * We need to add IPv6 setting to the original connection now so that + * the comparison can succeed. Missing IPv6 setting should have been + * written out (and re-read) as Automatic IPv6. + */ + s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + g_assert (s_ip6); + nm_connection_add_setting (connection, NM_SETTING (s_ip6)); + g_object_set (s_ip6, + NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE, + NULL); + + ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, + "ethernet-missing-ipv6", "written and re-read connection weren't the same."); + + g_free (testfile); + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); +} + #define TEST_IFCFG_BOND_MAIN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bond-main" static void @@ -12479,10 +12843,10 @@ test_read_bond_slave (void) &error, &ignore_error); ASSERT (connection != NULL, - "bond-slave-read", "unexpected failure reading %s", TEST_IFCFG_BOND_MAIN); + "bond-slave-read", "unexpected failure reading %s", TEST_IFCFG_BOND_SLAVE); ASSERT (nm_connection_verify (connection, &error), - "bond-slave-read", "failed to verify %s: %s", TEST_IFCFG_BOND_MAIN, error->message); + "bond-slave-read", "failed to verify %s: %s", TEST_IFCFG_BOND_SLAVE, error->message); s_con = nm_connection_get_setting_connection (connection); ASSERT (s_con != NULL, @@ -12834,6 +13198,167 @@ test_write_infiniband (void) g_object_unref (reread); } +#define TEST_IFCFG_BOND_SLAVE_IB TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bond-slave-ib" + +static void +test_read_bond_slave_ib (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + GError *error = NULL; + + connection = connection_from_file (TEST_IFCFG_BOND_SLAVE_IB, + NULL, + NULL, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + ASSERT (connection != NULL, + "bond-slave-read-ib", "unexpected failure reading %s", TEST_IFCFG_BOND_SLAVE_IB); + + ASSERT (nm_connection_verify (connection, &error), + "bond-slave-read-ib", "failed to verify %s: %s", TEST_IFCFG_BOND_SLAVE_IB, error->message); + + s_con = nm_connection_get_setting_connection (connection); + ASSERT (s_con != NULL, + "bond-slave-read-ib", "failed to verify %s: missing %s setting", + TEST_IFCFG_BOND_SLAVE_IB, NM_SETTING_CONNECTION_SETTING_NAME); + + ASSERT (g_strcmp0 (nm_setting_connection_get_master (s_con), "bond0") == 0, + "bond-slave-read-ib", "failed to verify %s: master is not bond0", + TEST_IFCFG_BOND_SLAVE_IB); + + ASSERT (g_strcmp0 (nm_setting_connection_get_slave_type (s_con), NM_SETTING_BOND_SETTING_NAME) == 0, + "bond-slave-read-ib", "failed to verify %s: slave-type is not bond", + TEST_IFCFG_BOND_SLAVE_IB); + + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); +} + +static void +test_write_bond_slave_ib (void) +{ + NMConnection *connection; + NMConnection *reread; + NMSettingConnection *s_con; + NMSettingInfiniband *s_infiniband; + static unsigned char tmpmac[] = { + 0x80, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, + 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22 + }; + GByteArray *mac; + char *uuid; + gboolean success; + GError *error = NULL; + char *testfile = NULL; + char *unmanaged = NULL; + char *keyfile = NULL; + char *routefile = NULL; + char *route6file = NULL; + gboolean ignore_error = FALSE; + + connection = nm_connection_new (); + ASSERT (connection != NULL, + "bond-slave-write-ib", "failed to allocate new connection"); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + ASSERT (s_con != NULL, + "bond-slave-write-ib", "failed to allocate new %s setting", + NM_SETTING_CONNECTION_SETTING_NAME); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bond Slave InfiniBand", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_INFINIBAND_SETTING_NAME, + NM_SETTING_CONNECTION_MASTER, "bond0", + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BOND_SETTING_NAME, + NULL); + g_free (uuid); + + /* InfiniBand setting */ + s_infiniband = (NMSettingInfiniband *) nm_setting_infiniband_new (); + ASSERT (s_infiniband != NULL, + "bond-main-write", "failed to allocate new %s setting", + NM_SETTING_INFINIBAND_SETTING_NAME); + nm_connection_add_setting (connection, NM_SETTING (s_infiniband)); + + mac = g_byte_array_sized_new (sizeof (tmpmac)); + g_byte_array_append (mac, &tmpmac[0], sizeof (tmpmac)); + + g_object_set (s_infiniband, + NM_SETTING_INFINIBAND_MAC_ADDRESS, mac, + NM_SETTING_INFINIBAND_MTU, 2044, + NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", + NULL); + g_byte_array_free (mac, TRUE); + + ASSERT (nm_connection_verify (connection, &error) == TRUE, + "bond-slave-write-ib", "failed to verify connection: %s", + (error && error->message) ? error->message : "(unknown)"); + + /* Save the ifcfg */ + success = writer_new_connection (connection, + TEST_SCRATCH_DIR "/network-scripts/", + &testfile, + &error); + ASSERT (success == TRUE, + "bond-slave-write-ib", "failed to write connection to disk: %s", + (error && error->message) ? error->message : "(unknown)"); + + ASSERT (testfile != NULL, + "bond-slave-write-ib", "didn't get ifcfg file path back after writing connection"); + + /* re-read the connection for comparison */ + reread = connection_from_file (testfile, + NULL, + NULL, + NULL, + &unmanaged, + &keyfile, + &routefile, + &route6file, + &error, + &ignore_error); + unlink (testfile); + + ASSERT (reread != NULL, + "bond-slave-write-ib-reread", "failed to read %s: %s", testfile, error->message); + + ASSERT (nm_connection_verify (reread, &error), + "bond-slave-write-ib-reread-verify", "failed to verify %s: %s", testfile, error->message); + + ASSERT (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE, + "bond-slave-write-ib", "written and re-read connection weren't the same."); + + if (route6file) + unlink (route6file); + + g_free (testfile); + g_free (unmanaged); + g_free (keyfile); + g_free (routefile); + g_free (route6file); + g_object_unref (connection); + g_object_unref (reread); +} + #define TEST_IFCFG_WIFI_OPEN_SSID_BAD_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex" #define TEST_IFCFG_WIFI_OPEN_SSID_LONG_QUOTED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted" #define TEST_IFCFG_WIFI_OPEN_SSID_LONG_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-hex" @@ -12996,6 +13521,7 @@ int main (int argc, char **argv) test_write_infiniband (); test_write_vlan (); test_write_vlan_only_vlanid (); + test_write_ethernet_missing_ipv6 (); /* iSCSI / ibft */ test_read_ibft_dhcp (); @@ -13010,16 +13536,21 @@ int main (int argc, char **argv) /* bonding */ test_read_bond_main (); test_read_bond_slave (); + test_read_bond_slave_ib (); test_write_bond_main (); test_write_bond_slave (); + test_write_bond_slave_ib (); + + test_read_bridge_main (); + test_write_bridge_main (); + test_read_bridge_component (); + test_write_bridge_component (); /* Stuff we expect to fail for now */ test_write_wired_pppoe (); test_write_vpn (); test_write_mobile_broadband (TRUE); test_write_mobile_broadband (FALSE); - test_read_bridge_main (); - test_read_bridge_component (); base = g_path_get_basename (argv[0]); fprintf (stdout, "%s: SUCCESS\n", base); diff --git a/src/settings/plugins/ifcfg-rh/utils.c b/src/settings/plugins/ifcfg-rh/utils.c index 4e0afb96f..04df66713 100644 --- a/src/settings/plugins/ifcfg-rh/utils.c +++ b/src/settings/plugins/ifcfg-rh/utils.c @@ -454,7 +454,8 @@ utils_ignore_ip_config (NMConnection *connection) /* bonding slaves have no IP configuration, and the system * scripts just ignore it if it's there. */ - if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME)) + if ( nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME) + || nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)) return TRUE; return FALSE; diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index 26a1585b0..e258081f8 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -18,7 +18,6 @@ * Copyright (C) 2009 - 2012 Red Hat, Inc. */ -#include <ctype.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> @@ -845,7 +844,7 @@ write_wireless_setting (NMConnection *connection, * hex notation of the SSID instead. */ for (i = 0; i < ssid->len; i++) { - if (!isprint (ssid->data[i])) { + if (!g_ascii_isprint (ssid->data[i])) { hex_ssid = TRUE; break; } @@ -1123,7 +1122,8 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) return TRUE; } -static GString *vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVlanPriorityMap map) +static GString * +vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVlanPriorityMap map) { GSList *strlist = NULL, *iter; GString *value = NULL; @@ -1145,10 +1145,11 @@ static GString *vlan_priority_maplist_to_stringlist (NMSettingVlan *s_vlan, NMVl } static gboolean -write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) +write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, GError **error) { NMSettingVlan *s_vlan; NMSettingConnection *s_con; + NMSettingWired *s_wired; char *tmp; guint32 vlan_flags = 0; GString *text = NULL; @@ -1200,6 +1201,39 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (text) g_string_free (text, TRUE); + svSetValue (ifcfg, "HWADDR", NULL, FALSE); + svSetValue (ifcfg, "MACADDR", NULL, FALSE); + svSetValue (ifcfg, "MTU", NULL, FALSE); + + s_wired = nm_connection_get_setting_wired (connection); + if (s_wired) { + const GByteArray *device_mac, *cloned_mac; + guint32 mtu; + + *wired = TRUE; + + device_mac = nm_setting_wired_get_mac_address (s_wired); + if (device_mac) { + tmp = nm_utils_hwaddr_ntoa (device_mac->data, ARPHRD_ETHER); + svSetValue (ifcfg, "HWADDR", tmp, FALSE); + g_free (tmp); + } + + cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired); + if (cloned_mac) { + tmp = nm_utils_hwaddr_ntoa (cloned_mac->data, ARPHRD_ETHER); + svSetValue (ifcfg, "MACADDR", tmp, FALSE); + g_free (tmp); + } + + mtu = nm_setting_wired_get_mtu (s_wired); + if (mtu) { + tmp = g_strdup_printf ("%u", mtu); + svSetValue (ifcfg, "MTU", tmp, FALSE); + g_free (tmp); + } + } + return TRUE; } @@ -1254,6 +1288,136 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, GError **erro return TRUE; } +static guint32 +get_setting_default (NMSetting *setting, const char *prop) +{ + GParamSpec *pspec; + GValue val = { 0 }; + guint32 ret = 0; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), prop); + g_assert (pspec); + g_value_init (&val, pspec->value_type); + g_param_value_set_default (pspec, &val); + g_assert (G_VALUE_HOLDS_UINT (&val)); + ret = g_value_get_uint (&val); + g_value_unset (&val); + return ret; +} + +static gboolean +write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) +{ + NMSettingBridge *s_bridge; + const char *iface; + guint32 i; + GString *opts; + char *s; + + s_bridge = nm_connection_get_setting_bridge (connection); + if (!s_bridge) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, + "Missing '%s' setting", NM_SETTING_BRIDGE_SETTING_NAME); + return FALSE; + } + + iface = nm_setting_bridge_get_interface_name (s_bridge); + if (!iface) { + g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Missing interface name"); + return FALSE; + } + + svSetValue (ifcfg, "DEVICE", iface, FALSE); + svSetValue (ifcfg, "BRIDGING_OPTS", NULL, FALSE); + svSetValue (ifcfg, "STP", NULL, FALSE); + svSetValue (ifcfg, "DELAY", NULL, FALSE); + + /* Bridge options */ + opts = g_string_sized_new (32); + + if (nm_setting_bridge_get_stp (s_bridge)) { + svSetValue (ifcfg, "STP", "yes", FALSE); + + i = nm_setting_bridge_get_forward_delay (s_bridge); + if (i && i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY)) { + s = g_strdup_printf ("%u", i); + svSetValue (ifcfg, "DELAY", s, FALSE); + g_free (s); + } + + g_string_append_printf (opts, "priority=%u", nm_setting_bridge_get_priority (s_bridge)); + + i = nm_setting_bridge_get_hello_time (s_bridge); + if (i && i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_HELLO_TIME)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "hello_time=%u", i); + } + + i = nm_setting_bridge_get_max_age (s_bridge); + if (i && i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_MAX_AGE)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "max_age=%u", i); + } + } + + i = nm_setting_bridge_get_ageing_time (s_bridge); + if (i != get_setting_default (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_AGEING_TIME)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "ageing_time=%u", i); + } + + if (opts->len) + svSetValue (ifcfg, "BRIDGING_OPTS", opts->str, FALSE); + g_string_free (opts, TRUE); + + svSetValue (ifcfg, "TYPE", TYPE_BRIDGE, FALSE); + + return TRUE; +} + +static gboolean +write_bridge_port_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) +{ + NMSettingBridgePort *s_port; + guint32 i; + GString *opts; + + s_port = nm_connection_get_setting_bridge_port (connection); + if (!s_port) + return TRUE; + + svSetValue (ifcfg, "BRIDGING_OPTS", NULL, FALSE); + + /* Bridge options */ + opts = g_string_sized_new (32); + + i = nm_setting_bridge_port_get_priority (s_port); + if (i && i != get_setting_default (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PRIORITY)) + g_string_append_printf (opts, "priority=%u", i); + + i = nm_setting_bridge_port_get_path_cost (s_port); + if (i && i != get_setting_default (NM_SETTING (s_port), NM_SETTING_BRIDGE_PORT_PATH_COST)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "path_cost=%u", i); + } + + if (nm_setting_bridge_port_get_hairpin_mode (s_port)) { + if (opts->len) + g_string_append_c (opts, ' '); + g_string_append_printf (opts, "hairpin_mode=1"); + } + + if (opts->len) + svSetValue (ifcfg, "BRIDGING_OPTS", opts->str, FALSE); + g_string_free (opts, TRUE); + + return TRUE; +} + static void write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) { @@ -1295,6 +1459,30 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) if (master) { if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME)) svSetValue (ifcfg, "MASTER", master, FALSE); + else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)) + svSetValue (ifcfg, "BRIDGE", master, FALSE); + } + + /* secondary connection UUIDs */ + svSetValue (ifcfg, "SECONDARY_UUIDS", NULL, FALSE); + n = nm_setting_connection_get_num_secondaries (s_con); + if (n > 0) { + str = g_string_sized_new (n * 37); + + for (i = 0; i < n; i++) { + const char *uuid; + + /* Items separated by space for consistency with eg + * IPV6ADDR_SECONDARIES and DOMAIN. + */ + if (str->len) + g_string_append_c (str, ' '); + + if ((uuid = nm_setting_connection_get_secondary (s_con, i)) != NULL) + g_string_append (str, uuid); + } + svSetValue (ifcfg, "SECONDARY_UUIDS", str->str, FALSE); + g_string_free (str, TRUE); } } @@ -1517,7 +1705,6 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "PEERDNS", NULL, FALSE); svSetValue (ifcfg, "PEERROUTES", NULL, FALSE); - svSetValue (ifcfg, "DHCP_HOSTNAME", NULL, FALSE); svSetValue (ifcfg, "DHCP_CLIENT_ID", NULL, FALSE); if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { svSetValue (ifcfg, "PEERDNS", @@ -1710,9 +1897,15 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) s_ip6 = nm_connection_get_setting_ip6_config (connection); if (!s_ip6) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Missing '%s' setting", NM_SETTING_IP6_CONFIG_SETTING_NAME); - return FALSE; + /* Treat missing IPv6 setting as a setting with method "auto" */ + svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); + svSetValue (ifcfg, "IPV6_AUTOCONF", "yes", FALSE); + svSetValue (ifcfg, "DHCPV6C", NULL, FALSE); + svSetValue (ifcfg, "IPV6_DEFROUTE", "yes", FALSE); + svSetValue (ifcfg, "IPV6_PEERDNS", "yes", FALSE); + svSetValue (ifcfg, "IPV6_PEERROUTES", "yes", FALSE); + svSetValue (ifcfg, "IPV6_FAILURE_FATAL", "no", FALSE); + return TRUE; } value = nm_setting_ip6_config_get_method (s_ip6); @@ -1726,9 +1919,13 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "IPV6_AUTOCONF", "yes", FALSE); svSetValue (ifcfg, "DHCPV6C", NULL, FALSE); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { + const char *hostname; svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE); svSetValue (ifcfg, "DHCPV6C", "yes", FALSE); + hostname = nm_setting_ip6_config_get_dhcp_hostname (s_ip6); + if (hostname) + svSetValue (ifcfg, "DHCP_HOSTNAME", hostname, FALSE); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { svSetValue (ifcfg, "IPV6INIT", "yes", FALSE); svSetValue (ifcfg, "IPV6_AUTOCONF", "no", FALSE); @@ -1907,8 +2104,6 @@ write_connection (NMConnection *connection, GError **error) { NMSettingConnection *s_con; - NMSettingIP4Config *s_ip4; - NMSettingIP6Config *s_ip6; gboolean success = FALSE; shvarFile *ifcfg = NULL; char *ifcfg_name = NULL; @@ -1987,7 +2182,7 @@ write_connection (NMConnection *connection, goto out; wired = TRUE; } else if (!strcmp (type, NM_SETTING_VLAN_SETTING_NAME)) { - if (!write_vlan_setting (connection, ifcfg, error)) + if (!write_vlan_setting (connection, ifcfg, &wired, error)) goto out; } else if (!strcmp (type, NM_SETTING_WIRELESS_SETTING_NAME)) { if (!write_wireless_setting (connection, ifcfg, &no_8021x, error)) @@ -1998,6 +2193,9 @@ write_connection (NMConnection *connection, } else if (!strcmp (type, NM_SETTING_BOND_SETTING_NAME)) { if (!write_bonding_setting (connection, ifcfg, error)) goto out; + } else if (!strcmp (type, NM_SETTING_BRIDGE_SETTING_NAME)) { + if (!write_bridge_setting (connection, ifcfg, error)) + goto out; } else { g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Can't write connection type '%s'", type); @@ -2009,16 +2207,17 @@ write_connection (NMConnection *connection, goto out; } + if (!write_bridge_port_setting (connection, ifcfg, error)) + goto out; + if (!utils_ignore_ip_config (connection)) { - s_ip4 = nm_connection_get_setting_ip4_config (connection); + svSetValue (ifcfg, "DHCP_HOSTNAME", NULL, FALSE); + if (!write_ip4_setting (connection, ifcfg, error)) goto out; - s_ip6 = nm_connection_get_setting_ip6_config (connection); - if (s_ip6) { - if (!write_ip6_setting (connection, ifcfg, error)) - goto out; - } + if (!write_ip6_setting (connection, ifcfg, error)) + goto out; } write_connection_setting (s_con, ifcfg); diff --git a/src/settings/plugins/ifcfg-suse/Makefile.am b/src/settings/plugins/ifcfg-suse/Makefile.am index 3db8ed31d..6b14bfe20 100644 --- a/src/settings/plugins/ifcfg-suse/Makefile.am +++ b/src/settings/plugins/ifcfg-suse/Makefile.am @@ -7,11 +7,10 @@ libnm_settings_plugin_ifcfg_suse_la_SOURCES = \ libnm_settings_plugin_ifcfg_suse_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -I${top_srcdir}/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -DSYSCONFDIR=\"$(sysconfdir)\" @@ -20,7 +19,5 @@ libnm_settings_plugin_ifcfg_suse_la_LDFLAGS = -module -avoid-version libnm_settings_plugin_ifcfg_suse_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) diff --git a/src/settings/plugins/ifcfg-suse/Makefile.in b/src/settings/plugins/ifcfg-suse/Makefile.in index 90028f858..8832e679e 100644 --- a/src/settings/plugins/ifcfg-suse/Makefile.in +++ b/src/settings/plugins/ifcfg-suse/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/ifcfg-suse DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -103,8 +105,7 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libnm_settings_plugin_ifcfg_suse_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/libnm-glib/libnm-glib.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-glib/libnm-glib.la $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifcfg_suse_la_OBJECTS = \ libnm_settings_plugin_ifcfg_suse_la-plugin.lo libnm_settings_plugin_ifcfg_suse_la_OBJECTS = \ @@ -165,6 +166,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -179,9 +184,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -191,17 +194,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -242,6 +242,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -258,11 +259,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -277,6 +274,8 @@ 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@ @@ -286,6 +285,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -312,13 +312,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -373,6 +374,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -387,6 +393,10 @@ 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@ pkglib_LTLIBRARIES = libnm-settings-plugin-ifcfg-suse.la libnm_settings_plugin_ifcfg_suse_la_SOURCES = \ plugin.c \ @@ -394,11 +404,10 @@ libnm_settings_plugin_ifcfg_suse_la_SOURCES = \ libnm_settings_plugin_ifcfg_suse_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -I${top_srcdir}/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -DSYSCONFDIR=\"$(sysconfdir)\" @@ -407,9 +416,7 @@ libnm_settings_plugin_ifcfg_suse_la_LDFLAGS = -module -avoid-version libnm_settings_plugin_ifcfg_suse_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GIO_LIBS) + $(GLIB_LIBS) all: all-am @@ -489,25 +496,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifcfg_suse_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/plugins/ifnet/Makefile.am b/src/settings/plugins/ifnet/Makefile.am index 07a2fc885..9aaa06f86 100644 --- a/src/settings/plugins/ifnet/Makefile.am +++ b/src/settings/plugins/ifnet/Makefile.am @@ -1,10 +1,13 @@ SUBDIRS = . tests + INCLUDES = \ -I$(top_srcdir)/src/wifi \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util pkglib_LTLIBRARIES = libnm-settings-plugin-ifnet.la @@ -18,10 +21,8 @@ libnm_settings_plugin_ifnet_la_SOURCES = \ libnm_settings_plugin_ifnet_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifnet_la_LDFLAGS = -module -avoid-version @@ -31,9 +32,7 @@ libnm_settings_plugin_ifnet_la_LIBADD = \ $(top_builddir)/libnm-glib/libnm-glib.la \ lib-ifnet-io.la\ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GUDEV_LIBS) \ - $(GIO_LIBS) + $(GUDEV_LIBS) lib_ifnet_io_la_SOURCES = \ net_parser.c\ @@ -48,12 +47,10 @@ lib_ifnet_io_la_SOURCES = \ lib_ifnet_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" lib_ifnet_io_la_LIBADD = \ $(top_builddir)/src/wifi/libwifi-utils.la \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS)\ - $(GIO_LIBS) + $(GLIB_LIBS) diff --git a/src/settings/plugins/ifnet/Makefile.in b/src/settings/plugins/ifnet/Makefile.in index e351a6ed3..6cdf335df 100644 --- a/src/settings/plugins/ifnet/Makefile.in +++ b/src/settings/plugins/ifnet/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/ifnet DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -103,8 +105,7 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = lib_ifnet_io_la_DEPENDENCIES = \ $(top_builddir)/src/wifi/libwifi-utils.la \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) am_lib_ifnet_io_la_OBJECTS = lib_ifnet_io_la-net_parser.lo \ lib_ifnet_io_la-connection_parser.lo \ lib_ifnet_io_la-net_utils.lo lib_ifnet_io_la-wpa_parser.lo @@ -115,7 +116,6 @@ am__v_lt_0 = --silent libnm_settings_plugin_ifnet_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la lib-ifnet-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifnet_la_OBJECTS = \ libnm_settings_plugin_ifnet_la-nm-ifnet-connection.lo \ @@ -214,6 +214,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -228,9 +232,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -240,17 +242,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -291,6 +290,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -307,11 +307,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -326,6 +322,8 @@ 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@ @@ -335,6 +333,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -361,13 +360,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -422,6 +422,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -436,13 +441,19 @@ 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@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/wifi \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util pkglib_LTLIBRARIES = libnm-settings-plugin-ifnet.la noinst_LTLIBRARIES = lib-ifnet-io.la @@ -454,10 +465,8 @@ libnm_settings_plugin_ifnet_la_SOURCES = \ libnm_settings_plugin_ifnet_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifnet_la_LDFLAGS = -module -avoid-version @@ -466,9 +475,7 @@ libnm_settings_plugin_ifnet_la_LIBADD = \ $(top_builddir)/libnm-glib/libnm-glib.la \ lib-ifnet-io.la\ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(GUDEV_LIBS) \ - $(GIO_LIBS) + $(GUDEV_LIBS) lib_ifnet_io_la_SOURCES = \ net_parser.c\ @@ -483,15 +490,13 @@ lib_ifnet_io_la_SOURCES = \ lib_ifnet_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" \ -DSBINDIR=\"$(sbindir)\" lib_ifnet_io_la_LIBADD = \ $(top_builddir)/src/wifi/libwifi-utils.la \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS)\ - $(GIO_LIBS) + $(GLIB_LIBS) all: all-recursive @@ -587,25 +592,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifnet_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c index 78812f977..c85b5c4b5 100644 --- a/src/settings/plugins/ifnet/connection_parser.c +++ b/src/settings/plugins/ifnet/connection_parser.c @@ -26,7 +26,6 @@ #include <stdlib.h> #include <netinet/ether.h> #include <errno.h> -#include <ctype.h> #include <glib/gi18n.h> #include <nm-setting-connection.h> @@ -76,24 +75,28 @@ static gboolean eap_simple_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); static gboolean eap_tls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); static gboolean eap_peap_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); static gboolean eap_ttls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); typedef struct { @@ -102,6 +105,7 @@ typedef struct { const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error); gboolean wifi_phase2_only; } EAPReader; @@ -125,6 +129,7 @@ eap_simple_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { const char *value; @@ -153,17 +158,30 @@ eap_simple_reader (const char *eap_method, return TRUE; } +static char * +get_cert (const char *ssid, const char *key, const char *basepath) +{ + const char *orig; + + /* If it's a relative path, convert to absolute using 'basepath' */ + orig = wpa_get_value (ssid, key); + if (g_path_is_absolute (orig)) + return g_strdup (orig); + return g_strdup_printf ("%s/%s", basepath, orig); +} + static gboolean eap_tls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { const char *value; - const char *ca_cert = NULL; - const char *client_cert = NULL; - const char *privkey = NULL; + char *ca_cert = NULL; + char *client_cert = NULL; + char *privkey = NULL; const char *privkey_password = NULL; gboolean success = FALSE; NMSetting8021xCKFormat privkey_format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; @@ -179,7 +197,7 @@ eap_tls_reader (const char *eap_method, g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, value, NULL); /* ca cert */ - ca_cert = wpa_get_value (ssid, phase2 ? "ca_cert2" : "ca_cert"); + ca_cert = get_cert (ssid, phase2 ? "ca_cert2" : "ca_cert", basepath); if (ca_cert) { if (phase2) { if (!nm_setting_802_1x_set_phase2_ca_cert (s_8021x, @@ -216,7 +234,7 @@ eap_tls_reader (const char *eap_method, } /* The private key itself */ - privkey = wpa_get_value (ssid, phase2 ? "private_key2" : "private_key"); + privkey = get_cert (ssid, phase2 ? "private_key2" : "private_key", basepath); if (!privkey) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", @@ -249,9 +267,7 @@ eap_tls_reader (const char *eap_method, */ if (privkey_format == NM_SETTING_802_1X_CK_FORMAT_RAW_KEY || privkey_format == NM_SETTING_802_1X_CK_FORMAT_X509) { - client_cert = wpa_get_value (ssid, - phase2 ? "client_cert2" : - "client_cert"); + client_cert = get_cert (ssid, phase2 ? "client_cert2" : "client_cert", basepath); if (!client_cert) { g_set_error (error, ifnet_plugin_error_quark (), 0, "Missing %s for EAP method '%s'.", @@ -279,6 +295,9 @@ eap_tls_reader (const char *eap_method, success = TRUE; done: + g_free (ca_cert); + g_free (client_cert); + g_free (privkey); return success; } @@ -287,15 +306,16 @@ eap_peap_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { - const char *ca_cert = NULL; + char *ca_cert = NULL; const char *inner_auth = NULL; const char *peapver = NULL; char **list = NULL, **iter, *lower; gboolean success = FALSE; - ca_cert = wpa_get_value (ssid, "ca_cert"); + ca_cert = get_cert (ssid, "ca_cert", basepath); if (ca_cert) { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, @@ -347,11 +367,10 @@ eap_peap_reader (const char *eap_method, if (!(pos = strstr (*iter, "MSCHAPV2")) || !(pos = strstr (*iter, "MD5")) || !(pos = strstr (*iter, "GTC"))) { - if (!eap_simple_reader - (pos, ssid, s_8021x, TRUE, error)) + if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; } else if (!(pos = strstr (*iter, "TLS"))) { - if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, error)) + if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; } else { g_set_error (error, ifnet_plugin_error_quark (), 0, @@ -378,6 +397,7 @@ eap_peap_reader (const char *eap_method, success = TRUE; done: + g_free (ca_cert); if (list) g_strfreev (list); return success; @@ -388,16 +408,17 @@ eap_ttls_reader (const char *eap_method, const char *ssid, NMSetting8021x *s_8021x, gboolean phase2, + const char *basepath, GError **error) { gboolean success = FALSE; const char *anon_ident = NULL; - const char *ca_cert = NULL; + char *ca_cert = NULL; const char *tmp; char **list = NULL, **iter, *inner_auth = NULL; /* ca cert */ - ca_cert = wpa_get_value (ssid, "ca_cert"); + ca_cert = get_cert (ssid, "ca_cert", basepath); if (ca_cert) { if (!nm_setting_802_1x_set_ca_cert (s_8021x, ca_cert, @@ -435,20 +456,18 @@ eap_ttls_reader (const char *eap_method, || (pos = strstr (*iter, "mschap")) != NULL || (pos = strstr (*iter, "pap")) != NULL || (pos = strstr (*iter, "chap")) != NULL) { - if (!eap_simple_reader - (pos, ssid, s_8021x, TRUE, error)) + if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, pos, NULL); } else if ((pos = strstr (*iter, "tls")) != NULL) { - if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, error)) + if (!eap_tls_reader (pos, ssid, s_8021x, TRUE, basepath, error)) goto done; g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, "tls", NULL); } else if ((pos = strstr (*iter, "mschapv2")) != NULL || (pos = strstr (*iter, "md5")) != NULL) { - if (!eap_simple_reader - (pos, ssid, s_8021x, TRUE, error)) { + if (!eap_simple_reader (pos, ssid, s_8021x, TRUE, basepath, error)) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "SIMPLE ERROR"); goto done; } @@ -465,6 +484,7 @@ eap_ttls_reader (const char *eap_method, success = TRUE; done: + g_free (ca_cert); if (list) g_strfreev (list); g_free (inner_auth); @@ -1386,6 +1406,7 @@ static NMSetting8021x * fill_8021x (const char *ssid, const char *key_mgmt, gboolean wifi, + const char *basepath, GError **error) { NMSetting8021x *s_8021x; @@ -1427,8 +1448,7 @@ fill_8021x (const char *ssid, } /* Parse EAP method specific options */ - if (!(*eap->reader) - (lower, ssid, s_8021x, FALSE, error)) { + if (!(*eap->reader) (lower, ssid, s_8021x, FALSE, basepath, error)) { g_free (lower); goto error; } @@ -1463,6 +1483,7 @@ error: static NMSettingWirelessSecurity * make_wpa_setting (const char *ssid, + const char *basepath, NMSetting8021x **s_8021x, GError **error) { @@ -1477,8 +1498,7 @@ make_wpa_setting (const char *ssid, return NULL; } - wsec = - NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); + wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); /* mode=1: adhoc * mode=0: infrastructure */ @@ -1530,7 +1550,7 @@ make_wpa_setting (const char *ssid, value); goto error; } - *s_8021x = fill_8021x (ssid, value, TRUE, error); + *s_8021x = fill_8021x (ssid, value, TRUE, basepath, error); if (!*s_8021x) goto error; @@ -1552,6 +1572,7 @@ error: static NMSettingWirelessSecurity * make_wireless_security_setting (const char *conn_name, + const char *basepath, NMSetting8021x **s_8021x, GError ** error) { @@ -1579,7 +1600,7 @@ make_wireless_security_setting (const char *conn_name, goto error; } if (!wsec) { - wsec = make_wpa_setting (ssid, s_8021x, error); + wsec = make_wpa_setting (ssid, basepath, s_8021x, error); if (error && *error) goto error; } @@ -1636,7 +1657,9 @@ make_pppoe_connection_setting (NMConnection *connection, } NMConnection * -ifnet_update_connection_from_config_block (const char *conn_name, GError **error) +ifnet_update_connection_from_config_block (const char *conn_name, + const char *basepath, + GError **error) { const gchar *type = NULL; NMConnection *connection = NULL; @@ -1700,7 +1723,7 @@ ifnet_update_connection_from_config_block (const char *conn_name, GError **error } /* wireless security setting */ - wsec = make_wireless_security_setting (conn_name, &s_8021x, error); + wsec = make_wireless_security_setting (conn_name, basepath, &s_8021x, error); if (wsec) { nm_connection_add_setting (connection, NM_SETTING (wsec)); @@ -2291,7 +2314,7 @@ write_wireless_setting (NMConnection *connection, * support these characters, see bug #356337) */ for (i = 0; i < ssid->len; i++) { - if (!isalnum (ssid->data[i])) { + if (!g_ascii_isalnum (ssid->data[i])) { hex_ssid = TRUE; break; } @@ -2785,6 +2808,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection, const char *config_file, const char *wpa_file, gchar **out_new_name, + gchar **out_backup, GError **error) { NMSettingConnection *s_con; @@ -2868,7 +2892,7 @@ ifnet_update_parsers_by_connection (NMConnection *connection, /* connection id will be displayed in nm-applet */ update_connection_id (connection, conn_name); - success = ifnet_flush_to_file (config_file); + success = ifnet_flush_to_file (config_file, out_backup); if (success) wpa_flush_to_file (wpa_file); @@ -2882,12 +2906,13 @@ out: gboolean ifnet_delete_connection_in_parsers (const char *conn_name, const char *config_file, - const char *wpa_file) + const char *wpa_file, + gchar **out_backup) { gboolean result = FALSE; ifnet_delete_network (conn_name); - result = ifnet_flush_to_file (config_file); + result = ifnet_flush_to_file (config_file, out_backup); if (result) { /* connection may not have security information * so simply ignore the return value*/ @@ -2953,7 +2978,7 @@ get_wireless_name (NMConnection * connection) } for (i = 0; i < ssid->len; i++) { - if (!isprint (ssid->data[i])) { + if (!g_ascii_isprint (ssid->data[i])) { hex_ssid = TRUE; break; } @@ -2982,6 +3007,7 @@ char * ifnet_add_new_connection (NMConnection *connection, const char *config_file, const char *wpa_file, + gchar **out_backup, GError **error) { NMSettingConnection *s_con; @@ -3025,6 +3051,7 @@ ifnet_add_new_connection (NMConnection *connection, config_file, wpa_file, NULL, + out_backup, error); } diff --git a/src/settings/plugins/ifnet/connection_parser.h b/src/settings/plugins/ifnet/connection_parser.h index b617b6051..e8596a64e 100644 --- a/src/settings/plugins/ifnet/connection_parser.h +++ b/src/settings/plugins/ifnet/connection_parser.h @@ -25,6 +25,7 @@ #include "net_parser.h" NMConnection *ifnet_update_connection_from_config_block (const char *conn_name, + const char *basepath, GError **error); /* nm_conn_name is used to update nm_ifnet_connection's priv data */ @@ -33,14 +34,17 @@ gboolean ifnet_update_parsers_by_connection (NMConnection *connection, const char *config_file, const char *wpa_file, gchar **out_new_name, + gchar **out_backup, GError **error); gboolean ifnet_delete_connection_in_parsers (const char *conn_name, const char *config_file, - const char *wpa_file); + const char *wpa_file, + gchar **out_backup); char * ifnet_add_new_connection (NMConnection *connection, const char *config_file, const char *wpa_file, + gchar **out_backup, GError ** error); #endif diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c index 2562e6133..f37366afe 100644 --- a/src/settings/plugins/ifnet/net_parser.c +++ b/src/settings/plugins/ifnet/net_parser.c @@ -590,7 +590,7 @@ done: } gboolean -ifnet_flush_to_file (const char *config_file) +ifnet_flush_to_file (const char *config_file, gchar **out_backup) { GIOChannel *channel; GError **error = NULL; @@ -600,18 +600,20 @@ ifnet_flush_to_file (const char *config_file) gchar *out_line = NULL; gsize bytes_written; gboolean result = FALSE; + gchar *backup; if (!net_parser_data_changed) return TRUE; if (!conn_table || !global_settings_table) return FALSE; - backup_file (config_file); + backup = backup_file (config_file); channel = g_io_channel_new_file (config_file, "w", NULL); if (!channel) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Can't open file %s for writing", config_file); + g_free (backup); return FALSE; } g_hash_table_iter_init (&iter, global_settings_table); @@ -714,7 +716,13 @@ ifnet_flush_to_file (const char *config_file) } result = TRUE; net_parser_data_changed = FALSE; + done: + if (result && out_backup) + *out_backup = backup; + else + g_free (backup); + g_io_channel_shutdown (channel, FALSE, NULL); g_io_channel_unref (channel); return result; diff --git a/src/settings/plugins/ifnet/net_parser.h b/src/settings/plugins/ifnet/net_parser.h index 5dcc7e253..47086c762 100644 --- a/src/settings/plugins/ifnet/net_parser.h +++ b/src/settings/plugins/ifnet/net_parser.h @@ -25,7 +25,6 @@ #include <glib.h> #define CONF_NET_FILE SYSCONFDIR "/conf.d/net" -#define IFNET_SYSTEM_SETTINGS_KEY_FILE SYSCONFDIR "/NetworkManager/nm-system-settings.conf" #define IFNET_KEY_FILE_GROUP "ifnet" gboolean ifnet_init (gchar * config_file); @@ -39,7 +38,7 @@ const char *ifnet_get_global_setting (const char *group, const char *key); gboolean ifnet_has_network (const char *conn_name); /* Writer functions */ -gboolean ifnet_flush_to_file (const char *config_file); +gboolean ifnet_flush_to_file (const char *config_file, gchar **out_backup); void ifnet_set_data (const char *conn_name, const char *key, const char *value); gboolean ifnet_add_network (const char *name, const char *type); gboolean ifnet_delete_network (const char *conn_name); diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c index d613db6a6..17eb16771 100644 --- a/src/settings/plugins/ifnet/net_utils.c +++ b/src/settings/plugins/ifnet/net_utils.c @@ -22,7 +22,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <ctype.h> #include <errno.h> #include <nm-utils.h> #include <nm-system-config-interface.h> @@ -67,7 +66,7 @@ is_hex (const char *value) if (!p) return FALSE; while (*p) { - if (!isxdigit (*p++)) + if (!g_ascii_isxdigit (*p++)) return FALSE; } return TRUE; @@ -79,7 +78,7 @@ is_ascii (const char *value) const char *p = value; while (*p) { - if (!isascii (*p++)) + if (!g_ascii_isprint (*p++)) return FALSE; } return TRUE; @@ -254,7 +253,7 @@ read_hostname (const char *path) } gboolean -write_hostname (const gchar *hostname, const char *path) +write_hostname (const char *path, const gchar *hostname) { gboolean result; char *contents; @@ -462,7 +461,7 @@ create_ip4_block (gchar * ip) iblock->ip = tmp_ip4_addr.s_addr; prefix = ip_mask[1]; i = 0; - while (i < length && isdigit (prefix[i])) + while (i < length && g_ascii_isdigit (prefix[i])) i++; prefix[i] = '\0'; iblock->netmask = nm_utils_ip4_prefix_to_netmask ((guint32) @@ -951,7 +950,7 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id) g_free (contents); } -void backup_file (const gchar* target) +gchar *backup_file (const gchar* target) { GFile *source, *backup; gchar* backup_path; @@ -962,8 +961,11 @@ void backup_file (const gchar* target) backup = g_file_new_for_path (backup_path); g_file_copy (source, backup, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error); - if (error && *error) + if (error && *error) { PLUGIN_WARN (IFNET_PLUGIN_NAME, "Backup failed: %s", (*error)->message); + g_free (backup_path); + backup_path = NULL; + } - g_free (backup_path); + return backup_path; } diff --git a/src/settings/plugins/ifnet/net_utils.h b/src/settings/plugins/ifnet/net_utils.h index dee491439..c2ed83a13 100644 --- a/src/settings/plugins/ifnet/net_utils.h +++ b/src/settings/plugins/ifnet/net_utils.h @@ -45,7 +45,7 @@ typedef struct _ip6_block { } ip6_block; gchar *read_hostname (const char *path); -gboolean write_hostname (const char *hostname, const char *path); +gboolean write_hostname (const char *path, const char *hostname); gboolean is_static_ip4 (const char *conn_name); gboolean is_static_ip6 (const char *conn_name); gboolean is_ip4_address (const char *in_address); @@ -77,5 +77,5 @@ gboolean is_true (const char *str); void get_dhcp_hostname_and_client_id (char **hostname, char **client_id); -void backup_file (const gchar* target); +gchar *backup_file (const gchar* target); #endif diff --git a/src/settings/plugins/ifnet/nm-ifnet-connection.c b/src/settings/plugins/ifnet/nm-ifnet-connection.c index 8b7a153cc..873a62ecd 100644 --- a/src/settings/plugins/ifnet/nm-ifnet-connection.c +++ b/src/settings/plugins/ifnet/nm-ifnet-connection.c @@ -68,7 +68,7 @@ nm_ifnet_connection_new (const char *conn_name, NMConnection *source) if (source) tmp = g_object_ref (source); else { - tmp = ifnet_update_connection_from_config_block (conn_name, &error); + tmp = ifnet_update_connection_from_config_block (conn_name, NULL, &error); if (!tmp){ g_error_free (error); return NULL; @@ -108,6 +108,7 @@ commit_changes (NMSettingsConnection *connection, CONF_NET_FILE, WPA_SUPPLICANT_CONF, &new_name, + NULL, &error)) { PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Failed to update %s", priv->conn_name); reload_parsers (); @@ -135,8 +136,7 @@ do_delete (NMSettingsConnection *connection, NMIfnetConnectionPrivate *priv = NM_IFNET_CONNECTION_GET_PRIVATE (connection); g_signal_emit (connection, signals[IFNET_CANCEL_MONITORS], 0); - if (!ifnet_delete_connection_in_parsers - (priv->conn_name, CONF_NET_FILE, WPA_SUPPLICANT_CONF)) { + if (!ifnet_delete_connection_in_parsers (priv->conn_name, CONF_NET_FILE, WPA_SUPPLICANT_CONF, NULL)) { PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Failed to delete %s", priv->conn_name); reload_parsers (); diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c index fff83805f..5100ad3e4 100644 --- a/src/settings/plugins/ifnet/plugin.c +++ b/src/settings/plugins/ifnet/plugin.c @@ -108,7 +108,7 @@ write_system_hostname (NMSystemConfigInterface * config, g_return_if_fail (newhostname); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Write system hostname: %s", newhostname); - if (write_hostname (newhostname, IFNET_SYSTEM_HOSTNAME_FILE)) { + if (write_hostname (IFNET_SYSTEM_HOSTNAME_FILE, newhostname)) { g_free (priv->hostname); priv->hostname = g_strdup (newhostname); g_object_notify (G_OBJECT (config), @@ -360,7 +360,7 @@ add_connection (NMSystemConfigInterface *config, nm_connection_for_each_setting_value (source, check_flagged_secrets, &has_flagged_secrets); if (!has_flagged_secrets) { - conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, error); + conn_name = ifnet_add_new_connection (source, CONF_NET_FILE, WPA_SUPPLICANT_CONF, NULL, error); if (conn_name) connection = nm_ifnet_connection_new (conn_name, source); reload_connections (config); diff --git a/src/settings/plugins/ifnet/tests/Makefile.am b/src/settings/plugins/ifnet/tests/Makefile.am index 85d42388a..23f96c81f 100644 --- a/src/settings/plugins/ifnet/tests/Makefile.am +++ b/src/settings/plugins/ifnet/tests/Makefile.am @@ -1,19 +1,35 @@ +if ENABLE_TESTS + INCLUDES=-I$(srcdir)/../ \ -I$(top_srcdir)/libnm-glib \ -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/src/settings -TESTS = check_ifnet -check_PROGRAMS = check_ifnet -check_ifnet_SOURCES = test_all.c -check_ifnet_CPPFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS) + +noinst_PROGRAMS = check_ifnet +check_ifnet_SOURCES = test_all.c + +check_ifnet_CPPFLAGS = \ + $(CHECK_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DTEST_WPA_SUPPLICANT_CONF='"$(srcdir)/wpa_supplicant.conf"' + check_ifnet_LDADD = $(top_builddir)/libnm-util/libnm-util.la \ $(builddir)/../lib-ifnet-io.la \ $(CHECK_LIBS) \ $(GLIB_LIBS) \ $(LIBM) -EXTRA_DIST = hostname \ - net \ - net.all \ - nm-system-settings.conf \ - wpa_supplicant.conf +check-local: check_ifnet + $(abs_builddir)/check_ifnet $(abs_srcdir) $(abs_builddir) + +EXTRA_DIST = \ + hostname \ + net \ + net.all \ + nm-system-settings.conf \ + wpa_supplicant.conf \ + test_ca_cert.pem + +endif diff --git a/src/settings/plugins/ifnet/tests/Makefile.in b/src/settings/plugins/ifnet/tests/Makefile.in index 669e22f62..0c2c1910e 100644 --- a/src/settings/plugins/ifnet/tests/Makefile.in +++ b/src/settings/plugins/ifnet/tests/Makefile.in @@ -14,6 +14,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -50,34 +51,39 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -TESTS = check_ifnet$(EXEEXT) -check_PROGRAMS = check_ifnet$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = check_ifnet$(EXEEXT) subdir = src/settings/plugins/ifnet/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am_check_ifnet_OBJECTS = check_ifnet-test_all.$(OBJEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__check_ifnet_SOURCES_DIST = test_all.c +@ENABLE_TESTS_TRUE@am_check_ifnet_OBJECTS = \ +@ENABLE_TESTS_TRUE@ check_ifnet-test_all.$(OBJEXT) check_ifnet_OBJECTS = $(am_check_ifnet_OBJECTS) am__DEPENDENCIES_1 = -check_ifnet_DEPENDENCIES = $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../lib-ifnet-io.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@check_ifnet_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../lib-ifnet-io.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -108,7 +114,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(check_ifnet_SOURCES) -DIST_SOURCES = $(check_ifnet_SOURCES) +DIST_SOURCES = $(am__check_ifnet_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -116,8 +122,6 @@ am__can_run_installinfo = \ esac ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ @@ -131,6 +135,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -145,9 +153,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -157,17 +163,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -208,6 +211,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -224,11 +228,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -243,6 +243,8 @@ 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@ @@ -252,6 +254,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -278,13 +281,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -339,6 +343,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -353,25 +362,37 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I$(srcdir)/../ \ - -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/settings - -check_ifnet_SOURCES = test_all.c -check_ifnet_CPPFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS) -check_ifnet_LDADD = $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../lib-ifnet-io.la \ - $(CHECK_LIBS) \ - $(GLIB_LIBS) \ - $(LIBM) - -EXTRA_DIST = hostname \ - net \ - net.all \ - nm-system-settings.conf \ - wpa_supplicant.conf +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = -I$(srcdir)/../ \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src/settings + +@ENABLE_TESTS_TRUE@check_ifnet_SOURCES = test_all.c +@ENABLE_TESTS_TRUE@check_ifnet_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(CHECK_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_WPA_SUPPLICANT_CONF='"$(srcdir)/wpa_supplicant.conf"' + +@ENABLE_TESTS_TRUE@check_ifnet_LDADD = $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../lib-ifnet-io.la \ +@ENABLE_TESTS_TRUE@ $(CHECK_LIBS) \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(LIBM) + +@ENABLE_TESTS_TRUE@EXTRA_DIST = \ +@ENABLE_TESTS_TRUE@ hostname \ +@ENABLE_TESTS_TRUE@ net \ +@ENABLE_TESTS_TRUE@ net.all \ +@ENABLE_TESTS_TRUE@ nm-system-settings.conf \ +@ENABLE_TESTS_TRUE@ wpa_supplicant.conf \ +@ENABLE_TESTS_TRUE@ test_ca_cert.pem all: all-am @@ -408,8 +429,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ @@ -429,25 +450,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_ifnet-test_all.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -524,99 +542,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ - else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi - distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -647,11 +572,11 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done +@ENABLE_TESTS_FALSE@check-local: check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS + $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am -all-am: Makefile +all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am @@ -685,7 +610,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am @@ -756,8 +681,8 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ @@ -770,6 +695,8 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am +@ENABLE_TESTS_TRUE@check-local: check_ifnet +@ENABLE_TESTS_TRUE@ $(abs_builddir)/check_ifnet $(abs_srcdir) $(abs_builddir) # 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. diff --git a/src/settings/plugins/ifnet/tests/test_all.c b/src/settings/plugins/ifnet/tests/test_all.c index 974258b95..4c3126010 100644 --- a/src/settings/plugins/ifnet/tests/test_all.c +++ b/src/settings/plugins/ifnet/tests/test_all.c @@ -25,6 +25,7 @@ #include <glib.h> #include <arpa/inet.h> #include <stdlib.h> +#include <unistd.h> #include <nm-utils.h> #include "net_parser.h" @@ -62,31 +63,33 @@ test_getdata () } static void -test_read_hostname () +test_read_hostname (const char *base_path) { - gchar *hostname = read_hostname ("hostname"); + char *hostname_path, *hostname; + + hostname_path = g_build_filename (base_path, "hostname", NULL); + hostname = read_hostname (hostname_path); + + g_assert_cmpstr (hostname, ==, "gentoo"); - ASSERT (hostname != NULL, "get hostname", "hostname is NULL"); - ASSERT (strcmp ("gentoo", hostname) == 0, - "get hostname", - "hostname is not correctly read, read:%s, expected: gentoo", - hostname); g_free (hostname); + g_free (hostname_path); } static void -test_write_hostname () +test_write_hostname (const char *temp_path) { - gchar *hostname = read_hostname ("hostname"); - gchar *tmp; - - write_hostname ("gentoo-nm", "hostname"); - tmp = read_hostname ("hostname"); - ASSERT (strcmp (tmp, "gentoo-nm") == 0, - "write hostname", "write hostname error"); - write_hostname (hostname, "hostname"); - g_free (tmp); + char *hostname_path, *hostname; + + hostname_path = g_build_filename (temp_path, "hostname-test", NULL); + write_hostname (hostname_path, "gentoo-nm"); + hostname = read_hostname (hostname_path); + + g_assert_cmpstr (hostname, ==, "gentoo-nm"); + g_free (hostname); + unlink (hostname_path); + g_free (hostname_path); } static void @@ -226,21 +229,15 @@ test_wpa_parser () { const char *value; - ASSERT (exist_ssid ("example"), "get wsec", - "ssid myxjtu2 is not found"); - ASSERT (exist_ssid ("static-wep-test"), "exist_ssid", - "ssid static-wep-test is not found"); + g_assert (exist_ssid ("example")); + + g_assert (exist_ssid ("static-wep-test")); value = wpa_get_value ("static-wep-test", "key_mgmt"); - ASSERT (value - && strcmp (value, "NONE") == 0, "get wpa data", - "key_mgmt of static-wep-test should be NONE, find %s", value); + g_assert_cmpstr (value, ==, "NONE"); value = wpa_get_value ("static-wep-test", "wep_key0"); - ASSERT (value - && strcmp (value, "\"abcde\"") == 0, - "get wpa data", - "wep_key0 of static-wep-test should be abcde, find %s", value); - ASSERT (exist_ssid ("leap-example"), "get wsec", - "ssid leap-example is not found"); + g_assert_cmpstr (value, ==, "\"abcde\""); + + g_assert (exist_ssid ("leap-example")); value = wpa_get_value ("test-with-hash-in-psk", "psk"); g_assert_cmpstr (value, ==, "\"xjtudlc3731###asdfasdfasdf\""); @@ -277,48 +274,59 @@ test_new_connection () GError *error = NULL; NMConnection *connection; - connection = ifnet_update_connection_from_config_block ("eth2", &error); + connection = ifnet_update_connection_from_config_block ("eth2", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection failed: %s", error ? error->message : "None"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("qiaomuf", &error); + connection = ifnet_update_connection_from_config_block ("qiaomuf", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection failed: %s", error ? error->message : "NONE"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("myxjtu2", &error); + connection = ifnet_update_connection_from_config_block ("myxjtu2", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection failed: %s", error ? error->message : "NONE"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("eth9", &error); + connection = ifnet_update_connection_from_config_block ("eth9", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection(eth9) failed: %s", error ? error->message : "NONE"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("eth10", &error); + connection = ifnet_update_connection_from_config_block ("eth10", NULL, &error); ASSERT (connection != NULL, "new connection", "new connection(eth10) failed: %s", error ? error->message : "NONE"); g_object_unref (connection); } +static void +kill_backup (char **path) +{ + if (path) { + unlink (*path); + g_free (*path); + *path = NULL; + } +} + #define NET_GEN_NAME "net.generate" #define SUP_GEN_NAME "wpa_supplicant.conf.generate" static void -test_update_connection () +test_update_connection (const char *basepath) { GError *error = NULL; NMConnection *connection; gboolean success; + char *backup = NULL; - connection = ifnet_update_connection_from_config_block ("eth0", &error); + connection = ifnet_update_connection_from_config_block ("eth0", basepath, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); @@ -327,11 +335,13 @@ test_update_connection () NET_GEN_NAME, SUP_GEN_NAME, NULL, + &backup, &error); + kill_backup (&backup); ASSERT (success, "update connection", "update connection failed %s", "eth0"); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("0xab3ace", &error); + connection = ifnet_update_connection_from_config_block ("0xab3ace", basepath, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); @@ -339,7 +349,9 @@ test_update_connection () NET_GEN_NAME, SUP_GEN_NAME, NULL, + &backup, &error); + kill_backup (&backup); ASSERT (success, "update connection", "update connection failed %s", "0xab3ace"); g_object_unref (connection); @@ -348,17 +360,21 @@ test_update_connection () } static void -test_add_connection () +test_add_connection (const char *basepath) { NMConnection *connection; + char *backup = NULL; - connection = ifnet_update_connection_from_config_block ("eth0", NULL); - ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, NULL), + connection = ifnet_update_connection_from_config_block ("eth0", basepath, NULL); + ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, &backup, NULL), "add connection", "add connection failed: %s", "eth0"); + kill_backup (&backup); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("myxjtu2", NULL); - ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, NULL), + + connection = ifnet_update_connection_from_config_block ("myxjtu2", basepath, NULL); + ASSERT (ifnet_add_new_connection (connection, NET_GEN_NAME, SUP_GEN_NAME, &backup, NULL), "add connection", "add connection failed: %s", "myxjtu2"); + kill_backup (&backup); g_object_unref (connection); unlink (NET_GEN_NAME); @@ -370,20 +386,24 @@ test_delete_connection () { GError *error = NULL; NMConnection *connection; + char *backup = NULL; - connection = ifnet_update_connection_from_config_block ("eth7", &error); + connection = ifnet_update_connection_from_config_block ("eth7", NULL, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); - ASSERT (ifnet_delete_connection_in_parsers ("eth7", NET_GEN_NAME, SUP_GEN_NAME), + ASSERT (ifnet_delete_connection_in_parsers ("eth7", NET_GEN_NAME, SUP_GEN_NAME, &backup), "delete connection", "delete connection failed: %s", "eth7"); + kill_backup (&backup); g_object_unref (connection); - connection = ifnet_update_connection_from_config_block ("qiaomuf", &error); + + connection = ifnet_update_connection_from_config_block ("qiaomuf", NULL, &error); ASSERT (connection != NULL, "get connection", "get connection failed: %s", error ? error->message : "None"); - ASSERT (ifnet_delete_connection_in_parsers ("qiaomuf", NET_GEN_NAME, SUP_GEN_NAME), + ASSERT (ifnet_delete_connection_in_parsers ("qiaomuf", NET_GEN_NAME, SUP_GEN_NAME, &backup), "delete connection", "delete connection failed: %s", "qiaomuf"); + kill_backup (&backup); g_object_unref (connection); unlink (NET_GEN_NAME); @@ -396,50 +416,51 @@ test_missing_config () GError *error = NULL; NMConnection *connection; - connection = ifnet_update_connection_from_config_block ("eth8", &error); + connection = ifnet_update_connection_from_config_block ("eth8", NULL, &error); ASSERT (connection == NULL && error != NULL, "get connection", "get connection should fail with 'Unknown config for eth8'"); } -static void -run_all (gboolean run) -{ - if (run) { - test_strip_string (); - test_is_static (); - test_has_ip6_address (); - test_has_default_route (); - test_getdata (); - test_read_hostname (); - test_write_hostname (); - test_is_ip4_address (); - test_is_ip6_address (); - test_convert_ipv4_config_block (); - test_convert_ipv4_routes_block (); - test_is_unmanaged (); - test_wpa_parser (); - test_convert_ipv4_routes_block (); - test_new_connection (); - test_update_connection (); - test_add_connection (); - test_delete_connection (); - test_missing_config (); - } -} - int -main (void) +main (int argc, char **argv) { -// g_mem_set_vtable(glib_mem_profiler_table); -// g_atexit(g_mem_profile); + char *f; + g_type_init (); + + f = g_build_filename (argv[1], "net", NULL); + ifnet_init (f); + g_free (f); + + f = g_build_filename (argv[1], "wpa_supplicant.conf", NULL); + wpa_parser_init (f); + g_free (f); + + test_strip_string (); + test_is_static (); + test_has_ip6_address (); + test_has_default_route (); + test_getdata (); + test_read_hostname (argv[1]); + test_write_hostname (argv[2]); + test_is_ip4_address (); + test_is_ip6_address (); + test_convert_ipv4_config_block (); + test_convert_ipv4_routes_block (); + test_is_unmanaged (); + test_wpa_parser (); + test_convert_ipv4_routes_block (); + test_new_connection (); + test_update_connection (argv[1]); + test_add_connection (argv[1]); + test_delete_connection (); + test_missing_config (); + ifnet_destroy (); wpa_parser_destroy (); - ifnet_init ("net"); - wpa_parser_init ("wpa_supplicant.conf"); - printf ("Initialization complete\n"); - run_all (TRUE); - ifnet_destroy (); - wpa_parser_destroy (); + + f = g_path_get_basename (argv[0]); + fprintf (stdout, "%s: SUCCESS\n", f); + g_free (f); return 0; } diff --git a/src/settings/plugins/ifnet/tests/test_ca_cert.pem b/src/settings/plugins/ifnet/tests/test_ca_cert.pem new file mode 100644 index 000000000..ef1be20d2 --- /dev/null +++ b/src/settings/plugins/ifnet/tests/test_ca_cert.pem @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEjzCCA3egAwIBAgIJAOvnZPt59yIZMA0GCSqGSIb3DQEBBQUAMIGLMQswCQYD +VQQGEwJVUzESMBAGA1UECBMJQmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcw +FQYDVQQKEw5NeSBDb21wYW55IEx0ZDEQMA4GA1UECxMHVGVzdGluZzENMAsGA1UE +AxMEdGVzdDEcMBoGCSqGSIb3DQEJARYNdGVzdEB0ZXN0LmNvbTAeFw0wOTAzMTAx +NTEyMTRaFw0xOTAzMDgxNTEyMTRaMIGLMQswCQYDVQQGEwJVUzESMBAGA1UECBMJ +QmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcwFQYDVQQKEw5NeSBDb21wYW55 +IEx0ZDEQMA4GA1UECxMHVGVzdGluZzENMAsGA1UEAxMEdGVzdDEcMBoGCSqGSIb3 +DQEJARYNdGVzdEB0ZXN0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAKot9j+/+CX1/gZLgJHIXCRgCItKLGnf7qGbgqB9T2ACBqR0jllKWwDKrcWU +xjXNIc+GF9Wnv+lX6G0Okn4Zt3/uRNobL+2b/yOF7M3Td3/9W873zdkQQX930YZc +Rr8uxdRPP5bxiCgtcw632y21sSEbG9mjccAUnV/0jdvfmMNj0i8gN6E0fMBiJ9S3 +FkxX/KFvt9JWE9CtoyL7ki7UIDq+6vj7Gd5N0B3dOa1y+rRHZzKlJPcSXQSEYUS4 +HmKDwiKSVahft8c4tDn7KPi0vex91hlgZVd3usL2E/Vq7o5D9FAZ5kZY0AdFXwdm +J4lO4Mj7ac7GE4vNERNcXVIX59sCAwEAAaOB8zCB8DAdBgNVHQ4EFgQUuDU3Mr7P +T3n1e3Sy8hBauoDFahAwgcAGA1UdIwSBuDCBtYAUuDU3Mr7PT3n1e3Sy8hBauoDF +ahChgZGkgY4wgYsxCzAJBgNVBAYTAlVTMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAO +BgNVBAcTB05ld2J1cnkxFzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMRAwDgYDVQQL +EwdUZXN0aW5nMQ0wCwYDVQQDEwR0ZXN0MRwwGgYJKoZIhvcNAQkBFg10ZXN0QHRl +c3QuY29tggkA6+dk+3n3IhkwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC +AQEAVRG4aALIvCXCiKfe7K+iJxjBVRDFPEf7JWA9LGgbFOn6pNvbxonrR+0BETdc +JV1ET4ct2xsE7QNFIkp9GKRC+6J32zCo8qtLCD5+v436r8TUG2/t2JRMkb9I2XVT +p7RJoot6M0Ltf8KNQUPYh756xmKZ4USfQUwc58MOSDGY8VWEXJOYij9Pf0e0c52t +qiCEjXH7uXiS8Pgq9TYm7AkWSOrglYhSa83x0f8mtT8Q15nBESIHZ6o8FAS2bBgn +B0BkrKRjtBUkuJG3vTox+bYINh2Gxi1JZHWSV1tN5z3hd4VFcKqanW5OgQwToBqp +3nniskIjbH0xjgZf/nVMyLnjxg== +-----END CERTIFICATE----- diff --git a/src/settings/plugins/ifnet/tests/wpa_supplicant.conf b/src/settings/plugins/ifnet/tests/wpa_supplicant.conf index 609ee0e10..917d495d2 100644 --- a/src/settings/plugins/ifnet/tests/wpa_supplicant.conf +++ b/src/settings/plugins/ifnet/tests/wpa_supplicant.conf @@ -1,529 +1,3 @@ -##### Example wpa_supplicant configuration file ############################### -# -# This file describes configuration file format and lists all available option. -# Please also take a look at simpler configuration examples in 'examples' -# subdirectory. -# -# Empty lines and lines starting with # are ignored - -# NOTE! This file may contain password information and should probably be made -# readable only by root user on multiuser systems. - -# Note: All file paths in this configuration file should use full (absolute, -# not relative to working directory) path in order to allow working directory -# to be changed. This can happen if wpa_supplicant is run in the background. - -# Whether to allow wpa_supplicant to update (overwrite) configuration -# -# This option can be used to allow wpa_supplicant to overwrite configuration -# file whenever configuration is changed (e.g., new network block is added with -# wpa_cli or wpa_gui, or a password is changed). This is required for -# wpa_cli/wpa_gui to be able to store the configuration changes permanently. -# Please note that overwriting configuration file will remove the comments from -# it. -#update_config=1 - -# global configuration (shared by all network blocks) -# -# Parameters for the control interface. If this is specified, wpa_supplicant -# will open a control interface that is available for external programs to -# manage wpa_supplicant. The meaning of this string depends on which control -# interface mechanism is used. For all cases, the existance of this parameter -# in configuration is used to determine whether the control interface is -# enabled. -# -# For UNIX domain sockets (default on Linux and BSD): This is a directory that -# will be created for UNIX domain sockets for listening to requests from -# external programs (CLI/GUI, etc.) for status information and configuration. -# The socket file will be named based on the interface name, so multiple -# wpa_supplicant processes can be run at the same time if more than one -# interface is used. -# /var/run/wpa_supplicant is the recommended directory for sockets and by -# default, wpa_cli will use it when trying to connect with wpa_supplicant. -# -# Access control for the control interface can be configured by setting the -# directory to allow only members of a group to use sockets. This way, it is -# possible to run wpa_supplicant as root (since it needs to change network -# configuration and open raw sockets) and still allow GUI/CLI components to be -# run as non-root users. However, since the control interface can be used to -# change the network configuration, this access needs to be protected in many -# cases. By default, wpa_supplicant is configured to use gid 0 (root). If you -# want to allow non-root users to use the control interface, add a new group -# and change this value to match with that group. Add users that should have -# control interface access to this group. If this variable is commented out or -# not included in the configuration file, group will not be changed from the -# value it got by default when the directory or socket was created. -# -# When configuring both the directory and group, use following format: -# DIR=/var/run/wpa_supplicant GROUP=wheel -# DIR=/var/run/wpa_supplicant GROUP=0 -# (group can be either group name or gid) -# -# For UDP connections (default on Windows): The value will be ignored. This -# variable is just used to select that the control interface is to be created. -# The value can be set to, e.g., udp (ctrl_interface=udp) -# -# For Windows Named Pipe: This value can be used to set the security descriptor -# for controlling access to the control interface. Security descriptor can be -# set using Security Descriptor String Format (see http://msdn.microsoft.com/ -# library/default.asp?url=/library/en-us/secauthz/security/ -# security_descriptor_string_format.asp). The descriptor string needs to be -# prefixed with SDDL=. For example, ctrl_interface=SDDL=D: would set an empty -# DACL (which will reject all connections). See README-Windows.txt for more -# information about SDDL string format. -# -ctrl_interface=/var/run/wpa_supplicant - -# IEEE 802.1X/EAPOL version -# wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which defines -# EAPOL version 2. However, there are many APs that do not handle the new -# version number correctly (they seem to drop the frames completely). In order -# to make wpa_supplicant interoperate with these APs, the version number is set -# to 1 by default. This configuration value can be used to set it to the new -# version (2). -eapol_version=1 - -# AP scanning/selection -# By default, wpa_supplicant requests driver to perform AP scanning and then -# uses the scan results to select a suitable AP. Another alternative is to -# allow the driver to take care of AP scanning and selection and use -# wpa_supplicant just to process EAPOL frames based on IEEE 802.11 association -# information from the driver. -# 1: wpa_supplicant initiates scanning and AP selection -# 0: driver takes care of scanning, AP selection, and IEEE 802.11 association -# parameters (e.g., WPA IE generation); this mode can also be used with -# non-WPA drivers when using IEEE 802.1X mode; do not try to associate with -# APs (i.e., external program needs to control association). This mode must -# also be used when using wired Ethernet drivers. -# 2: like 0, but associate with APs using security policy and SSID (but not -# BSSID); this can be used, e.g., with ndiswrapper and NDIS drivers to -# enable operation with hidden SSIDs and optimized roaming; in this mode, -# the network blocks in the configuration file are tried one by one until -# the driver reports successful association; each network block should have -# explicit security policy (i.e., only one option in the lists) for -# key_mgmt, pairwise, group, proto variables -ap_scan=1 - -# EAP fast re-authentication -# By default, fast re-authentication is enabled for all EAP methods that -# support it. This variable can be used to disable fast re-authentication. -# Normally, there is no need to disable this. -fast_reauth=1 - -# OpenSSL Engine support -# These options can be used to load OpenSSL engines. -# The two engines that are supported currently are shown below: -# They are both from the opensc project (http://www.opensc.org/) -# By default no engines are loaded. -# make the opensc engine available -#opensc_engine_path=/usr/lib64/engine_opensc.so -# make the pkcs11 engine available -#pkcs11_engine_path=/usr/lib64/engine_pkcs11.so -# configure the path to the pkcs11 module required by the pkcs11 engine -#pkcs11_module_path=/usr/lib64/opensc-pkcs11.so - -# Dynamic EAP methods -# If EAP methods were built dynamically as shared object files, they need to be -# loaded here before being used in the network blocks. By default, EAP methods -# are included statically in the build, so these lines are not needed -#load_dynamic_eap=/usr/lib/wpa_supplicant/eap_tls.so -#load_dynamic_eap=/usr/lib/wpa_supplicant/eap_md5.so - -# Driver interface parameters -# This field can be used to configure arbitrary driver interace parameters. The -# format is specific to the selected driver interface. This field is not used -# in most cases. -#driver_param="field=value" - -# Country code -# The ISO/IEC alpha2 country code for the country in which this device is -# currently operating. -#country=US - -# Maximum lifetime for PMKSA in seconds; default 43200 -#dot11RSNAConfigPMKLifetime=43200 -# Threshold for reauthentication (percentage of PMK lifetime); default 70 -#dot11RSNAConfigPMKReauthThreshold=70 -# Timeout for security association negotiation in seconds; default 60 -#dot11RSNAConfigSATimeout=60 - -# Wi-Fi Protected Setup (WPS) parameters - -# Universally Unique IDentifier (UUID; see RFC 4122) of the device -# If not configured, UUID will be generated based on the local MAC address. -#uuid=12345678-9abc-def0-1234-56789abcdef0 - -# Device Name -# User-friendly description of device; up to 32 octets encoded in UTF-8 -#device_name=Wireless Client - -# Manufacturer -# The manufacturer of the device (up to 64 ASCII characters) -#manufacturer=Company - -# Model Name -# Model of the device (up to 32 ASCII characters) -#model_name=cmodel - -# Model Number -# Additional device description (up to 32 ASCII characters) -#model_number=123 - -# Serial Number -# Serial number of the device (up to 32 characters) -#serial_number=12345 - -# Primary Device Type -# Used format: <categ>-<OUI>-<subcateg> -# categ = Category as an integer value -# OUI = OUI and type octet as a 4-octet hex-encoded value; 0050F204 for -# default WPS OUI -# subcateg = OUI-specific Sub Category as an integer value -# Examples: -# 1-0050F204-1 (Computer / PC) -# 1-0050F204-2 (Computer / Server) -# 5-0050F204-1 (Storage / NAS) -# 6-0050F204-1 (Network Infrastructure / AP) -#device_type=1-0050F204-1 - -# OS Version -# 4-octet operating system version number (hex string) -#os_version=01020300 - -# Credential processing -# 0 = process received credentials internally (default) -# 1 = do not process received credentials; just pass them over ctrl_iface to -# external program(s) -# 2 = process received credentials internally and pass them over ctrl_iface -# to external program(s) -#wps_cred_processing=0 - -# network block -# -# Each network (usually AP's sharing the same SSID) is configured as a separate -# block in this configuration file. The network blocks are in preference order -# (the first match is used). -# -# network block fields: -# -# disabled: -# 0 = this network can be used (default) -# 1 = this network block is disabled (can be enabled through ctrl_iface, -# e.g., with wpa_cli or wpa_gui) -# -# id_str: Network identifier string for external scripts. This value is passed -# to external action script through wpa_cli as WPA_ID_STR environment -# variable to make it easier to do network specific configuration. -# -# ssid: SSID (mandatory); either as an ASCII string with double quotation or -# as hex string; network name -# -# scan_ssid: -# 0 = do not scan this SSID with specific Probe Request frames (default) -# 1 = scan with SSID-specific Probe Request frames (this can be used to -# find APs that do not accept broadcast SSID or use multiple SSIDs; -# this will add latency to scanning, so enable this only when needed) -# -# bssid: BSSID (optional); if set, this network block is used only when -# associating with the AP using the configured BSSID -# -# priority: priority group (integer) -# By default, all networks will get same priority group (0). If some of the -# networks are more desirable, this field can be used to change the order in -# which wpa_supplicant goes through the networks when selecting a BSS. The -# priority groups will be iterated in decreasing priority (i.e., the larger the -# priority value, the sooner the network is matched against the scan results). -# Within each priority group, networks will be selected based on security -# policy, signal strength, etc. -# Please note that AP scanning with scan_ssid=1 and ap_scan=2 mode are not -# using this priority to select the order for scanning. Instead, they try the -# networks in the order that used in the configuration file. -# -# mode: IEEE 802.11 operation mode -# 0 = infrastructure (Managed) mode, i.e., associate with an AP (default) -# 1 = IBSS (ad-hoc, peer-to-peer) -# Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP) -# and key_mgmt=WPA-NONE (fixed group key TKIP/CCMP). In addition, ap_scan has -# to be set to 2 for IBSS. WPA-None requires following network block options: -# proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or CCMP, but not -# both), and psk must also be set. -# -# frequency: Channel frequency in megahertz (MHz) for IBSS, e.g., -# 2412 = IEEE 802.11b/g channel 1. This value is used to configure the initial -# channel for IBSS (adhoc) networks. It is ignored in the infrastructure mode. -# In addition, this value is only used by the station that creates the IBSS. If -# an IBSS network with the configured SSID is already present, the frequency of -# the network will be used instead of this configured value. -# -# proto: list of accepted protocols -# WPA = WPA/IEEE 802.11i/D3.0 -# RSN = WPA2/IEEE 802.11i (also WPA2 can be used as an alias for RSN) -# If not set, this defaults to: WPA RSN -# -# key_mgmt: list of accepted authenticated key management protocols -# WPA-PSK = WPA pre-shared key (this requires 'psk' field) -# WPA-EAP = WPA using EAP authentication -# IEEE8021X = IEEE 802.1X using EAP authentication and (optionally) dynamically -# generated WEP keys -# NONE = WPA is not used; plaintext or static WEP could be used -# WPA-PSK-SHA256 = Like WPA-PSK but using stronger SHA256-based algorithms -# WPA-EAP-SHA256 = Like WPA-EAP but using stronger SHA256-based algorithms -# If not set, this defaults to: WPA-PSK WPA-EAP -# -# auth_alg: list of allowed IEEE 802.11 authentication algorithms -# OPEN = Open System authentication (required for WPA/WPA2) -# SHARED = Shared Key authentication (requires static WEP keys) -# LEAP = LEAP/Network EAP (only used with LEAP) -# If not set, automatic selection is used (Open System with LEAP enabled if -# LEAP is allowed as one of the EAP methods). -# -# pairwise: list of accepted pairwise (unicast) ciphers for WPA -# CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] -# TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] -# NONE = Use only Group Keys (deprecated, should not be included if APs support -# pairwise keys) -# If not set, this defaults to: CCMP TKIP -# -# group: list of accepted group (broadcast/multicast) ciphers for WPA -# CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] -# TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] -# WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key -# WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key [IEEE 802.11] -# If not set, this defaults to: CCMP TKIP WEP104 WEP40 -# -# psk: WPA preshared key; 256-bit pre-shared key -# The key used in WPA-PSK mode can be entered either as 64 hex-digits, i.e., -# 32 bytes or as an ASCII passphrase (in which case, the real PSK will be -# generated using the passphrase and SSID). ASCII passphrase must be between -# 8 and 63 characters (inclusive). -# This field is not needed, if WPA-EAP is used. -# Note: Separate tool, wpa_passphrase, can be used to generate 256-bit keys -# from ASCII passphrase. This process uses lot of CPU and wpa_supplicant -# startup and reconfiguration time can be optimized by generating the PSK only -# only when the passphrase or SSID has actually changed. -# -# eapol_flags: IEEE 802.1X/EAPOL options (bit field) -# Dynamic WEP key required for non-WPA mode -# bit0 (1): require dynamically generated unicast WEP key -# bit1 (2): require dynamically generated broadcast WEP key -# (3 = require both keys; default) -# Note: When using wired authentication, eapol_flags must be set to 0 for the -# authentication to be completed successfully. -# -# mixed_cell: This option can be used to configure whether so called mixed -# cells, i.e., networks that use both plaintext and encryption in the same -# SSID, are allowed when selecting a BSS form scan results. -# 0 = disabled (default) -# 1 = enabled -# -# proactive_key_caching: -# Enable/disable opportunistic PMKSA caching for WPA2. -# 0 = disabled (default) -# 1 = enabled -# -# wep_key0..3: Static WEP key (ASCII in double quotation, e.g. "abcde" or -# hex without quotation, e.g., 0102030405) -# wep_tx_keyidx: Default WEP key index (TX) (0..3) -# -# peerkey: Whether PeerKey negotiation for direct links (IEEE 802.11e DLS) is -# allowed. This is only used with RSN/WPA2. -# 0 = disabled (default) -# 1 = enabled -#peerkey=1 -# -# wpa_ptk_rekey: Maximum lifetime for PTK in seconds. This can be used to -# enforce rekeying of PTK to mitigate some attacks against TKIP deficiencies. -# -# Following fields are only used with internal EAP implementation. -# eap: space-separated list of accepted EAP methods -# MD5 = EAP-MD5 (unsecure and does not generate keying material -> -# cannot be used with WPA; to be used as a Phase 2 method -# with EAP-PEAP or EAP-TTLS) -# MSCHAPV2 = EAP-MSCHAPv2 (cannot be used separately with WPA; to be used -# as a Phase 2 method with EAP-PEAP or EAP-TTLS) -# OTP = EAP-OTP (cannot be used separately with WPA; to be used -# as a Phase 2 method with EAP-PEAP or EAP-TTLS) -# GTC = EAP-GTC (cannot be used separately with WPA; to be used -# as a Phase 2 method with EAP-PEAP or EAP-TTLS) -# TLS = EAP-TLS (client and server certificate) -# PEAP = EAP-PEAP (with tunnelled EAP authentication) -# TTLS = EAP-TTLS (with tunnelled EAP or PAP/CHAP/MSCHAP/MSCHAPV2 -# authentication) -# If not set, all compiled in methods are allowed. -# -# identity: Identity string for EAP -# This field is also used to configure user NAI for -# EAP-PSK/PAX/SAKE/GPSK. -# anonymous_identity: Anonymous identity string for EAP (to be used as the -# unencrypted identity with EAP types that support different tunnelled -# identity, e.g., EAP-TTLS) -# password: Password string for EAP. This field can include either the -# plaintext password (using ASCII or hex string) or a NtPasswordHash -# (16-byte MD4 hash of password) in hash:<32 hex digits> format. -# NtPasswordHash can only be used when the password is for MSCHAPv2 or -# MSCHAP (EAP-MSCHAPv2, EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP). -# EAP-PSK (128-bit PSK), EAP-PAX (128-bit PSK), and EAP-SAKE (256-bit -# PSK) is also configured using this field. For EAP-GPSK, this is a -# variable length PSK. -# ca_cert: File path to CA certificate file (PEM/DER). This file can have one -# or more trusted CA certificates. If ca_cert and ca_path are not -# included, server certificate will not be verified. This is insecure and -# a trusted CA certificate should always be configured when using -# EAP-TLS/TTLS/PEAP. Full path should be used since working directory may -# change when wpa_supplicant is run in the background. -# On Windows, trusted CA certificates can be loaded from the system -# certificate store by setting this to cert_store://<name>, e.g., -# ca_cert="cert_store://CA" or ca_cert="cert_store://ROOT". -# Note that when running wpa_supplicant as an application, the user -# certificate store (My user account) is used, whereas computer store -# (Computer account) is used when running wpasvc as a service. -# ca_path: Directory path for CA certificate files (PEM). This path may -# contain multiple CA certificates in OpenSSL format. Common use for this -# is to point to system trusted CA list which is often installed into -# directory like /etc/ssl/certs. If configured, these certificates are -# added to the list of trusted CAs. ca_cert may also be included in that -# case, but it is not required. -# client_cert: File path to client certificate file (PEM/DER) -# Full path should be used since working directory may change when -# wpa_supplicant is run in the background. -# Alternatively, a named configuration blob can be used by setting this -# to blob://<blob name>. -# private_key: File path to client private key file (PEM/DER/PFX) -# When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be -# commented out. Both the private key and certificate will be read from -# the PKCS#12 file in this case. Full path should be used since working -# directory may change when wpa_supplicant is run in the background. -# Windows certificate store can be used by leaving client_cert out and -# configuring private_key in one of the following formats: -# cert://substring_to_match -# hash://certificate_thumbprint_in_hex -# for example: private_key="hash://63093aa9c47f56ae88334c7b65a4" -# Note that when running wpa_supplicant as an application, the user -# certificate store (My user account) is used, whereas computer store -# (Computer account) is used when running wpasvc as a service. -# Alternatively, a named configuration blob can be used by setting this -# to blob://<blob name>. -# private_key_passwd: Password for private key file (if left out, this will be -# asked through control interface) -# dh_file: File path to DH/DSA parameters file (in PEM format) -# This is an optional configuration file for setting parameters for an -# ephemeral DH key exchange. In most cases, the default RSA -# authentication does not use this configuration. However, it is possible -# setup RSA to use ephemeral DH key exchange. In addition, ciphers with -# DSA keys always use ephemeral DH keys. This can be used to achieve -# forward secrecy. If the file is in DSA parameters format, it will be -# automatically converted into DH params. -# subject_match: Substring to be matched against the subject of the -# authentication server certificate. If this string is set, the server -# sertificate is only accepted if it contains this string in the subject. -# The subject string is in following format: -# /C=US/ST=CA/L=San Francisco/CN=Test AS/emailAddress=as@example.com -# altsubject_match: Semicolon separated string of entries to be matched against -# the alternative subject name of the authentication server certificate. -# If this string is set, the server sertificate is only accepted if it -# contains one of the entries in an alternative subject name extension. -# altSubjectName string is in following format: TYPE:VALUE -# Example: EMAIL:server@example.com -# Example: DNS:server.example.com;DNS:server2.example.com -# Following types are supported: EMAIL, DNS, URI -# phase1: Phase1 (outer authentication, i.e., TLS tunnel) parameters -# (string with field-value pairs, e.g., "peapver=0" or -# "peapver=1 peaplabel=1") -# 'peapver' can be used to force which PEAP version (0 or 1) is used. -# 'peaplabel=1' can be used to force new label, "client PEAP encryption", -# to be used during key derivation when PEAPv1 or newer. Most existing -# PEAPv1 implementation seem to be using the old label, "client EAP -# encryption", and wpa_supplicant is now using that as the default value. -# Some servers, e.g., Radiator, may require peaplabel=1 configuration to -# interoperate with PEAPv1; see eap_testing.txt for more details. -# 'peap_outer_success=0' can be used to terminate PEAP authentication on -# tunneled EAP-Success. This is required with some RADIUS servers that -# implement draft-josefsson-pppext-eap-tls-eap-05.txt (e.g., -# Lucent NavisRadius v4.4.0 with PEAP in "IETF Draft 5" mode) -# include_tls_length=1 can be used to force wpa_supplicant to include -# TLS Message Length field in all TLS messages even if they are not -# fragmented. -# sim_min_num_chal=3 can be used to configure EAP-SIM to require three -# challenges (by default, it accepts 2 or 3) -# result_ind=1 can be used to enable EAP-SIM and EAP-AKA to use -# protected result indication. -# 'crypto_binding' option can be used to control PEAPv0 cryptobinding -# behavior: -# * 0 = do not use cryptobinding (default) -# * 1 = use cryptobinding if server supports it -# * 2 = require cryptobinding -# EAP-WSC (WPS) uses following options: pin=<Device Password> or -# pbc=1. -# phase2: Phase2 (inner authentication with TLS tunnel) parameters -# (string with field-value pairs, e.g., "auth=MSCHAPV2" for EAP-PEAP or -# "autheap=MSCHAPV2 autheap=MD5" for EAP-TTLS) -# Following certificate/private key fields are used in inner Phase2 -# authentication when using EAP-TTLS or EAP-PEAP. -# ca_cert2: File path to CA certificate file. This file can have one or more -# trusted CA certificates. If ca_cert2 and ca_path2 are not included, -# server certificate will not be verified. This is insecure and a trusted -# CA certificate should always be configured. -# ca_path2: Directory path for CA certificate files (PEM) -# client_cert2: File path to client certificate file -# private_key2: File path to client private key file -# private_key2_passwd: Password for private key file -# dh_file2: File path to DH/DSA parameters file (in PEM format) -# subject_match2: Substring to be matched against the subject of the -# authentication server certificate. -# altsubject_match2: Substring to be matched against the alternative subject -# name of the authentication server certificate. -# -# fragment_size: Maximum EAP fragment size in bytes (default 1398). -# This value limits the fragment size for EAP methods that support -# fragmentation (e.g., EAP-TLS and EAP-PEAP). This value should be set -# small enough to make the EAP messages fit in MTU of the network -# interface used for EAPOL. The default value is suitable for most -# cases. -# -# EAP-FAST variables: -# pac_file: File path for the PAC entries. wpa_supplicant will need to be able -# to create this file and write updates to it when PAC is being -# provisioned or refreshed. Full path to the file should be used since -# working directory may change when wpa_supplicant is run in the -# background. Alternatively, a named configuration blob can be used by -# setting this to blob://<blob name> -# phase1: fast_provisioning option can be used to enable in-line provisioning -# of EAP-FAST credentials (PAC): -# 0 = disabled, -# 1 = allow unauthenticated provisioning, -# 2 = allow authenticated provisioning, -# 3 = allow both unauthenticated and authenticated provisioning -# fast_max_pac_list_len=<num> option can be used to set the maximum -# number of PAC entries to store in a PAC list (default: 10) -# fast_pac_format=binary option can be used to select binary format for -# storing PAC entries in order to save some space (the default -# text format uses about 2.5 times the size of minimal binary -# format) -# -# wpa_supplicant supports number of "EAP workarounds" to work around -# interoperability issues with incorrectly behaving authentication servers. -# These are enabled by default because some of the issues are present in large -# number of authentication servers. Strict EAP conformance mode can be -# configured by disabling workarounds with eap_workaround=0. - -# Example blocks: - -# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers -network={ - ssid="simple" - psk="very secret passphrase" - priority=5 -} - -# Same as previous, but request SSID-specific scanning (for APs that reject -# broadcast SSID) -network={ - ssid="second ssid" - scan_ssid=1 - psk="very secret passphrase" - priority=2 -} - # Only WPA-PSK is used. Any valid cipher combination is accepted. network={ ssid="example" @@ -535,149 +9,6 @@ network={ priority=2 } -# WPA-Personal(PSK) with TKIP and enforcement for frequent PTK rekeying -network={ - ssid="example" - proto=WPA - key_mgmt=WPA-PSK - pairwise=TKIP - group=TKIP - psk="not so secure passphrase" - wpa_ptk_rekey=600 -} - -# Only WPA-EAP is used. Both CCMP and TKIP is accepted. An AP that used WEP104 -# or WEP40 as the group cipher will not be accepted. -network={ - ssid="example" - proto=RSN - key_mgmt=WPA-EAP - pairwise=CCMP TKIP - group=CCMP TKIP - eap=TLS - identity="user@example.com" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - private_key="/etc/cert/user.prv" - private_key_passwd="password" - priority=1 -} - -# EAP-PEAP/MSCHAPv2 configuration for RADIUS servers that use the new peaplabel -# (e.g., Radiator) -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=PEAP - identity="user@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - phase1="peaplabel=1" - phase2="auth=MSCHAPV2" - priority=10 -} - -# EAP-TTLS/EAP-MD5-Challenge configuration with anonymous identity for the -# unencrypted use. Real identity is sent only within an encrypted TLS tunnel. -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - identity="user@example.com" - anonymous_identity="anonymous@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - priority=2 -} - -# EAP-TTLS/MSCHAPv2 configuration with anonymous identity for the unencrypted -# use. Real identity is sent only within an encrypted TLS tunnel. -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - identity="user@example.com" - anonymous_identity="anonymous@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - phase2="auth=MSCHAPV2" -} - -# WPA-EAP, EAP-TTLS with different CA certificate used for outer and inner -# authentication. -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - # Phase1 / outer authentication - anonymous_identity="anonymous@example.com" - ca_cert="/etc/cert/ca.pem" - # Phase 2 / inner authentication - phase2="autheap=TLS" - ca_cert2="/etc/cert/ca2.pem" - client_cert2="/etc/cer/user.pem" - private_key2="/etc/cer/user.prv" - private_key2_passwd="password" - priority=2 -} - -# Both WPA-PSK and WPA-EAP is accepted. Only CCMP is accepted as pairwise and -# group cipher. -network={ - ssid="example" - bssid=00:11:22:33:44:55 - proto=WPA RSN - key_mgmt=WPA-PSK WPA-EAP - pairwise=CCMP - group=CCMP - psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb -} - -# Special characters in SSID, so use hex string. Default to WPA-PSK, WPA-EAP -# and all valid ciphers. -network={ - ssid=00010203 - psk=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f -} - - -# EAP-SIM with a GSM SIM or USIM -network={ - ssid="eap-sim-test" - key_mgmt=WPA-EAP - eap=SIM - pin="1234" - pcsc="" -} - - -# EAP-PSK -network={ - ssid="eap-psk-test" - key_mgmt=WPA-EAP - eap=PSK - anonymous_identity="eap_psk_user" - password=06b4be19da289f475aa46a33cb793029 - identity="eap_psk_user@example.com" -} - - -# IEEE 802.1X/EAPOL with dynamically generated WEP keys (i.e., no WPA) using -# EAP-TLS for authentication and key generation; require both unicast and -# broadcast WEP keys. -network={ - ssid="1xtest" - key_mgmt=IEEE8021X - eap=TLS - identity="user@example.com" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - private_key="/etc/cert/user.prv" - private_key_passwd="password" - eapol_flags=3 -} - - # LEAP with dynamic WEP keys network={ ssid="leap-example" @@ -687,45 +18,6 @@ network={ password="foobar" } -# EAP-IKEv2 using shared secrets for both server and peer authentication -network={ - ssid="ikev2-example" - key_mgmt=WPA-EAP - eap=IKEV2 - identity="user" - password="foobar" -} - -# EAP-FAST with WPA (WPA or WPA2) -network={ - ssid="eap-fast-test" - key_mgmt=WPA-EAP - eap=FAST - anonymous_identity="FAST-000102030405" - identity="username" - password="password" - phase1="fast_provisioning=1" - pac_file="/etc/wpa_supplicant.eap-fast-pac" -} - -network={ - ssid="eap-fast-test" - key_mgmt=WPA-EAP - eap=FAST - anonymous_identity="FAST-000102030405" - identity="username" - password="password" - phase1="fast_provisioning=1" - pac_file="blob://eap-fast-pac" -} - -# Plaintext connection (no WPA, no IEEE 802.1X) -network={ - ssid="plaintext-test" - key_mgmt=NONE -} - - # Shared WEP key connection (no WPA, no IEEE 802.1X) network={ ssid="static-wep-test" @@ -737,107 +29,12 @@ network={ priority=5 } - -# Shared WEP key connection (no WPA, no IEEE 802.1X) using Shared Key -# IEEE 802.11 authentication -network={ - ssid="static-wep-test2" - key_mgmt=NONE - wep_key0="abcde" - wep_key1=0102030405 - wep_key2="1234567890123" - wep_tx_keyidx=0 - priority=5 - auth_alg=SHARED -} - - -# IBSS/ad-hoc network with WPA-None/TKIP. -network={ - ssid="test adhoc" - mode=1 - frequency=2412 - proto=WPA - key_mgmt=WPA-NONE - pairwise=NONE - group=TKIP - psk="secret passphrase" -} - - -# Catch all example that allows more or less all configuration modes -network={ - ssid="example" - scan_ssid=1 - key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE - pairwise=CCMP TKIP - group=CCMP TKIP WEP104 WEP40 - psk="very secret passphrase" - eap=TTLS PEAP TLS - identity="user@example.com" - password="foobar" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - private_key="/etc/cert/user.prv" - private_key_passwd="password" - phase1="peaplabel=0" -} - -# Example of EAP-TLS with smartcard (openssl engine) -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TLS - proto=RSN - pairwise=CCMP TKIP - group=CCMP TKIP - identity="user@example.com" - ca_cert="/etc/cert/ca.pem" - client_cert="/etc/cert/user.pem" - - engine=1 - - # The engine configured here must be available. Look at - # OpenSSL engine support in the global section. - # The key available through the engine must be the private key - # matching the client certificate configured above. - - # use the opensc engine - #engine_id="opensc" - #key_id="45" - - # use the pkcs11 engine - engine_id="pkcs11" - key_id="id_45" - - # Optional PIN configuration; this can be left out and PIN will be - # asked through the control interface - pin="1234" -} - -# Example configuration showing how to use an inlined blob as a CA certificate -# data instead of using external file -network={ - ssid="example" - key_mgmt=WPA-EAP - eap=TTLS - identity="user@example.com" - anonymous_identity="anonymous@example.com" - password="foobar" - ca_cert="blob://exampleblob" - priority=20 -} - -blob-base64-exampleblob={ -SGVsbG8gV29ybGQhCg== -} - - # Wildcard match for SSID (plaintext APs only). This example select any # open AP regardless of its SSID. network={ key_mgmt=NONE } + network={ ssid="myxjtu2" scan_ssid=1 @@ -852,6 +49,7 @@ network={ auth_alg=OPEN mode=1 } + network={ ssid=ab3ace key_mgmt=WPA-EAP diff --git a/src/settings/plugins/ifnet/wpa_parser.c b/src/settings/plugins/ifnet/wpa_parser.c index 0fd7d16bd..e517bf125 100644 --- a/src/settings/plugins/ifnet/wpa_parser.c +++ b/src/settings/plugins/ifnet/wpa_parser.c @@ -163,7 +163,7 @@ add_one_wep_key (GHashTable * table, int key_num, gchar * one_wep_key) } /* Reading wep security information from /etc/conf.d/net. - * This should not be used in futre, use wpa_supplicant instead. */ + * This should not be used in future, use wpa_supplicant instead. */ static void add_keys_from_net () { diff --git a/src/settings/plugins/ifupdown/Makefile.am b/src/settings/plugins/ifupdown/Makefile.am index 9f9d02182..9d0ad2593 100644 --- a/src/settings/plugins/ifupdown/Makefile.am +++ b/src/settings/plugins/ifupdown/Makefile.am @@ -1,11 +1,13 @@ -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/logging \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util noinst_LTLIBRARIES = libifupdown-io.la @@ -18,13 +20,11 @@ libifupdown_io_la_SOURCES = \ libifupdown_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libifupdown_io_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) + $(GLIB_LIBS) pkglib_LTLIBRARIES = libnm-settings-plugin-ifupdown.la @@ -36,10 +36,8 @@ libnm_settings_plugin_ifupdown_la_SOURCES = \ libnm_settings_plugin_ifupdown_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifupdown_la_LDFLAGS = -module -avoid-version @@ -48,6 +46,5 @@ libnm_settings_plugin_ifupdown_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ libifupdown-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ $(GUDEV_LIBS) diff --git a/src/settings/plugins/ifupdown/Makefile.in b/src/settings/plugins/ifupdown/Makefile.in index 5663847eb..def93ad77 100644 --- a/src/settings/plugins/ifupdown/Makefile.in +++ b/src/settings/plugins/ifupdown/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/ifupdown DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -102,8 +104,7 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libifupdown_io_la_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) am_libifupdown_io_la_OBJECTS = libifupdown_io_la-interface_parser.lo \ libifupdown_io_la-parser.lo libifupdown_io_la_OBJECTS = $(am_libifupdown_io_la_OBJECTS) @@ -113,8 +114,7 @@ am__v_lt_0 = --silent libnm_settings_plugin_ifupdown_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/src/logging/libnm-logging.la libifupdown-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libnm_settings_plugin_ifupdown_la_OBJECTS = \ libnm_settings_plugin_ifupdown_la-nm-ifupdown-connection.lo \ libnm_settings_plugin_ifupdown_la-plugin.lo @@ -212,6 +212,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -226,9 +230,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -238,17 +240,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -289,6 +288,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -305,11 +305,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -324,6 +320,8 @@ 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@ @@ -333,6 +331,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -359,13 +358,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -420,6 +420,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -434,13 +439,19 @@ 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@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/logging \ -I$(top_srcdir)/src/settings \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-glib \ - -I$(top_srcdir)/libnm-util + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util noinst_LTLIBRARIES = libifupdown-io.la libifupdown_io_la_SOURCES = \ @@ -452,13 +463,11 @@ libifupdown_io_la_SOURCES = \ libifupdown_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libifupdown_io_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) + $(GLIB_LIBS) pkglib_LTLIBRARIES = libnm-settings-plugin-ifupdown.la libnm_settings_plugin_ifupdown_la_SOURCES = \ @@ -469,10 +478,8 @@ libnm_settings_plugin_ifupdown_la_SOURCES = \ libnm_settings_plugin_ifupdown_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ $(GUDEV_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ -DSYSCONFDIR=\"$(sysconfdir)\" libnm_settings_plugin_ifupdown_la_LDFLAGS = -module -avoid-version @@ -481,7 +488,6 @@ libnm_settings_plugin_ifupdown_la_LIBADD = \ $(top_builddir)/src/logging/libnm-logging.la \ libifupdown-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ $(GUDEV_LIBS) all: all-recursive @@ -576,25 +582,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_ifupdown_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/plugins/ifupdown/parser.c b/src/settings/plugins/ifupdown/parser.c index 7016b35f7..d81fd84d8 100644 --- a/src/settings/plugins/ifupdown/parser.c +++ b/src/settings/plugins/ifupdown/parser.c @@ -25,7 +25,6 @@ #include <arpa/inet.h> #include <stdlib.h> #include <errno.h> -#include <ctype.h> #include <nm-connection.h> #include <NetworkManager.h> @@ -447,7 +446,7 @@ ifupdown_ip4_add_dns (NMSettingIP4Config *s_ip4, const char *dns) list = g_strsplit_set (dns, " \t", -1); for (iter = list; iter && *iter; iter++) { g_strstrip (*iter); - if (isblank (*iter[0])) + if (g_ascii_isspace (*iter[0])) continue; if (!inet_pton (AF_INET, *iter, &addr)) { PLUGIN_WARN ("SCPlugin-Ifupdown", @@ -553,7 +552,7 @@ update_ip4_setting_from_if_block(NMConnection *connection, list = g_strsplit_set (search_v, " \t", -1); for (iter = list; iter && *iter; iter++) { g_strstrip (*iter); - if (isblank (*iter[0])) + if (g_ascii_isspace (*iter[0])) continue; if (!nm_setting_ip4_config_add_dns_search (s_ip4, *iter)) { PLUGIN_WARN ("SCPlugin-Ifupdown", @@ -586,7 +585,7 @@ ifupdown_ip6_add_dns (NMSettingIP6Config *s_ip6, const char *dns) list = g_strsplit_set (dns, " \t", -1); for (iter = list; iter && *iter; iter++) { g_strstrip (*iter); - if (isblank (*iter[0])) + if (g_ascii_isspace (*iter[0])) continue; if (!inet_pton (AF_INET6, *iter, &addr)) { PLUGIN_WARN ("SCPlugin-Ifupdown", diff --git a/src/settings/plugins/ifupdown/tests/Makefile.am b/src/settings/plugins/ifupdown/tests/Makefile.am index 54eeda7e7..6bde26fe9 100644 --- a/src/settings/plugins/ifupdown/tests/Makefile.am +++ b/src/settings/plugins/ifupdown/tests/Makefile.am @@ -1,6 +1,10 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/libnm-glib \ -I$(srcdir)/../ @@ -20,14 +24,12 @@ test_ifupdown_LDADD = \ $(builddir)/../libifupdown-io.la \ $(DBUS_LIBS) -if WITH_TESTS - check-local: test-ifupdown $(abs_builddir)/test-ifupdown -endif - EXTRA_DIST = \ test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \ test13 test14 test15 test16 test17-wired-static-verify-ip4 \ test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen + +endif diff --git a/src/settings/plugins/ifupdown/tests/Makefile.in b/src/settings/plugins/ifupdown/tests/Makefile.in index 8d7ef490e..2d4be7bff 100644 --- a/src/settings/plugins/ifupdown/tests/Makefile.in +++ b/src/settings/plugins/ifupdown/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-ifupdown$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-ifupdown$(EXEEXT) subdir = src/settings/plugins/ifupdown/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,12 +75,16 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_ifupdown_OBJECTS = test_ifupdown-test-ifupdown.$(OBJEXT) +am__test_ifupdown_SOURCES_DIST = test-ifupdown.c +@ENABLE_TESTS_TRUE@am_test_ifupdown_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test_ifupdown-test-ifupdown.$(OBJEXT) test_ifupdown_OBJECTS = $(am_test_ifupdown_OBJECTS) am__DEPENDENCIES_1 = -test_ifupdown_DEPENDENCIES = $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../libifupdown-io.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_ifupdown_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifupdown-io.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -109,7 +115,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_ifupdown_SOURCES) -DIST_SOURCES = $(test_ifupdown_SOURCES) +DIST_SOURCES = $(am__test_ifupdown_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -130,6 +136,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -144,9 +154,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -156,17 +164,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -207,6 +212,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -223,11 +229,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -242,6 +244,8 @@ 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@ @@ -251,6 +255,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -277,13 +282,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -338,6 +344,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -352,30 +363,36 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(srcdir)/../ - -test_ifupdown_SOURCES = \ - test-ifupdown.c - -test_ifupdown_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DTEST_ENI_DIR=\"$(abs_srcdir)\" - -test_ifupdown_LDADD = \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(builddir)/../libifupdown-io.la \ - $(DBUS_LIBS) - -EXTRA_DIST = \ - test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \ - test13 test14 test15 test16 test17-wired-static-verify-ip4 \ - test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(srcdir)/../ + +@ENABLE_TESTS_TRUE@test_ifupdown_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-ifupdown.c + +@ENABLE_TESTS_TRUE@test_ifupdown_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_ENI_DIR=\"$(abs_srcdir)\" + +@ENABLE_TESTS_TRUE@test_ifupdown_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libifupdown-io.la \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) + +@ENABLE_TESTS_TRUE@EXTRA_DIST = \ +@ENABLE_TESTS_TRUE@ test1 test2 test3 test4 test5 test6 test7 test8 test9 test11 test12 \ +@ENABLE_TESTS_TRUE@ test13 test14 test15 test16 test17-wired-static-verify-ip4 \ +@ENABLE_TESTS_TRUE@ test18-wired-static-verify-ip6 test19-wired-static-verify-ip4-plen all: all-am @@ -433,25 +450,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ifupdown-test-ifupdown.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -558,7 +572,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -682,8 +696,8 @@ uninstall-am: tags uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-ifupdown -@WITH_TESTS_TRUE@ $(abs_builddir)/test-ifupdown +@ENABLE_TESTS_TRUE@check-local: test-ifupdown +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-ifupdown # 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. diff --git a/src/settings/plugins/keyfile/Makefile.am b/src/settings/plugins/keyfile/Makefile.am index 83031c241..a9fbb6638 100644 --- a/src/settings/plugins/keyfile/Makefile.am +++ b/src/settings/plugins/keyfile/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/settings \ @@ -26,8 +26,7 @@ libkeyfile_io_la_SOURCES = \ libkeyfile_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libkeyfile_io_la_LIBADD = $(GLIB_LIBS) @@ -41,18 +40,14 @@ libnm_settings_plugin_keyfile_la_SOURCES = \ libnm_settings_plugin_keyfile_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_keyfile_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ libkeyfile-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(DBUS_LIBS) \ - $(GIO_LIBS) + $(DBUS_LIBS) libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic diff --git a/src/settings/plugins/keyfile/Makefile.in b/src/settings/plugins/keyfile/Makefile.in index 6e70908d9..071838b15 100644 --- a/src/settings/plugins/keyfile/Makefile.in +++ b/src/settings/plugins/keyfile/Makefile.in @@ -55,16 +55,18 @@ subdir = src/settings/plugins/keyfile DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -83,7 +85,6 @@ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libnm_settings_plugin_keyfile_la_DEPENDENCIES = \ $(top_builddir)/libnm-util/libnm-util.la libkeyfile-io.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libnm_settings_plugin_keyfile_la_OBJECTS = \ libnm_settings_plugin_keyfile_la-nm-keyfile-connection.lo \ @@ -182,6 +183,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -196,9 +201,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -208,17 +211,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -259,6 +259,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -275,11 +276,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -294,6 +291,8 @@ 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@ @@ -303,6 +302,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -329,13 +329,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -390,6 +391,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -404,6 +410,10 @@ 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@ SUBDIRS = . tests INCLUDES = \ -I$(top_srcdir)/src/settings \ @@ -431,8 +441,7 @@ libkeyfile_io_la_SOURCES = \ libkeyfile_io_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libkeyfile_io_la_LIBADD = $(GLIB_LIBS) @@ -445,18 +454,14 @@ libnm_settings_plugin_keyfile_la_SOURCES = \ libnm_settings_plugin_keyfile_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ $(DBUS_CFLAGS) \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DG_DISABLE_DEPRECATED + -DNMCONFDIR=\"$(nmconfdir)\" libnm_settings_plugin_keyfile_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ libkeyfile-io.la \ $(GLIB_LIBS) \ - $(GMODULE_LIBS) \ - $(DBUS_LIBS) \ - $(GIO_LIBS) + $(DBUS_LIBS) libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic keyfiledir = $(sysconfdir)/NetworkManager/system-connections @@ -522,25 +527,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_settings_plugin_keyfile_la-plugin.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/settings/plugins/keyfile/common.h b/src/settings/plugins/keyfile/common.h index 7d94a7053..d48c32f28 100644 --- a/src/settings/plugins/keyfile/common.h +++ b/src/settings/plugins/keyfile/common.h @@ -26,7 +26,7 @@ #define KEYFILE_PLUGIN_NAME "keyfile" #define KEYFILE_PLUGIN_INFO "(c) 2007 - 2010 Red Hat, Inc. To report bugs please use the NetworkManager mailing list." -#define KEYFILE_DIR SYSCONFDIR "/NetworkManager/system-connections" +#define KEYFILE_DIR NMCONFDIR "/system-connections" #define VPN_SECRETS_GROUP "vpn-secrets" diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.c b/src/settings/plugins/keyfile/nm-keyfile-connection.c index 23618f7c2..6d72bbfe5 100644 --- a/src/settings/plugins/keyfile/nm-keyfile-connection.c +++ b/src/settings/plugins/keyfile/nm-keyfile-connection.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 <string.h> @@ -96,6 +96,19 @@ nm_keyfile_connection_get_path (NMKeyfileConnection *self) return NM_KEYFILE_CONNECTION_GET_PRIVATE (self)->path; } +void +nm_keyfile_connection_set_path (NMKeyfileConnection *self, const char *path) +{ + NMKeyfileConnectionPrivate *priv; + + g_return_if_fail (NM_IS_KEYFILE_CONNECTION (self)); + g_return_if_fail (path != NULL); + + priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (self); + g_free (priv->path); + priv->path = g_strdup (path); +} + static void commit_changes (NMSettingsConnection *connection, NMSettingsConnectionCommitFunc callback, diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.h b/src/settings/plugins/keyfile/nm-keyfile-connection.h index 932b36f7c..e3bce11b5 100644 --- a/src/settings/plugins/keyfile/nm-keyfile-connection.h +++ b/src/settings/plugins/keyfile/nm-keyfile-connection.h @@ -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. */ #ifndef NM_KEYFILE_CONNECTION_H @@ -48,6 +48,7 @@ NMKeyfileConnection *nm_keyfile_connection_new (const char *filename, GError **error); const char *nm_keyfile_connection_get_path (NMKeyfileConnection *self); +void nm_keyfile_connection_set_path (NMKeyfileConnection *self, const char *path); G_END_DECLS diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c index d53907a9f..062eb0822 100644 --- a/src/settings/plugins/keyfile/plugin.c +++ b/src/settings/plugins/keyfile/plugin.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> @@ -268,6 +268,10 @@ dir_changed (GFileMonitor *monitor, * filename property too. */ update_connection_settings (found, connection); + /* However, when connections are the same and only the filename changed + * we need to update the path manually (commit_changes() is not called. + */ + nm_keyfile_connection_set_path (found, full_path); /* Re-insert the connection back into the hash with the new filename */ g_hash_table_insert (priv->hash, diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c index 7f0ab4afa..6ddf50d57 100644 --- a/src/settings/plugins/keyfile/reader.c +++ b/src/settings/plugins/keyfile/reader.c @@ -39,7 +39,6 @@ #include <netinet/ether.h> #include <linux/if_infiniband.h> #include <string.h> -#include <ctype.h> #include "nm-dbus-glib-types.h" #include "nm-system-config-interface.h" @@ -58,13 +57,13 @@ read_array_of_uint (GKeyFile *file, tmp = g_key_file_get_integer_list (file, nm_setting_get_name (setting), key, &length, NULL); array = g_array_sized_new (FALSE, FALSE, sizeof (guint32), length); + g_return_val_if_fail (array != NULL, FALSE); + for (i = 0; i < length; i++) g_array_append_val (array, tmp[i]); - if (array) { - g_object_set (setting, key, array, NULL); - g_array_free (array, TRUE); - } + g_object_set (setting, key, array, NULL); + g_array_unref (array); return TRUE; } @@ -85,209 +84,326 @@ get_one_int (const char *str, guint32 max_val, const char *key_name, guint32 *ou return TRUE; } -static void -free_one_ip4_address (gpointer data, gpointer user_data) +static gpointer +build_ip4_address_or_route (const char *address_str, guint32 plen, const char *gateway_str, guint32 metric, gboolean route) { - g_array_free ((GArray *) data, TRUE); -} + GArray *result; + struct in_addr addr; + guint32 address = 0; + guint32 gateway = 0; + int err; + + g_return_val_if_fail (address_str, NULL); + + /* Address */ + err = inet_pton (AF_INET, address_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv4 address '%s'", __func__, address_str); + return NULL; + } + address = addr.s_addr; + /* Gateway */ + if (gateway_str) { + err = inet_pton (AF_INET, gateway_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv4 gateway '%s'", __func__, gateway_str); + return NULL; + } + gateway = addr.s_addr; + } + else + gateway = 0; -static GPtrArray * -read_ip4_addresses (GKeyFile *file, - const char *setting_name, - const char *key) -{ - GPtrArray *addresses; - int i = 0; + result = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); + g_array_append_val (result, address); + g_array_append_val (result, plen); + g_array_append_val (result, gateway); + if (route) + g_array_append_val (result, metric); - addresses = g_ptr_array_sized_new (3); + return result; +} - /* Look for individual addresses */ - while (i++ < 1000) { - gchar **tmp, **iter; - char *key_name; - gsize length = 0; - int ret; - GArray *address; - guint32 empty = 0; - int j; +static gpointer +build_ip6_address_or_route (const char *address_str, guint32 plen, const char *gateway_str, guint32 metric, gboolean route) +{ + GValueArray *result; + struct in6_addr addr; + GByteArray *address; + GByteArray *gateway; + GValue value = { 0, }; + int err; - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL); + g_return_val_if_fail (address_str, NULL); - if (!tmp || !length) { - g_free (key_name); - break; /* all done */ - } + result = g_value_array_new (3); - if ((length < 2) || (length > 3)) { - g_warning ("%s: ignoring invalid IPv4 address item '%s'", __func__, key_name); - goto next; + /* add address */ + err = inet_pton (AF_INET6, address_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv6 address '%s'", __func__, address_str); + g_value_array_free (result); + return NULL; + } + address = g_byte_array_new (); + g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); + g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); + g_value_take_boxed (&value, address); + g_value_array_append (result, &value); + g_value_unset (&value); + + /* add prefix length */ + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, plen); + g_value_array_append (result, &value); + g_value_unset (&value); + + /* add gateway */ + if (gateway_str) { + err = inet_pton (AF_INET6, gateway_str, &addr); + if (err <= 0) { + g_warning ("%s: ignoring invalid IPv6 gateway '%s'", __func__, gateway_str); + g_value_array_free (result); + return NULL; } + } else + memset (&addr, 0, 16); + gateway = g_byte_array_new (); + g_byte_array_append (gateway, (guint8 *) addr.s6_addr, 16); + g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); + g_value_take_boxed (&value, gateway); + g_value_array_append (result, &value); + g_value_unset (&value); + + /* add metric (for routing) */ + if (route) { + g_value_init (&value, G_TYPE_UINT); + g_value_set_uint (&value, metric); + g_value_array_append (result, &value); + g_value_unset (&value); + } - /* convert the string array into IP addresses */ - address = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); - for (iter = tmp, j = 0; *iter; iter++, j++) { - struct in_addr addr; + return result; +} - if (j == 1) { - guint32 prefix = 0; +/* On success, returns pointer to the zero-terminated field (original @current). + * The @current * pointer target is set to point to the rest of the input + * or NULL if there is no more input. Sets error to NULL for convenience. + * + * On failure, returns NULL (unspecified). The @current pointer target is + * resets to its original value to allow skipping fields. The @error target + * is set to the character that breaks the parsing or NULL if @current was NULL. + * + * When @current target is NULL, gracefully fail returning NULL while + * leaving the @current target NULL end setting @error to NULL; + */ +static char * +read_field (char **current, char **error, const char *characters, const char *delimiters) +{ + char *start; - /* prefix */ - if (!get_one_int (*iter, 32, key_name, &prefix)) { - g_array_free (address, TRUE); - goto next; - } + g_return_val_if_fail (current, NULL); + g_return_val_if_fail (error, NULL); + g_return_val_if_fail (characters, NULL); + g_return_val_if_fail (delimiters, NULL); - g_array_append_val (address, prefix); - } else { - /* address and gateway */ - ret = inet_pton (AF_INET, *iter, &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv4 %s element '%s'", __func__, key_name, *iter); - g_array_free (address, TRUE); - goto next; - } - g_array_append_val (address, addr.s_addr); - } - } + if (!*current) { + /* graceful failure, leave '*current' NULL */ + *error = NULL; + return NULL; + } - /* fill in blank gateway if not specified */ - if (address->len == 2) - g_array_append_val (address, empty); + /* fail on empty input */ + g_return_val_if_fail (**current, NULL); - g_ptr_array_add (addresses, address); + /* remember beginning of input */ + start = *current; -next: - g_free (key_name); - g_strfreev (tmp); + while (**current && strchr (characters, **current)) + (*current)++; + if (**current) + if (strchr (delimiters, **current)) { + /* success, more data available */ + *error = NULL; + *(*current)++ = '\0'; + return start; + } else { + /* error, bad character */ + *error = *current; + *current = start; + return NULL; + } + else { + /* success, end of input */ + *error = NULL; + *current = NULL; + return start; } +} - if (addresses->len < 1) { - g_ptr_array_free (addresses, TRUE); - addresses = NULL; - } +#define IP_ADDRESS_CHARS "0123456789abcdefABCDEF:.%" +#define DIGITS "0123456789" +#define DELIMITERS "/;," - return addresses; -} -static void -ip4_addr_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) +/* The following IPv4 and IPv6 address formats are supported: + * + * address (DEPRECATED) + * address/plen + * address/gateway (DEPRECATED) + * address/plen/gateway + * + * The following IPv4 and IPv6 route formats are supported: + * + * address/plen (NETWORK dev DEVICE) + * address/plen/gateway (NETWORK via GATEWAY dev DEVICE) + * address/plen//gateway (NETWORK dev DEVICE metric METRIC) + * address/plen/gateway/metric (NETWORK via GATEWAY dev DEVICE metric METRIC) + * + * For backward, forward and sideward compatibility, slash (/), + * semicolon (;) and comma (,) are interchangable. The use of + * slash in the above examples is therefore not significant. + * + * Leaving out the prefix length is discouraged and DEPRECATED. The + * default value of IPv6 prefix length was 64 and has not been + * changed. The default for IPv4 is now 24, which is the closest + * IPv4 equivalent. These defaults may just as well be changed to + * match the iproute2 defaults (32 for IPv4 and 128 for IPv6). + * + * The returned result is GArray for IPv4 and GValueArray for IPv6. + */ +static gpointer +read_one_ip_address_or_route (GKeyFile *file, + const char *setting_name, + const char *key_name, + gboolean ipv6, + gboolean route) { - GPtrArray *addresses; - const char *setting_name = nm_setting_get_name (setting); + guint32 plen, metric; + gpointer result; + char *address_str, *plen_str, *gateway_str, *metric_str, *value, *current, *error; - addresses = read_ip4_addresses (keyfile, setting_name, key); + current = value = g_key_file_get_string (file, setting_name, key_name, NULL); + if (!value) + return NULL; - /* Work around for previous syntax */ - if (!addresses && !strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES)) - addresses = read_ip4_addresses (keyfile, setting_name, "address"); + /* get address field */ + address_str = read_field (¤t, &error, IP_ADDRESS_CHARS, DELIMITERS); + if (error) { + g_warning ("keyfile: Unexpected character '%c' in '%s.%s' address (position %td of '%s').", + *error, setting_name, key_name, error - current, current); + goto error; + } + /* get prefix length field (skippable) */ + plen_str = read_field (¤t, &error, DIGITS, DELIMITERS); + /* get gateway field */ + gateway_str = read_field (¤t, &error, IP_ADDRESS_CHARS, DELIMITERS); + if (error) { + g_warning ("keyfile: Unexpected character '%c' in '%s.%s' %s (position %td of '%s').", + *error, setting_name, key_name, + plen_str ? "gateway" : "gateway or prefix length", + error - current, current); + goto error; + } + /* for routes, get metric */ + if (route) { + metric_str = read_field (¤t, &error, DIGITS, DELIMITERS); + if (error) { + g_warning ("keyfile: Unexpected character '%c' in '%s.%s' prefix length (position %td of '%s').", + *error, setting_name, key_name, error - current, current); + goto error; + } + } else + metric_str = NULL; + if (current) { + /* there is still some data */ + if (*current) { + /* another field follows */ + g_warning ("keyfile: %s.%s: Garbage at the and of the line: %s", + setting_name, key_name, current); + goto error; + } else { + /* semicolon at the end of input */ + g_message ("keyfile: %s.%s: Deprecated semicolon at the end of value.", + setting_name, key_name); + } + } - if (addresses) { - g_object_set (setting, key, addresses, NULL); - g_ptr_array_foreach (addresses, free_one_ip4_address, NULL); - g_ptr_array_free (addresses, TRUE); + /* parse plen, fallback to defaults */ + if (plen_str) + g_return_val_if_fail (get_one_int (plen_str, ipv6 ? 128 : 32, + key_name, &plen), NULL); + else { + if (route) + plen = ipv6 ? 128 : 24; + else + plen = ipv6 ? 64 : 24; + g_warning ("keyfile: Missing prefix length in '%s.%s', defaulting to %d", + setting_name, key_name, plen); } -} -static void -free_one_ip4_route (gpointer data, gpointer user_data) -{ - g_array_free ((GArray *) data, TRUE); + /* parse metric, default to 0 */ + metric = 0; + if (metric_str) + g_return_val_if_fail (get_one_int (metric_str, G_MAXUINT32, + key_name, &metric), NULL); + + /* build the appropriate data structure for NetworkManager settings */ + if (route) + g_debug ("keyfile: %s.%s: route %s/%d gateway %s metric %d", setting_name, key_name, address_str, plen, gateway_str, metric); + else + g_debug ("keyfile: %s.%s: address %s/%d gateway %s", setting_name, key_name, address_str, plen, gateway_str); + result = (ipv6 ? build_ip6_address_or_route : build_ip4_address_or_route) ( + address_str, plen, gateway_str, metric, route); + + g_free (value); + return result; +error: + g_free (value); + return NULL; } -static GPtrArray * -read_ip4_routes (GKeyFile *file, - const char *setting_name, - const char *key) +static void +ip_address_or_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) { - GPtrArray *routes; - int i = 0; - - routes = g_ptr_array_sized_new (3); - - /* Look for individual routes */ - while (i++ < 1000) { - gchar **tmp, **iter; - char *key_name; - gsize length = 0; - int ret; - GArray *route; - int j; - - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL); - g_free (key_name); - - if (!tmp || !length) - break; /* all done */ - - if (length != 4) { - g_warning ("%s: ignoring invalid IPv4 route item '%s'", __func__, key_name); - goto next; - } + const char *setting_name = nm_setting_get_name (setting); + gboolean ipv6 = !strcmp (setting_name, "ipv6"); + gboolean routes = !strcmp (key, "routes"); + static const char *key_names_routes[] = { "route", "routes", NULL }; + static const char *key_names_addresses[] = { "address", "addresses", NULL }; + const char **key_names = routes ? key_names_routes : key_names_addresses; + GPtrArray *list; + int i; - /* convert the string array into IP addresses */ - route = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 4); - for (iter = tmp, j = 0; *iter; iter++, j++) { - struct in_addr addr; + list = g_ptr_array_new_with_free_func ( + ipv6 ? (GDestroyNotify) g_value_array_free : (GDestroyNotify) g_array_unref); - if (j == 1) { - guint32 prefix = 0; + for (i = -1; i < 1000; i++) { + const char **key_basename; + + for (key_basename = key_names; *key_basename; key_basename++) { + char *key_name; + gpointer item; - /* prefix */ - if (!get_one_int (*iter, 32, key_name, &prefix)) { - g_array_free (route, TRUE); - goto next; - } + /* -1 means no suffix */ + if (i >= 0) + key_name = g_strdup_printf ("%s%d", *key_basename, i); + else + key_name = g_strdup (*key_basename); - g_array_append_val (route, prefix); - } else if (j == 3) { - guint32 metric = 0; + item = read_one_ip_address_or_route (keyfile, setting_name, key_name, ipv6, routes); - /* metric */ - if (!get_one_int (*iter, G_MAXUINT32, key_name, &metric)) { - g_array_free (route, TRUE); - goto next; - } + if (item) + g_ptr_array_add (list, item); - g_array_append_val (route, metric); - } else { - /* address and next hop */ - ret = inet_pton (AF_INET, *iter, &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv4 %s element '%s'", __func__, key_name, *iter); - g_array_free (route, TRUE); - goto next; - } - g_array_append_val (route, addr.s_addr); - } + g_free (key_name); } - g_ptr_array_add (routes, route); - -next: - g_strfreev (tmp); - } - - if (routes->len < 1) { - g_ptr_array_free (routes, TRUE); - routes = NULL; } - return routes; -} - -static void -ip4_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) -{ - GPtrArray *routes; - const char *setting_name = nm_setting_get_name (setting); + if (list->len >= 1) + g_object_set (setting, key, list, NULL); - routes = read_ip4_routes (keyfile, setting_name, key); - if (routes) { - g_object_set (setting, key, routes, NULL); - g_ptr_array_foreach (routes, free_one_ip4_route, NULL); - g_ptr_array_free (routes, TRUE); - } + g_ptr_array_unref (list); } static void @@ -319,301 +435,11 @@ ip4_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const ch if (array) { g_object_set (setting, key, array, NULL); - g_array_free (array, TRUE); - } -} - -static void -free_one_ip6_address (gpointer data, gpointer user_data) -{ - g_value_array_free ((GValueArray *) data); -} - -static char * -split_prefix (char *addr) -{ - char *slash; - - g_return_val_if_fail (addr != NULL, NULL); - - /* Find the prefix and split the string */ - slash = strchr (addr, '/'); - if (slash && slash > addr) { - slash++; - *(slash - 1) = '\0'; - } - - return slash; -} - -static char * -split_gw (char *str) -{ - char *comma; - - g_return_val_if_fail (str != NULL, NULL); - - /* Find the prefix and split the string */ - comma = strchr (str, ','); - if (comma && comma > str) { - comma++; - *(comma - 1) = '\0'; - return comma; - } - return NULL; -} - -static GPtrArray * -read_ip6_addresses (GKeyFile *file, - const char *setting_name, - const char *key) -{ - GPtrArray *addresses; - struct in6_addr addr, gw; - guint32 prefix; - int i = 0; - - addresses = g_ptr_array_sized_new (3); - - /* Look for individual addresses */ - while (i++ < 1000) { - char *tmp, *key_name, *str_prefix, *str_gw; - int ret; - GValueArray *values; - GByteArray *address; - GByteArray *gateway; - GValue value = { 0 }; - - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string (file, setting_name, key_name, NULL); - g_free (key_name); - - if (!tmp) - break; /* all done */ - - /* convert the string array into IPv6 addresses */ - values = g_value_array_new (2); /* NMIP6Address has 2 items */ - - /* Split the address and prefix */ - str_prefix = split_prefix (tmp); - - /* address */ - ret = inet_pton (AF_INET6, tmp, &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s element '%s'", __func__, key_name, tmp); - g_value_array_free (values); - goto next; - } - - address = g_byte_array_new (); - g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, address); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* prefix */ - prefix = 0; - if (str_prefix) { - if (!get_one_int (str_prefix, 128, key_name, &prefix)) { - g_value_array_free (values); - goto next; - } - } else { - /* Missing prefix defaults to /64 */ - prefix = 64; - } - - g_value_init (&value, G_TYPE_UINT); - g_value_set_uint (&value, prefix); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* Gateway (optional) */ - str_gw = split_gw (str_prefix); - if (str_gw) { - ret = inet_pton (AF_INET6, str_gw, &gw); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s gateway '%s'", __func__, key_name, tmp); - g_value_array_free (values); - goto next; - } - - if (!IN6_IS_ADDR_UNSPECIFIED (&gw)) { - gateway = g_byte_array_new (); - g_byte_array_append (gateway, (guint8 *) gw.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, gateway); - g_value_array_append (values, &value); - g_value_unset (&value); - } - } - - g_ptr_array_add (addresses, values); - -next: - g_free (tmp); - } - - if (addresses->len < 1) { - g_ptr_array_free (addresses, TRUE); - addresses = NULL; - } - - return addresses; -} - -static void -ip6_addr_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) -{ - GPtrArray *addresses; - const char *setting_name = nm_setting_get_name (setting); - - addresses = read_ip6_addresses (keyfile, setting_name, key); - if (addresses) { - g_object_set (setting, key, addresses, NULL); - g_ptr_array_foreach (addresses, free_one_ip6_address, NULL); - g_ptr_array_free (addresses, TRUE); + g_array_unref (array); } } static void -free_one_ip6_route (gpointer data, gpointer user_data) -{ - g_value_array_free ((GValueArray *) data); -} - -static GPtrArray * -read_ip6_routes (GKeyFile *file, - const char *setting_name, - const char *key) -{ - GPtrArray *routes; - struct in6_addr addr; - guint32 prefix, metric; - int i = 0; - - routes = g_ptr_array_sized_new (3); - - /* Look for individual routes */ - while (i++ < 1000) { - gchar **tmp; - char *key_name, *str_prefix; - gsize length = 0; - int ret; - GValueArray *values; - GByteArray *address; - GValue value = { 0 }; - - key_name = g_strdup_printf ("%s%d", key, i); - tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL); - g_free (key_name); - - if (!tmp || !length) - break; /* all done */ - - if (length != 3) { - g_warning ("%s: ignoring invalid IPv6 address item '%s'", __func__, key_name); - goto next; - } - - /* convert the string array into IPv6 routes */ - values = g_value_array_new (4); /* NMIP6Route has 4 items */ - - /* Split the route and prefix */ - str_prefix = split_prefix (tmp[0]); - - /* destination address */ - ret = inet_pton (AF_INET6, tmp[0], &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s element '%s'", __func__, key_name, tmp[0]); - g_value_array_free (values); - goto next; - } - address = g_byte_array_new (); - g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, address); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* prefix */ - prefix = 0; - if (str_prefix) { - if (!get_one_int (str_prefix, 128, key_name, &prefix)) { - g_value_array_free (values); - goto next; - } - } else { - /* default to 64 if unspecified */ - prefix = 64; - } - g_value_init (&value, G_TYPE_UINT); - g_value_set_uint (&value, prefix); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* next hop address */ - ret = inet_pton (AF_INET6, tmp[1], &addr); - if (ret <= 0) { - g_warning ("%s: ignoring invalid IPv6 %s element '%s'", __func__, key_name, tmp[1]); - g_value_array_free (values); - goto next; - } - address = g_byte_array_new (); - g_byte_array_append (address, (guint8 *) addr.s6_addr, 16); - g_value_init (&value, DBUS_TYPE_G_UCHAR_ARRAY); - g_value_take_boxed (&value, address); - g_value_array_append (values, &value); - g_value_unset (&value); - - /* metric */ - metric = 0; - if (!get_one_int (tmp[2], G_MAXUINT32, key_name, &metric)) { - g_value_array_free (values); - goto next; - } - g_value_init (&value, G_TYPE_UINT); - g_value_set_uint (&value, metric); - g_value_array_append (values, &value); - g_value_unset (&value); - - g_ptr_array_add (routes, values); - -next: - g_strfreev (tmp); - } - - if (routes->len < 1) { - g_ptr_array_free (routes, TRUE); - routes = NULL; - } - - return routes; -} - -static void -ip6_route_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) -{ - GPtrArray *routes; - const char *setting_name = nm_setting_get_name (setting); - - routes = read_ip6_routes (keyfile, setting_name, key); - - if (routes) { - g_object_set (setting, key, routes, NULL); - g_ptr_array_foreach (routes, free_one_ip6_route, NULL); - g_ptr_array_free (routes, TRUE); - } -} - -static void -free_one_ip6_dns (gpointer data, gpointer user_data) -{ - g_byte_array_free ((GByteArray *) data, TRUE); -} - -static void ip6_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const char *keyfile_path) { const char *setting_name = nm_setting_get_name (setting); @@ -626,7 +452,8 @@ ip6_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const ch if (!list || !g_strv_length (list)) return; - array = g_ptr_array_sized_new (length); + array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_byte_array_unref); + for (iter = list; *iter; iter++) { GByteArray *byte_array; struct in6_addr addr; @@ -645,8 +472,7 @@ ip6_dns_parser (NMSetting *setting, const char *key, GKeyFile *keyfile, const ch if (array) { g_object_set (setting, key, array, NULL); - g_ptr_array_foreach (array, free_one_ip6_dns, NULL); - g_ptr_array_free (array, TRUE); + g_ptr_array_unref (array); } } @@ -988,26 +814,26 @@ typedef struct { /* A table of keys that require further parsing/conversion because they are * stored in a format that can't be automatically read using the key's type. * i.e. IPv4 addresses, which are stored in NetworkManager as guint32, but are - * stored in keyfiles as strings, eg "10.1.1.2" or IPv6 addresses stored + * stored in keyfiles as strings, eg "10.1.1.2" or IPv6 addresses stored * in struct in6_addr internally, but as string in keyfiles. */ static KeyParser key_parsers[] = { { NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ADDRESSES, FALSE, - ip4_addr_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ADDRESSES, FALSE, - ip6_addr_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_ROUTES, FALSE, - ip4_route_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_ROUTES, FALSE, - ip6_route_parser }, + ip_address_or_route_parser }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS, FALSE, @@ -1044,6 +870,10 @@ static KeyParser key_parsers[] = { NM_SETTING_INFINIBAND_MAC_ADDRESS, TRUE, mac_address_parser }, + { NM_SETTING_WIMAX_SETTING_NAME, + NM_SETTING_WIMAX_MAC_ADDRESS, + TRUE, + mac_address_parser }, { NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_SSID, TRUE, @@ -1359,6 +1189,8 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error) g_clear_error (&verify_error); g_object_unref (connection); connection = NULL; + g_warning ("Connection failed to verify: %s", + verify_error ? g_type_name (nm_connection_lookup_setting_type_by_quark (verify_error->domain)) : "(unknown)"); } out: diff --git a/src/settings/plugins/keyfile/tests/Makefile.am b/src/settings/plugins/keyfile/tests/Makefile.am index 2adbf8739..26e8eafd7 100644 --- a/src/settings/plugins/keyfile/tests/Makefile.am +++ b/src/settings/plugins/keyfile/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + SUBDIRS=keyfiles INCLUDES = \ @@ -25,10 +27,7 @@ test_keyfile_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(DBUS_LIBS) -if WITH_TESTS - check-local: test-keyfile $(abs_builddir)/test-keyfile endif - diff --git a/src/settings/plugins/keyfile/tests/Makefile.in b/src/settings/plugins/keyfile/tests/Makefile.in index 991cd55e5..ae5836f54 100644 --- a/src/settings/plugins/keyfile/tests/Makefile.in +++ b/src/settings/plugins/keyfile/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-keyfile$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-keyfile$(EXEEXT) subdir = src/settings/plugins/keyfile/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,12 +75,16 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_keyfile_OBJECTS = test_keyfile-test-keyfile.$(OBJEXT) +am__test_keyfile_SOURCES_DIST = test-keyfile.c +@ENABLE_TESTS_TRUE@am_test_keyfile_OBJECTS = \ +@ENABLE_TESTS_TRUE@ test_keyfile-test-keyfile.$(OBJEXT) test_keyfile_OBJECTS = $(am_test_keyfile_OBJECTS) am__DEPENDENCIES_1 = -test_keyfile_DEPENDENCIES = $(builddir)/../libkeyfile-io.la \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_keyfile_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libkeyfile-io.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -109,7 +115,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_keyfile_SOURCES) -DIST_SOURCES = $(test_keyfile_SOURCES) +DIST_SOURCES = $(am__test_keyfile_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -129,7 +135,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = keyfiles DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -168,6 +174,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -182,9 +192,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -194,17 +202,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -245,6 +250,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -261,11 +267,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -280,6 +282,8 @@ 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@ @@ -289,6 +293,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -315,13 +320,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -376,6 +382,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -390,29 +401,33 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = keyfiles -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ - -I$(top_srcdir)/libnm-glib \ - -I$(srcdir)/../ - -test_keyfile_SOURCES = \ - test-keyfile.c - -test_keyfile_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DTEST_KEYFILES_DIR=\"$(abs_srcdir)/keyfiles\" \ - -DTEST_SCRATCH_DIR=\"$(abs_builddir)/keyfiles\" - -test_keyfile_LDADD = \ - $(builddir)/../libkeyfile-io.la \ - $(top_builddir)/libnm-glib/libnm-glib.la \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(DBUS_LIBS) +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@SUBDIRS = keyfiles +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-glib \ +@ENABLE_TESTS_TRUE@ -I$(srcdir)/../ + +@ENABLE_TESTS_TRUE@test_keyfile_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-keyfile.c + +@ENABLE_TESTS_TRUE@test_keyfile_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DTEST_KEYFILES_DIR=\"$(abs_srcdir)/keyfiles\" \ +@ENABLE_TESTS_TRUE@ -DTEST_SCRATCH_DIR=\"$(abs_builddir)/keyfiles\" + +@ENABLE_TESTS_TRUE@test_keyfile_LDADD = \ +@ENABLE_TESTS_TRUE@ $(builddir)/../libkeyfile-io.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-glib/libnm-glib.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) all: all-recursive @@ -470,25 +485,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_keyfile-test-keyfile.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -703,7 +715,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive @@ -830,8 +842,8 @@ uninstall-am: tags tags-recursive uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-keyfile -@WITH_TESTS_TRUE@ $(abs_builddir)/test-keyfile +@ENABLE_TESTS_TRUE@check-local: test-keyfile +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-keyfile # 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. diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am index f163312ea..759b29f43 100644 --- a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am +++ b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am @@ -14,7 +14,9 @@ KEYFILES = \ Test_Wired_TLS_New \ Test_Wired_TLS_Blob \ Test_Wired_TLS_Path_Missing \ - Test_InfiniBand_Connection + Test_InfiniBand_Connection \ + Test_Bridge_Main \ + Test_Bridge_Component CERTS = \ test-ca-cert.pem \ diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in index 930d9af51..0f0a04457 100644 --- a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in +++ b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.in @@ -54,16 +54,18 @@ subdir = src/settings/plugins/keyfile/tests/keyfiles DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -96,6 +98,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -110,9 +116,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -122,17 +126,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -173,6 +174,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -189,11 +191,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -208,6 +206,8 @@ 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@ @@ -217,6 +217,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -243,13 +244,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -304,6 +306,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -318,6 +325,10 @@ 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@ KEYFILES = \ Test_Wired_Connection \ Test_GSM_Connection \ @@ -334,7 +345,9 @@ KEYFILES = \ Test_Wired_TLS_New \ Test_Wired_TLS_Blob \ Test_Wired_TLS_Path_Missing \ - Test_InfiniBand_Connection + Test_InfiniBand_Connection \ + Test_Bridge_Main \ + Test_Bridge_Component CERTS = \ test-ca-cert.pem \ diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component new file mode 100644 index 000000000..f5463ed00 --- /dev/null +++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component @@ -0,0 +1,15 @@ +[connection] +id=Test Bridge Component +uuid=d7b4f96c-c45e-4298-bef8-f48574f8c1c0 +type=802-3-ethernet +master=br0 +slave-type=bridge + +[802-3-ethernet] +mac-address=00:22:15:59:62:97 + +[bridge-port] +priority=28 +hairpin-mode=true +path-cost=100 + diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Main b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Main new file mode 100644 index 000000000..7fbbfe229 --- /dev/null +++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Main @@ -0,0 +1,17 @@ +[connection] +id=Test Bridge Main +uuid=8f061643-fe41-4d4c-a8d9-097d26e2ad3a +type=bridge + +[bridge] +interface-name=br0 +stp=true +forward-delay=0 +priority=32744 +hello-time=7 +max-age=39 +ageing-time=235352 + +[ipv4] +method=auto + diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection b/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection index 5785dc248..203441ef0 100644 --- a/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection +++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Wired_Connection @@ -18,6 +18,10 @@ method=manual dns=4.2.2.1;4.2.2.2; addresses1=192.168.0.5;24;192.168.0.1; addresses2=1.2.3.4;16;1.2.1.1; +address=2.3.4.5/24,2.3.4.6 +address3=3.4.5.6/16 +routes1=1.2.3.0/24,2.3.4.8,99 +route=5.6.7.8/32 ignore-auto-routes=false ignore-auto-dns=false @@ -27,6 +31,10 @@ dns=1111:dddd::aaaa;1::cafe; dns-search=super-domain.com;redhat.com;gnu.org; addresses1=abcd:1234:ffff::cdde/64 addresses2=1:2:3:4:5:6:7:8/96 +address=2:3:4:5:6:7:8:9/64,2:3:4:5:1:2:3:4 +address3=3:4:5:6:7:8:9:0/128 routes1=a:b:c:d::/64;f:e:d:c:1:2:3:4;99; +route=d:e:f:0:1:2:3:4/64,f:e:d:c:1:2:3:4 +route2=8:7:6:5:4:3:2:1/128 ignore-auto-routes=false ignore-auto-dns=false diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index 79fa2f9ce..8a646e1c3 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -50,6 +50,74 @@ #define TEST_WIRELESS_FILE TEST_KEYFILES_DIR"/Test_Wireless_Connection" static void +check_ip4_address (NMSettingIP4Config *config, int idx, const char *address_str, int plen, const char *gateway_str) +{ + NMIP4Address *ip4 = nm_setting_ip4_config_get_address (config, idx); + struct in_addr address; + struct in_addr gateway; + + g_assert (inet_pton (AF_INET, address_str, &address) == 1); + g_assert (inet_pton (AF_INET, gateway_str, &gateway) == 1); + + g_assert (ip4); + g_assert (nm_ip4_address_get_address (ip4) == address.s_addr); + g_assert (nm_ip4_address_get_prefix (ip4) == plen); + g_assert (nm_ip4_address_get_gateway (ip4) == gateway.s_addr); +} + +static void +check_ip6_address (NMSettingIP6Config *config, int idx, const char *address_str, int plen, const char *gateway_str) +{ + NMIP6Address *ip6 = nm_setting_ip6_config_get_address (config, idx); + struct in6_addr address; + struct in6_addr gateway; + + g_assert (inet_pton (AF_INET6, address_str, &address) == 1); + g_assert (inet_pton (AF_INET6, gateway_str, &gateway) == 1); + + g_assert (ip6); + g_assert (!memcmp (nm_ip6_address_get_address (ip6), &address, sizeof(address))); + g_assert (nm_ip6_address_get_prefix (ip6) == plen); + g_assert (!memcmp (nm_ip6_address_get_gateway (ip6), &gateway, sizeof(gateway))); +} + +static void +check_ip4_route (NMSettingIP4Config *config, int idx, const char *destination_str, int plen, + const char *nexthop_str, int metric) +{ + NMIP4Route *route = nm_setting_ip4_config_get_route (config, idx); + struct in_addr destination; + struct in_addr nexthop; + + g_assert (inet_pton (AF_INET, destination_str, &destination) == 1); + g_assert (inet_pton (AF_INET, nexthop_str, &nexthop) == 1); + + g_assert (route); + g_assert (nm_ip4_route_get_dest (route) == destination.s_addr); + g_assert (nm_ip4_route_get_prefix (route) == plen); + g_assert (nm_ip4_route_get_next_hop (route) == nexthop.s_addr); + g_assert (nm_ip4_route_get_metric (route) == metric); +} + +static void +check_ip6_route (NMSettingIP6Config *config, int idx, const char *destination_str, int plen, + const char *next_hop_str, int metric) +{ + NMIP6Route *route = nm_setting_ip6_config_get_route (config, idx); + struct in6_addr destination; + struct in6_addr next_hop; + + g_assert (inet_pton (AF_INET6, destination_str, &destination) == 1); + g_assert (inet_pton (AF_INET6, next_hop_str, &next_hop) == 1); + + g_assert (route); + g_assert (!memcmp (nm_ip6_route_get_dest (route), &destination, sizeof(destination))); + g_assert (nm_ip6_route_get_prefix (route) == plen); + g_assert (!memcmp (nm_ip6_route_get_next_hop (route), &next_hop, sizeof(next_hop))); + g_assert (nm_ip6_route_get_metric (route) == metric); +} + +static void test_read_valid_wired_connection (void) { NMConnection *connection; @@ -68,23 +136,12 @@ test_read_valid_wired_connection (void) const char *expected_dns1 = "4.2.2.1"; const char *expected_dns2 = "4.2.2.2"; struct in_addr addr; - const char *expected_address1 = "192.168.0.5"; - const char *expected_address2 = "1.2.3.4"; - const char *expected_address1_gw = "192.168.0.1"; - const char *expected_address2_gw = "1.2.1.1"; - NMIP4Address *ip4_addr; + struct in6_addr addr6; const char *expected6_dns1 = "1111:dddd::aaaa"; const char *expected6_dns2 = "1::cafe"; const char *expected6_dnssearch1 = "super-domain.com"; const char *expected6_dnssearch2 = "redhat.com"; const char *expected6_dnssearch3 = "gnu.org"; - struct in6_addr addr6; - const char *expected6_address1 = "abcd:1234:ffff::cdde"; - const char *expected6_address2 = "1:2:3:4:5:6:7:8"; - const char *expected6_route_dest = "a:b:c:d::"; - const char *expected6_route_nh = "f:e:d:c:1:2:3:4"; - NMIP6Address *ip6_addr; - NMIP6Route *ip6_route; connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_FILE, NULL); ASSERT (connection != NULL, @@ -219,83 +276,17 @@ test_read_valid_wired_connection (void) NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_setting_ip4_config_get_num_addresses (s_ip4) == 2, - "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - - /* Address #1 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 0); - ASSERT (ip4_addr, - "connection-verify-wired", "failed to verify %s: missing IP4 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 24, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address1_gw, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - /* Address #2 */ - ip4_addr = nm_setting_ip4_config_get_address (s_ip4, 1); - ASSERT (ip4_addr, - "connection-verify-wired", "failed to verify %s: missing IP4 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + /* IPv4 addresses */ + g_assert (nm_setting_ip4_config_get_num_addresses (s_ip4) == 4); + check_ip4_address (s_ip4, 0, "2.3.4.5", 24, "2.3.4.6"); + check_ip4_address (s_ip4, 1, "192.168.0.5", 24, "192.168.0.1"); + check_ip4_address (s_ip4, 2, "1.2.3.4", 16, "1.2.1.1"); + check_ip4_address (s_ip4, 3, "3.4.5.6", 16, "0.0.0.0"); - ASSERT (nm_ip4_address_get_prefix (ip4_addr) == 16, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #2 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address2, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #2", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_DNS); - ASSERT (nm_ip4_address_get_address (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET, expected_address2_gw, &addr) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #2 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); - ASSERT (nm_ip4_address_get_gateway (ip4_addr) == addr.s_addr, - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #2 gateway", - TEST_WIRED_FILE, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP4_CONFIG_ADDRESSES); + /* IPv4 routes */ + g_assert (nm_setting_ip4_config_get_num_routes (s_ip4) == 2); + check_ip4_route (s_ip4, 0, "5.6.7.8", 32, "0.0.0.0", 0); + check_ip4_route (s_ip4, 1, "1.2.3.0", 24, "2.3.4.8", 99); /* ===== IPv6 SETTING ===== */ @@ -342,12 +333,6 @@ test_read_valid_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS); - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 2, - "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - /* DNS Searches */ ASSERT (nm_setting_ip6_config_get_num_dns_searches (s_ip6) == 3, "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", @@ -371,98 +356,18 @@ test_read_valid_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_DNS_SEARCH); - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "connection-verify-wired", "failed to verify %s: missing IP6 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 64, - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #1 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_address1, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - /* Address #2 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 1); - ASSERT (ip6_addr, - "connection-verify-wired", "failed to verify %s: missing IP6 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 96, - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #2 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_address2, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #2", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #2", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + /* IPv6 addresses */ + g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 4); + check_ip6_address (s_ip6, 0, "2:3:4:5:6:7:8:9", 64, "2:3:4:5:1:2:3:4"); + check_ip6_address (s_ip6, 1, "abcd:1234:ffff::cdde", 64, "::"); + check_ip6_address (s_ip6, 2, "1:2:3:4:5:6:7:8", 96, "::"); + check_ip6_address (s_ip6, 3, "3:4:5:6:7:8:9:0", 128, "::"); /* Route #1 */ - ip6_route = nm_setting_ip6_config_get_route (s_ip6, 0); - ASSERT (ip6_route, - "connection-verify-wired", "failed to verify %s: missing IP6 route #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (inet_pton (AF_INET6, expected6_route_dest, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP route dest #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_route_get_dest (ip6_route), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 route dest #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (nm_ip6_route_get_prefix (ip6_route) == 64, - "connection-verify-wired", "failed to verify %s: unexpected IP6 route #1 prefix", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (inet_pton (AF_INET6, expected6_route_nh, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP route next hop #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_route_get_next_hop (ip6_route), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 route dest #1", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - - ASSERT (nm_ip6_route_get_metric (ip6_route) == 99, - "connection-verify-wired", "failed to verify %s: unexpected IP6 route #1 metric", - TEST_WIRED_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ROUTES); - + g_assert (nm_setting_ip6_config_get_num_routes (s_ip6) == 3); + check_ip6_route (s_ip6, 0, "d:e:f:0:1:2:3:4", 64, "f:e:d:c:1:2:3:4", 0); + check_ip6_route (s_ip6, 1, "a:b:c:d::", 64, "f:e:d:c:1:2:3:4", 99); + check_ip6_route (s_ip6, 2, "8:7:6:5:4:3:2:1", 128, "::", 0); g_object_unref (connection); } @@ -733,10 +638,6 @@ test_read_ip6_wired_connection (void) const char *tmp; const char *expected_id = "Test Wired Connection IP6"; const char *expected_uuid = "4e80a56d-c99f-4aad-a6dd-b449bc398c57"; - struct in6_addr addr6; - const char *expected6_address1 = "abcd:1234:ffff::cdde"; - const char *expected6_gw1 = "abcd:1234:ffff::cdd1"; - NMIP6Address *ip6_addr; connection = nm_keyfile_plugin_connection_from_file (TEST_WIRED_IP6_FILE, NULL); ASSERT (connection != NULL, @@ -825,47 +726,9 @@ test_read_ip6_wired_connection (void) NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_METHOD); - ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1, - "connection-verify-wired", "failed to verify %s: unexpected %s / %s key value", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_DNS); - - /* Address #1 */ - ip6_addr = nm_setting_ip6_config_get_address (s_ip6, 0); - ASSERT (ip6_addr, - "connection-verify-wired", "failed to verify %s: missing IP6 address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (nm_ip6_address_get_prefix (ip6_addr) == 64, - "connection-verify-wired", "failed to verify %s: unexpected IP6 address #1 prefix", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_address1, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert IP address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_address (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - - ASSERT (inet_pton (AF_INET6, expected6_gw1, &addr6) > 0, - "connection-verify-wired", "failed to verify %s: couldn't convert GW address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); - ASSERT (IN6_ARE_ADDR_EQUAL (nm_ip6_address_get_gateway (ip6_addr), &addr6), - "connection-verify-wired", "failed to verify %s: unexpected IP4 address #1", - TEST_WIRED_IP6_FILE, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_ADDRESSES); + /* IPv6 address */ + g_assert (nm_setting_ip6_config_get_num_addresses (s_ip6) == 1); + check_ip6_address (s_ip6, 0, "abcd:1234:ffff::cdde", 64, "abcd:1234:ffff::cdd1"); g_object_unref (connection); } @@ -2958,6 +2821,264 @@ test_write_infiniband_connection (void) g_object_unref (connection); } +#define TEST_BRIDGE_MAIN_FILE TEST_KEYFILES_DIR"/Test_Bridge_Main" + +static void +test_read_bridge_main (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingIP4Config *s_ip4; + NMSettingBridge *s_bridge; + GError *error = NULL; + const char *expected_id = "Test Bridge Main"; + const char *expected_uuid = "8f061643-fe41-4d4c-a8d9-097d26e2ad3a"; + gboolean success; + + connection = nm_keyfile_plugin_connection_from_file (TEST_BRIDGE_MAIN_FILE, &error); + g_assert_no_error (error); + g_assert (connection); + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + /* Connection setting */ + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, expected_id); + g_assert_cmpstr (nm_setting_connection_get_uuid (s_con), ==, expected_uuid); + + /* IPv4 setting */ + s_ip4 = nm_connection_get_setting_ip4_config (connection); + g_assert (s_ip4); + g_assert_cmpstr (nm_setting_ip4_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO); + + /* Bridge setting */ + s_bridge = nm_connection_get_setting_bridge (connection); + g_assert (s_bridge); + g_assert_cmpstr (nm_setting_bridge_get_interface_name (s_bridge), ==, "br0"); + g_assert_cmpuint (nm_setting_bridge_get_forward_delay (s_bridge), ==, 0); + g_assert_cmpuint (nm_setting_bridge_get_stp (s_bridge), ==, TRUE); + g_assert_cmpuint (nm_setting_bridge_get_priority (s_bridge), ==, 32744); + g_assert_cmpuint (nm_setting_bridge_get_hello_time (s_bridge), ==, 7); + g_assert_cmpuint (nm_setting_bridge_get_max_age (s_bridge), ==, 39); + g_assert_cmpuint (nm_setting_bridge_get_ageing_time (s_bridge), ==, 235352); + + g_object_unref (connection); +} + +static void +test_write_bridge_main (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridge *s_bridge; + NMSettingIP4Config *s_ip4; + NMSettingIP6Config *s_ip6; + char *uuid; + gboolean success; + NMConnection *reread; + char *testfile = NULL; + GError *error = NULL; + pid_t owner_grp; + uid_t owner_uid; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Main", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* Bridge setting */ + s_bridge = (NMSettingBridge *) nm_setting_bridge_new (); + g_assert (s_bridge); + nm_connection_add_setting (connection, NM_SETTING (s_bridge)); + + g_object_set (s_bridge, + NM_SETTING_BRIDGE_INTERFACE_NAME, "br0", + NULL); + + /* IP4 setting */ + s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); + g_assert (s_ip4); + nm_connection_add_setting (connection, NM_SETTING (s_ip4)); + g_object_set (s_ip4, + NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE, + NULL); + + add_one_ip4_address (s_ip4, "1.2.3.4", "1.1.1.1", 24); + + /* IP6 setting */ + s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); + g_assert (s_ip6); + nm_connection_add_setting (connection, NM_SETTING (s_ip6)); + g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, NULL); + + /* Write out the connection */ + owner_uid = geteuid (); + owner_grp = getegid (); + success = nm_keyfile_plugin_write_test_connection (connection, TEST_SCRATCH_DIR, owner_uid, owner_grp, &testfile, &error); + g_assert_no_error (error); + g_assert (success); + g_assert (testfile); + + /* Read the connection back in and compare it to the one we just wrote out */ + reread = nm_keyfile_plugin_connection_from_file (testfile, &error); + g_assert_no_error (error); + g_assert (reread); + + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + unlink (testfile); + g_free (testfile); + + g_object_unref (reread); + g_object_unref (connection); +} + +#define TEST_BRIDGE_COMPONENT_FILE TEST_KEYFILES_DIR"/Test_Bridge_Component" + +static void +test_read_bridge_component (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridgePort *s_port; + NMSettingWired *s_wired; + const GByteArray *array; + guint8 expected_mac[ETH_ALEN] = { 0x00, 0x22, 0x15, 0x59, 0x62, 0x97 }; + GError *error = NULL; + const char *expected_id = "Test Bridge Component"; + const char *expected_uuid = "d7b4f96c-c45e-4298-bef8-f48574f8c1c0"; + gboolean success; + + connection = nm_keyfile_plugin_connection_from_file (TEST_BRIDGE_COMPONENT_FILE, &error); + g_assert_no_error (error); + g_assert (connection); + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + /* Connection setting */ + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, expected_id); + g_assert_cmpstr (nm_setting_connection_get_uuid (s_con), ==, expected_uuid); + g_assert_cmpstr (nm_setting_connection_get_master (s_con), ==, "br0"); + g_assert (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)); + + /* Wired setting */ + s_wired = nm_connection_get_setting_wired (connection); + g_assert (s_wired); + array = nm_setting_wired_get_mac_address (s_wired); + g_assert (array); + g_assert_cmpint (array->len, ==, ETH_ALEN); + g_assert_cmpint (memcmp (array->data, expected_mac, sizeof (expected_mac)), ==, 0); + + /* BridgePort setting */ + s_port = nm_connection_get_setting_bridge_port (connection); + g_assert (s_port); + g_assert (nm_setting_bridge_port_get_hairpin_mode (s_port)); + g_assert_cmpuint (nm_setting_bridge_port_get_priority (s_port), ==, 28); + g_assert_cmpuint (nm_setting_bridge_port_get_path_cost (s_port), ==, 100); + + g_object_unref (connection); +} + +static void +test_write_bridge_component (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBridgePort *s_port; + NMSettingWired *s_wired; + char *uuid; + GByteArray *mac; + guint8 tmpmac[] = { 0x99, 0x88, 0x77, 0x66, 0x55, 0x44 }; + gboolean success; + NMConnection *reread; + char *testfile = NULL; + GError *error = NULL; + pid_t owner_grp; + uid_t owner_uid; + + connection = nm_connection_new (); + g_assert (connection); + + /* Connection setting */ + s_con = (NMSettingConnection *) nm_setting_connection_new (); + g_assert (s_con); + nm_connection_add_setting (connection, NM_SETTING (s_con)); + + uuid = nm_utils_uuid_generate (); + g_object_set (s_con, + NM_SETTING_CONNECTION_ID, "Test Write Bridge Component", + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NM_SETTING_CONNECTION_MASTER, "br0", + NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_BRIDGE_SETTING_NAME, + NULL); + g_free (uuid); + + /* Wired setting */ + s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); + g_assert (s_wired); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + + mac = g_byte_array_sized_new (ETH_ALEN); + g_byte_array_append (mac, &tmpmac[0], sizeof (tmpmac)); + g_object_set (s_wired, + NM_SETTING_WIRED_MAC_ADDRESS, mac, + NM_SETTING_WIRED_MTU, 1300, + NULL); + g_byte_array_free (mac, TRUE); + + /* BridgePort setting */ + s_port = (NMSettingBridgePort *) nm_setting_bridge_port_new (); + g_assert (s_port); + nm_connection_add_setting (connection, NM_SETTING (s_port)); + + g_object_set (s_port, + NM_SETTING_BRIDGE_PORT_PRIORITY, 3, + NM_SETTING_BRIDGE_PORT_PATH_COST, 99, + NULL); + + /* Write out the connection */ + owner_uid = geteuid (); + owner_grp = getegid (); + success = nm_keyfile_plugin_write_test_connection (connection, TEST_SCRATCH_DIR, owner_uid, owner_grp, &testfile, &error); + g_assert_no_error (error); + g_assert (success); + g_assert (testfile); + + /* Read the connection back in and compare it to the one we just wrote out */ + reread = nm_keyfile_plugin_connection_from_file (testfile, &error); + g_assert_no_error (error); + g_assert (reread); + + g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT)); + + unlink (testfile); + g_free (testfile); + + g_object_unref (reread); + g_object_unref (connection); +} + + int main (int argc, char **argv) { GError *error = NULL; @@ -3009,6 +3130,11 @@ int main (int argc, char **argv) test_read_infiniband_connection (); test_write_infiniband_connection (); + test_read_bridge_main (); + test_write_bridge_main (); + test_read_bridge_component (); + test_write_bridge_component (); + base = g_path_get_basename (argv[0]); fprintf (stdout, "%s: SUCCESS\n", base); g_free (base); diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index bbd6a7c3b..0b8c15929 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.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> @@ -41,7 +41,6 @@ #include <string.h> #include <arpa/inet.h> #include <netinet/ether.h> -#include <ctype.h> #include "nm-dbus-glib-types.h" #include "nm-glib-compat.h" @@ -116,18 +115,16 @@ write_ip4_values (GKeyFile *file, guint32 addr1_pos, guint32 addr2_pos) { - char **list = NULL; + GString *output; int i, j; - list = g_new (char *, tuple_len); - for (i = 0, j = 0; i < array->len; i++, j++) { GArray *tuple = g_ptr_array_index (array, i); gboolean success = TRUE; char *key_name; int k; - memset (list, 0, tuple_len * sizeof (char *)); + output = g_string_new (""); for (k = 0; k < tuple_len; k++) { if (k == addr1_pos || k == addr2_pos) { @@ -142,24 +139,23 @@ write_ip4_values (GKeyFile *file, success = FALSE; break; } else { - list[k] = g_strdup (buf); + g_string_append_printf (output, "%s%s", k == 0 ? "" : ",", buf); } } else { /* prefix, metric */ - list[k] = g_strdup_printf ("%d", g_array_index (tuple, guint32, k)); + g_string_append_printf (output, "%c%d", k == 1 ? '/' : ',', g_array_index (tuple, guint32, k)); } } if (success) { key_name = g_strdup_printf ("%s%d", key, j + 1); - g_key_file_set_string_list (file, setting_name, key_name, (const char **) list, tuple_len); + g_key_file_set_string (file, setting_name, key_name, output->str); g_free (key_name); } - for (k = 0; k < tuple_len; k++) - g_free (list[k]); + g_string_free (output, TRUE); + } - g_free (list); } static void @@ -177,7 +173,7 @@ ip4_addr_writer (GKeyFile *file, array = (GPtrArray *) g_value_get_boxed (value); if (array && array->len) - write_ip4_values (file, setting_name, key, array, 3, 0, 2); + write_ip4_values (file, setting_name, "address", array, 3, 0, 2); } static void @@ -195,7 +191,7 @@ ip4_route_writer (GKeyFile *file, array = (GPtrArray *) g_value_get_boxed (value); if (array && array->len) - write_ip4_values (file, setting_name, key, array, 4, 0, 2); + write_ip4_values (file, setting_name, "route", array, 4, 0, 2); } static void @@ -340,7 +336,7 @@ ip6_addr_writer (GKeyFile *file, ip6_addr = ip6_array_to_addr_prefix (values); if (ip6_addr) { /* Write it out */ - key_name = g_strdup_printf ("%s%d", key, j++); + key_name = g_strdup_printf ("address%d", j++); g_key_file_set_string (file, setting_name, key_name, ip6_addr); g_free (key_name); g_free (ip6_addr); @@ -358,7 +354,7 @@ ip6_route_writer (GKeyFile *file, { GPtrArray *array; const char *setting_name = nm_setting_get_name (setting); - char *list[3]; + GString *output; int i, j; g_return_if_fail (G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_IP6_ROUTE)); @@ -371,36 +367,23 @@ ip6_route_writer (GKeyFile *file, GValueArray *values = g_ptr_array_index (array, i); char *key_name; guint32 int_val; - char buf[INET6_ADDRSTRLEN + 1]; - gboolean is_unspec = FALSE; - memset (list, 0, sizeof (list)); + output = g_string_new (""); - /* Address and prefix */ - list[0] = ip6_array_to_addr_prefix (values); - if (!list[0]) - continue; - - /* Next Hop */ - if (!ip6_array_to_addr (values, 2, buf, sizeof (buf), &is_unspec)) - continue; - if (is_unspec) - continue; - list[1] = g_strdup (buf); + /* Address, prefix and next hop*/ + g_string_append (output, ip6_array_to_addr_prefix (values)); /* Metric */ value = g_value_array_get_nth (values, 3); int_val = g_value_get_uint (value); - list[2] = g_strdup_printf ("%d", int_val); + g_string_append_printf (output, ",%d", int_val); /* Write it out */ - key_name = g_strdup_printf ("%s%d", key, j++); - g_key_file_set_string_list (file, setting_name, key_name, (const char **) list, 3); + key_name = g_strdup_printf ("route%d", j++); + g_key_file_set_string (file, setting_name, key_name, output->str); g_free (key_name); - g_free (list[0]); - g_free (list[1]); - g_free (list[2]); + g_string_free (output, TRUE); } } @@ -500,7 +483,7 @@ ssid_writer (GKeyFile *file, */ for (i = 0; i < array->len; i++) { char c = array->data[i] & 0xFF; - if (!isprint (c)) { + if (!g_ascii_isprint (c)) { new_format = FALSE; break; } @@ -816,6 +799,9 @@ static KeyWriter key_writers[] = { { NM_SETTING_INFINIBAND_SETTING_NAME, NM_SETTING_INFINIBAND_MAC_ADDRESS, mac_address_writer }, + { NM_SETTING_WIMAX_SETTING_NAME, + NM_SETTING_WIMAX_MAC_ADDRESS, + mac_address_writer }, { NM_SETTING_WIRELESS_SETTING_NAME, NM_SETTING_WIRELESS_SSID, ssid_writer }, @@ -1024,8 +1010,15 @@ _internal_write_connection (NMConnection *connection, if (!data) goto out; - filename = _writer_id_to_filename (id); - path = g_build_filename (keyfile_dir, filename, NULL); + /* If we have existing file path, use it. Else generate one from + * connection's ID. + */ + if (existing_path != NULL) { + path = g_strdup (existing_path); + } else { + filename = _writer_id_to_filename (id); + path = g_build_filename (keyfile_dir, filename, NULL); + } /* If a file with this path already exists (but isn't the existing path * of the connection) then we need another name. Multiple connections diff --git a/src/settings/tests/Makefile.am b/src/settings/tests/Makefile.am index 57d56fc48..5c0c45658 100644 --- a/src/settings/tests/Makefile.am +++ b/src/settings/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @@ -24,10 +26,7 @@ test_wired_defname_LDADD = \ ########################################### -if WITH_TESTS - check-local: test-wired-defname $(abs_builddir)/test-wired-defname endif - diff --git a/src/settings/tests/Makefile.in b/src/settings/tests/Makefile.in index 10801a77e..1b7450cf1 100644 --- a/src/settings/tests/Makefile.in +++ b/src/settings/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-wired-defname$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-wired-defname$(EXEEXT) subdir = src/settings/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,14 +75,14 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_wired_defname_OBJECTS = \ - test_wired_defname-test-wired-defname.$(OBJEXT) +am__test_wired_defname_SOURCES_DIST = test-wired-defname.c +@ENABLE_TESTS_TRUE@am_test_wired_defname_OBJECTS = test_wired_defname-test-wired-defname.$(OBJEXT) test_wired_defname_OBJECTS = $(am_test_wired_defname_OBJECTS) am__DEPENDENCIES_1 = -test_wired_defname_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/settings/libtest-settings-utils.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_wired_defname_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/settings/libtest-settings-utils.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -111,7 +113,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_wired_defname_SOURCES) -DIST_SOURCES = $(test_wired_defname_SOURCES) +DIST_SOURCES = $(am__test_wired_defname_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -132,6 +134,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -146,9 +152,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -158,17 +162,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -209,6 +210,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -225,11 +227,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -244,6 +242,8 @@ 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@ @@ -253,6 +253,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -279,13 +280,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -340,6 +342,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -354,26 +361,30 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_srcdir)/src/settings +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src/settings ####### wired defname test ####### -test_wired_defname_SOURCES = \ - test-wired-defname.c +@ENABLE_TESTS_TRUE@test_wired_defname_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-wired-defname.c -test_wired_defname_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) +@ENABLE_TESTS_TRUE@test_wired_defname_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) -test_wired_defname_LDADD = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/settings/libtest-settings-utils.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@test_wired_defname_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/settings/libtest-settings-utils.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) all: all-am @@ -431,25 +442,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_wired_defname-test-wired-defname.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -556,7 +564,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -682,8 +690,8 @@ uninstall-am: ########################################### -@WITH_TESTS_TRUE@check-local: test-wired-defname -@WITH_TESTS_TRUE@ $(abs_builddir)/test-wired-defname +@ENABLE_TESTS_TRUE@check-local: test-wired-defname +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-wired-defname # 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. diff --git a/src/supplicant-manager/Makefile.am b/src/supplicant-manager/Makefile.am index 1c24d0ef5..74ec9c38c 100644 --- a/src/supplicant-manager/Makefile.am +++ b/src/supplicant-manager/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. tests +SUBDIRS = . tests INCLUDES = \ -I${top_srcdir}/src \ diff --git a/src/supplicant-manager/Makefile.in b/src/supplicant-manager/Makefile.in index c5892b1bf..ae6768f8e 100644 --- a/src/supplicant-manager/Makefile.in +++ b/src/supplicant-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/supplicant-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -172,6 +174,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -186,9 +192,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -198,17 +202,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -249,6 +250,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -265,11 +267,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -284,6 +282,8 @@ 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@ @@ -293,6 +293,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -319,13 +320,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -380,6 +382,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -394,6 +401,10 @@ 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@ SUBDIRS = . tests INCLUDES = \ -I${top_srcdir}/src \ @@ -486,25 +497,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsupplicant_manager_la-nm-supplicant-settings-verify.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index a8e4ab9d5..21b525826 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -363,11 +363,11 @@ gboolean nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, NMSettingWireless * setting, gboolean is_broadcast, - guint32 adhoc_freq, + guint32 fixed_freq, gboolean has_scan_capa_ssid) { NMSupplicantConfigPrivate *priv; - gboolean is_adhoc; + gboolean is_adhoc, is_ap; const char *mode; const GByteArray *id; @@ -378,7 +378,8 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, mode = nm_setting_wireless_get_mode (setting); is_adhoc = (mode && !strcmp (mode, "adhoc")) ? TRUE : FALSE; - if (is_adhoc) + is_ap = (mode && !strcmp (mode, "ap")) ? TRUE : FALSE; + if (is_adhoc || is_ap) priv->ap_scan = 2; else if (is_broadcast == FALSE) { /* drivers that support scanning specific SSIDs should use @@ -395,27 +396,34 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, if (is_adhoc) { if (!nm_supplicant_config_add_option (self, "mode", "1", -1, FALSE)) { - nm_log_warn (LOGD_SUPPLICANT, "Error adding mode to supplicant config."); + nm_log_warn (LOGD_SUPPLICANT, "Error adding mode=1 (adhoc) to supplicant config."); return FALSE; } + } + + if (is_ap) { + if (!nm_supplicant_config_add_option (self, "mode", "2", -1, FALSE)) { + nm_log_warn (LOGD_SUPPLICANT, "Error adding mode=2 (ap) to supplicant config."); + return FALSE; + } + } - if (adhoc_freq) { - char *str_freq; + if ((is_adhoc || is_ap) && fixed_freq) { + char *str_freq; - str_freq = g_strdup_printf ("%u", adhoc_freq); - if (!nm_supplicant_config_add_option (self, "frequency", str_freq, -1, FALSE)) { - g_free (str_freq); - nm_log_warn (LOGD_SUPPLICANT, "Error adding Ad-Hoc frequency to supplicant config."); - return FALSE; - } + str_freq = g_strdup_printf ("%u", fixed_freq); + if (!nm_supplicant_config_add_option (self, "frequency", str_freq, -1, FALSE)) { g_free (str_freq); + nm_log_warn (LOGD_SUPPLICANT, "Error adding Ad-Hoc/AP frequency to supplicant config."); + return FALSE; } + g_free (str_freq); } - /* Except for Ad-Hoc networks, request that the driver probe for the + /* Except for Ad-Hoc and Hotspot, request that the driver probe for the * specific SSID we want to associate with. */ - if (!is_adhoc) { + if (!(is_adhoc || is_ap)) { if (!nm_supplicant_config_add_option (self, "scan_ssid", "1", -1, FALSE)) return FALSE; } @@ -712,6 +720,13 @@ nm_supplicant_config_add_setting_wireless_security (NMSupplicantConfig *self, */ if (!nm_supplicant_config_add_option (self, "bgscan", "simple:30:-45:300", -1, FALSE)) nm_log_warn (LOGD_SUPPLICANT, "Error enabling background scanning for ESS roaming"); + + /* When using WPA-Enterprise, we want to use Proactive Key Caching (also + * called Opportunistic Key Caching) to avoid full EAP exchanges when + * roaming between access points in the same mobility group. + */ + if (!nm_supplicant_config_add_option (self, "proactive_key_caching", "1", -1, FALSE)) + return FALSE; } } @@ -730,7 +745,7 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, gboolean success, added; GString *phase1, *phase2; const GByteArray *array; - gboolean peap = FALSE, fast = FALSE; + gboolean fast = FALSE; guint32 i, num_eap; gboolean fast_provisoning_allowed = FALSE; @@ -778,25 +793,12 @@ nm_supplicant_config_add_setting_8021x (NMSupplicantConfig *self, for (i = 0; i < num_eap; i++) { const char *method = nm_setting_802_1x_get_eap_method (setting, i); - if (method && (strcasecmp (method, "peap") == 0)) - peap = TRUE; if (method && (strcasecmp (method, "fast") == 0)) { fast = TRUE; priv->fast_required = TRUE; } } - /* When using PEAP-GTC, we're likely using Cisco kit, so we want to turn - * on PMKSA caching so that roaming between access points actually works - * without a full reauth (which requires a new token code). We may want - * to extend this to all PEAP phase2 methods at some point. - */ - value = nm_setting_802_1x_get_phase2_auth (setting); - if (peap && value && (strcasecmp (value, "gtc") == 0)) { - if (!nm_supplicant_config_add_option (self, "proactive_key_caching", "1", -1, FALSE)) - return FALSE; - } - /* Drop the fragment size a bit for better compatibility */ if (!nm_supplicant_config_add_option (self, "fragment_size", "1300", -1, FALSE)) return FALSE; diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index dc35d5af7..75450a0a1 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -86,12 +86,14 @@ typedef struct { char * dev; gboolean is_wireless; gboolean has_credreq; /* Whether querying 802.1x credentials is supported */ + ApSupport ap_support; /* Lightweight AP mode support */ gboolean fast_supported; guint32 max_scan_ssids; guint32 ready_count; char * object_path; guint32 state; + int disconnect_reason; NMCallStore * assoc_pcalls; NMCallStore * other_pcalls; @@ -468,7 +470,14 @@ set_state (NMSupplicantInterface *self, guint32 new_state) || old_state == NM_SUPPLICANT_INTERFACE_STATE_SCANNING) priv->last_scan = time (NULL); - g_signal_emit (self, signals[STATE], 0, priv->state, old_state); + /* Disconnect reason is no longer relevant when not in the DISCONNECTED state */ + if (priv->state != NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED) + priv->disconnect_reason = 0; + + g_signal_emit (self, signals[STATE], 0, + priv->state, + old_state, + priv->disconnect_reason); } static void @@ -607,6 +616,21 @@ wpas_iface_properties_changed (DBusGProxy *proxy, value = g_hash_table_lookup (props, "Capabilities"); if (value && G_VALUE_HOLDS (value, DBUS_TYPE_G_MAP_OF_VARIANT)) parse_capabilities (self, g_value_get_boxed (value)); + + /* Disconnect reason is currently only given for deauthentication events, + * not disassociation; currently they are IEEE 802.11 "reason codes", + * defined by (IEEE 802.11-2007, 7.3.1.7, Table 7-22). Any locally caused + * deauthentication will be negative, while authentications caused by the + * AP will be positive. + */ + value = g_hash_table_lookup (props, "DisconnectReason"); + if (value && G_VALUE_HOLDS (value, G_TYPE_INT)) { + priv->disconnect_reason = g_value_get_int (value); + if (priv->disconnect_reason != 0) { + nm_log_warn (LOGD_SUPPLICANT, "Connection disconnected (reason %d)", + priv->disconnect_reason); + } + } } static void @@ -734,6 +758,7 @@ wpas_iface_check_network_reply (NMSupplicantInterface *self) NMSupplicantInfo *info; DBusGProxyCall *call; + priv->ready_count++; info = nm_supplicant_info_new (self, priv->props_proxy, priv->other_pcalls); call = dbus_g_proxy_begin_call (priv->iface_proxy, "NetworkReply", iface_check_netreply_cb, @@ -746,6 +771,76 @@ wpas_iface_check_network_reply (NMSupplicantInterface *self) nm_supplicant_info_set_call (info, call); } +ApSupport +nm_supplicant_interface_get_ap_support (NMSupplicantInterface *self) +{ + return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->ap_support; +} + +void +nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self, + ApSupport ap_support) +{ + NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); + + /* Use the best indicator of support between the supplicant global + * Capabilities property and the interface's introspection data. + */ + if (ap_support > priv->ap_support) + priv->ap_support = ap_support; +} + +static void +iface_check_ap_mode_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) +{ + NMSupplicantInfo *info = (NMSupplicantInfo *) user_data; + NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface); + char *data; + + /* The ProbeRequest method only exists if AP mode has been enabled */ + if (dbus_g_proxy_end_call (proxy, call_id, NULL, + G_TYPE_STRING, + &data, + G_TYPE_INVALID)) { + if (data && strstr (data, "ProbeRequest")) + priv->ap_support = AP_SUPPORT_YES; + g_free (data); + } + + iface_check_ready (info->interface); +} + +static void +wpas_iface_check_ap_mode (NMSupplicantInterface *self) +{ + NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); + NMSupplicantInfo *info; + DBusGProxyCall *call; + DBusGProxy *proxy; + + priv->ready_count++; + + proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr), + WPAS_DBUS_SERVICE, + priv->object_path, + DBUS_INTERFACE_INTROSPECTABLE); + + info = nm_supplicant_info_new (self, proxy, priv->other_pcalls); + g_object_unref (proxy); + + /* If the global supplicant capabilities property is not present, we can + * fall back to checking whether the ProbeRequest method is supported. If + * neither of these works we have no way of determining if AP mode is + * supported or not. hostap 1.0 and earlier don't support either of these. + */ + call = dbus_g_proxy_begin_call (proxy, "Introspect", + iface_check_ap_mode_cb, + info, + nm_supplicant_info_destroy, + G_TYPE_INVALID); + nm_supplicant_info_set_call (info, call); +} + static void interface_add_done (NMSupplicantInterface *self, char *path) { @@ -818,9 +913,13 @@ interface_add_done (NMSupplicantInterface *self, char *path) path, DBUS_INTERFACE_PROPERTIES); /* Get initial properties and check whether NetworkReply is supported */ + priv->ready_count = 1; wpas_iface_get_props (self); + + /* These two increment ready_count themselves */ wpas_iface_check_network_reply (self); - priv->ready_count = 2; + if (priv->ap_support == AP_SUPPORT_UNKNOWN) + wpas_iface_check_ap_mode (self); } static void @@ -1383,6 +1482,7 @@ nm_supplicant_interface_new (NMSupplicantManager *smgr, const char *ifname, gboolean is_wireless, gboolean fast_supported, + ApSupport ap_support, gboolean start_now) { NMSupplicantInterface *self; @@ -1406,6 +1506,7 @@ nm_supplicant_interface_new (NMSupplicantManager *smgr, priv->dev = g_strdup (ifname); priv->is_wireless = is_wireless; priv->fast_supported = fast_supported; + priv->ap_support = ap_support; if (start_now) interface_add (self, priv->is_wireless); @@ -1540,8 +1641,8 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (NMSupplicantInterfaceClass, state), NULL, NULL, - _nm_marshal_VOID__UINT_UINT, - G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); + _nm_marshal_VOID__UINT_UINT_INT, + G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INT); signals[REMOVED] = g_signal_new (NM_SUPPLICANT_INTERFACE_REMOVED, diff --git a/src/supplicant-manager/nm-supplicant-interface.h b/src/supplicant-manager/nm-supplicant-interface.h index b99c0f269..2f0233cf7 100644 --- a/src/supplicant-manager/nm-supplicant-interface.h +++ b/src/supplicant-manager/nm-supplicant-interface.h @@ -64,6 +64,12 @@ enum { #define NM_SUPPLICANT_INTERFACE_CONNECTION_ERROR "connection-error" #define NM_SUPPLICANT_INTERFACE_CREDENTIALS_REQUEST "credentials-request" +typedef enum { + AP_SUPPORT_UNKNOWN = 0, /* Can't detect whether supported or not */ + AP_SUPPORT_NO = 1, /* AP mode definitely not supported */ + AP_SUPPORT_YES = 2, /* AP mode definitely supported */ +} ApSupport; + struct _NMSupplicantInterface { GObject parent; }; @@ -76,7 +82,8 @@ typedef struct { /* change in the interface's state */ void (*state) (NMSupplicantInterface * iface, guint32 new_state, - guint32 old_state); + guint32 old_state, + int disconnect_reason); /* interface was removed by the supplicant */ void (*removed) (NMSupplicantInterface * iface); @@ -117,6 +124,7 @@ NMSupplicantInterface * nm_supplicant_interface_new (NMSupplicantManager * smgr, const char *ifname, gboolean is_wireless, gboolean fast_supported, + ApSupport ap_support, gboolean start_now); gboolean nm_supplicant_interface_set_config (NMSupplicantInterface * iface, @@ -149,4 +157,9 @@ gboolean nm_supplicant_interface_credentials_reply (NMSupplicantInterface *self, const char *value, GError **error); +ApSupport nm_supplicant_interface_get_ap_support (NMSupplicantInterface *self); + +void nm_supplicant_interface_set_ap_support (NMSupplicantInterface *self, + ApSupport apmode); + #endif /* NM_SUPPLICANT_INTERFACE_H */ diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c index ae1508651..430a3852c 100644 --- a/src/supplicant-manager/nm-supplicant-manager.c +++ b/src/supplicant-manager/nm-supplicant-manager.c @@ -27,6 +27,7 @@ #include "nm-supplicant-interface.h" #include "nm-dbus-manager.h" #include "nm-logging.h" +#include "nm-dbus-glib-types.h" #define NM_SUPPLICANT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ NM_TYPE_SUPPLICANT_MANAGER, \ @@ -49,6 +50,7 @@ typedef struct { gboolean running; GHashTable * ifaces; gboolean fast_supported; + ApSupport ap_support; guint die_count_reset_id; guint die_count; gboolean disposed; @@ -86,7 +88,12 @@ nm_supplicant_manager_iface_get (NMSupplicantManager * self, start_now = !die_count_exceeded (priv->die_count); nm_log_dbg (LOGD_SUPPLICANT, "(%s): creating new supplicant interface", ifname); - iface = nm_supplicant_interface_new (self, ifname, is_wireless, priv->fast_supported, start_now); + iface = nm_supplicant_interface_new (self, + ifname, + is_wireless, + priv->fast_supported, + priv->ap_support, + start_now); if (iface) g_hash_table_insert (priv->ifaces, g_strdup (ifname), iface); } else { @@ -125,52 +132,78 @@ nm_supplicant_manager_iface_release (NMSupplicantManager *self, } static void -get_eap_methods_reply (DBusGProxy *proxy, - DBusGProxyCall *call, - gpointer user_data) +get_capabilities_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) { NMSupplicantManager *self = NM_SUPPLICANT_MANAGER (user_data); NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); + NMSupplicantInterface *iface; + GHashTableIter hash_iter; GError *error = NULL; - GValue value = { 0 }; - const char **iter; - - if (dbus_g_proxy_end_call (proxy, call, &error, - G_TYPE_VALUE, &value, - G_TYPE_INVALID)) { - if (G_VALUE_HOLDS (&value, G_TYPE_STRV)) { - iter = g_value_get_boxed (&value); - while (iter && *iter) { - if (strcasecmp (*iter++, "FAST") == 0) { - priv->fast_supported = TRUE; - break; - } - } - } else { - nm_log_warn (LOGD_SUPPLICANT, "Unexpected EapMethods property type %s", - G_VALUE_TYPE_NAME (&value)); - } - g_value_unset (&value); - } else { - nm_log_warn (LOGD_SUPPLICANT, "Unexpected error requesting EapMethods: (%d) %s", + GHashTable *props = NULL; + GValue *value; + char **iter; + + if (!dbus_g_proxy_end_call (proxy, call_id, &error, + DBUS_TYPE_G_MAP_OF_VARIANT, &props, + G_TYPE_INVALID)) { + nm_log_warn (LOGD_CORE, "Unexpected error requesting supplicant properties: (%d) %s", error ? error->code : -1, error && error->message ? error->message : "(unknown)"); g_clear_error (&error); + return; + } + + /* The supplicant only advertises global capabilities if the following + * commit has been applied: + * + * commit 1634ac0654eba8d458640a115efc0a6cde3bac4d + * Author: Dan Williams <dcbw@redhat.com> + * Date: Sat Sep 29 19:06:30 2012 +0300 + * + * dbus: Add global capabilities property + */ + priv->ap_support = AP_SUPPORT_UNKNOWN; + value = g_hash_table_lookup (props, "Capabilities"); + if (value && G_VALUE_HOLDS (value, G_TYPE_STRV)) { + priv->ap_support = AP_SUPPORT_NO; + for (iter = g_value_get_boxed (value); iter && *iter; iter++) { + if (strcasecmp (*iter, "ap")) + priv->ap_support = AP_SUPPORT_YES; + } } - nm_log_dbg (LOGD_SUPPLICANT, "EAP-FAST is %ssupported", - priv->fast_supported ? "" : "not "); + /* Tell all interfaces about results of the AP check */ + g_hash_table_iter_init (&hash_iter, priv->ifaces); + while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer) &iface)) + nm_supplicant_interface_set_ap_support (iface, priv->ap_support); + + nm_log_dbg (LOGD_SUPPLICANT, "AP mode is %ssupported", + (priv->ap_support == AP_SUPPORT_YES) ? "" : + (priv->ap_support == AP_SUPPORT_NO) ? "not " : " possibly"); + + /* EAP-FAST */ + priv->fast_supported = FALSE; + value = g_hash_table_lookup (props, "EapMethods"); + if (value && G_VALUE_HOLDS (value, G_TYPE_STRV)) { + for (iter = g_value_get_boxed (value); iter && *iter; iter++) { + if (strcasecmp (*iter, "fast")) + priv->fast_supported = TRUE; + } + } + + nm_log_dbg (LOGD_SUPPLICANT, "EAP-FAST is %ssupported", priv->fast_supported ? "" : "not "); + + g_hash_table_unref (props); } static void -check_supported_eap_methods (NMSupplicantManager *self) +check_capabilities (NMSupplicantManager *self) { NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (self); - dbus_g_proxy_begin_call (priv->props_proxy, "Get", - get_eap_methods_reply, self, NULL, + dbus_g_proxy_begin_call (priv->props_proxy, "GetAll", + get_capabilities_cb, self, NULL, G_TYPE_STRING, WPAS_DBUS_INTERFACE, - G_TYPE_STRING, "EapMethods", G_TYPE_INVALID); } @@ -239,7 +272,7 @@ name_owner_changed (NMDBusManager *dbus_mgr, if (!old_owner_good && new_owner_good) { nm_log_info (LOGD_SUPPLICANT, "wpa_supplicant started"); set_running (self, TRUE); - check_supported_eap_methods (self); + check_capabilities (self); } else if (old_owner_good && !new_owner_good) { nm_log_info (LOGD_SUPPLICANT, "wpa_supplicant stopped"); @@ -307,9 +340,9 @@ nm_supplicant_manager_init (NMSupplicantManager *self) priv->ifaces = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); - /* Grab list of supported EAP methods */ + /* Check generic supplicant capabilities */ if (priv->running) - check_supported_eap_methods (self); + check_capabilities (self); } static void diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.c b/src/supplicant-manager/nm-supplicant-settings-verify.c index 76de84d82..143e51a36 100644 --- a/src/supplicant-manager/nm-supplicant-settings-verify.c +++ b/src/supplicant-manager/nm-supplicant-settings-verify.c @@ -91,7 +91,7 @@ static const struct Opt opt_table[] = { { "ssid", TYPE_BYTES, 0, 32,FALSE, NULL }, { "bssid", TYPE_KEYWORD, 0, 0, FALSE, NULL }, { "scan_ssid", TYPE_INT, 0, 1, FALSE, NULL }, - { "mode", TYPE_INT, 0, 1, FALSE, NULL }, + { "mode", TYPE_INT, 0, 2, FALSE, NULL }, { "frequency", TYPE_INT, 2412, 5825, FALSE, NULL }, { "auth_alg", TYPE_KEYWORD, 0, 0, FALSE, auth_alg_allowed }, { "psk", TYPE_BYTES, 0, 0, FALSE, NULL }, diff --git a/src/supplicant-manager/tests/Makefile.am b/src/supplicant-manager/tests/Makefile.am index 47ae66c57..20ba9cc57 100644 --- a/src/supplicant-manager/tests/Makefile.am +++ b/src/supplicant-manager/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @@ -20,10 +22,7 @@ test_supplicant_config_LDADD = \ $(top_builddir)/src/supplicant-manager/libsupplicant-manager.la \ $(DBUS_LIBS) -if WITH_TESTS - check-local: test-supplicant-config $(abs_builddir)/test-supplicant-config endif - diff --git a/src/supplicant-manager/tests/Makefile.in b/src/supplicant-manager/tests/Makefile.in index eb4d001c5..cf4be05d8 100644 --- a/src/supplicant-manager/tests/Makefile.in +++ b/src/supplicant-manager/tests/Makefile.in @@ -51,21 +51,23 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-supplicant-config$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-supplicant-config$(EXEEXT) subdir = src/supplicant-manager/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -73,14 +75,14 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_supplicant_config_OBJECTS = \ - test_supplicant_config-test-supplicant-config.$(OBJEXT) +am__test_supplicant_config_SOURCES_DIST = test-supplicant-config.c +@ENABLE_TESTS_TRUE@am_test_supplicant_config_OBJECTS = test_supplicant_config-test-supplicant-config.$(OBJEXT) test_supplicant_config_OBJECTS = $(am_test_supplicant_config_OBJECTS) am__DEPENDENCIES_1 = -test_supplicant_config_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/supplicant-manager/libsupplicant-manager.la \ - $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_supplicant_config_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/supplicant-manager/libsupplicant-manager.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -111,7 +113,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_supplicant_config_SOURCES) -DIST_SOURCES = $(test_supplicant_config_SOURCES) +DIST_SOURCES = $(am__test_supplicant_config_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -132,6 +134,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -146,9 +152,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -158,17 +162,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -209,6 +210,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -225,11 +227,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -244,6 +242,8 @@ 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@ @@ -253,6 +253,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -279,13 +280,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -340,6 +342,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -354,25 +361,29 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/supplicant-manager - -test_supplicant_config_SOURCES = \ - test-supplicant-config.c - -test_supplicant_config_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) - -test_supplicant_config_LDADD = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/supplicant-manager/libsupplicant-manager.la \ - $(DBUS_LIBS) +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src/supplicant-manager + +@ENABLE_TESTS_TRUE@test_supplicant_config_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-supplicant-config.c + +@ENABLE_TESTS_TRUE@test_supplicant_config_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) + +@ENABLE_TESTS_TRUE@test_supplicant_config_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/supplicant-manager/libsupplicant-manager.la \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) all: all-am @@ -430,25 +441,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_supplicant_config-test-supplicant-config.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -555,7 +563,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -679,8 +687,8 @@ uninstall-am: tags uninstall uninstall-am -@WITH_TESTS_TRUE@check-local: test-supplicant-config -@WITH_TESTS_TRUE@ $(abs_builddir)/test-supplicant-config +@ENABLE_TESTS_TRUE@check-local: test-supplicant-config +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-supplicant-config # 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. diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 61e2261fb..8f4063617 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_TESTS + INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ @@ -64,12 +66,9 @@ EXTRA_DIST = test-secret-agent.py ########################################### -if WITH_TESTS - check-local: test-dhcp-options test-policy-hosts test-wifi-ap-utils $(abs_builddir)/test-dhcp-options $(abs_builddir)/test-policy-hosts $(abs_builddir)/test-wifi-ap-utils endif - diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in index 63d14c20e..df19fc42a 100644 --- a/src/tests/Makefile.in +++ b/src/tests/Makefile.in @@ -51,22 +51,25 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test-dhcp-options$(EXEEXT) \ - test-policy-hosts$(EXEEXT) test-wifi-ap-utils$(EXEEXT) +@ENABLE_TESTS_TRUE@noinst_PROGRAMS = test-dhcp-options$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-policy-hosts$(EXEEXT) \ +@ENABLE_TESTS_TRUE@ test-wifi-ap-utils$(EXEEXT) subdir = src/tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -74,31 +77,30 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_test_dhcp_options_OBJECTS = \ - test_dhcp_options-test-dhcp-options.$(OBJEXT) +am__test_dhcp_options_SOURCES_DIST = test-dhcp-options.c +@ENABLE_TESTS_TRUE@am_test_dhcp_options_OBJECTS = test_dhcp_options-test-dhcp-options.$(OBJEXT) test_dhcp_options_OBJECTS = $(am_test_dhcp_options_OBJECTS) am__DEPENDENCIES_1 = -test_dhcp_options_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/dhcp-manager/libdhcp-manager.la \ - $(top_builddir)/src/libtest-dhcp.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_dhcp_options_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/dhcp-manager/libdhcp-manager.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/libtest-dhcp.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am_test_policy_hosts_OBJECTS = \ - test_policy_hosts-test-policy-hosts.$(OBJEXT) +am__test_policy_hosts_SOURCES_DIST = test-policy-hosts.c +@ENABLE_TESTS_TRUE@am_test_policy_hosts_OBJECTS = test_policy_hosts-test-policy-hosts.$(OBJEXT) test_policy_hosts_OBJECTS = $(am_test_policy_hosts_OBJECTS) -test_policy_hosts_DEPENDENCIES = \ - $(top_builddir)/src/libtest-policy-hosts.la \ - $(am__DEPENDENCIES_1) -am_test_wifi_ap_utils_OBJECTS = \ - test_wifi_ap_utils-test-wifi-ap-utils.$(OBJEXT) +@ENABLE_TESTS_TRUE@test_policy_hosts_DEPENDENCIES = $(top_builddir)/src/libtest-policy-hosts.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) +am__test_wifi_ap_utils_SOURCES_DIST = test-wifi-ap-utils.c +@ENABLE_TESTS_TRUE@am_test_wifi_ap_utils_OBJECTS = test_wifi_ap_utils-test-wifi-ap-utils.$(OBJEXT) test_wifi_ap_utils_OBJECTS = $(am_test_wifi_ap_utils_OBJECTS) -test_wifi_ap_utils_DEPENDENCIES = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/libtest-wifi-ap-utils.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@ENABLE_TESTS_TRUE@test_wifi_ap_utils_DEPENDENCIES = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/libtest-wifi-ap-utils.la \ +@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -127,8 +129,9 @@ am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_dhcp_options_SOURCES) $(test_policy_hosts_SOURCES) \ $(test_wifi_ap_utils_SOURCES) -DIST_SOURCES = $(test_dhcp_options_SOURCES) \ - $(test_policy_hosts_SOURCES) $(test_wifi_ap_utils_SOURCES) +DIST_SOURCES = $(am__test_dhcp_options_SOURCES_DIST) \ + $(am__test_policy_hosts_SOURCES_DIST) \ + $(am__test_wifi_ap_utils_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -149,6 +152,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -163,9 +170,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -175,17 +180,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -226,6 +228,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -242,11 +245,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -261,6 +260,8 @@ 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@ @@ -270,6 +271,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -296,13 +298,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -357,6 +360,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -371,64 +379,68 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libnm-util \ - -I$(top_builddir)/libnm-util \ - -I$(top_srcdir)/src/dhcp-manager \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src +with_dhclient = @with_dhclient@ +with_dhcpcd = @with_dhcpcd@ +with_netconfig = @with_netconfig@ +with_resolvconf = @with_resolvconf@ +@ENABLE_TESTS_TRUE@INCLUDES = \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-util \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src/dhcp-manager \ +@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/src \ +@ENABLE_TESTS_TRUE@ -I$(top_builddir)/src ####### DHCP options test ####### -test_dhcp_options_SOURCES = \ - test-dhcp-options.c +@ENABLE_TESTS_TRUE@test_dhcp_options_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-dhcp-options.c -test_dhcp_options_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - -DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \ - -DDHCPCD_PATH=\"$(DHCPCD_PATH)\" +@ENABLE_TESTS_TRUE@test_dhcp_options_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) \ +@ENABLE_TESTS_TRUE@ -DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \ +@ENABLE_TESTS_TRUE@ -DDHCPCD_PATH=\"$(DHCPCD_PATH)\" -test_dhcp_options_LDADD = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/dhcp-manager/libdhcp-manager.la \ - $(top_builddir)/src/libtest-dhcp.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@test_dhcp_options_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/dhcp-manager/libdhcp-manager.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/libtest-dhcp.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) ####### policy /etc/hosts test ####### -test_policy_hosts_SOURCES = \ - test-policy-hosts.c +@ENABLE_TESTS_TRUE@test_policy_hosts_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-policy-hosts.c -test_policy_hosts_CPPFLAGS = \ - $(GLIB_CFLAGS) +@ENABLE_TESTS_TRUE@test_policy_hosts_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) -test_policy_hosts_LDADD = \ - -ldl \ - $(top_builddir)/src/libtest-policy-hosts.la \ - $(GLIB_LIBS) +@ENABLE_TESTS_TRUE@test_policy_hosts_LDADD = \ +@ENABLE_TESTS_TRUE@ -ldl \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/libtest-policy-hosts.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) ####### wifi ap utils test ####### -test_wifi_ap_utils_SOURCES = \ - test-wifi-ap-utils.c +@ENABLE_TESTS_TRUE@test_wifi_ap_utils_SOURCES = \ +@ENABLE_TESTS_TRUE@ test-wifi-ap-utils.c -test_wifi_ap_utils_CPPFLAGS = \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) +@ENABLE_TESTS_TRUE@test_wifi_ap_utils_CPPFLAGS = \ +@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_CFLAGS) -test_wifi_ap_utils_LDADD = \ - $(top_builddir)/libnm-util/libnm-util.la \ - $(top_builddir)/src/libtest-wifi-ap-utils.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) +@ENABLE_TESTS_TRUE@test_wifi_ap_utils_LDADD = \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm-util/libnm-util.la \ +@ENABLE_TESTS_TRUE@ $(top_builddir)/src/libtest-wifi-ap-utils.la \ +@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) \ +@ENABLE_TESTS_TRUE@ $(DBUS_LIBS) ####### secret agent interface test ####### -EXTRA_DIST = test-secret-agent.py +@ENABLE_TESTS_TRUE@EXTRA_DIST = test-secret-agent.py all: all-am .SUFFIXES: @@ -493,25 +505,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_wifi_ap_utils-test-wifi-ap-utils.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< @@ -646,7 +655,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -@WITH_TESTS_FALSE@check-local: +@ENABLE_TESTS_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am @@ -772,10 +781,10 @@ uninstall-am: ########################################### -@WITH_TESTS_TRUE@check-local: test-dhcp-options test-policy-hosts test-wifi-ap-utils -@WITH_TESTS_TRUE@ $(abs_builddir)/test-dhcp-options -@WITH_TESTS_TRUE@ $(abs_builddir)/test-policy-hosts -@WITH_TESTS_TRUE@ $(abs_builddir)/test-wifi-ap-utils +@ENABLE_TESTS_TRUE@check-local: test-dhcp-options test-policy-hosts test-wifi-ap-utils +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-dhcp-options +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-policy-hosts +@ENABLE_TESTS_TRUE@ $(abs_builddir)/test-wifi-ap-utils # 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. diff --git a/src/vpn-manager/Makefile.am b/src/vpn-manager/Makefile.am index 06e04734c..a525ce205 100644 --- a/src/vpn-manager/Makefile.am +++ b/src/vpn-manager/Makefile.am @@ -26,8 +26,7 @@ libvpn_manager_la_SOURCES = \ libvpn_manager_la_CPPFLAGS = \ $(LIBNL_CFLAGS) \ $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED + $(GLIB_CFLAGS) libvpn_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ diff --git a/src/vpn-manager/Makefile.in b/src/vpn-manager/Makefile.in index 5eb769c5e..bb8efd17c 100644 --- a/src/vpn-manager/Makefile.in +++ b/src/vpn-manager/Makefile.in @@ -55,16 +55,18 @@ subdir = src/vpn-manager DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -134,6 +136,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -148,9 +154,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -160,17 +164,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -211,6 +212,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -227,11 +229,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -246,6 +244,8 @@ 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@ @@ -255,6 +255,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -281,13 +282,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -342,6 +344,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -356,6 +363,10 @@ 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@ INCLUDES = \ -I${top_srcdir} \ -I${top_builddir}/include \ @@ -382,8 +393,7 @@ libvpn_manager_la_SOURCES = \ libvpn_manager_la_CPPFLAGS = \ $(LIBNL_CFLAGS) \ $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ - -DG_DISABLE_DEPRECATED + $(GLIB_CFLAGS) libvpn_manager_la_LIBADD = \ $(top_builddir)/src/generated/libnm-generated.la \ @@ -457,25 +467,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvpn_manager_la-nm-vpn-service.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index 1820ede3f..639d66d05 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -47,6 +47,7 @@ #include "nm-netlink-utils.h" #include "nm-glib-compat.h" #include "settings/nm-settings-connection.h" +#include "nm-dispatcher.h" #include "nm-vpn-connection-glue.h" @@ -68,8 +69,6 @@ typedef struct { NMConnection *connection; - gboolean user_requested; - gulong user_uid; guint32 secrets_id; SecretsReq secrets_idx; char *username; @@ -134,6 +133,9 @@ ac_state_from_vpn_state (NMVPNConnectionState vpn_state) return NM_ACTIVE_CONNECTION_STATE_ACTIVATING; case NM_VPN_CONNECTION_STATE_ACTIVATED: return NM_ACTIVE_CONNECTION_STATE_ACTIVATED; + case NM_VPN_CONNECTION_STATE_FAILED: + case NM_VPN_CONNECTION_STATE_DISCONNECTED: + return NM_ACTIVE_CONNECTION_STATE_DEACTIVATED; default: break; } @@ -242,23 +244,27 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection, nm_connection_clear_secrets (priv->connection); /* Let dispatcher scripts know we're up and running */ - nm_utils_call_dispatcher ("vpn-up", - priv->connection, - priv->parent_dev, - priv->ip_iface, - priv->ip4_config, - priv->ip6_config); + nm_dispatcher_call_vpn (DISPATCHER_ACTION_VPN_UP, + priv->connection, + priv->parent_dev, + priv->ip_iface, + priv->ip4_config, + priv->ip6_config, + NULL, + NULL); break; case NM_VPN_CONNECTION_STATE_FAILED: case NM_VPN_CONNECTION_STATE_DISCONNECTED: if (old_vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED) { /* Let dispatcher scripts know we're about to go down */ - nm_utils_call_dispatcher ("vpn-down", - priv->connection, - priv->parent_dev, - priv->ip_iface, - NULL, - NULL); + nm_dispatcher_call_vpn (DISPATCHER_ACTION_VPN_DOWN, + priv->connection, + priv->parent_dev, + priv->ip_iface, + NULL, + NULL, + NULL, + NULL); } /* Tear down and clean up the connection */ @@ -342,42 +348,20 @@ nm_vpn_connection_new (NMConnection *connection, gulong user_uid) { NMVPNConnection *self; - NMVPNConnectionPrivate *priv; g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_DEVICE (parent_device), NULL); self = (NMVPNConnection *) g_object_new (NM_TYPE_VPN_CONNECTION, + NM_ACTIVE_CONNECTION_INT_CONNECTION, connection, + NM_ACTIVE_CONNECTION_INT_DEVICE, parent_device, NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, specific_object, + NM_ACTIVE_CONNECTION_INT_USER_REQUESTED, user_requested, + NM_ACTIVE_CONNECTION_INT_USER_UID, user_uid, NM_ACTIVE_CONNECTION_VPN, TRUE, NULL); - if (!self) - return NULL; - - priv = NM_VPN_CONNECTION_GET_PRIVATE (self); - - priv->user_requested = user_requested; - priv->user_uid = user_uid; - priv->connection = g_object_ref (connection); - priv->parent_dev = g_object_ref (parent_device); - - priv->device_monitor = g_signal_connect (parent_device, "state-changed", - G_CALLBACK (device_state_changed), - self); - - priv->device_ip4 = g_signal_connect (parent_device, "notify::" NM_DEVICE_IP4_CONFIG, - G_CALLBACK (device_ip4_config_changed), - self); - priv->device_ip6 = g_signal_connect (parent_device, "notify::" NM_DEVICE_IP6_CONFIG, - G_CALLBACK (device_ip6_config_changed), - self); - - if (!nm_active_connection_export (NM_ACTIVE_CONNECTION (self), - connection, - nm_device_get_path (parent_device))) { - g_object_unref (self); - self = NULL; - } + if (self) + nm_active_connection_export (NM_ACTIVE_CONNECTION (self)); return self; } @@ -642,7 +626,7 @@ nm_vpn_connection_apply_config (NMVPNConnection *connection) } nm_log_info (LOGD_VPN, "VPN connection '%s' (IP Config Get) complete.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); nm_vpn_connection_set_vpn_state (connection, NM_VPN_CONNECTION_STATE_ACTIVATED, NM_VPN_CONNECTION_STATE_REASON_NONE); @@ -684,7 +668,7 @@ nm_vpn_connection_config_maybe_complete (NMVPNConnection *connection, g_clear_object (&priv->ip6_config); nm_log_warn (LOGD_VPN, "VPN connection '%s' did not receive valid IP config information.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); nm_vpn_connection_set_vpn_state (connection, NM_VPN_CONNECTION_STATE_FAILED, NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID); @@ -708,7 +692,7 @@ process_generic_config (NMVPNConnection *connection, /* Grab the interface index for address/routing operations */ priv->ip_ifindex = nm_netlink_iface_to_index (priv->ip_iface); - if (priv->ip_ifindex < 0) { + if (priv->ip_ifindex <= 0) { nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface); nm_vpn_connection_config_maybe_complete (connection, FALSE); return FALSE; @@ -762,7 +746,7 @@ nm_vpn_connection_config_get (DBusGProxy *proxy, GValue *val; nm_log_info (LOGD_VPN, "VPN connection '%s' (IP Config Get) reply received.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); if (!process_generic_config (connection, config_hash)) return; @@ -792,7 +776,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy, if (priv->has_ip4) { nm_log_info (LOGD_VPN, "VPN connection '%s' (IP4 Config Get) reply received.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); if (g_hash_table_size (config_hash) == 0) { priv->has_ip4 = FALSE; @@ -801,7 +785,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy, } } else { nm_log_info (LOGD_VPN, "VPN connection '%s' (IP4 Config Get) reply received from old-style plugin.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); /* In the old API, the generic and IPv4 configuration items * were mixed together. @@ -937,7 +921,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy, int i; nm_log_info (LOGD_VPN, "VPN connection '%s' (IP6 Config Get) reply received.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); if (g_hash_table_size (config_hash) == 0) { priv->has_ip6 = FALSE; @@ -1073,7 +1057,7 @@ nm_vpn_connection_ip_config_timeout (gpointer user_data) */ if (nm_vpn_connection_get_vpn_state (connection) == NM_VPN_CONNECTION_STATE_IP_CONFIG_GET) { nm_log_warn (LOGD_VPN, "VPN connection '%s' (IP Config Get) timeout exceeded.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); nm_vpn_connection_set_vpn_state (connection, NM_VPN_CONNECTION_STATE_FAILED, NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT); @@ -1089,11 +1073,11 @@ nm_vpn_connection_connect_cb (DBusGProxy *proxy, GError *err, gpointer user_data NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); nm_log_info (LOGD_VPN, "VPN connection '%s' (Connect) reply received.", - nm_vpn_connection_get_name (connection)); + nm_connection_get_id (priv->connection)); if (err) { nm_log_warn (LOGD_VPN, "VPN connection '%s' failed to connect: '%s'.", - nm_vpn_connection_get_name (connection), err->message); + nm_connection_get_id (priv->connection), err->message); nm_vpn_connection_set_vpn_state (connection, NM_VPN_CONNECTION_STATE_FAILED, NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED); @@ -1219,20 +1203,6 @@ nm_vpn_connection_activate (NMVPNConnection *connection) NM_VPN_CONNECTION_STATE_REASON_NONE); } -const char * -nm_vpn_connection_get_name (NMVPNConnection *connection) -{ - NMVPNConnectionPrivate *priv; - NMSettingConnection *s_con; - - g_return_val_if_fail (NM_IS_VPN_CONNECTION (connection), NULL); - - priv = NM_VPN_CONNECTION_GET_PRIVATE (connection); - s_con = nm_connection_get_setting_connection (priv->connection); - - return nm_setting_connection_get_id (s_con); -} - NMConnection * nm_vpn_connection_get_connection (NMVPNConnection *connection) { @@ -1431,11 +1401,13 @@ get_secrets (NMVPNConnection *self, SecretsReq secrets_idx) NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self); NMSettingsGetSecretsFlags flags = NM_SETTINGS_GET_SECRETS_FLAG_NONE; GError *error = NULL; - gboolean filter_by_uid = priv->user_requested; + gboolean filter_by_uid; g_return_if_fail (secrets_idx < SECRETS_REQ_LAST); priv->secrets_idx = secrets_idx; + filter_by_uid = nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self)); + nm_log_dbg (LOGD_VPN, "(%s/%s) requesting VPN secrets pass #%d", nm_connection_get_uuid (priv->connection), nm_connection_get_id (priv->connection), @@ -1456,12 +1428,12 @@ get_secrets (NMVPNConnection *self, SecretsReq secrets_idx) g_assert_not_reached (); } - if (priv->user_requested) + if (nm_active_connection_get_user_requested (NM_ACTIVE_CONNECTION (self))) flags |= NM_SETTINGS_GET_SECRETS_FLAG_USER_REQUESTED; priv->secrets_id = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (priv->connection), filter_by_uid, - priv->user_uid, + nm_active_connection_get_user_uid (NM_ACTIVE_CONNECTION (self)), NM_SETTING_VPN_SETTING_NAME, flags, NULL, @@ -1487,6 +1459,35 @@ nm_vpn_connection_init (NMVPNConnection *self) } static void +constructed (GObject *object) +{ + NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object); + NMConnection *connection; + NMDevice *device; + + G_OBJECT_CLASS (nm_vpn_connection_parent_class)->constructed (object); + + connection = nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (object)); + priv->connection = g_object_ref (connection); + + device = (NMDevice *) nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object)); + g_assert (device); + + priv->parent_dev = g_object_ref (device); + + priv->device_monitor = g_signal_connect (device, "state-changed", + G_CALLBACK (device_state_changed), + object); + + priv->device_ip4 = g_signal_connect (device, "notify::" NM_DEVICE_IP4_CONFIG, + G_CALLBACK (device_ip4_config_changed), + object); + priv->device_ip6 = g_signal_connect (device, "notify::" NM_DEVICE_IP6_CONFIG, + G_CALLBACK (device_ip6_config_changed), + object); +} + +static void dispose (GObject *object) { NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object); @@ -1512,7 +1513,7 @@ dispose (GObject *object) if (priv->device_monitor) g_signal_handler_disconnect (priv->parent_dev, priv->device_monitor); - g_object_unref (priv->parent_dev); + g_clear_object (&priv->parent_dev); if (priv->ip4_config) g_object_unref (priv->ip4_config); @@ -1530,7 +1531,7 @@ dispose (GObject *object) priv->secrets_id); } - g_object_unref (priv->connection); + g_clear_object (&priv->connection); g_free (priv->username); G_OBJECT_CLASS (nm_vpn_connection_parent_class)->dispose (object); @@ -1578,6 +1579,7 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class) /* virtual methods */ object_class->get_property = get_property; + object_class->constructed = constructed; object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/src/vpn-manager/nm-vpn-connection.h b/src/vpn-manager/nm-vpn-connection.h index 98bf14f1d..bf5433456 100644 --- a/src/vpn-manager/nm-vpn-connection.h +++ b/src/vpn-manager/nm-vpn-connection.h @@ -72,7 +72,6 @@ NMVPNConnection * nm_vpn_connection_new (NMConnection *connection, void nm_vpn_connection_activate (NMVPNConnection *connection); NMConnection * nm_vpn_connection_get_connection (NMVPNConnection *connection); -const char * nm_vpn_connection_get_name (NMVPNConnection *connection); NMVPNConnectionState nm_vpn_connection_get_vpn_state (NMVPNConnection *connection); const char * nm_vpn_connection_get_banner (NMVPNConnection *connection); void nm_vpn_connection_fail (NMVPNConnection *connection, diff --git a/src/vpn-manager/nm-vpn-manager.c b/src/vpn-manager/nm-vpn-manager.c index 8bfa82aed..7743fddd7 100644 --- a/src/vpn-manager/nm-vpn-manager.c +++ b/src/vpn-manager/nm-vpn-manager.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2005 - 2011 Red Hat, Inc. + * Copyright (C) 2005 - 2012 Red Hat, Inc. * Copyright (C) 2006 - 2008 Novell, Inc. */ @@ -44,15 +44,6 @@ typedef struct { guint monitor_id; } NMVPNManagerPrivate; -enum { - CONNECTION_ACTIVATED, - CONNECTION_DEACTIVATED, - - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - GQuark nm_vpn_manager_error_quark (void) { @@ -91,7 +82,7 @@ find_active_vpn_connection_by_connection (NMVPNManager *self, NMConnection *conn NMVPNManagerPrivate *priv = NM_VPN_MANAGER_GET_PRIVATE (self); GHashTableIter iter; gpointer data; - GSList *active, *aiter; + const GSList *active, *aiter; NMVPNConnection *found = NULL; g_return_val_if_fail (connection, NULL); @@ -108,33 +99,10 @@ find_active_vpn_connection_by_connection (NMVPNManager *self, NMConnection *conn break; } } - g_slist_free (active); } return found; } -static void -connection_vpn_state_changed (NMVPNConnection *connection, - NMVPNConnectionState new_state, - NMVPNConnectionState old_state, - NMVPNConnectionStateReason reason, - gpointer user_data) -{ - NMVPNManager *manager = NM_VPN_MANAGER (user_data); - - switch (new_state) { - case NM_VPN_CONNECTION_STATE_ACTIVATED: - g_signal_emit (manager, signals[CONNECTION_ACTIVATED], 0, connection); - break; - case NM_VPN_CONNECTION_STATE_FAILED: - case NM_VPN_CONNECTION_STATE_DISCONNECTED: - g_signal_emit (manager, signals[CONNECTION_DEACTIVATED], 0, connection, new_state, old_state, reason); - break; - default: - break; - } -} - NMActiveConnection * nm_vpn_manager_activate_connection (NMVPNManager *manager, NMConnection *connection, @@ -155,7 +123,8 @@ nm_vpn_manager_activate_connection (NMVPNManager *manager, g_return_val_if_fail (error != NULL, NULL); g_return_val_if_fail (*error == NULL, NULL); - if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED) { + if ( nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED + && nm_device_get_state (device) != NM_DEVICE_STATE_SECONDARIES) { g_set_error (error, NM_VPN_MANAGER_ERROR, NM_VPN_MANAGER_ERROR_DEVICE_NOT_ACTIVE, "%s", "The base device for the VPN connection was not active."); @@ -187,142 +156,48 @@ nm_vpn_manager_activate_connection (NMVPNManager *manager, return NULL; } - vpn = nm_vpn_service_activate (service, connection, device, specific_object, user_requested, user_uid, error); - if (vpn) { - g_signal_connect (vpn, NM_VPN_CONNECTION_INTERNAL_STATE_CHANGED, - G_CALLBACK (connection_vpn_state_changed), - manager); - } - - return (NMActiveConnection *) vpn; + return (NMActiveConnection *) nm_vpn_service_activate (service, + connection, + device, + specific_object, + user_requested, + user_uid, + error); } gboolean nm_vpn_manager_deactivate_connection (NMVPNManager *self, - const char *path, + NMVPNConnection *connection, NMVPNConnectionStateReason reason) { NMVPNManagerPrivate *priv; GHashTableIter iter; gpointer data; - GSList *active, *aiter; + const GSList *active, *aiter; gboolean success = FALSE; g_return_val_if_fail (self, FALSE); g_return_val_if_fail (NM_IS_VPN_MANAGER (self), FALSE); - g_return_val_if_fail (path != NULL, FALSE); + g_return_val_if_fail (connection != NULL, FALSE); priv = NM_VPN_MANAGER_GET_PRIVATE (self); g_hash_table_iter_init (&iter, priv->services); while (g_hash_table_iter_next (&iter, NULL, &data) && (success == FALSE)) { active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data)); for (aiter = active; aiter; aiter = g_slist_next (aiter)) { - NMVPNConnection *vpn = NM_VPN_CONNECTION (aiter->data); - const char *vpn_path; + NMVPNConnection *candidate = aiter->data; - vpn_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (vpn)); - if (!strcmp (path, vpn_path)) { - nm_vpn_connection_disconnect (vpn, reason); + if (connection == candidate) { + nm_vpn_connection_disconnect (connection, reason); success = TRUE; break; } } - g_slist_free (active); } return success; } -void -nm_vpn_manager_add_active_connections (NMVPNManager *self, - NMConnection *filter, - GPtrArray *array) -{ - NMVPNManagerPrivate *priv; - GHashTableIter iter; - gpointer data; - GSList *active, *aiter; - - g_return_if_fail (self); - g_return_if_fail (NM_IS_VPN_MANAGER (self)); - g_return_if_fail (array != NULL); - - priv = NM_VPN_MANAGER_GET_PRIVATE (self); - g_hash_table_iter_init (&iter, priv->services); - while (g_hash_table_iter_next (&iter, NULL, &data)) { - active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data)); - for (aiter = active; aiter; aiter = g_slist_next (aiter)) { - NMVPNConnection *vpn = NM_VPN_CONNECTION (aiter->data); - const char *path; - - if (!filter || (nm_vpn_connection_get_connection (vpn) == filter)) { - path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (vpn)); - g_ptr_array_add (array, g_strdup (path)); - } - } - g_slist_free (active); - } -} - -GSList * -nm_vpn_manager_get_active_connections (NMVPNManager *self) -{ - NMVPNManagerPrivate *priv; - GHashTableIter iter; - gpointer data; - GSList *list = NULL, *active; - - g_return_val_if_fail (self, NULL); - g_return_val_if_fail (NM_IS_VPN_MANAGER (self), NULL); - - priv = NM_VPN_MANAGER_GET_PRIVATE (self); - g_hash_table_iter_init (&iter, priv->services); - while (g_hash_table_iter_next (&iter, NULL, &data)) { - active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data)); - list = g_slist_concat (list, active); - } - return list; -} - -NMVPNConnection * -nm_vpn_manager_get_vpn_connection_for_active (NMVPNManager *manager, - const char *active_path) -{ - NMVPNManagerPrivate *priv; - GHashTableIter iter; - gpointer data; - GSList *active, *elt; - - g_return_val_if_fail (NM_IS_VPN_MANAGER (manager), NULL); - - priv = NM_VPN_MANAGER_GET_PRIVATE (manager); - g_hash_table_iter_init (&iter, priv->services); - while (g_hash_table_iter_next (&iter, NULL, &data)) { - active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data)); - for (elt = active; elt; elt = g_slist_next (elt)) { - NMVPNConnection *vpn = NM_VPN_CONNECTION (elt->data); - const char *ac_path; - - ac_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (vpn)); - if (ac_path && !strcmp (ac_path, active_path)) - return vpn; - } - } - - return NULL; -} - -NMConnection * -nm_vpn_manager_get_connection_for_active (NMVPNManager *manager, - const char *active_path) -{ - NMVPNConnection *vpn_con; - - vpn_con = nm_vpn_manager_get_vpn_connection_for_active (manager, active_path); - - return vpn_con ? nm_vpn_connection_get_connection (vpn_con) : NULL; -} - static char * service_name_from_file (const char *path) { @@ -506,23 +381,6 @@ nm_vpn_manager_class_init (NMVPNManagerClass *manager_class) /* virtual methods */ object_class->dispose = dispose; - /* signals */ - signals[CONNECTION_ACTIVATED] = - g_signal_new ("connection-activated", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, G_TYPE_OBJECT); - - signals[CONNECTION_DEACTIVATED] = - g_signal_new ("connection-deactivated", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, - _nm_marshal_VOID__OBJECT_UINT_UINT_UINT, - G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); - dbus_g_error_domain_register (NM_VPN_MANAGER_ERROR, NULL, NM_TYPE_VPN_MANAGER_ERROR); } diff --git a/src/vpn-manager/nm-vpn-manager.h b/src/vpn-manager/nm-vpn-manager.h index efae161ed..1d398ea2c 100644 --- a/src/vpn-manager/nm-vpn-manager.h +++ b/src/vpn-manager/nm-vpn-manager.h @@ -53,16 +53,6 @@ typedef struct { typedef struct { GObjectClass parent; - - /* Signals */ - void (*connection_activated) (NMVPNManager *manager, - NMVPNConnection *connection); - - void (*connection_deactivated) (NMVPNManager *manager, - NMVPNConnection *connection, - NMVPNConnectionState new_state, - NMVPNConnectionState old_state, - NMVPNConnectionStateReason reason); } NMVPNManagerClass; GType nm_vpn_manager_get_type (void); @@ -78,19 +68,7 @@ NMActiveConnection *nm_vpn_manager_activate_connection (NMVPNManager *manager, GError **error); gboolean nm_vpn_manager_deactivate_connection (NMVPNManager *manager, - const char *path, + NMVPNConnection *connection, NMVPNConnectionStateReason reason); -void nm_vpn_manager_add_active_connections (NMVPNManager *manager, - NMConnection *filter, - GPtrArray *list); - -GSList *nm_vpn_manager_get_active_connections (NMVPNManager *manager); - -NMVPNConnection *nm_vpn_manager_get_vpn_connection_for_active (NMVPNManager *manager, - const char *active_path); - -NMConnection *nm_vpn_manager_get_connection_for_active (NMVPNManager *manager, - const char *active_path); - #endif /* NM_VPN_MANAGER_H */ diff --git a/src/vpn-manager/nm-vpn-service.c b/src/vpn-manager/nm-vpn-service.c index 8fdf6c161..668cbf2e3 100644 --- a/src/vpn-manager/nm-vpn-service.c +++ b/src/vpn-manager/nm-vpn-service.c @@ -355,7 +355,7 @@ nm_vpn_service_activate (NMVPNService *service, G_CALLBACK (connection_vpn_state_changed), service); - priv->connections = g_slist_prepend (priv->connections, vpn); + priv->connections = g_slist_prepend (priv->connections, g_object_ref (vpn)); if (nm_dbus_manager_name_has_owner (priv->dbus_mgr, priv->dbus_service)) { // FIXME: fill in error when errors happen @@ -369,12 +369,12 @@ nm_vpn_service_activate (NMVPNService *service, return vpn; } -GSList * +const GSList * nm_vpn_service_get_active_connections (NMVPNService *service) { g_return_val_if_fail (NM_IS_VPN_SERVICE (service), NULL); - return g_slist_copy (NM_VPN_SERVICE_GET_PRIVATE (service)->connections); + return NM_VPN_SERVICE_GET_PRIVATE (service)->connections; } static void diff --git a/src/vpn-manager/nm-vpn-service.h b/src/vpn-manager/nm-vpn-service.h index 6ccdcc473..e883d55f8 100644 --- a/src/vpn-manager/nm-vpn-service.h +++ b/src/vpn-manager/nm-vpn-service.h @@ -62,7 +62,7 @@ NMVPNConnection * nm_vpn_service_activate (NMVPNService *service, gulong user_uid, GError **error); -GSList * nm_vpn_service_get_active_connections (NMVPNService *service); +const GSList *nm_vpn_service_get_active_connections (NMVPNService *service); void nm_vpn_service_connections_stop (NMVPNService *service, gboolean fail, diff --git a/src/wifi/Makefile.in b/src/wifi/Makefile.in index f3d4499f2..5019bbeb4 100644 --- a/src/wifi/Makefile.in +++ b/src/wifi/Makefile.in @@ -56,16 +56,18 @@ subdir = src/wifi DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -136,6 +138,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -150,9 +156,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -162,17 +166,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -213,6 +214,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -229,11 +231,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -248,6 +246,8 @@ 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@ @@ -257,6 +257,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -283,13 +284,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -344,6 +346,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -358,6 +365,10 @@ 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@ INCLUDES = \ -I${top_srcdir}/include \ -I${top_builddir}/include \ @@ -437,25 +448,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwifi_utils_la-wifi-utils.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/wifi/wifi-utils-nl80211.c b/src/wifi/wifi-utils-nl80211.c index 663cbc268..62ec6c2be 100644 --- a/src/wifi/wifi-utils-nl80211.c +++ b/src/wifi/wifi-utils-nl80211.c @@ -108,7 +108,6 @@ _nl80211_send_and_recv (struct nl_sock *nl_sock, int err, done; g_return_val_if_fail (msg != NULL, -ENOMEM); - g_return_val_if_fail (valid_handler != NULL, -EINVAL); cb = nl_cb_clone (nl_cb); if (!cb) { @@ -124,7 +123,8 @@ _nl80211_send_and_recv (struct nl_sock *nl_sock, nl_cb_err (cb, NL_CB_CUSTOM, error_handler, &done); nl_cb_set (cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &done); nl_cb_set (cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &done); - nl_cb_set (cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, valid_data); + if (valid_handler) + nl_cb_set (cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, valid_data); /* Loop until one of our NL callbacks says we're done; on success * done will be 1, on error it will be < 0. @@ -187,6 +187,9 @@ static int nl80211_iface_info_handler (struct nl_msg *msg, void *arg) case NL80211_IFTYPE_ADHOC: info->mode = NM_802_11_MODE_ADHOC; break; + case NL80211_IFTYPE_AP: + info->mode = NM_802_11_MODE_AP; + break; case NL80211_IFTYPE_STATION: info->mode = NM_802_11_MODE_INFRA; break; @@ -216,12 +219,32 @@ wifi_nl80211_get_mode (WifiData *data) static gboolean wifi_nl80211_set_mode (WifiData *data, const NM80211Mode mode) { - /* - * Used only to set mode for scanning as some old cards - * don't properly scan in IBSS mode, nl80211 cards are - * expected to scan properly so ignore this. - */ - return TRUE; + WifiDataNl80211 *nl80211 = (WifiDataNl80211 *) data; + struct nl_msg *msg; + int err; + + msg = nl80211_alloc_msg (nl80211, NL80211_CMD_SET_INTERFACE, 0); + + switch (mode) { + case NM_802_11_MODE_INFRA: + NLA_PUT_U32 (msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_STATION); + break; + case NM_802_11_MODE_ADHOC: + NLA_PUT_U32 (msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_ADHOC); + break; + case NM_802_11_MODE_AP: + NLA_PUT_U32 (msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_AP); + break; + default: + g_assert_not_reached (); + } + + err = nl80211_send_and_recv (nl80211, msg, NULL, NULL); + return err ? FALSE : TRUE; + + nla_put_failure: + nlmsg_free (msg); + return FALSE; } /* @divisor: pass what value @xbm should be divided by to get dBm */ diff --git a/src/wifi/wifi-utils-wext.c b/src/wifi/wifi-utils-wext.c index 75d00f412..37cd94e98 100644 --- a/src/wifi/wifi-utils-wext.c +++ b/src/wifi/wifi-utils-wext.c @@ -118,6 +118,8 @@ wifi_wext_get_mode (WifiData *data) switch (wrq.u.mode) { case IW_MODE_ADHOC: return NM_802_11_MODE_ADHOC; + case IW_MODE_MASTER: + return NM_802_11_MODE_AP; case IW_MODE_INFRA: return NM_802_11_MODE_INFRA; default: @@ -140,6 +142,9 @@ wifi_wext_set_mode (WifiData *data, const NM80211Mode mode) case NM_802_11_MODE_ADHOC: wrq.u.mode = IW_MODE_ADHOC; break; + case NM_802_11_MODE_AP: + wrq.u.mode = IW_MODE_MASTER; + break; case NM_802_11_MODE_INFRA: wrq.u.mode = IW_MODE_INFRA; break; diff --git a/src/wifi/wifi-utils.c b/src/wifi/wifi-utils.c index a99a4b7bc..fc491ec4f 100644 --- a/src/wifi/wifi-utils.c +++ b/src/wifi/wifi-utils.c @@ -96,7 +96,9 @@ gboolean wifi_utils_set_mode (WifiData *data, const NM80211Mode mode) { g_return_val_if_fail (data != NULL, FALSE); - g_return_val_if_fail ((mode == NM_802_11_MODE_INFRA) || (mode == NM_802_11_MODE_ADHOC), FALSE); + g_return_val_if_fail ( (mode == NM_802_11_MODE_INFRA) + || (mode == NM_802_11_MODE_AP) + || (mode == NM_802_11_MODE_ADHOC), FALSE); /* nl80211 probably doesn't need this */ return data->set_mode ? data->set_mode (data, mode) : TRUE; diff --git a/src/wimax/Makefile.in b/src/wimax/Makefile.in index 6c15e97d9..8e2352777 100644 --- a/src/wimax/Makefile.in +++ b/src/wimax/Makefile.in @@ -55,16 +55,18 @@ subdir = src/wimax DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ - $(top_srcdir)/m4/gettext.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/libnl-check.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 + $(top_srcdir)/m4/gettext.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/libnl-check.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) mkinstalldirs = $(install_sh) -d @@ -167,6 +169,10 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CKDB_PATH = @CKDB_PATH@ +CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ +CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ +CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -181,9 +187,7 @@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCLIENT_VERSION = @DHCLIENT_VERSION@ DHCPCD_PATH = @DHCPCD_PATH@ -DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -193,17 +197,14 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GENHTML = @GENHTML@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MAKEFILE = @GLIB_MAKEFILE@ GLIB_MKENUMS = @GLIB_MKENUMS@ -GMODULE_CFLAGS = @GMODULE_CFLAGS@ -GMODULE_LIBS = @GMODULE_LIBS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ @@ -244,6 +245,7 @@ IPTABLES_PATH = @IPTABLES_PATH@ IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDL = @LIBDL@ @@ -260,11 +262,7 @@ LIBNL2_LIBS = @LIBNL2_LIBS@ LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_GENL3_CFLAGS = @LIBNL_GENL3_CFLAGS@ -LIBNL_GENL3_LIBS = @LIBNL_GENL3_LIBS@ LIBNL_LIBS = @LIBNL_LIBS@ -LIBNL_ROUTE3_CFLAGS = @LIBNL_ROUTE3_CFLAGS@ -LIBNL_ROUTE3_LIBS = @LIBNL_ROUTE3_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ @@ -279,6 +277,8 @@ 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@ @@ -288,6 +288,7 @@ NMEDIT = @NMEDIT@ 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@ @@ -314,13 +315,14 @@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ -RESOLVCONF_PATH = @RESOLVCONF_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ -SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ -SYSTEMD_LIBS = @SYSTEMD_LIBS@ +SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ +SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ +SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ @@ -375,6 +377,11 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ +nmbinary = @nmbinary@ +nmconfdir = @nmconfdir@ +nmdatadir = @nmdatadir@ +nmrundir = @nmrundir@ +nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -389,6 +396,10 @@ 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@ INCLUDES = \ -I${top_srcdir}/src \ -I${top_builddir}/src/generated \ @@ -513,25 +524,22 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_device_plugin_wimax_la-nm-wimax-util.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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 $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< diff --git a/src/wimax/nm-device-wimax.c b/src/wimax/nm-device-wimax.c index 1f1a622c4..d549e67e5 100644 --- a/src/wimax/nm-device-wimax.c +++ b/src/wimax/nm-device-wimax.c @@ -254,6 +254,8 @@ remove_all_nsps (NMDeviceWimax *self) g_object_unref (nsp); } + nm_device_recheck_available_connections (NM_DEVICE (self)); + g_slist_free (priv->nsp_list); priv->nsp_list = NULL; } @@ -308,7 +310,7 @@ update_availability (NMDeviceWimax *self, gboolean old_available) /* NMDeviceInterface interface */ static void -real_set_enabled (NMDevice *device, gboolean enabled) +set_enabled (NMDevice *device, gboolean enabled) { NMDeviceWimax *self = NM_DEVICE_WIMAX (device); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); @@ -345,7 +347,7 @@ real_set_enabled (NMDevice *device, gboolean enabled) /* NMDevice methods */ static void -real_take_down (NMDevice *device) +take_down (NMDevice *device) { NMDeviceWimax *self = NM_DEVICE_WIMAX (device); @@ -354,13 +356,13 @@ real_take_down (NMDevice *device) } static gboolean -real_hw_is_up (NMDevice *device) +hw_is_up (NMDevice *device) { return nm_system_iface_is_up (nm_device_get_ip_ifindex (device)); } static gboolean -real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) +hw_bring_up (NMDevice *dev, gboolean *no_firmware) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (dev); @@ -371,13 +373,13 @@ real_hw_bring_up (NMDevice *dev, gboolean *no_firmware) } static void -real_hw_take_down (NMDevice *dev) +hw_take_down (NMDevice *dev) { nm_system_iface_set_up (nm_device_get_ip_ifindex (dev), FALSE, NULL); } static void -real_update_hw_address (NMDevice *dev) +update_hw_address (NMDevice *dev) { NMDeviceWimax *self = NM_DEVICE_WIMAX (dev); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); @@ -439,9 +441,9 @@ hwaddr_matches (NMDevice *device, } static gboolean -real_check_connection_compatible (NMDevice *device, - NMConnection *connection, - GError **error) +check_connection_compatible (NMDevice *device, + NMConnection *connection, + GError **error) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); NMSettingConnection *s_con; @@ -480,11 +482,26 @@ real_check_connection_compatible (NMDevice *device, } static gboolean -real_complete_connection (NMDevice *device, - NMConnection *connection, - const char *specific_object, - const GSList *existing_connections, - GError **error) +check_connection_available (NMDevice *device, NMConnection *connection) +{ + NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); + const GSList *ns_iter = NULL; + + /* Ensure the connection applies to an NSP in the scan list */ + for (ns_iter = priv->nsp_list; ns_iter; ns_iter = ns_iter->next) { + if (nm_wimax_nsp_check_compatible (NM_WIMAX_NSP (ns_iter->data), connection)) + return TRUE; + } + + return FALSE; +} + +static gboolean +complete_connection (NMDevice *device, + NMConnection *connection, + const char *specific_object, + const GSList *existing_connections, + GError **error) { NMDeviceWimax *self = NM_DEVICE_WIMAX (device); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); @@ -592,9 +609,9 @@ real_complete_connection (NMDevice *device, } static NMConnection * -real_get_best_auto_connection (NMDevice *device, - GSList *connections, - char **specific_object) +get_best_auto_connection (NMDevice *device, + GSList *connections, + char **specific_object) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); GSList *iter; @@ -638,13 +655,13 @@ real_get_best_auto_connection (NMDevice *device, } static guint32 -real_get_generic_capabilities (NMDevice *dev) +get_generic_capabilities (NMDevice *dev) { return NM_DEVICE_CAP_NM_SUPPORTED; } static gboolean -real_is_available (NMDevice *device) +is_available (NMDevice *device) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); const char *iface = nm_device_get_iface (device); @@ -708,7 +725,7 @@ clear_connected_poll (NMDeviceWimax *self) } static NMActStageReturn -real_act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) +act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); NMActRequest *req; @@ -756,7 +773,7 @@ real_act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) } static NMActStageReturn -real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) { NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device); NMConnection *connection; @@ -824,7 +841,7 @@ force_disconnect (NMDeviceWimax *self, struct wmxsdk *sdk) } static void -real_deactivate (NMDevice *device) +deactivate (NMDevice *device) { NMDeviceWimax *self = NM_DEVICE_WIMAX (device); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); @@ -1070,6 +1087,9 @@ remove_outdated_nsps (NMDeviceWimax *self, g_object_unref (nsp); } + if (g_slist_length(to_remove) > 0) + nm_device_recheck_available_connections (NM_DEVICE (self)); + g_slist_free (to_remove); } @@ -1117,6 +1137,7 @@ wmx_scan_result_cb (struct wmxsdk *wmxsdk, priv->nsp_list = g_slist_append (priv->nsp_list, nsp); nm_wimax_nsp_export_to_dbus (nsp); g_signal_emit (self, signals[NSP_ADDED], 0, nsp); + nm_device_recheck_available_connections (NM_DEVICE (self)); } } } @@ -1272,8 +1293,7 @@ static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, - NMDeviceStateReason reason, - gpointer user_data) + NMDeviceStateReason reason) { NMDeviceWimax *self = NM_DEVICE_WIMAX (device); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); @@ -1375,7 +1395,6 @@ nm_device_wimax_new (const char *udi, struct wmxsdk *sdk; nm_wimax_util_sdk_ref (); - g_signal_connect (device, "state-changed", G_CALLBACK (device_state_changed), NULL); /* See if the SDK already knows about this interface */ sdk = iwmx_sdk_get_wmxsdk_for_iface (iface); @@ -1498,21 +1517,24 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *klass) object_class->get_property = get_property; object_class->dispose = dispose; - device_class->take_down = real_take_down; - device_class->hw_is_up = real_hw_is_up; - device_class->hw_bring_up = real_hw_bring_up; - device_class->hw_take_down = real_hw_take_down; - device_class->update_hw_address = real_update_hw_address; - device_class->check_connection_compatible = real_check_connection_compatible; - device_class->complete_connection = real_complete_connection; - device_class->get_best_auto_connection = real_get_best_auto_connection; - device_class->get_generic_capabilities = real_get_generic_capabilities; - device_class->is_available = real_is_available; - device_class->act_stage1_prepare = real_act_stage1_prepare; - device_class->act_stage2_config = real_act_stage2_config; - device_class->deactivate = real_deactivate; - device_class->set_enabled = real_set_enabled; - device_class->hwaddr_matches = hwaddr_matches; + device_class->take_down = take_down; + device_class->hw_is_up = hw_is_up; + device_class->hw_bring_up = hw_bring_up; + device_class->hw_take_down = hw_take_down; + device_class->update_hw_address = update_hw_address; + device_class->check_connection_compatible = check_connection_compatible; + device_class->check_connection_available = check_connection_available; + device_class->complete_connection = complete_connection; + device_class->get_best_auto_connection = get_best_auto_connection; + device_class->get_generic_capabilities = get_generic_capabilities; + device_class->is_available = is_available; + device_class->act_stage1_prepare = act_stage1_prepare; + device_class->act_stage2_config = act_stage2_config; + device_class->deactivate = deactivate; + device_class->set_enabled = set_enabled; + device_class->hwaddr_matches = hwaddr_matches; + + device_class->state_changed = device_state_changed; /* Properties */ g_object_class_install_property |