diff --git a/system-settings/plugins/ifupdown/Makefile.am b/system-settings/plugins/ifupdown/Makefile.am index ec50311554..f99724d629 100644 --- a/system-settings/plugins/ifupdown/Makefile.am +++ b/system-settings/plugins/ifupdown/Makefile.am @@ -5,15 +5,30 @@ INCLUDES = \ -I$(top_srcdir)/libnm-glib \ -I$(top_srcdir)/libnm-util +noinst_LTLIBRARIES = libifupdown-io.la + +libifupdown_io_la_SOURCES = \ + interface_parser.c \ + interface_parser.h \ + parser.c \ + parser.h + +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) + pkglib_LTLIBRARIES = libnm-settings-plugin-ifupdown.la libnm_settings_plugin_ifupdown_la_SOURCES = \ - interface_parser.c \ - interface_parser.h \ nm-ifupdown-connection.c \ nm-ifupdown-connection.h \ - parser.c \ - parser.h \ plugin.c \ plugin.h @@ -28,6 +43,7 @@ libnm_settings_plugin_ifupdown_la_CPPFLAGS = \ libnm_settings_plugin_ifupdown_la_LDFLAGS = -module -avoid-version libnm_settings_plugin_ifupdown_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ + libifupdown-io.la \ $(GLIB_LIBS) \ $(GMODULE_LIBS) \ $(GUDEV_LIBS) diff --git a/system-settings/plugins/ifupdown/interface_parser.c b/system-settings/plugins/ifupdown/interface_parser.c index f28cf7cab1..374fafb58e 100644 --- a/system-settings/plugins/ifupdown/interface_parser.c +++ b/system-settings/plugins/ifupdown/interface_parser.c @@ -75,19 +75,19 @@ void add_data(const char *key,const char *data) #define SPACE_OR_TAB(string,ret) {ret = strchr(string,' ');ret=(ret == NULL?strchr(string,'\t'):ret);} -void ifparser_init(void) +void ifparser_init (const char *eni_file) { - FILE *inp = fopen(ENI_INTERFACES_FILE, "r"); + FILE *inp = fopen (eni_file, "r"); int ret = 0; char *line; char *space; char rline[255]; - if (inp == NULL) - { - nm_warning ("Error: Can't open %s\n", ENI_INTERFACES_FILE); + if (inp == NULL) { + nm_warning ("Error: Can't open %s\n", eni_file); return; } + first = last = NULL; while(1) { diff --git a/system-settings/plugins/ifupdown/interface_parser.h b/system-settings/plugins/ifupdown/interface_parser.h index 52b98d04c4..262b2172ab 100644 --- a/system-settings/plugins/ifupdown/interface_parser.h +++ b/system-settings/plugins/ifupdown/interface_parser.h @@ -26,8 +26,6 @@ #include "config.h" -#define ENI_INTERFACES_FILE "/etc/network/interfaces" - typedef struct _if_data { char *key; @@ -43,7 +41,7 @@ typedef struct _if_block struct _if_block *next; } if_block; -void ifparser_init(void); +void ifparser_init(const char *eni_file); void ifparser_destroy(void); if_block *ifparser_getif(const char* iface); diff --git a/system-settings/plugins/ifupdown/plugin.c b/system-settings/plugins/ifupdown/plugin.c index e2358b9f51..879cf9b0cb 100644 --- a/system-settings/plugins/ifupdown/plugin.c +++ b/system-settings/plugins/ifupdown/plugin.c @@ -55,6 +55,8 @@ #define G_UDEV_API_IS_SUBJECT_TO_CHANGE #include +#define ENI_INTERFACES_FILE "/etc/network/interfaces" + #define IFUPDOWN_PLUGIN_NAME "ifupdown" #define IFUPDOWN_PLUGIN_INFO "(C) 2008 Canonical Ltd. To report bugs please use the NetworkManager mailing list." #define IFUPDOWN_SYSTEM_HOSTNAME_FILE "/etc/hostname" @@ -355,7 +357,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config) update_system_hostname (inotify_helper, NULL, NULL, config); /* Read in all the interfaces */ - ifparser_init (); + ifparser_init (ENI_INTERFACES_FILE); block = ifparser_getfirst (); while (block) { if(!strcmp ("auto", block->type) || !strcmp ("allow-hotplug", block->type))