Commit Graph

331 Commits

Author SHA1 Message Date
Dan Williams
8f7aedc7e0 Merge remote branch 'origin/master' into rm-userset 2010-10-18 19:02:27 -05:00
Dan Williams
be97e7f104 build: include <config.h> for kill(2), isblank(3), and isascii(3)
config.h defines _GNU_SOURCE, which in turn defines the bits necessary
for kill, isblank, and isascii.  So wherever we use those, we need
to make sure config.h is included.
2010-10-08 22:46:55 -05:00
Jiří Klimeš
088454fcab ifcfg-rh: fix assertion failure when IP4 setting is missing while writing connection 2010-09-30 15:13:39 +02:00
Dan Williams
8b41f70dd5 Merge remote branch 'origin/master' into rm-userset 2010-09-27 10:30:46 -05:00
Dan Williams
b80f31e191 trivial: typo fixes
Sent by a Debian user to Michael Biebl.  No other attribution
information available.  Thanks Debian user!
2010-09-25 00:34:10 -05:00
Dan Williams
6f2aa8a817 ifupdown: return NULL hostname, not a zero-length string 2010-09-24 18:54:37 -05:00
Dan Williams
da3d920d97 keyfile: read and write SSIDs as strings by default
Keep compat with old format if the SSID includes unprintable
characters.  But having to type an int list for an SSID is just silly
and it's about damn time we fix that.
2010-09-16 18:27:19 -05:00
Dan Williams
7f4a7a62c4 keyfile: clean up directory structure
The IO library was in io/ because I was too lazy to find autotools'
SUBDIRS rules at the time and that you could use '.' for the current
directory.  Fix that and use its own error defines instead of
the system settings service.  Clean up a for more things for good
measure too (like KEYFILE_DIR, etc).
2010-09-16 17:39:06 -05:00
Dan Williams
6e287e4179 Merge remote branch 'origin/master' into rm-userset 2010-09-16 17:10:49 -05:00
Dan Williams
c40d79ae97 keyfile: be chattier, especially about parsing errors
This should help people debug issues with keyfile not recognizing
files since it'll actually print out something when it fails to
parse stuff.  Also logs changes, new connections, and deletions.
2010-09-16 15:44:06 -05:00
Dan Williams
f58f2d7f39 ifnet: update for settings rework 2010-08-26 15:10:29 -05:00
Dan Williams
022d8e665c Merge remote branch 'origin/master' into gsoc 2010-08-26 09:18:37 -05:00
Mu Qiao
38f3e5ca61 ifnet: add Gentoo system settings plugin 2010-08-24 12:09:30 -05:00
Dan Williams
ba355b6a7e ifupdown: make testcase parsing quiet
Removes messages about invalid ENI formatting when running the
testcases.
2010-08-12 22:44:07 -05:00
Peter Marschall
a5b77939fb ifupdown: make parser for /etc/network/interfaces more robust
The previous implementation of the parser for /etc/network/interfaces had
quite a few drawbacks:
- it expected the lines to be terminated with "\n", even the last line
- it ignored line wraps with "\\" followed by "\n"
- it expected over-long lines to be shorter than 510 characters
- it ignored line wraps on over-long lines
- it treated spaces and tabs differently
- it did not make sure to really tokenize on word boundaries
- it treated the equivalent stanzas "auto" and "allow-auto" differently
- it ignored the fact that the "allow-*" stanzas can take multiple arguments
  that need to be separated to be recognized NetworkManager's processing later
- it allowed "non-block" stanzas to appear before a block

This patch is a rewrite of the parser to fix the issues mentioned:
- it accepts the last line even if it is not terminated by "\n"
- it skips over-long lines, emits a warning and even takes into account
  that over-long lines may be wrapped to next lines
- it un-wraps wrapped lines
- it uses spaces and tabs equivalently to tokenize the input
- it treats "allow-auto" as a synonym to "auto"
- it splits multi-argument "auto"/"allow-*" into multiple
  single-argument stanzas of the same type
