diff options
Diffstat (limited to 'callouts')
| -rw-r--r-- | callouts/77-nm-olpc-mesh.rules | 6 | ||||
| -rw-r--r-- | callouts/Makefile.am | 94 | ||||
| -rw-r--r-- | callouts/Makefile.in | 825 | ||||
| -rw-r--r-- | callouts/nm-avahi-autoipd-action.c | 142 | ||||
| -rw-r--r-- | callouts/nm-avahi-autoipd.conf | 13 | ||||
| -rw-r--r-- | callouts/nm-dhcp-client-action.c | 320 | ||||
| -rw-r--r-- | callouts/nm-dhcp-client.conf | 13 | ||||
| -rw-r--r-- | callouts/nm-dispatcher-action.c | 798 | ||||
| -rw-r--r-- | callouts/nm-dispatcher-action.h | 33 | ||||
| -rw-r--r-- | callouts/nm-dispatcher.conf | 14 | ||||
| -rw-r--r-- | callouts/nm-dispatcher.xml | 37 | ||||
| -rw-r--r-- | callouts/org.freedesktop.nm_dispatcher.service.in | 5 |
12 files changed, 2300 insertions, 0 deletions
diff --git a/callouts/77-nm-olpc-mesh.rules b/callouts/77-nm-olpc-mesh.rules new file mode 100644 index 00000000..a1a1554c --- /dev/null +++ b/callouts/77-nm-olpc-mesh.rules @@ -0,0 +1,6 @@ +# do not edit this file, it will be overwritten on update + +# The fact that this device is driven by libertas is not currently exposed +# in the sysfs tree..? +KERNEL=="msh*", SUBSYSTEM=="net", DRIVERS=="usb", ATTRS{idVendor}=="1286", ATTRS{idProduct}=="2001", ENV{ID_NM_OLPC_MESH}="1" + diff --git a/callouts/Makefile.am b/callouts/Makefile.am new file mode 100644 index 00000000..6f28f5a7 --- /dev/null +++ b/callouts/Makefile.am @@ -0,0 +1,94 @@ +dbusservicedir = $(DBUS_SYS_DIR) +dbusservice_DATA = \ + nm-dhcp-client.conf \ + nm-dispatcher.conf \ + nm-avahi-autoipd.conf + +libexec_PROGRAMS = \ + nm-dhcp-client.action \ + nm-dispatcher.action \ + nm-avahi-autoipd.action + +nm_dhcp_client_action_SOURCES = \ + nm-dhcp-client-action.c + +nm_dhcp_client_action_CPPFLAGS = \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" + +nm_dhcp_client_action_LDADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + + +nm_avahi_autoipd_action_SOURCES = \ + nm-avahi-autoipd-action.c + +nm_avahi_autoipd_action_CPPFLAGS = \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" + +nm_avahi_autoipd_action_LDADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + + +nm_dispatcher_action_SOURCES = \ + nm-dispatcher-action.c \ + nm-dispatcher-action.h + +nm_dispatcher_action_CPPFLAGS = \ + -I${top_srcdir} \ + -I${top_srcdir}/include \ + -I${top_srcdir}/libnm-util \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" + +nm_dispatcher_action_LDADD = \ + $(top_builddir)/libnm-glib/libnm-glib.la \ + $(top_builddir)/libnm-util/libnm-util.la \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + +nm-dispatcher-glue.h: nm-dispatcher.xml + dbus-binding-tool --prefix=nm_dispatcher --mode=glib-server --output=$@ $< + +udevrulesdir = $(UDEV_BASE_DIR)/rules.d +udevrules_DATA = 77-nm-olpc-mesh.rules + +dbusactivationdir = $(datadir)/dbus-1/system-services +dbusactivation_in_files = org.freedesktop.nm_dispatcher.service.in +dbusactivation_DATA = $(dbusactivation_in_files:.service.in=.service) + +%.service: %.service.in + $(edit) $< >$@ + +edit = @sed \ + -e 's|@sbindir[@]|$(sbindir)|g' \ + -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|@localstatedir[@]|$(localstatedir)|g' \ + -e 's|@libexecdir[@]|$(libexecdir)|g' + +dispatcherdir=$(sysconfdir)/NetworkManager/dispatcher.d +install-data-hook: + $(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir) + +BUILT_SOURCES = nm-dispatcher-glue.h + +CLEANFILES = $(BUILT_SOURCES) $(dbusactivation_DATA) + +EXTRA_DIST = \ + $(dbusservice_DATA) \ + $(udevrules_DATA) \ + $(dbusactivation_in_files) \ + nm-dispatcher.xml + diff --git a/callouts/Makefile.in b/callouts/Makefile.in new file mode 100644 index 00000000..b392ccd5 --- /dev/null +++ b/callouts/Makefile.in @@ -0,0 +1,825 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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@ +libexec_PROGRAMS = nm-dhcp-client.action$(EXEEXT) \ + nm-dispatcher.action$(EXEEXT) nm-avahi-autoipd.action$(EXEEXT) +subdir = callouts +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/gtk-doc.m4 $(top_srcdir)/m4/intltool.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)/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__installdirs = "$(DESTDIR)$(libexecdir)" \ + "$(DESTDIR)$(dbusactivationdir)" "$(DESTDIR)$(dbusservicedir)" \ + "$(DESTDIR)$(udevrulesdir)" +PROGRAMS = $(libexec_PROGRAMS) +am_nm_avahi_autoipd_action_OBJECTS = \ + nm_avahi_autoipd_action-nm-avahi-autoipd-action.$(OBJEXT) +nm_avahi_autoipd_action_OBJECTS = \ + $(am_nm_avahi_autoipd_action_OBJECTS) +am__DEPENDENCIES_1 = +nm_avahi_autoipd_action_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_nm_dhcp_client_action_OBJECTS = \ + nm_dhcp_client_action-nm-dhcp-client-action.$(OBJEXT) +nm_dhcp_client_action_OBJECTS = $(am_nm_dhcp_client_action_OBJECTS) +nm_dhcp_client_action_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_nm_dispatcher_action_OBJECTS = \ + nm_dispatcher_action-nm-dispatcher-action.$(OBJEXT) +nm_dispatcher_action_OBJECTS = $(am_nm_dispatcher_action_OBJECTS) +nm_dispatcher_action_DEPENDENCIES = \ + $(top_builddir)/libnm-glib/libnm-glib.la \ + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(nm_avahi_autoipd_action_SOURCES) \ + $(nm_dhcp_client_action_SOURCES) \ + $(nm_dispatcher_action_SOURCES) +DIST_SOURCES = $(nm_avahi_autoipd_action_SOURCES) \ + $(nm_dhcp_client_action_SOURCES) \ + $(nm_dispatcher_action_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +DATA = $(dbusactivation_DATA) $(dbusservice_DATA) $(udevrules_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +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@ +DHCPCD_PATH = @DHCPCD_PATH@ +DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GMODULE_CFLAGS = @GMODULE_CFLAGS@ +GMODULE_LIBS = @GMODULE_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +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@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +IPTABLES_PATH = @IPTABLES_PATH@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBM = @LIBM@ +LIBNL_CFLAGS = @LIBNL_CFLAGS@ +LIBNL_LIBS = @LIBNL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +RANLIB = @RANLIB@ +RESOLVCONF_PATH = @RESOLVCONF_PATH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ +UDEV_BASE_DIR = @UDEV_BASE_DIR@ +USE_NLS = @USE_NLS@ +UUID_CFLAGS = @UUID_CFLAGS@ +UUID_LIBS = @UUID_LIBS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +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@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +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@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +dbusservicedir = $(DBUS_SYS_DIR) +dbusservice_DATA = \ + nm-dhcp-client.conf \ + nm-dispatcher.conf \ + nm-avahi-autoipd.conf + +nm_dhcp_client_action_SOURCES = \ + nm-dhcp-client-action.c + +nm_dhcp_client_action_CPPFLAGS = \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" + +nm_dhcp_client_action_LDADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + +nm_avahi_autoipd_action_SOURCES = \ + nm-avahi-autoipd-action.c + +nm_avahi_autoipd_action_CPPFLAGS = \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" + +nm_avahi_autoipd_action_LDADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + +nm_dispatcher_action_SOURCES = \ + nm-dispatcher-action.c \ + nm-dispatcher-action.h + +nm_dispatcher_action_CPPFLAGS = \ + -I${top_srcdir} \ + -I${top_srcdir}/include \ + -I${top_srcdir}/libnm-util \ + $(DBUS_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLIBEXECDIR=\"$(libexecdir)\" + +nm_dispatcher_action_LDADD = \ + $(top_builddir)/libnm-glib/libnm-glib.la \ + $(top_builddir)/libnm-util/libnm-util.la \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + +udevrulesdir = $(UDEV_BASE_DIR)/rules.d +udevrules_DATA = 77-nm-olpc-mesh.rules +dbusactivationdir = $(datadir)/dbus-1/system-services +dbusactivation_in_files = org.freedesktop.nm_dispatcher.service.in +dbusactivation_DATA = $(dbusactivation_in_files:.service.in=.service) +edit = @sed \ + -e 's|@sbindir[@]|$(sbindir)|g' \ + -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|@localstatedir[@]|$(localstatedir)|g' \ + -e 's|@libexecdir[@]|$(libexecdir)|g' + +dispatcherdir = $(sysconfdir)/NetworkManager/dispatcher.d +BUILT_SOURCES = nm-dispatcher-glue.h +CLEANFILES = $(BUILT_SOURCES) $(dbusactivation_DATA) +EXTRA_DIST = \ + $(dbusservice_DATA) \ + $(udevrules_DATA) \ + $(dbusactivation_in_files) \ + nm-dispatcher.xml + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) 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 callouts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu callouts/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): +install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)" + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(libexecdir)" && rm -f $$files + +clean-libexecPROGRAMS: + @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +nm-avahi-autoipd.action$(EXEEXT): $(nm_avahi_autoipd_action_OBJECTS) $(nm_avahi_autoipd_action_DEPENDENCIES) + @rm -f nm-avahi-autoipd.action$(EXEEXT) + $(LINK) $(nm_avahi_autoipd_action_OBJECTS) $(nm_avahi_autoipd_action_LDADD) $(LIBS) +nm-dhcp-client.action$(EXEEXT): $(nm_dhcp_client_action_OBJECTS) $(nm_dhcp_client_action_DEPENDENCIES) + @rm -f nm-dhcp-client.action$(EXEEXT) + $(LINK) $(nm_dhcp_client_action_OBJECTS) $(nm_dhcp_client_action_LDADD) $(LIBS) +nm-dispatcher.action$(EXEEXT): $(nm_dispatcher_action_OBJECTS) $(nm_dispatcher_action_DEPENDENCIES) + @rm -f nm-dispatcher.action$(EXEEXT) + $(LINK) $(nm_dispatcher_action_OBJECTS) $(nm_dispatcher_action_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ 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@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ 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@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ 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@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +nm_avahi_autoipd_action-nm-avahi-autoipd-action.o: nm-avahi-autoipd-action.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_avahi_autoipd_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_avahi_autoipd_action-nm-avahi-autoipd-action.o -MD -MP -MF $(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Tpo -c -o nm_avahi_autoipd_action-nm-avahi-autoipd-action.o `test -f 'nm-avahi-autoipd-action.c' || echo '$(srcdir)/'`nm-avahi-autoipd-action.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Tpo $(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-avahi-autoipd-action.c' object='nm_avahi_autoipd_action-nm-avahi-autoipd-action.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_avahi_autoipd_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm_avahi_autoipd_action-nm-avahi-autoipd-action.o `test -f 'nm-avahi-autoipd-action.c' || echo '$(srcdir)/'`nm-avahi-autoipd-action.c + +nm_avahi_autoipd_action-nm-avahi-autoipd-action.obj: nm-avahi-autoipd-action.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_avahi_autoipd_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_avahi_autoipd_action-nm-avahi-autoipd-action.obj -MD -MP -MF $(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Tpo -c -o nm_avahi_autoipd_action-nm-avahi-autoipd-action.obj `if test -f 'nm-avahi-autoipd-action.c'; then $(CYGPATH_W) 'nm-avahi-autoipd-action.c'; else $(CYGPATH_W) '$(srcdir)/nm-avahi-autoipd-action.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Tpo $(DEPDIR)/nm_avahi_autoipd_action-nm-avahi-autoipd-action.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-avahi-autoipd-action.c' object='nm_avahi_autoipd_action-nm-avahi-autoipd-action.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_avahi_autoipd_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm_avahi_autoipd_action-nm-avahi-autoipd-action.obj `if test -f 'nm-avahi-autoipd-action.c'; then $(CYGPATH_W) 'nm-avahi-autoipd-action.c'; else $(CYGPATH_W) '$(srcdir)/nm-avahi-autoipd-action.c'; fi` + +nm_dhcp_client_action-nm-dhcp-client-action.o: nm-dhcp-client-action.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dhcp_client_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_dhcp_client_action-nm-dhcp-client-action.o -MD -MP -MF $(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Tpo -c -o nm_dhcp_client_action-nm-dhcp-client-action.o `test -f 'nm-dhcp-client-action.c' || echo '$(srcdir)/'`nm-dhcp-client-action.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Tpo $(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-dhcp-client-action.c' object='nm_dhcp_client_action-nm-dhcp-client-action.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dhcp_client_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm_dhcp_client_action-nm-dhcp-client-action.o `test -f 'nm-dhcp-client-action.c' || echo '$(srcdir)/'`nm-dhcp-client-action.c + +nm_dhcp_client_action-nm-dhcp-client-action.obj: nm-dhcp-client-action.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dhcp_client_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_dhcp_client_action-nm-dhcp-client-action.obj -MD -MP -MF $(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Tpo -c -o nm_dhcp_client_action-nm-dhcp-client-action.obj `if test -f 'nm-dhcp-client-action.c'; then $(CYGPATH_W) 'nm-dhcp-client-action.c'; else $(CYGPATH_W) '$(srcdir)/nm-dhcp-client-action.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Tpo $(DEPDIR)/nm_dhcp_client_action-nm-dhcp-client-action.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-dhcp-client-action.c' object='nm_dhcp_client_action-nm-dhcp-client-action.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dhcp_client_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm_dhcp_client_action-nm-dhcp-client-action.obj `if test -f 'nm-dhcp-client-action.c'; then $(CYGPATH_W) 'nm-dhcp-client-action.c'; else $(CYGPATH_W) '$(srcdir)/nm-dhcp-client-action.c'; fi` + +nm_dispatcher_action-nm-dispatcher-action.o: nm-dispatcher-action.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dispatcher_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_dispatcher_action-nm-dispatcher-action.o -MD -MP -MF $(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Tpo -c -o nm_dispatcher_action-nm-dispatcher-action.o `test -f 'nm-dispatcher-action.c' || echo '$(srcdir)/'`nm-dispatcher-action.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Tpo $(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-dispatcher-action.c' object='nm_dispatcher_action-nm-dispatcher-action.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dispatcher_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm_dispatcher_action-nm-dispatcher-action.o `test -f 'nm-dispatcher-action.c' || echo '$(srcdir)/'`nm-dispatcher-action.c + +nm_dispatcher_action-nm-dispatcher-action.obj: nm-dispatcher-action.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dispatcher_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm_dispatcher_action-nm-dispatcher-action.obj -MD -MP -MF $(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Tpo -c -o nm_dispatcher_action-nm-dispatcher-action.obj `if test -f 'nm-dispatcher-action.c'; then $(CYGPATH_W) 'nm-dispatcher-action.c'; else $(CYGPATH_W) '$(srcdir)/nm-dispatcher-action.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Tpo $(DEPDIR)/nm_dispatcher_action-nm-dispatcher-action.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-dispatcher-action.c' object='nm_dispatcher_action-nm-dispatcher-action.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nm_dispatcher_action_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm_dispatcher_action-nm-dispatcher-action.obj `if test -f 'nm-dispatcher-action.c'; then $(CYGPATH_W) 'nm-dispatcher-action.c'; else $(CYGPATH_W) '$(srcdir)/nm-dispatcher-action.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-dbusactivationDATA: $(dbusactivation_DATA) + @$(NORMAL_INSTALL) + test -z "$(dbusactivationdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusactivationdir)" + @list='$(dbusactivation_DATA)'; test -n "$(dbusactivationdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusactivationdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusactivationdir)" || exit $$?; \ + done + +uninstall-dbusactivationDATA: + @$(NORMAL_UNINSTALL) + @list='$(dbusactivation_DATA)'; test -n "$(dbusactivationdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(dbusactivationdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(dbusactivationdir)" && rm -f $$files +install-dbusserviceDATA: $(dbusservice_DATA) + @$(NORMAL_INSTALL) + test -z "$(dbusservicedir)" || $(MKDIR_P) "$(DESTDIR)$(dbusservicedir)" + @list='$(dbusservice_DATA)'; test -n "$(dbusservicedir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusservicedir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusservicedir)" || exit $$?; \ + done + +uninstall-dbusserviceDATA: + @$(NORMAL_UNINSTALL) + @list='$(dbusservice_DATA)'; test -n "$(dbusservicedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(dbusservicedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(dbusservicedir)" && rm -f $$files +install-udevrulesDATA: $(udevrules_DATA) + @$(NORMAL_INSTALL) + test -z "$(udevrulesdir)" || $(MKDIR_P) "$(DESTDIR)$(udevrulesdir)" + @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(udevrulesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(udevrulesdir)" || exit $$?; \ + done + +uninstall-udevrulesDATA: + @$(NORMAL_UNINSTALL) + @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(udevrulesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(udevrulesdir)" && rm -f $$files + +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: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(dbusactivationdir)" "$(DESTDIR)$(dbusservicedir)" "$(DESTDIR)$(udevrulesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \ + 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-dbusactivationDATA install-dbusserviceDATA \ + install-udevrulesDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libexecPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dbusactivationDATA uninstall-dbusserviceDATA \ + uninstall-libexecPROGRAMS uninstall-udevrulesDATA + +.MAKE: all check install install-am install-data-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-libtool 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-data-hook install-dbusactivationDATA \ + install-dbusserviceDATA install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip install-udevrulesDATA 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 uninstall-dbusactivationDATA \ + uninstall-dbusserviceDATA uninstall-libexecPROGRAMS \ + uninstall-udevrulesDATA + + +nm-dispatcher-glue.h: nm-dispatcher.xml + dbus-binding-tool --prefix=nm_dispatcher --mode=glib-server --output=$@ $< + +%.service: %.service.in + $(edit) $< >$@ +install-data-hook: + $(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir) + +# 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/callouts/nm-avahi-autoipd-action.c b/callouts/nm-avahi-autoipd-action.c new file mode 100644 index 00000000..440efade --- /dev/null +++ b/callouts/nm-avahi-autoipd-action.c @@ -0,0 +1,142 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2008 Red Hat, Inc. + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include <glib.h> +#include <dbus/dbus.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus-glib.h> + +#define NM_AVAHI_AUTOIPD_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" +#define NM_AVAHI_AUTOIPD_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" + +static DBusConnection * +dbus_init (void) +{ + DBusConnection * connection; + DBusError error; + int ret; + + dbus_connection_set_change_sigpipe (TRUE); + + dbus_error_init (&error); + connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); + if (dbus_error_is_set (&error)) { + fprintf (stderr, "Error: could not get the system bus. Make sure " + "the message bus daemon is running! Message: (%s) %s\n", + error.name, + error.message); + goto error; + } + + dbus_connection_set_exit_on_disconnect (connection, FALSE); + + dbus_error_init (&error); + ret = dbus_bus_request_name (connection, + NM_AVAHI_AUTOIPD_DBUS_SERVICE, + DBUS_NAME_FLAG_DO_NOT_QUEUE, + &error); + if (dbus_error_is_set (&error)) { + fprintf (stderr, "Error: Could not acquire the NM DHCP client service. " + "Message: (%s) %s\n", + error.name, + error.message); + goto error; + } + + if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + fprintf (stderr, "Error: Could not acquire the NM DHCP client service " + "as it is already taken. Return: %d\n", + ret); + goto error; + } + + return connection; + +error: + if (dbus_error_is_set (&error)) + dbus_error_free (&error); + if (connection) + dbus_connection_unref (connection); + return NULL; +} + +int +main (int argc, char *argv[]) +{ + DBusConnection *connection; + DBusMessage *message; + dbus_bool_t result; + char *event, *iface, *address; + + g_type_init (); + + if (argc != 4) { + fprintf (stderr, "Error: expected 3 arguments (event, interface, address).\n"); + exit (1); + } + + event = argv[1]; + iface = argv[2]; + address = argv[3] ? argv[3] : ""; + + if (!event || !iface || !strlen (event) || !strlen (iface)) { + fprintf (stderr, "Error: unexpected arguments received from avahi-autoipd.\n"); + exit (1); + } + + /* Get a connection to the system bus */ + connection = dbus_init (); + if (connection == NULL) + exit (1); + + message = dbus_message_new_signal ("/", NM_AVAHI_AUTOIPD_DBUS_IFACE, "Event"); + if (message == NULL) { + fprintf (stderr, "Error: not enough memory to send autoip Event signal.\n"); + exit (1); + } + + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, &event, + DBUS_TYPE_STRING, &iface, + DBUS_TYPE_STRING, &address, + DBUS_TYPE_INVALID)) { + fprintf (stderr, "Error: failed to construct autoip Event signal.\n"); + exit (1); + } + + /* queue the message */ + result = dbus_connection_send (connection, message, NULL); + if (!result) { + fprintf (stderr, "Error: could not send send autoip Event signal.\n"); + exit (1); + } + dbus_message_unref (message); + + /* Send out the message */ + dbus_connection_flush (connection); + + return 0; +} + diff --git a/callouts/nm-avahi-autoipd.conf b/callouts/nm-avahi-autoipd.conf new file mode 100644 index 00000000..485ab429 --- /dev/null +++ b/callouts/nm-avahi-autoipd.conf @@ -0,0 +1,13 @@ +<!DOCTYPE busconfig PUBLIC + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <policy user="root"> + <allow own="org.freedesktop.nm_avahi_autoipd"/> + </policy> + <policy context="default"> + <deny own="org.freedesktop.nm_avahi_autoipd"/> + <deny send_destination="org.freedesktop.nm_avahi_autoipd"/> + </policy> +</busconfig> + diff --git a/callouts/nm-dhcp-client-action.c b/callouts/nm-dhcp-client-action.c new file mode 100644 index 00000000..f001c9e4 --- /dev/null +++ b/callouts/nm-dhcp-client-action.c @@ -0,0 +1,320 @@ +/* -*- 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) 2007 - 2008 Red Hat, Inc. + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include <glib.h> +#include <dbus/dbus.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus-glib.h> + +#define NM_DHCP_CLIENT_DBUS_SERVICE "org.freedesktop.nm_dhcp_client" +#define NM_DHCP_CLIENT_DBUS_IFACE "org.freedesktop.nm_dhcp_client" + +/** + * Start a dict in a dbus message. Should be paired with a call to + * {@link wpa_dbus_dict_close_write}. + * + * @param iter A valid dbus message iterator + * @param iter_dict (out) A dict iterator to pass to further dict functions + * @return TRUE on success, FALSE on failure + * + */ +static dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter, + DBusMessageIter *iter_dict) +{ + dbus_bool_t result; + + if (!iter || !iter_dict) + return FALSE; + + result = dbus_message_iter_open_container( + iter, + DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + iter_dict); + return result; +} + +/** + * End a dict element in a dbus message. Should be paired with + * a call to {@link wpa_dbus_dict_open_write}. + * + * @param iter valid dbus message iterator, same as passed to + * wpa_dbus_dict_open_write() + * @param iter_dict a dbus dict iterator returned from + * {@link wpa_dbus_dict_open_write} + * @return TRUE on success, FALSE on failure + * + */ +static dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter, + DBusMessageIter *iter_dict) +{ + if (!iter || !iter_dict) + return FALSE; + + return dbus_message_iter_close_container(iter, iter_dict); +} + +static dbus_bool_t _wpa_dbus_add_dict_entry_start( + DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry, + const char *key, const int value_type) +{ + if (!dbus_message_iter_open_container(iter_dict, + DBUS_TYPE_DICT_ENTRY, NULL, + iter_dict_entry)) + return FALSE; + + if (!dbus_message_iter_append_basic(iter_dict_entry, DBUS_TYPE_STRING, + &key)) + return FALSE; + + return TRUE; +} + + +static dbus_bool_t _wpa_dbus_add_dict_entry_end( + DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry, + DBusMessageIter *iter_dict_val) +{ + if (!dbus_message_iter_close_container(iter_dict_entry, iter_dict_val)) + return FALSE; + if (!dbus_message_iter_close_container(iter_dict, iter_dict_entry)) + return FALSE; + + return TRUE; +} + +static dbus_bool_t _wpa_dbus_add_dict_entry_byte_array( + DBusMessageIter *iter_dict, const char *key, + const char *value, const dbus_uint32_t value_len) +{ + DBusMessageIter iter_dict_entry, iter_dict_val, iter_array; + dbus_uint32_t i; + + if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry, + key, DBUS_TYPE_ARRAY)) + return FALSE; + + if (!dbus_message_iter_open_container(&iter_dict_entry, + DBUS_TYPE_VARIANT, + DBUS_TYPE_ARRAY_AS_STRING + DBUS_TYPE_BYTE_AS_STRING, + &iter_dict_val)) + return FALSE; + + if (!dbus_message_iter_open_container(&iter_dict_val, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, + &iter_array)) + return FALSE; + + for (i = 0; i < value_len; i++) { + if (!dbus_message_iter_append_basic(&iter_array, + DBUS_TYPE_BYTE, + &(value[i]))) + return FALSE; + } + + if (!dbus_message_iter_close_container(&iter_dict_val, &iter_array)) + return FALSE; + + if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry, + &iter_dict_val)) + return FALSE; + + return TRUE; +} + +/** + * Add a byte array entry to the dict. + * + * @param iter_dict A valid DBusMessageIter returned from + * {@link wpa_dbus_dict_open_write} + * @param key The key of the dict item + * @param value The byte array + * @param value_len The length of the byte array, in bytes + * @return TRUE on success, FALSE on failure + * + */ +static dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict, + const char *key, + const char *value, + const dbus_uint32_t value_len) +{ + if (!key) + return FALSE; + if (!value && (value_len != 0)) + return FALSE; + return _wpa_dbus_add_dict_entry_byte_array(iter_dict, key, value, + value_len); +} + + +static const char * ignore[] = {"PATH", "SHLVL", "_", "PWD", "dhc_dbus", NULL}; + +static dbus_bool_t +build_message (DBusMessage * message) +{ + char ** env = NULL; + char ** item; + char ** p; + dbus_bool_t success = FALSE; + DBusMessageIter iter, iter_dict; + + dbus_message_iter_init_append (message, &iter); + if (!wpa_dbus_dict_open_write (&iter, &iter_dict)) + goto out; + + /* List environment and format for dbus dict */ + env = g_listenv (); + for (item = env; *item; item++) { + gboolean ignore_item = FALSE; + const char * val = g_getenv (*item); + + /* Ignore non-DCHP-related environment variables */ + for (p = (char **) ignore; *p && !ignore_item; p++) { + if (strncmp (*item, *p, strlen (*p)) == 0) + ignore_item = TRUE; + } + if (ignore_item) + continue; + + /* Value passed as a byte array rather than a string, because there are + * no character encoding guarantees with DHCP, and D-Bus requires + * strings to be UTF-8. + */ + if (!wpa_dbus_dict_append_byte_array (&iter_dict, + *item, + val ? val : "\0", + val ? strlen (val) : 1)) { + fprintf (stderr, "Error: failed to add item '%s' to signal\n", + *item); + goto out; + } + } + + if (!wpa_dbus_dict_close_write (&iter, &iter_dict)) + goto out; + + success = TRUE; + +out: + g_strfreev (env); + return success; +} + +static DBusConnection * +dbus_init (void) +{ + DBusConnection * connection; + DBusError error; + int ret; + + dbus_connection_set_change_sigpipe (TRUE); + + dbus_error_init (&error); + connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); + if (dbus_error_is_set (&error)) { + fprintf (stderr, "Error: could not get the system bus. Make sure " + "the message bus daemon is running! Message: (%s) %s\n", + error.name, + error.message); + goto error; + } + + dbus_connection_set_exit_on_disconnect (connection, FALSE); + + dbus_error_init (&error); + ret = dbus_bus_request_name (connection, + NM_DHCP_CLIENT_DBUS_SERVICE, + DBUS_NAME_FLAG_DO_NOT_QUEUE, + &error); + if (dbus_error_is_set (&error)) { + fprintf (stderr, "Error: Could not acquire the NM DHCP client service. " + "Message: (%s) %s\n", + error.name, + error.message); + goto error; + } + + if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + fprintf (stderr, "Error: Could not acquire the NM DHCP client service " + "as it is already taken. Return: %d\n", + ret); + goto error; + } + + return connection; + +error: + if (dbus_error_is_set (&error)) + dbus_error_free (&error); + if (connection) + dbus_connection_unref (connection); + return NULL; +} + +int +main (int argc, char *argv[]) +{ + DBusConnection * connection; + DBusMessage * message; + dbus_bool_t result; + + g_type_init (); + + /* Get a connection to the system bus */ + connection = dbus_init (); + if (connection == NULL) + exit (1); + + message = dbus_message_new_signal ("/", NM_DHCP_CLIENT_DBUS_IFACE, "Event"); + if (message == NULL) { + fprintf (stderr, "Error: Not enough memory to send DHCP Event signal.\n"); + exit (1); + } + + /* Dump environment variables into the message */ + result = build_message (message); + if (result == FALSE) { + fprintf (stderr, "Error: Not enough memory to send DHCP Event signal.\n"); + exit (1); + } + + /* queue the message */ + result = dbus_connection_send (connection, message, NULL); + if (!result) { + fprintf (stderr, "Error: Could not send send DHCP Event signal.\n"); + exit (1); + } + dbus_message_unref (message); + + /* Send out the message */ + dbus_connection_flush (connection); + + return 0; +} + diff --git a/callouts/nm-dhcp-client.conf b/callouts/nm-dhcp-client.conf new file mode 100644 index 00000000..0aeae603 --- /dev/null +++ b/callouts/nm-dhcp-client.conf @@ -0,0 +1,13 @@ +<!DOCTYPE busconfig PUBLIC + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <policy user="root"> + <allow own="org.freedesktop.nm_dhcp_client"/> + </policy> + <policy context="default"> + <deny own="org.freedesktop.nm_dhcp_client"/> + <deny send_destination="org.freedesktop.nm_dhcp_client"/> + </policy> +</busconfig> + diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c new file mode 100644 index 00000000..828d8be1 --- /dev/null +++ b/callouts/nm-dispatcher-action.c @@ -0,0 +1,798 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2008 Red Hat, Inc. + */ + +#include <syslog.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <signal.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <errno.h> +#include <arpa/inet.h> + +#include <glib.h> +#include <dbus/dbus.h> +#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus-glib.h> + +#include <NetworkManager.h> +#include "nm-glib-compat.h" +#include <libnm-util/nm-connection.h> +#include <libnm-util/nm-setting-ip4-config.h> +#include <libnm-util/nm-setting-connection.h> +#include <libnm-glib/nm-dhcp4-config.h> +#include <libnm-glib/nm-device.h> + +#include "nm-dispatcher-action.h" + +#define NMD_SCRIPT_DIR SYSCONFDIR "/NetworkManager/dispatcher.d" + +static GMainLoop *loop = NULL; +static gboolean debug = FALSE; + +static gboolean quit_timeout_cb (gpointer user_data); + +typedef struct Handler Handler; +typedef struct HandlerClass HandlerClass; + +GType handler_get_type (void); + +struct Handler { + GObject parent; +}; + +struct HandlerClass { + GObjectClass parent; +}; + +#define HANDLER_TYPE (handler_get_type ()) +#define HANDLER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HANDLER_TYPE, Handler)) +#define HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HANDLER_TYPE, HandlerClass)) +#define IS_HANDLER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HANDLER_TYPE)) +#define IS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HANDLER_TYPE)) +#define HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HANDLER_TYPE, HandlerClass)) + +G_DEFINE_TYPE(Handler, handler, G_TYPE_OBJECT) + +typedef struct { + DBusGConnection *g_connection; + DBusGProxy *bus_proxy; + guint quit_timeout; + gboolean persist; + + Handler *handler; +} Dispatcher; + +static gboolean +nm_dispatcher_action (Handler *obj, + const char *action, + GHashTable *connection, + GHashTable *connection_props, + GHashTable *device_props, + GError **error); + +#include "nm-dispatcher-glue.h" + + +static void +handler_init (Handler *h) +{ +} + +static void +handler_finalize (GObject *object) +{ + G_OBJECT_CLASS (handler_parent_class)->finalize (object); +} + +static void +handler_class_init (HandlerClass *h_class) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (h_class); + + gobject_class->finalize = handler_finalize; +} + +/* + * nmd_permission_check + * + * Verify that the given script has the permissions we want. Specifically, + * ensure that the file is + * - A regular file. + * - Owned by root. + * - Not writable by the group or by other. + * - Not setuid. + * - Executable by the owner. + * + */ +static inline gboolean +nmd_permission_check (struct stat *s, GError **error) +{ + g_return_val_if_fail (s != NULL, FALSE); + g_return_val_if_fail (error != NULL, FALSE); + g_return_val_if_fail (*error == NULL, FALSE); + + /* Only accept regular files */ + if (!S_ISREG (s->st_mode)) { + g_set_error (error, 0, 0, "not a regular file."); + return FALSE; + } + + /* Only accept files owned by root */ + if (s->st_uid != 0) { + g_set_error (error, 0, 0, "not owned by root."); + return FALSE; + } + + /* Only accept files not writable by group or other, and not SUID */ + if (s->st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) { + g_set_error (error, 0, 0, "writable by group or other, or set-UID."); + return FALSE; + } + + /* Only accept files executable by the owner */ + if (!(s->st_mode & S_IXUSR)) { + g_set_error (error, 0, 0, "not executable by owner."); + return FALSE; + } + + return TRUE; +} + + +/* + * nmd_is_valid_filename + * + * Verify that the given script is a valid file name. Specifically, + * ensure that the file: + * - is not a editor backup file + * - is not a package management file + * - does not start with '.' + */ +static inline gboolean +nmd_is_valid_filename (const char *file_name) +{ + char *bad_suffixes[] = { "~", ".rpmsave", ".rpmorig", ".rpmnew", NULL }; + char *tmp; + int i; + + if (file_name[0] == '.') + return FALSE; + for (i = 0; bad_suffixes[i]; i++) { + if (g_str_has_suffix(file_name, bad_suffixes[i])) + return FALSE; + } + tmp = g_strrstr(file_name, ".dpkg-"); + if (tmp && (tmp == strrchr(file_name,'.'))) + return FALSE; + return TRUE; +} + +static gint +sort_files (gconstpointer a, gconstpointer b) +{ + char *a_base = NULL, *b_base = NULL; + int ret = 0; + + if (a && !b) + return 1; + if (!a && !b) + return 0; + if (!a && b) + return -1; + + a_base = g_path_get_basename (a); + b_base = g_path_get_basename (b); + + ret = strcmp (a_base, b_base); + + g_free (a_base); + g_free (b_base); + return ret; +} + +static void +child_setup (gpointer user_data G_GNUC_UNUSED) +{ + /* We are in the child process at this point */ + /* Give child a different process group to ensure signal separation. */ + pid_t pid = getpid (); + setpgid (pid, pid); +} + +typedef struct { + char **envp; + guint32 i; +} EnvAddInfo; + +static void +add_one_option_to_envp (gpointer key, gpointer value, gpointer user_data) +{ + EnvAddInfo *info = (EnvAddInfo *) user_data; + char *ucased; + + ucased = g_ascii_strup (key, -1); + info->envp[info->i++] = g_strdup_printf ("DHCP4_%s=%s", ucased, (char *) value); + g_free (ucased); +} + +static char ** +construct_envp (const char *uuid, NMIP4Config *ip4_config, NMDHCP4Config *dhcp4_config) +{ + guint32 env_size = 0; + char **envp; + guint32 envp_idx = 0; + GHashTable *options = NULL; + GSList *addresses, *routes, *iter; + GArray *nameservers; + GPtrArray *domains; + guint32 num, i; + GString *tmp; + + if (!ip4_config) + return g_new0 (char *, 1); + + addresses = (GSList *) nm_ip4_config_get_addresses (ip4_config); + nameservers = (GArray *) nm_ip4_config_get_nameservers (ip4_config); + domains = (GPtrArray *) nm_ip4_config_get_domains (ip4_config); + routes = (GSList *) nm_ip4_config_get_routes (ip4_config); + + env_size = g_slist_length (addresses) + + 1 /* addresses length */ + + 1 /* nameservers */ + + 1 /* domains */ + + 1 /* hostname */ + + g_slist_length (routes) + + 1 /* routes length */ + + 1 /* connection UUID */; + + if (dhcp4_config) { + options = nm_dhcp4_config_get_options (dhcp4_config); + env_size += g_hash_table_size (options); + } + + envp = g_new0 (char *, env_size + 1); + + if (uuid) + envp[envp_idx++] = g_strdup_printf ("CONNECTION_UUID=%s", uuid); + + /* IP4 config stuff */ + for (iter = addresses, num = 0; iter; iter = g_slist_next (iter)) { + NMIP4Address *addr = (NMIP4Address *) iter->data; + char str_addr[INET_ADDRSTRLEN + 1]; + char str_gw[INET_ADDRSTRLEN + 1]; + struct in_addr tmp_addr; + guint32 prefix = nm_ip4_address_get_prefix (addr); + + memset (str_addr, 0, sizeof (str_addr)); + tmp_addr.s_addr = nm_ip4_address_get_address (addr); + if (!inet_ntop (AF_INET, &tmp_addr, str_addr, sizeof (str_addr))) + continue; + + memset (str_gw, 0, sizeof (str_gw)); + tmp_addr.s_addr = nm_ip4_address_get_gateway (addr); + inet_ntop (AF_INET, &tmp_addr, str_gw, sizeof (str_gw)); + + tmp = g_string_sized_new (25 + strlen (str_addr) + strlen (str_gw)); + g_string_append_printf (tmp, "IP4_ADDRESS_%d=%s/%d %s", num++, str_addr, prefix, str_gw); + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + if (num) + envp[envp_idx++] = g_strdup_printf ("IP4_NUM_ADDRESSES=%d", num); + + if (nameservers && nameservers->len) { + gboolean first = TRUE; + + tmp = g_string_new ("IP4_NAMESERVERS="); + for (i = 0; i < nameservers->len; i++) { + struct in_addr addr; + char buf[INET_ADDRSTRLEN + 1]; + + addr.s_addr = g_array_index (nameservers, guint32, i); + memset (buf, 0, sizeof (buf)); + if (inet_ntop (AF_INET, &addr, buf, sizeof (buf))) { + if (!first) + g_string_append_c (tmp, ' '); + g_string_append (tmp, buf); + first = FALSE; + } + } + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + + if (domains && domains->len) { + tmp = g_string_new ("IP4_DOMAINS="); + for (i = 0; i < domains->len; i++) { + if (i > 0) + g_string_append_c (tmp, ' '); + g_string_append (tmp, (char *) g_ptr_array_index (domains, i)); + } + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + + for (iter = routes, num = 0; iter; iter = g_slist_next (iter)) { + NMIP4Route *route = (NMIP4Route *) iter->data; + char str_addr[INET_ADDRSTRLEN + 1]; + char str_nh[INET_ADDRSTRLEN + 1]; + struct in_addr tmp_addr; + guint32 prefix = nm_ip4_route_get_prefix (route); + guint32 metric = nm_ip4_route_get_metric (route); + + memset (str_addr, 0, sizeof (str_addr)); + tmp_addr.s_addr = nm_ip4_route_get_dest (route); + if (!inet_ntop (AF_INET, &tmp_addr, str_addr, sizeof (str_addr))) + continue; + + memset (str_nh, 0, sizeof (str_nh)); + tmp_addr.s_addr = nm_ip4_route_get_next_hop (route); + inet_ntop (AF_INET, &tmp_addr, str_nh, sizeof (str_nh)); + + tmp = g_string_sized_new (30 + strlen (str_addr) + strlen (str_nh)); + g_string_append_printf (tmp, "IP4_ROUTE_%d=%s/%d %s %d", num++, str_addr, prefix, str_nh, metric); + envp[envp_idx++] = tmp->str; + g_string_free (tmp, FALSE); + } + envp[envp_idx++] = g_strdup_printf ("IP4_NUM_ROUTES=%d", num); + + /* DHCP stuff */ + if (dhcp4_config && options) { + EnvAddInfo info; + + info.envp = envp; + info.i = envp_idx; + g_hash_table_foreach (options, add_one_option_to_envp, &info); + } + + if (debug) { + char **p; + + g_message ("------------ Script Environment ------------"); + for (p = envp; *p; p++) + g_message (" %s", *p); + g_message ("\n"); + } + + return envp; +} + +static void +dispatch_scripts (const char *action, + const char *iface, + const char *parent_iface, + NMDeviceType type, + const char *uuid, + NMIP4Config *ip4_config, + NMDHCP4Config *dhcp4_config) +{ + GDir *dir; + const char *filename; + GSList *scripts = NULL, *iter; + GError *error = NULL; + char **envp = NULL; + + if (!(dir = g_dir_open (NMD_SCRIPT_DIR, 0, &error))) { + g_warning ("g_dir_open() could not open '" NMD_SCRIPT_DIR "'. '%s'", + error->message); + g_error_free (error); + return; + } + + while ((filename = g_dir_read_name (dir))) { + char *file_path; + struct stat s; + GError *pc_error = NULL; + int err; + + if (!nmd_is_valid_filename (filename)) + continue; + + file_path = g_build_filename (NMD_SCRIPT_DIR, filename, NULL); + + err = stat (file_path, &s); + if (err) { + g_warning ("Script '%s' could not be stated: %d", file_path, err); + g_free (file_path); + continue; + } + + if (!nmd_permission_check (&s, &pc_error)) { + g_warning ("Script '%s' could not be executed: %s", file_path, pc_error->message); + g_error_free (pc_error); + g_free (file_path); + } else { + /* success */ + scripts = g_slist_insert_sorted (scripts, file_path, sort_files); + } + } + g_dir_close (dir); + + envp = construct_envp (uuid, ip4_config, dhcp4_config); + + for (iter = scripts; iter; iter = g_slist_next (iter)) { + gchar *argv[4]; + gint status = -1; + + argv[0] = (char *) iter->data; + argv[1] = iface ? (char *) iface : "none"; + argv[2] = (char *) action; + argv[3] = NULL; + + if (debug) + g_message ("Script: %s %s %s", (char *) iter->data, iface ? (char *) iface : "(none)", (char *) action); + + error = NULL; + if (g_spawn_sync ("/", argv, envp, 0, child_setup, NULL, NULL, NULL, &status, &error)) { + if (WIFEXITED (status)) { + if (WEXITSTATUS (status) != 0) + g_warning ("Script '%s' exited with error status %d.", + (char *) iter->data, WEXITSTATUS (status)); + } else + g_warning ("Script '%s' exited abnormally.", (char *) iter->data); + } else { + g_warning ("Could not run script '%s': (%d) %s", + (char *) iter->data, error->code, error->message); + g_error_free (error); + } + } + + g_strfreev (envp); + + g_slist_foreach (scripts, (GFunc) g_free, NULL); + g_slist_free (scripts); +} + +static gboolean +nm_dispatcher_action (Handler *h, + const char *action, + GHashTable *connection_hash, + GHashTable *connection_props, + GHashTable *device_props, + GError **error) +{ + Dispatcher *d = g_object_get_data (G_OBJECT (h), "dispatcher"); + NMConnection *connection; + char *iface = NULL, *parent_iface = NULL; + const char *uuid = NULL; + NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN; + NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN; + NMDevice *device = NULL; + NMDHCP4Config *dhcp4_config = NULL; + NMIP4Config *ip4_config = NULL; + GValue *value; + + /* Back off the quit timeout */ + if (d->quit_timeout) + g_source_remove (d->quit_timeout); + if (!d->persist) + d->quit_timeout = g_timeout_add_seconds (10, quit_timeout_cb, NULL); + + connection = nm_connection_new_from_hash (connection_hash, error); + if (connection) { + NMSettingConnection *s_con; + + s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); + if (s_con) + uuid = nm_setting_connection_get_uuid (s_con); + } else { + g_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d", + __func__, + g_type_name (nm_connection_lookup_setting_type_by_quark ((*error)->domain)), + (*error)->message, (*error)->code); + /* Don't fail on this error yet */ + g_error_free (*error); + *error = NULL; + } + + /* Hostname changes don't require a device */ + if (!strcmp (action, "hostname")) + goto dispatch; + + /* interface name */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_INTERFACE); + if (!value || !G_VALUE_HOLDS_STRING (value)) { + g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_INTERFACE "!"); + goto out; + } + iface = (char *) g_value_get_string (value); + + /* IP interface name */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_IP_INTERFACE); + if (value) { + if (!G_VALUE_HOLDS_STRING (value)) { + g_warning ("Invalid required value " NMD_DEVICE_PROPS_IP_INTERFACE "!"); + goto out; + } + parent_iface = iface; + iface = (char *) g_value_get_string (value); + } + + /* Device type */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_TYPE); + if (!value || !G_VALUE_HOLDS_UINT (value)) { + g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_TYPE "!"); + goto out; + } + type = g_value_get_uint (value); + + /* Device state */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_STATE); + if (!value || !G_VALUE_HOLDS_UINT (value)) { + g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_STATE "!"); + goto out; + } + dev_state = g_value_get_uint (value); + + /* device itself */ + value = g_hash_table_lookup (device_props, NMD_DEVICE_PROPS_PATH); + if (!value || (G_VALUE_TYPE (value) != DBUS_TYPE_G_OBJECT_PATH)) { + g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_PATH "!"); + goto out; + } + device = NM_DEVICE (nm_device_new (d->g_connection, (const char *) g_value_get_boxed (value))); + + /* Get the DHCP4 config */ + if (device && (dev_state == NM_DEVICE_STATE_ACTIVATED)) { + dhcp4_config = nm_device_get_dhcp4_config (device); + ip4_config = nm_device_get_ip4_config (device); + } + +dispatch: + dispatch_scripts (action, iface, parent_iface, type, uuid, ip4_config, dhcp4_config); + + if (device) + g_object_unref (device); + +out: + return TRUE; +} + +static gboolean +start_dbus_service (Dispatcher *d) +{ + int request_name_result; + GError *err = NULL; + gboolean success = FALSE; + + if (!dbus_g_proxy_call (d->bus_proxy, "RequestName", &err, + G_TYPE_STRING, NM_DISPATCHER_DBUS_SERVICE, + G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE, + G_TYPE_INVALID, + G_TYPE_UINT, &request_name_result, + G_TYPE_INVALID)) { + g_warning ("Could not acquire the " NM_DISPATCHER_DBUS_SERVICE " service.\n" + " Message: '%s'", err->message); + g_error_free (err); + goto out; + } + + if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + g_warning ("Could not acquire the " NM_DISPATCHER_DBUS_SERVICE " service " + "as it is already taken. Return: %d", + request_name_result); + goto out; + } + success = TRUE; + +out: + return success; +} + +static void +destroy_cb (DBusGProxy *proxy, gpointer user_data) +{ + g_warning ("Disconnected from the system bus, exiting."); + g_main_loop_quit (loop); +} + +static gboolean +dbus_init (Dispatcher *d) +{ + GError *err = NULL; + DBusConnection *connection; + + dbus_connection_set_change_sigpipe (TRUE); + + d->g_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err); + if (!d->g_connection) { + g_warning ("Could not get the system bus. Make sure " + "the message bus daemon is running! Message: %s", + err->message); + g_error_free (err); + return FALSE; + } + + /* Clean up nicely if we get kicked off the bus */ + connection = dbus_g_connection_get_connection (d->g_connection); + dbus_connection_set_exit_on_disconnect (connection, FALSE); + + d->bus_proxy = dbus_g_proxy_new_for_name (d->g_connection, + "org.freedesktop.DBus", + "/org/freedesktop/DBus", + "org.freedesktop.DBus"); + if (!d->bus_proxy) { + g_warning ("Could not get the DBus object!"); + goto error; + } + + g_signal_connect (d->bus_proxy, "destroy", G_CALLBACK (destroy_cb), NULL); + + return TRUE; + +error: + return FALSE; +} + +static void +log_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer ignored) +{ + int syslog_priority; + + switch (log_level) { + case G_LOG_LEVEL_ERROR: + syslog_priority = LOG_CRIT; + break; + + case G_LOG_LEVEL_CRITICAL: + syslog_priority = LOG_ERR; + break; + + case G_LOG_LEVEL_WARNING: + syslog_priority = LOG_WARNING; + break; + + case G_LOG_LEVEL_MESSAGE: + syslog_priority = LOG_NOTICE; + break; + + case G_LOG_LEVEL_DEBUG: + syslog_priority = LOG_DEBUG; + break; + + case G_LOG_LEVEL_INFO: + default: + syslog_priority = LOG_INFO; + break; + } + + syslog (syslog_priority, "%s", message); +} + + +static void +logging_setup (void) +{ + openlog (G_LOG_DOMAIN, LOG_CONS, LOG_DAEMON); + g_log_set_handler (G_LOG_DOMAIN, + G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + log_handler, + NULL); +} + +static void +logging_shutdown (void) +{ + closelog (); +} + +static void +signal_handler (int signo) +{ + if (signo == SIGINT || signo == SIGTERM) { + g_message ("Caught signal %d, shutting down...", signo); + g_main_loop_quit (loop); + } +} + +static void +setup_signals (void) +{ + struct sigaction action; + sigset_t mask; + + sigemptyset (&mask); + action.sa_handler = signal_handler; + action.sa_mask = mask; + action.sa_flags = 0; + sigaction (SIGTERM, &action, NULL); + sigaction (SIGINT, &action, NULL); +} + +static gboolean +quit_timeout_cb (gpointer user_data) +{ + g_main_loop_quit (loop); + return FALSE; +} + +int +main (int argc, char **argv) +{ + Dispatcher *d = g_malloc0 (sizeof (Dispatcher)); + GOptionContext *opt_ctx; + GError *error = NULL; + gboolean persist = FALSE; + + GOptionEntry entries[] = { + { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Output to console rather than syslog", NULL }, + { "persist", 0, 0, G_OPTION_ARG_NONE, &persist, "Don't quit after a short timeout", NULL }, + { NULL } + }; + + opt_ctx = g_option_context_new (NULL); + g_option_context_set_summary (opt_ctx, "Executes scripts upon actions by NetworkManager."); + g_option_context_add_main_entries (opt_ctx, entries, NULL); + + if (!g_option_context_parse (opt_ctx, &argc, &argv, &error)) { + g_warning ("%s\n", error->message); + g_error_free (error); + g_free (d); + return 1; + } + + g_option_context_free (opt_ctx); + + g_type_init (); + setup_signals (); + + if (!debug) + logging_setup (); + + loop = g_main_loop_new (NULL, FALSE); + + if (!dbus_init (d)) + return -1; + if (!start_dbus_service (d)) + return -1; + + d->persist = persist; + d->handler = g_object_new (HANDLER_TYPE, NULL); + if (!d->handler) + return -1; + g_object_set_data (G_OBJECT (d->handler), "dispatcher", d); + + dbus_g_object_type_install_info (HANDLER_TYPE, &dbus_glib_nm_dispatcher_object_info); + dbus_g_connection_register_g_object (d->g_connection, + NM_DISPATCHER_DBUS_PATH, + G_OBJECT (d->handler)); + + if (!persist) + d->quit_timeout = g_timeout_add_seconds (10, quit_timeout_cb, NULL); + + g_main_loop_run (loop); + + g_object_unref (d->handler); + dbus_g_connection_unref (d->g_connection); + g_free (d); + + if (!debug) + logging_shutdown (); + + return 0; +} + diff --git a/callouts/nm-dispatcher-action.h b/callouts/nm-dispatcher-action.h new file mode 100644 index 00000000..39aefd8f --- /dev/null +++ b/callouts/nm-dispatcher-action.h @@ -0,0 +1,33 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager -- Network link manager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2008 Red Hat, Inc. + */ + +#define NM_DISPATCHER_DBUS_SERVICE "org.freedesktop.nm_dispatcher" +#define NM_DISPATCHER_DBUS_IFACE "org.freedesktop.nm_dispatcher" +#define NM_DISPATCHER_DBUS_PATH "/org/freedesktop/nm_dispatcher" + +#define NMD_CONNECTION_PROPS_SERVICE_NAME "service-name" +#define NMD_CONNECTION_PROPS_PATH "path" + +#define NMD_DEVICE_PROPS_INTERFACE "interface" +#define NMD_DEVICE_PROPS_IP_INTERFACE "ip-interface" +#define NMD_DEVICE_PROPS_TYPE "type" +#define NMD_DEVICE_PROPS_STATE "state" +#define NMD_DEVICE_PROPS_PATH "path" + diff --git a/callouts/nm-dispatcher.conf b/callouts/nm-dispatcher.conf new file mode 100644 index 00000000..fd2f0e5a --- /dev/null +++ b/callouts/nm-dispatcher.conf @@ -0,0 +1,14 @@ +<!DOCTYPE busconfig PUBLIC + "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <policy user="root"> + <allow own="org.freedesktop.nm_dispatcher"/> + <allow send_destination="org.freedesktop.nm_dispatcher"/> + </policy> + <policy context="default"> + <deny own="org.freedesktop.nm_dispatcher"/> + <deny send_destination="org.freedesktop.nm_dispatcher"/> + </policy> +</busconfig> + diff --git a/callouts/nm-dispatcher.xml b/callouts/nm-dispatcher.xml new file mode 100644 index 00000000..532ae9f3 --- /dev/null +++ b/callouts/nm-dispatcher.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> + <interface name="org.freedesktop.nm_dispatcher"> + + <method name="Action"> + <tp:docstring> + INTERNAL; not public API. Perform an action. + </tp:docstring> + + <arg name="action" type="s" direction="in"> + <tp:docstring> + The action being performed. + </tp:docstring> + </arg> + + <arg name="connection" type="a{sa{sv}}" direction="in"> + <tp:docstring> + The connection for which this action was triggered. + </tp:docstring> + </arg> + + <arg name="connection_properties" type="a{sv}" direction="in"> + <tp:docstring> + Properties of the connection, including service and path. + </tp:docstring> + </arg> + + <arg name="device_properties" type="a{sv}" direction="in"> + <tp:docstring> + Properties of the device, including type, path, interface, and state. + </tp:docstring> + </arg> + + </method> + </interface> +</node> diff --git a/callouts/org.freedesktop.nm_dispatcher.service.in b/callouts/org.freedesktop.nm_dispatcher.service.in new file mode 100644 index 00000000..b8f5bd1a --- /dev/null +++ b/callouts/org.freedesktop.nm_dispatcher.service.in @@ -0,0 +1,5 @@ +[D-BUS Service] +Name=org.freedesktop.nm_dispatcher +Exec=@libexecdir@/nm-dispatcher.action +User=root + |