| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ignoring SIGPIPE signal, otherwise it causes problems.
For example, running `NetworkManager --debug 2>&1 | tee log.txt` in a
terminal and killing it with CTRL+C (SIGINT), will abruplty terminate
NetworkManager without clean shutdown.
Note, that with this patch and above example, NetworkManager will both
receive SIGINT and SIGPIPE. Since we now ignore SIGPIPE, NetworkManager
will shut down cleanly. Any logging output after killing `tee` is of
lost however.
Also, there might be other cases where NM reads/writes to a pipe/socket
and unexpectedly received SIGPIPE. For example nm-dns-manager.c
spawns netconfig (run_netconfig()) and writes the configuration
to its stdin. If netconfig dies, the write might fail with EPIPE.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes NetworkManager independent of <polkit/polkit.h>
development headers and libpolkit-gobject-1.so library.
Instead communicate directly with polkit using its DBUS
interface.
PolicyKit support is now always compiled in. You can control
polkit authorization with the configuration option
[main]
auth-polkit=yes|no
If the configure option is omitted, a build time default
value is used. This default value can be set with the
configure option --enable-polkit.
This commit adds a new class NMAuthManager that reimplements the
relevant DBUS client parts. It takes source code from the polkit
library.
https://bugzilla.gnome.org/show_bug.cgi?id=734146
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
| |
"NetworkManager.h"'s name (and non-standard capitalization) suggest
that it's some sort of high-level super-important header, but it's
really just low-level D-Bus stuff. Rename it to "nm-dbus-interface.h"
and likewise "NetworkManagerVPN.h" to "nm-vpn-dbus-interface.h"
|
|
|
|
|
|
|
|
|
|
|
|
| |
GLib/Gtk have mostly settled on the convention that two-letter
acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
become initial-caps-only (eg, "Tcp").
NM was inconsistent, with most long acronyms using initial caps only
(Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
three-or-more-letter-long acronyms (and update nmcli and nmtui for the
libnm changes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up some of the cross-includes between headers (which made it so
that, eg, if you included NetworkManagerUtils.h in a test program, you
would need to build the test with -I$(top_srcdir)/src/platform, and if
you included nm-device.h you'd need $(POLKIT_CFLAGS)) by moving all
GObject struct definitions for src/ and src/settings/ into nm-types.h
(which already existed to solve the NMDevice/NMActRequest circular
references).
Update various .c files to explicitly include the headers they used to
get implicitly, and remove some now-unnecessary -I options from
Makefiles.
|
|
|
|
| |
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
| |
If there are no dispatcher scripts, don't bother dispatching any
events. This saves some time configuring networking if the event
would have no effect anyway.
|
|
|
|
|
| |
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
|
|
|
|
|
|
| |
It's only used to keep the DHCPManager up-to-date with hostname changes,
and that can be accomplished in much less code by just having NMManager
set a hostname on the DHCPManager itself.
|
|
|
|
| |
It's a singleton anyway, so no need to ref/unref it. Just use it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
NetworkManager stopped touching /etc/hosts in late 2010 before the
NetworkManager 0.8.1 release. The code in nm-policy-hosts.c's only
purpose is to remove any of the entries that NetworkManager added long
ago.
I think we're at the point where people have already upgraded to
NetworkManager 0.8.1 or later and thus this code would be a NOP. The
only risk is that some stale /etc/hosts entries will be left if you
upgrade from NM 0.8 or lower to anything higher than that.
FWIW, Ubuntu Lucid (10.04) ships NM 0.8.0 and SLES11 ships NM 0.7.0, so
if users of these distros upgraded to a later NetworkManager they might
run into the stale entries issue if we remove this code from NM. But
given how old these distros are, it seems unlikely that users will do a
direct upgrade to something 4+ years newer...
https://bugzilla.gnome.org/show_bug.cgi?id=729689
|
|
|
|
|
|
|
|
|
|
|
| |
Interpret the configuration option main.debug and the
environment variable NM_DEBUG as a comma separated list
of debugging options (parsed with g_parse_debug_string()).
Currently only the option "RLIMIT_CORE" is supported, to set
the core dump size to unlimited.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The OLPC mesh code did rely on nm_manager_get() referencing the
singleton when returning it, but all other callers of nm_manager_get()
did not. Thus the manager's refcount would always increase and
almost never decrease. Fix the refcounting so that the manager
always has only one ref, and it's lifetime is controlled by
main() and nothing else.
|
|
|
|
|
|
| |
Use the glib wrapper for snprintf.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So far NetworkManager didn't tell which option it didn't know about:
Invalid option. Please use --help to see a list of valid options.
Now it is a bit more informative:
Unknown option --asdf. Please use --help to see a list of valid options.
The "Unknown option" string is marked as translatable in glib so i18n
doesn't suffer.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
| |
If the command line or NetworkManager.conf mentions a non-existent
domain, just print a warning and ignore it. That way if you switch to
using an older NM that doesn't have that domain, it will still work.
|
|
|
|
| |
and ensure that main() frees the singleton before exiting
|
|
|
|
|
|
|
|
| |
gsystem-local-alloc.h
libgsystem contains more than just the local allocation macros; in the
future we will likely want to make use of some of this such as the
structured logging support.
|
|
|
|
|
| |
And make it owned by NMManager, rather than being a separate top-level
object.
|
| |
|
|
|
|
| |
Useful to see which files are being read.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new setup phase goes like this:
- main()
- parse command line options
- logging is configured, targeting stdout/stderr
- ...other stuff...
- do or do not daemonize, depending on commandline option and config files
- Call openlog() - further log messages go to syslog (and potentially
stderr as well, if the -d option was specified so we use LOG_PERROR).
Basically, this allows us to log messages about config file parsing
and such, which *greatly* helps with debugging.
|
|
|
|
|
|
| |
These assertions (such as getuid() == 0) don't need to access the
config files or commandline arguments, but *do* output localized error
messages, so they should be after setlocale().
|
|
|
|
|
| |
Since we may be creating e.g. pid files before this, we need to set
the umask as early as possible.
|
|
|
|
|
| |
See https://bugzilla.gnome.org/show_bug.cgi?id=701322 for why we
should order calls to setenv() as early as possible.
|
|
|
|
|
|
|
|
| |
7ff3d1500e8a9dcce4d12b7b879bf1d178b94bf8 reversed become_daemon for
"--no-daemon" with G_OPTION_FLAG_REVERSE, but missed to reverse initialization
into become_daemon=TRUE and thus NM couldn't be daemonized.
https://bugzilla.gnome.org/show_bug.cgi?id=701383
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add hidden command line option --run-from-build-dir; with that, helpers
like nm-avahi-autoipd.action and nm-dhcp-helper will be called from the
build tree instead of libexecdir, which allows testing without having to
install first.
Helper paths are now stored in global variables instead of macros, and
get modified with that new option.
https://bugzilla.gnome.org/show_bug.cgi?id=698752
|
|
|
|
|
|
|
|
| |
Add single-letter options for --version, --no-daemon, --debug, and
--pid-file (and document them, as well as the existing single-letter
option for --help).
https://bugzilla.gnome.org/show_bug.cgi?id=700550
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When run with --no-daemon, NM used to duplicate all syslog output to
stderr, for ease of debugging. But this meant it had to tell systemd
to ignore stderr, so you wouldn't get duplicated log entries. But that
meant we lost error messages that didn't go through nm_log. (eg,
g_warning()s and g_return_if_fail()s).
Fix this by making --no-daemon no longer duplicate syslog output to
stderr, and removing the "StandardError=null" from the systemd service
file. To get the old behavior, you can use --debug instead of
--no-daemon.
https://bugzilla.gnome.org/show_bug.cgi?id=700550
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=700550
|
|
|
|
|
|
|
|
|
| |
And change src/main.c to use the local allocation macros. This
results in much cleaner code, as one can see from the diff.
Because libgsystem is designed for nonrecursive make, it fits best in
the current recursive setup if we build . first. This will be a lot
nicer when we switch NM to a nonrecursive setup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Create the new nm-platform framework and implement link (or interface)
management. The nm-platform serves as the point of contact between
the rest of NetworkManager and the operating system.
There are two backends for nm-platform:
* NMFakePlatform: Fake kernel backend for testing purposes
* NMLinuxPlatform: Linux kernel backend for actual use
A comprehensive testsuite is included and will be extended with new
feature additions. To enable the Linux part of the testsuite, use
--enable-tests=root configure options and run 'make check' as root.
Use --enable-code-coverage for code coverage support.
./autogen.sh --enable-tests=root --enable-code-coverage
make
make -C src/platform check-code-coverage
Link features:
* Retrieve the list of links
* Translate between indexes and names
* Discover device type
* Add/remove dummy interfaces (for testing)
Thanks to Thomas Graf for helping with libnl3 synchronization issues.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For cases where NM may run without a bus daemon in root-only
environments, like an initramfs. For disconnection, since private
connection just get a disconnect message instead of NameOwnerChanged
signals broadcast by a bus daemon, just synthesize the NameOwnerChanged
signals using our fake owner name. It's just easier to do this rather
than modify any code that cares about disconnects.
Note that the new private socket is only enabled if built with
dbus-glib >= 0.100 as there are bugs in previous versions in the
implementation of dbus_g_proxy_new_for_peer() which clients must
use to talk to the private socket.
|
|
|
|
|
| |
They can just call nm_config_get() now to get the config, and
nm_config_get_path() to get its path.
|
|
|
|
|
|
| |
Most of the various nm_foo_manager_get/new() calls never return NULL,
so just g_assert() that fact rather than logging a separate error
message for each one.
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than passing specific bits of data to NMDHCPManager and
NMDnsManager, just let them call nm_config_get() and then get the data
themselves.
Also, remove the GError argument from nm_dhcp_manager_new(), since the
function never returned NULL. This in turn means there is no longer
any need for a distinction between nm_dhcp_manager_new() and
nm_dhcp_manager_get(), so remove the former.
|
|
|
|
|
|
| |
Rather than having main.c parse them and then hand them all to
nm_config_new(), just let nm-config provide its own GOptionEntry
array to merge in with main's.
|
|
|
|
|
|
| |
This reverts commit 272335a2cf86f0c5dc4399960de528fcbe4d0547.
Done by mistake. Sorry.
|
|
|
|
|
|
|
|
| |
nm-netlink-monitor is deprecated and the only consumer that still uses
it is nm-ip6-manager, which will start it on its own.
Conflicts:
src/main.c
|
|
|
|
| |
It will be activated by the first module that needs it.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
g_malloc(), etc, never return NULL, by API contract. Likewise, by
extension, no other glib function ever returns NULL due to lack of
memory. So remove lots of unnecessary checks (the vast majority of
which would have immediately crashed had they ever run anyway, since
g_set_error(), g_warning(), and nm_log_*() all need to allocate
memory).
https://bugzilla.gnome.org/show_bug.cgi?id=693678
|
| |
|
|
|
|
|
| |
dbus_glib_global_set_disable_legacy_property_access() was added in dbus-glib
0.88, and since we require 0.94 we can remove this check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modern operating systems come with systemwide "crash catching"
facilities; for example, the Linux kernel can now pipe core dumps out
to userspace, and programs like "systemd-coredump" and "abrt" record
these.
In this model, it's actively counterproductive for individual
processes to catch SIGSEGV because:
1) Trying to unwind from inside the process after arbitrary
corruption is destined to fail.
2) It hides the fact that a crash happened at all - my OS test
framework wants to know if any process crashed, and I don't
want to guess by running regexps against /var/log/Xorg.0.log
or whatever.
Signed-off-by: Colin Walters <walters@verbum.org>
https://bugzilla.gnome.org/show_bug.cgi?id=692032
|
|
|
|
| |
Instead of through the VPN manager.
|