- it warns on data stanzas before the first block stanza
2010-08-12 22:41:05 -05:00
Dan Williams
4397f4463a ifupdown: add ifparser testcases
ENI snippets from Peter Marschall <peter@adpm.de>
2010-08-12 22:35:13 -05:00
Dan Williams
e386548132 ifupdown: split parsers into convenience library for easier testcase creation 2010-08-12 18:15:21 -05:00
Dan Williams
d500eaa33b ifcfg-rh: add testcase for DHCPv6 only mode 2010-08-10 16:35:19 -05:00
Dan Williams
9bed26b856 ifcfg-rh: unmanaged connections should be invisible to ifup too (rh #619863)
The plugin does not expose them to NM, and it shouldn't expose them to
ifup either.  The world should be consistent :)
2010-08-10 00:31:33 -05:00
Dan Williams
7ed22185dd ifcfg-rh: bridge components are now expected to provide a valid connection
They aren't ignored if they have HWADDR due to commit
46696c22ca32999ec09d1ac395e8f043522fdf2d
(ifcfg-rh: correct handling of BRIDGE and VLAN unmanaged connections (rh #619863))
2010-08-09 13:48:01 -05:00
Dan Williams
a4a554a51b Revert "ifcfg-rh: testcases for unmanaged BRIDGE and VLAN"
This reverts commit 007e134594.
2010-08-09 13:47:52 -05:00
Dan Williams
3e48229208 ifcfg-rh: correct handling of BRIDGE and VLAN unmanaged connections (rh #619863)
For those ifcfg files that do have HWADDR and thus can have their
device be unmanaged, we want to read in a much of the connection as
possible since unmanaged devices are tracked via internal NMIfcfgConnection
objects.  For BRIDGE/VLAN ifcfg files that don't have HWADDR, we do
want to ignore them completely, but also return a useful error
message.
2010-08-09 13:23:01 -05:00
Dan Williams
c009759f9b ifcfg-rh: emit the right message when ignored connections are deleted
Previously the code would assume that if the ifcfg file had no backing
connection that we should try to read it in regardless of what the
inotify event was.  But if the event was DELETED, there's no point in
trying to read a deleted file in; it's gone.  Don't print bogus
warnings about failure to read the long-gone ifcfg file.
2010-08-09 13:22:56 -05:00
Dan Williams
97199ae3e3 ifcfg-rh: ignore .augnew and .augtmp files used by netcf 2010-08-09 13:22:51 -05:00
Daniel Gnoutcheff
7f8dc06dff remove nm-settings-connection-interface
NMSettingsConnectionInterface was created to allow the daemon and NM
clients to have common code that handled both system and user
connections. It's no longer needed now that user settings services are
gone.

This concludes the flattening of libnm-glib.
2010-08-06 20:53:37 -04:00
Daniel Gnoutcheff
bbd4c23213 split nm_sysconfig_connection_update
The various "update" functions implemented by NMSysconfigConnection have
become confusing.  Depending on how you count, we've wound up with about
4 functions that all share the name "update" but nonetheless do
different things.  These functions used to be distributed over several
interfaces implemented by NMSysconfigConnection, but now that we've
removed NMExportedConnection and are about to remove
NMSettingsConnectionInterface, they will be all crammed into a single
interface and will be even more confusing than before.  It's time to
give better names to these guys.

The renames planned are:

- nm_settings_connection_interface_update() -->
    nm_sysconfig_connection_commit_changes()

- nm_sysconfig_connection_update() with signal_update==FALSE -->
    nm_sysconfig_connection_replace_settings()

- nm_sysconfig_connection_update() with signal_update==TRUE -->
    nm_sysconfig_connection_replace_and_commit()

This commit performs the last two renames.  The first will be performed
when removing NMSettingsConnectionInterface.

We also have nm_sysconfig_connection_replace_and_commit() have an
async-ish API that accepts a callback. This fits nicely with the
async-ish API of nm_settings_connection_interface_update(), and it lets
us clean up pk_update_cb() a bit.
2010-08-06 13:05:47 -04:00
Daniel Gnoutcheff
a4af7967c9 ifupdown: get_secrets: don't override DBus handler
ifupdown only supports secrets for wireless connections, so attempts to
get non-wireless secrets need to fail. Previously, this was accomplished
by overriding NMSysconfigSettingsClass->get_secrets, the handler for
DBus GetSecrets() method calls. This had some problems:

- It created an information leak. The first thing the
  NMSysconfigConnection implementation does is verify that the caller is
  authorized to get secrets information, but nm-ifupdown-connection ends
  up performing its additional check before authorization happens. Thus,
  unauthorized users are able to determine that some connections don't
  have secrets.  This will become more significant when secrets handling
  is revamped.

- We'd really like to devirtualize these DBus method call handlers.
  They were inherited from from NMRemoteConnection, where we needed
  these functions to be virtual so that user and system settings
  services could implement them differently.  That is no longer needed.
  ifupdown was the last place were we actually "needed" these functions
  to be virtual.

With this commit, we fix these problems by overriding
nm_settings_connection_interface_get_secrets instead.
2010-08-06 13:05:47 -04:00
Daniel Gnoutcheff
c2f4b10ab5 libnm-glib: remove NMSettingsInterface
NMSettingsInterface was created to allow code to operate on a settings
service without caring about what kind of settings service it was. Now
that we have just one settings service, this is no longer needed.

More work needs to be done in order to handle errors and permission
settings in an appropriate manner.
2010-08-06 13:05:47 -04:00
Daniel Gnoutcheff
aee48901f4 Merged NM{Exported,Sysconfig}Connection
In continuation of the theme, the removal of user settings services
means that the distinction between NMSysconfigConnection and
NMExportedConnection is no longer needed. Merge NMExportedConnection
into NMSysconfigConnection.
2010-08-06 13:05:46 -04:00
Dan Williams
0ebeaaf1cb ifcfg-rh: clarify comment about unmanaged connections 2010-08-04 16:59:24 -05:00
Dan Williams
4cdf7468d3 ifcfg-rh: ensure BRIDGE and VLAN connections get completely ignored
Unlike NM_CONTROLLED=no connections we don't even want to both with
these when their devices aren't supposed to be managed.
2010-08-04 16:55:52 -05:00
Dan Williams
007e134594 ifcfg-rh: testcases for unmanaged BRIDGE and VLAN 2010-08-04 16:42:38 -05:00
Dan Williams
5e88c45925 ifcfg-rh: use IFCFG_PLUGIN_ERROR instead of ifcfg_plugin_error_quark ()
Trivial cleanup.
2010-08-04 16:27:34 -05:00
Dan Williams
b103cd34fa ifcfg-rh: be more careful about rewriting ifcfg files
Kind of a hack for now, would be better to push down a flag about
whether the update request came in from D-Bus, internally, or from
inotify, but that's a lot more invasive.
2010-08-04 16:23:36 -05:00
Dan Williams
49103db979 ifcfg-rh: require fewer parameters to connection_from_file() 2010-08-04 16:23:18 -05:00
Dan Williams
b66d5dd3e6 ifcfg-rh: treat BRIDGE and VLAN connections as unmanaged (rh #619863)
Treat them as unmanaged for now so that they dont' need NM_CONTROLLEd=no
which would require further configuration when NM does start to support
these configs.
2010-08-04 16:01:01 -05:00
Daniel Gnoutcheff
75822319bd ifupdown: fix connection class inheritance
NMIfupdownConnection really is a subclass of NMSysconfigConnection (as
declared via the G_DEFINE_TYPE macro in nm-ifconfig-connection.c), but
the header incorrectly used NMExportedConnection* in the class and
instance structs. We got away with it because NMSysconfigConnection*
didn't contain anything other than the stuff inherited from
NMExportedConnection*, but it would have caused much trouble if we did
add something.
2010-08-04 01:54:10 -05:00
Dan Williams
43c6800b35 ifcfg-rh: ignore BRIDGE and VLAN configs until we support them (rh #619863) 2010-08-03 16:17:45 -07:00
Dan Williams
4898f8cd3d Merge remote branch 'origin/zvm' 2010-08-03 15:49:31 -07:00
Pablo Castellano
ce5c0d5ac6 build: enable AM_SILENT_RULES (bgo #625263) 2010-08-03 12:58:46 -07:00
Dan Williams
3dcf858c04 Merge remote branch 'origin/master' into zvm 2010-07-28 08:59:47 -07:00
Daniel Gnoutcheff
2ffa6a830e keyfile: correctly send the 'update' signal
For exported connections, nm_settings_connection_interface_update() is
supposed to cause the emission of a
NM_SETTINGS_CONNECTION_INTERFACE_UPDATED signal.  This is usually done
by chaining up to the NMExportedConnection implementation of this
method, which actually emits the signal.  However, the
NMKeyfileConnection implementation usually forgot to do this.  Rewrite
so that we always chain up after successfully saving settings.
2010-07-28 02:28:45 -07:00
Dan Williams
4d43ce8fa0 Merge remote branch 'origin/master' into zvm 2010-07-27 23:24:10 -07:00
Dan Williams
bebf8d48b0 Revert "ip6: remove standalone DHCP method since DHCPv6 can't provide gateways" (rh #612445)
This reverts commit a729d2f649.

Turns out this is a valid IP config method that some sites use.
2010-07-27 21:43:42 -07:00
Dan Williams
fbdb963f04 ifcfg-rh: fix testcase format string
From Andrey Borzenkov <arvidjaar@gmail.com>
2010-07-22 16:26:34 -07:00
Dan Williams
16bccfd672 core: handle s390 options more cleanly
There are so many... so handle them as a table of key/value pairs
instead of having separate functions for each one.  At the moment
nothing but subchannels is used internally, but this allows plugins
to preserve options that NM doesn't care about when reading/writing
system configuration.
2010-06-29 00:37:14 -07:00
Dan Williams
cdf8c079ef ifcfg-rh: read and write various s390 settings 2010-06-25 23:46:47 -07:00
Dan Williams
ac9d2804bd Merge remote branch 'origin/master' into zvm 2010-06-25 19:57:30 -07:00
Dan Williams
91ab673b5c ifcfg-rh: ensure SSIDs don't get double-quoted when written out (rh #606518) 2010-06-25 09:56:53 -07:00
Jiří Klimeš
1b49f941a6 core: MAC address spoofing/cloning (rh #447827) (bgo #553771)
This commit implements MAC cloning feature in NetworkManager. To support that,
'PermHwAddress' property is added into *.Device.Wired and *.Device.Wireless
interfaces. The permanent MAC address is obtained when creating the device, and
is used for 'locking' connections to the device. If a cloned MAC is specified
in connection to be activated, the MAC is set to the interface in stage1. While
disconecting, the permanent MAC is set back to the interface.
2010-06-22 14:21:25 +02:00