Commit graph

64 commits

Author SHA1 Message Date
Colin Walters
fed48417c3 Revert "core: import libgsystem, use it for local-allocations in main.c (bgo #685440)"
This reverts commit 89623b99c4 pending
further discussion.

See: https://mail.gnome.org/archives/networkmanager-list/2012-October/msg00065.html
2012-10-23 16:40:46 -05:00
Colin Walters
89623b99c4 core: import libgsystem, use it for local-allocations in main.c (bgo #685440)
See http://git.gnome.org/browse/libgsystem/tree/README
for a description of libgsystem.

What we specifically are using it for here is the local allocation
macros; this patch just modifies main.c as a demo.

Note this patch fixes a double-free in an error condition in
check_pidfile(); those sort of mistakes are basically impossible
to make when using these macros.
2012-10-16 12:08:03 -05:00
Pavel Šimerda
3efc2c4b9d distro: remove nm_backend_enable_loopback()
We don't need to use distribution-specific network scripts to just bring
up the loopback interface.

I'm not aware of any init dependency problems but even if there are some,
it is more practical to solve them in the respective configuration files.

This function also tried to add 127.0.0.1 to the list of addresses but
not ::1. We don't need to set the interfaces up as this is done by the
kernel.
2012-09-25 16:44:12 -05:00
Alexandre Rostovtsev
64342a313e core: wait until we daemonized before setting up signals (bgo #683932)
If we mask signals before daemonizing, the daemon process will not be
able to handle them, and thus would be unkillable with anything other
than SIGKILL.
2012-09-17 14:47:06 +02:00
Jiří Klimeš
173b458da9 core: describe arguments for --connectivity-* options 2012-07-09 16:21:11 +02:00
Jiří Klimeš
d73f11aefa core: mark cmd options for translation 2012-07-09 16:21:11 +02:00
Jiří Klimeš
78dda3b093 core: unblock signals for child processes we spawn out of NM (rh #739836)
Commit 217c5bf6ac fixed processing of unix
signals: signals are blocked in all threads and a dedicated thread handles the
signals using sigwait().
However, the commit forgot that child processes inherit signal mask as well.
That is why we have to unblock signals for child processes we spawn from NM, so
that they can receive signals.
2012-05-21 15:00:51 +02:00
Pantelis Koukousoulas
d125296eb1 adsl: initial PPPoE support for ADSL devices 2012-05-18 15:42:56 -05:00
Dan Williams
8ed02c3039 core: log whether WEXT is enabled or not (bgo #674650)
Now that we've encountered this twice with distros disabling WEXT
but apparently not realizing it kills staging and out-of-kernel
drivers like wl.o, make it a log message so we don't have to go
hunting for build-time logfiles.
2012-04-26 13:40:07 -05:00
Jiří Klimeš
217c5bf6ac core: improve handling of POSIX signals using sigwait() (rh #739836)
There are multiple ways how to handle standard unix signals. They work quite
well for a single-threaded application. However, signal handling in a multi-
threaded app becomes tricky. And, the most safe way is to use sigwait() function
in a dedicated thread, which allows us to process the signals synchronously and
thus avoid various nasty problems.

A few useful links:
http://pubs.opengroup.org/onlinepubs/007904975/functions/sigwait.html
http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.genprogc%2Fdoc%2Fgenprogc%2Fsignal_mgmt.htm
http://www.linuxjournal.com/article/2121?page=0,2
http://www.redwoodsoft.com/~dru/unixbook/book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch12lev1sec8.html
2012-04-17 15:29:10 +02:00
Thomas Bechtold
267bc993a7 core: add internet connectivity check
* use libsoup to compare a http response from a given
  uri with a given response (use g_str_has_prefix () to compare)
* do periodically check the connectivity. Check interval is configurable
* check connectivity when device state change
  from/to NM_DEVICE_STATE_ACTIVATED
2012-02-27 10:56:51 -06:00
Jiří Klimeš
f4da4f5523 trivial: fix spelling 2012-01-17 16:26:30 +01:00
Jiří Klimeš
87a2030a43 core: fix translations - use NULL instead of "" (else odd translation appears) 2012-01-17 16:18:43 +01:00
Gabor Kelemen
3b00919b7a core: mark strings for translation (bgo #666652) 2012-01-17 15:53:16 +01:00
Gabor Kelemen
d3c1383b4e core: fix domain for g_option_context_set_translation_domain() (bgo #666652) 2012-01-17 15:51:28 +01:00
Gabor Kelemen
48852e112e core: setlocale(), so that locale's env variables are honored (bgo #666516) 2012-01-17 15:17:06 +01:00
Dan Williams
b2eaf7228e firewall: add firewall log domain and use it in firewall code 2011-12-06 16:51:17 -06:00
Dan Williams
c1344ec097 trivial: small cleanup checking error 2011-12-05 12:14:40 -06:00
Dan Williams
2ade420479 netlink: consolidate netlink monitor error handling and initialization
The fact that any of this code was in main.c was a hangover from
a long time ago and it should really go with the rest of the
netlink monitor code.
2011-12-03 17:38:07 -06:00
Dan Williams
2ea0f3e9c2 backends: clean them up somewhat
Put the two functions they provide into their own header so
places that need them don't have to include nm-system.h.
2011-11-17 18:55:07 -06:00
Jiri Popelka
1c0aeb4575 firewall: add firewall manager
src/firewall-manager tracks whether firewall is on the bus or not.
In nm-device.c at stage5 (ip-config-commit) before we actually
apply the IP configuration to the interface, we send the
IP interface name and zone to firewall and asynchronously wait
for a D-Bus reply.  Then after we get the reply
(or if the firewall isn't running) we proceed with
applying the IP configuration to the interface.
2011-11-09 22:02:02 -06:00
Jiří Klimeš
4d1d3b9935 core: fix building for GLib thread API changes (GLib >= 2.31.0) (bgo #662695) 2011-10-31 15:30:02 +01:00
Jiří Klimeš
3e79f06566 trivial: remove unwanted exclamation mark to fix compilation 2011-10-03 15:54:25 +02:00
Thomas Bechtold
ab7a8fcf98 core: improve config error handling
* better error messages
  * fix memory leak in parse_state_file ()
  * create intermediate parent directories as needed for state file
2011-10-03 00:46:37 -05:00
Dan Williams
a38032e96c core: split nm_manager_get() to simplify manager creation
OLPC Mesh code now doesn't have to be updated every time we change
the manager's creation arguments.  We could make all these arguments
GObject properties of the manager too, but that's more code and
we'd eventually like to figure out a better solution for letting
non-NMManager code listen for device addition/removal.
2011-09-27 09:40:54 -05:00
Dan Williams
52e96be3c4 core: split out config file handling
Make config file stuff somewhat clearer and easier to understand,
and possibly easier to extend later.
2011-09-27 09:40:50 -05:00
Dan Williams
1f835b0adb core: remove unused arguments from nm_manager_get() 2011-09-27 09:24:36 -05:00
Dan Williams
3620353050 core: add --version and allow it and --help to be run without root 2011-04-28 16:55:35 -05:00
Dan Williams
688da0fe4f core: better fix for ignoring return value of write(2)
Casting to (void) still doesn't do it, so just assign it to
something and ignore it, in conjunction with
-Wno-unused-but-set-variable
2011-04-14 17:10:05 -05:00
Dan Williams
f7428864ae core: fix ignoring return value of write(2) 2011-04-14 17:09:54 -05:00
Dan Williams
b6e66c8ff4 core: don't call g_main_loop_quit() from the signal handler
Besides not being technically reliable (although it mostly works)
we could get into situations where systemd would kill the cgroup
which resulted in NM getting a SIGCHLD for dhclient children before
the SIGTERM quit the mainloop.  This caused NM to think that the
dhclient process died unexpectedly, and to tear down the connection
even though what NM really wanted to do was just leave everything
running so that the connection could be taken over on restart.
2011-04-08 14:36:14 -05:00
Dan Williams
745c262568 Revert "core: don't trap SIGINT"
This reverts commit 3a47e57f68.

Forgot Ctl+C does SIGINT, which we use a ton when developing.  Oops!
2011-02-15 12:24:05 -06:00
Dan Williams
3a47e57f68 core: don't trap SIGINT
Let debuggers handle it like they're supposed to.
2011-02-15 11:35:56 -06:00
Jiří Klimeš
6fb021d5ea core: log the error when nm_settings_new() fails 2011-02-14 17:18:13 +01:00
Dan Williams
6d344a43e9 Merge remote-tracking branch 'origin/rm-userset'
There; it's merged.  Yay!
2011-02-12 22:51:12 -06:00
Ozan Çağlayan
e9c8ba4e3d trivial: fix RFKILL log domain manpage and help text 2011-02-09 10:56:14 -06:00
Dan Williams
f9ceafd4a1 Merge remote branch 'origin/master' into rm-userset 2011-01-12 15:46:37 -06:00
Dan Williams
0587ef1179 Merge remote branch 'origin/master' into wimax 2011-01-02 17:24:23 -06:00
Dan Williams
39eed50e47 policy: stop touching /etc/hosts
Handling of /etc/hosts is highly site- and admin- specific in
many more complex cases, and it's exceedingly hard and error-
prone for NetworkManager to handle all those cases.  So remove
this functionality entirely.  That's not a big loss, as it
turns out there's a much more elegant solution.

The only requirement is that the machine's hostname map back
to an IP address owned by the machine.  That requirement can
be satisifed by nss-myhostname or even possibly the distro's
installer.  If the user does not want nss-myhostname then it
can be uninstalled.  Distros should use a "recommends" feature
in their packaging system so that the NetworkManager package
does *not* have a hard requirement on nss-myhostname.  Thus
everyone is happy; things Just Work when nss-myhostname is
installed, but more advanced users can uninstall it and
customize /etc/hosts as they wish.

Another alternative is a dispatcher script that listents for
the 'hostname' event, and updates /etc/hosts according to the
administrator's preference.
2010-12-17 09:28:49 -06:00
Dan Williams
fd5e8c2f05 core: fix leak parsing config file 2010-12-10 18:50:49 -06:00
Dan Williams
1ec6b67162 settings: rename NMSysconfigSettings to NMSettings 2010-10-27 20:05:23 -05:00
Dan Williams
84def2fedf settings: remove connection tracking from NMManager
NMSysconfigSettings has the authoritative list of connections, no reason
to duplicate all that tracking code in NMManager.  Add the missing bits
that the manager had to NMSysconfigSettings, and point NMPolicy at the
settings object instead of NMManager for that.
2010-10-27 15:47:10 -05:00
Dan Williams
64b6cd1ebc core: add DNS plugin config options 2010-09-09 17:14:20 -05:00
Dan Williams
9b2b809aae core: rename NMNamedManager -> NMDnsManager 2010-09-07 22:08:18 -05:00
Dan Williams
92babdb658 core: work around dbus-glib property access bug (CVE-2010-1172) (rh #585394)
More info:
https://bugzilla.redhat.com/show_bug.cgi?id=585394
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-1172

dbus-glib was not properly enforcing the 'access' permissions on
object properties exported using its API.  There were 2 specific bugs:

1) dbus-glib did not enforce the introspection read/write property
permissions, so if the GObject property definition allowed write
access (which is sometimes desirable), D-Bus clients could modify
that value even if the introspection said it was read-only

2) dbus-glib was not filtering out GObject properties that were
not listed in the introspection XML.  Thus, if the GObject defined
more properties than were listed in the introspection XML (which is
also often useful, and NM uses this quite a bit) those properties
would also be exposed to D-Bus clients.

To fix this completely, you need to:

1) get dbus-glib master when the patch is commited, OR grab the
patch from https://bugzilla.redhat.com/show_bug.cgi?id=585394 and
build a new dbus-glib

2) rebuild NetworkManager against the new dbus-glib
2010-08-11 15:54:08 -05:00
Dan Williams
0a700de047 core: read nm-system-settings.conf first (rh #606160)
Even though we prefer NetworkManager.conf, we need to check the
old nm-system-settings.conf first to preserve compat with older
setups.  In package managed systems dropping a NetworkManager.conf
onto the system would make NM use it instead of nm-system-settings.conf,
changing behavior during an upgrade.  We don't want that.
2010-07-21 16:47:31 -07:00
Dan Williams
c4f3bf002b Merge remote branch 'origin/master' into wimax 2010-05-19 08:55:26 -07:00
Dan Williams
a7e0e62311 core: tell GIO to use local implementation (rh #588745)
GIO will apparently normally try to use the remote VFS implemenation
on the session bus.  But NM (as a root service) shouldn't ever be
trying to talk to anything on the session bus.  Squash that.
2010-05-13 10:52:07 -07:00
Dan Williams
e46577ffe5 core: rearrange version macros a bit 2010-04-23 12:12:47 -07:00
Jiří Klimeš
b0548425d7 logging: log NetworkManager version; use distribution version when configured 2010-04-23 15:25:32 +02:00