The setting names used when inserting a setting into the hash
table are const since they are derived from GObject internals,
so there's no need to strdup them.
Add a "need_carrier" argument to nm_device_is_available(), to allow
distinguishing between "device is not available", "device is fully
available", and "device is available except for not having carrier".
Adjust various parts of NMDevice and NMManager to allow for the
possibility of activating a connection with :carrier-detect = "no" on
a device with no carrier, and to avoid auto-disconnecting devices with
:carrier-detect = "on-activate".
https://bugzilla.gnome.org/show_bug.cgi?id=688284
24cda2bc broke the ability to set NMConnection:path back to NULL after
it had been set, as part of a hack to try to make
NMRemoteConnection:dbus-path work. Fix that by moving the hack
entirely into NMRemoteConnection.
https://bugzilla.gnome.org/show_bug.cgi?id=693829
In order to resolve NMRemoteConnection-valued properties, NMObject
needs to be able to create NMRemoteConnections. But NMObject assumes
that all the objects it will be creating have "dbus-connection" and
"dbus-path" properties. So add those properties to NMRemoteConnection,
aliasing the existing "bus" and "path" properties (and ensure that
whichever version gets set, we keep that value, rather than letting it
get overwritten by the NULL default value of the other one).
https://bugzilla.gnome.org/show_bug.cgi?id=693669
Make setting type registration less icky; instead of having the
connection register all the settings, have the settings themselves
register that information at library load time. Putting this sort
of thing in G_DEFINE_TYPE_WITH_CODE is apparently more standard
than the home-rolled stuff we had before. Also document the
priority stuff so when adding new settings, people know what
priority to use.
(cleanups by jklimes)
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.
Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.
Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.
To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.
Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
Some connection types such as bonding, bridging and VLAN require
specific virtual kernel interfaces identified by name to be auto
connected to the connection.
The function nm_connection_get_virtual_iface_name() returns the name
of the kernel interface if the connection type requires this
functionatlity.
Each connection base type settings class can implement the function
get_virtual_iface_name() if the connection needs to be auto connected
to a specific kernel interface.
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Introduced a new TYPE=bond for ifcfg-rh configuration files.
Alternatively BONDING_MASTER=yes can be specified instead of
setting the type explicitely to maintain backwards compatibility
with existing configuration files.
Bonding device files require a DEVICE= line to be present which
specifies the virtual bonding interface in the kernel. We do not
allow auto-generation of the name in order to keep confusion to
a minimum when reusing existing bonding interfaces.
The BONDING_OPTS= parameter can be used to specify various bonding
related options, such as:
- mode
- miimon
- updelay
- downdelay
- arp_interval
- arp_ip_target
By default, the NMSettingBond class uses a miimon value of 100 which
seems like a sensible default value for 99% of all configurations.
If this is not suitable, an arp_ip_target needs to be specified
manually.
A writer is not yet implemented.
Changes v2:
- renamed DeviceName property to InterfaceName
- moved code to validate device name to dev_valid_name() for future use
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Adds a helper nm_connection_is_type(connection, type) which returns TRUE
if a connection is of specified type.
Signed-off-by: Thomas Graf <tgraf@redhat.com>
What we want to do here is keep separate caches of system and
agent secrets. For system secrets, we cache them because NM
periodically clears secrets using nm_connection_clear_secrets() to
ensure they don't stay around in memory, and that transient secrets
get requested again when they are needed. For agent secrets, we
only want them during activation, but a connection read from disk
will not include agent secrets becuase by definition they aren't
stored in system settings along with the connection. Thus we need
to keep the agent/transient secrets somewhere for the duration of
the activation to ensure they don't get deleted.
This removes the copy-back hack in update_auth_cb() which copied
agent/transient secrets back into the connection over top of the
transient secrets that had been copied back in
nm_settings_connection_replace_settings(). No reason to copy
them twice if we keep an agent/transient secrets hash and do
the right thing with it.
The core problem was that the Update would trigger a write to
disk to save the connection's new settings, which called
nm_settings_connection_replace_settings(). Which saved existing
transient (agent/unsaved) secrets, replaced settings with the
new ones from Update(), then copied back the old transient
secrets. This was to ensure that changes triggered from getting
agent secrets during activation (which might write the connection
out to disk if new system secrets were provided, which triggered
an inotify read-back of the connection, which blew away the
transient secrets just returned from the agent) didn't blow away
transient secrets. Unfortunately that fix was too general.
As a quick hack for now, copy the new secrets and re-apply them
after nm_connection_replace_settings() has run. We'll do the
actual fix later, but it's more involved and needs more testing
so we don't want to apply it this close to release.
Unfortunately, GObject Introspection can no longer describe deeper
types, like those inside nested hash tables, which NM uses extensively
for the NMConnection type and other places. So we have to remove
those descriptions. But this moves us back into compliance with
GOI annotation formats.
By 'base type' I mean a hardware-related type that can actually be used
to activate the connection, like wifi, wired, gsm, cdma, wimax, bluetooth,
etc, but not ipv4, ipv6, 8021x, etc.
It's easier to be able to pass both a whole hashed connection, or just
a hashed setting to the function, and have it figure out what needs
to be updated based on the given setting_name.
Add some testcases to make sure that all works correctly too.
The first-level hash table key should be the setting name itself,
not the GType name of the setting's GObject. There's probably a
better way to do this to reduce that confusion.
Simplifies code internally, and makes it easier for clients as well in
some cases where they want to control what ends up in the resulting
hash and what does not.
Add the necessary annotations (the mininum required, that is those
on return values. NULL parameters or container types may require
more), and the Autotools stuff to get a NetworkManager GIR for
libnm-util and a NMClient for libnm-glib.
Connections are normally created from hashes using g_object_set()
which calls that object's set_property handler. But GObject does
not allow errors to be returned from property handlers, so if the
type doesn't match what it should be, the property does not get
set, and error is printed to stdout, and life goes on.
But that's not what we want for the permissions property since the
client might expect that property to be set, but the connection now
is available to everyone. So validate the permissions property
type (its really the only one we need to be so paranoid about)
and return an error when the incoming property type is wrong.
Remove code related to "connection scope" and such. Later, we will also
do lots of code flattening and simplification that's possible now that
user settings are gone.
* libnm-util/libnm-util.ver
libnm-util/nm-connection.c
- (nm_setting_register, nm_setting_unregister): unexport; they are
private and don't have a use outside libnm-util
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4297 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Merge the vpn-properties setting with the vpn setting since it was pointless
to keep both of them around. Convert the vpn 'data' hash table to a hash
of string:string (instead of string:variant) so that system settings plugins
can have an easier time dealing with the arbitrary key/value pairs.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3923 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Add a GError argument to nm_connection_verify() and nm_setting_verify(),
and add error enums to each NMSetting subclass. Each NMSetting subclass now
returns a descriptive GError when verification fails.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3751 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Split the 802.1x bits out of the wireless-security setting so they are
generalized enough for wired 802.1x to use too.
* introspection/nm-exported-connection.xml
- GetSecrets now returns 'a{sa{sv}}' (a hash of settings hashes) instead
of just a hash of the secrets for one setting
* libnm-util/nm-setting-wireless-security.c
libnm-util/nm-setting-wireless-security.h
- Remove 802.1x-specific stuff
- Added leap-username and leap-password properties for old-school LEAP
* src/nm-device.c
src/nm-device.h
- (connection_secrets_updated_cb): take a list of updated settings names,
not just one
* src/supplicant-manager/nm-supplicant-config.c
src/supplicant-manager/nm-supplicant-config.h
- (nm_supplicant_config_add_setting_wireless_security): remove 802.1x
specific stuff; fix for updated LEAP bits; punt 802.1x stuff
to nm_supplicant_config_add_setting_8021x()
- (nm_supplicant_config_add_setting_8021x): add an 802-1x setting to
the supplicant config
* src/nm-device-802-11-wireless.c
- (build_supplicant_config): pass in the 802.1x setting too, if any
- (real_connection_secrets_updated): take a list of updated settings
names, not just one
* src/nm-device-802-3-ethernet.c
src/nm-cdma-device.c
src/nm-gsm-device.c
- (real_connection_secrets_updated_cb): take a list of updated settings
names, not just one
* src/nm-activation-request.c
src/nm-activation-request.h
- (nm_act_request_class_init): the 'connection-secrets-updated' signal
now passes a list of updated settings names, not just one
- (update_one_setting): new function; handle one updated setting
- (get_secrets_cb): handle multiple settings returned from the
settings service; have to be careful of ordering here as there are
some dependencies between settings (ex. wireless-security and 802.1x
in some cases)
* src/marshallers/nm-marshal.list
- new marshaller for connection-secrets-updated signal
* libnm-util/nm-setting-8021x.c
- Add back the 'pin' and 'psk' settings, for EAP-SIM and EAP-PSK auth
methods
- (verify): a valid 'eap' property is now required
* libnm-util/nm-connection.c
- (register_default_settings): add priorities to settings; there are
some dependencies between settings, and during the need_secrets
calls this priority needs to be respected. For example, only the
wireless-security setting knows whether or not the connection is
going to use 802.1x or now, so it must be asked for secrets before
any existing 802.1x setting is
- (nm_connection_lookup_setting_type): expose
* libnm-util/nm-setting-wireless.c
- (verify): should verify even if all_settings is NULL; otherwise won't
catch the case where there is missing security
* libnm-util/nm-setting-wireless-security.c
- Remove everything to do with 802.1x
- Add old-school LEAP specific properties for username and password
- (need_secrets): rework LEAP secrets checking
- (verify): rework for LEAP and 802.1x verification
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3470 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* libnm-util/nm-connection.c
libnm-util/nm-connection.h
- (nm_connection_compare): accept compare flags and pass them to the
setting compare function
* libnm-util/nm-setting.c
libnm-util/nm-setting.h
- (nm_setting_compare): accept compare flags; ignore properties that are
marked fuzzy
* libnm-util/nm-setting-connection.c
libnm-util/nm-setting-wireless.c
libnm-util/nm-setting-ppp.c
libnm-util/nm-setting-wired.c
- Mark some setting properties as ignorable when doing a fuzzy compare
* src/nm-device.c
- (device_activation_precheck): use exact compare
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3336 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* Global rename of NMConnectionSettings -> NMExportedConnection to cut down
on confusing names
* Add 'path' and 'scope' properties to NMConnection since both NM and the
applet were having to hack this in anyway. Remove the 'path' stuff from
NMExportedConnection
* Internally rename NMConnectionType -> NMConnectionScope
* Provide default implementations of the 'get_id' and 'get_settings' methods
of NMExportedConnection
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3334 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* include/NetworkManager.h
- Add CDMA mobile broadband card device type
* src/nm-hal-manager.c
- (modem_device_creator): handle both CDMA and GSM modems; the device
must now be tagged with 'cdma' or 'gsm' capability
* src/nm-cdma-device.c
src/nm-cdma-device.h
src/Makefile.am
- Add the CDMA mobile broadband card device class
* libnm-util/nm-connection.c
- (register_default_settings): add NMSettingCdma
* libnm-util/nm-setting-cdma.c
libnm-util/nm-setting-cdma.h
libnm-util/Makefile.am
- Add the CDMA mobile broadband card setting class
* libnm-glib/nm-cdma-device.c
libnm-glib/nm-cdma-device.h
libnm-glib/Makefile.am
- Add the CDMA mobile broadband card GLib proxy class
* libnm-glib/nm-client.c
- (get_device): handle CDMA devices too
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3261 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Merge the beginnings of the new GSM card support.
* src/ppp-manager/nm-ppp-manager.c (nm_ppp_manager_stop): Remove
* the
ppp watch source before killing pppd - If this happens from
g_object_unref()
then the ppp manager is already destroyed by the time the watch
callback runs.
* src/nm-hal-manager.c: Add a device_type_name string to the
* device
creators, so that we can print a nice human readable string when
a
device is added.
* src/nm-umts-device.c (automatic_registration_get_network):
* Query
for the activated network, not much is done with the result
thought.
* src/nm-serial-device.c (nm_serial_device_get_reply):
* Implement.
(ppp_ip4_config): Change the device state to activated here for
now.
(real_check_connection): Make sure the connection includes ppp
setting.
* libnm-glib/nm-client.c (get_device): Handle umts devices.
* libnm-glib/Makefile.am: Add the new files to build.
* libnm-glib/nm-umts-device.c:
* libnm-glib/nm-umts-device.h: Implement.
2007-11-26 Tambet Ingo <tambet@gmail.com>
* src/nm-umts-device.c (automatic_registration_get_network): For
* now, dial
immediately, nm_serial_device_get_reply() isn't implemented
correctly yet.
* src/nm-serial-device.c (wait_for_reply_info_destroy): Don't
* try to remove
the timeout source - this function is only called when the
timeout source has
been removed.
(nm_serial_device_wait_for_reply): Allocate the duplicate
responses array
to be big enough to contain the terminating zero element as
well.
The timeout argument is meant to be in seconds now.
(real_deactivate_quickly): Implement.
* src/NetworkManager.conf: Allow root to own
"org.freedesktop.NetworkManager.PPP", deny it for everybody
else.
* libnm-util/nm-setting-umts.c: Network type and band properties
* are ints,
(not unsigned ints).
* libnm-util/nm-setting-serial.c (nm_setting_serial_class_init):
* Fix a
small issue with parity bounds - capital letters have lower
ascii codes
than lower case letters.
* libnm-util/nm-connection.c (register_default_settings):
* Register serial
and umts settings.
2007-11-22 Tambet Ingo <tambet@gmail.com>
Remove the "index" property from devices as not all device types
have this.
* include/NetworkManager.h (NM_DBUS_PATH_DEVICE): Remove.
* src/nm-hal-manager.c (nm_get_device_index_from_hal): Remove.
(wired_device_creator): Get the device interface from hal to
create the device.
(wireless_device_creator): Ditto.
* src/nm-device.c (nm_device_init): Remove the index member.
(constructor): Remove the checks for index property, make
interface property
a require constructor property.
Use the HAL udi for DBus path for devices.
(nm_device_get_index): Remove.
(set_property): Remove index handling.
(get_property): Ditto.
(nm_device_get_dbus_path): Remove.
* src/nm-device-interface.c (nm_device_interface_init): Remove
* the index
property.
* src/nm-device-802-3-ethernet.c
* (nm_device_802_3_ethernet_link_activated):
Access the device index through it's interface.
(nm_device_802_3_ethernet_link_deactivated): Ditto.
(nm_device_802_3_ethernet_new): Remove the useless argument
test_dev. Remove
index argument. Add interface argument.
* src/nm-device-802-11-wireless.c
* (nm_device_802_11_wireless_new): Remove
the useless test_dev argument. Remove index argument. Add
interface arugment.
* src/NetworkManagerSystem.c
* (nm_system_device_set_from_ip4_config): Get the
device index through interface.
(nm_system_set_mtu): Ditto.
* introspection/nm-device.xml: Remove the "Index" property.
2007-11-21 Tambet Ingo <tambet@gmail.com>
* src/nm-serial-device.c:
* src/nm-serial-device.c:
* src/nm-umts-device.c:
* src/nm-umts-device.h: Implement.
* src/nm-hal-manager.c (nm_get_device_driver_name):
* libhal_free_string the string
allocated by libhal.
(modem_device_creator): Implement.
(register_built_in_creators): Register the modem creator.
* src/nm-device-802-11-wireless.c
* (nm_device_802_11_wireless_new):
Remove the unused test_dev argument.
* src/nm-device-802-3-ethernet.c (nm_device_802_3_ethernet_new):
* Ditto.
* src/Makefile.am: Add new files to build.
Link in ppp-manager.
* libnm-util/nm-setting-umts.c:
* libnm-util/nm-setting-umts.h:
* libnm-util/nm-setting-serial.c:
* libnm-util/nm-setting-serial.h: Implement.
* libnm-util/Makefile.am: Add new files to build.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3116 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Rework NMSetting structures: Move each setting to it's own file.
Convert to GObject. Remove home grown setting types and use
GTypes.
Use GObject property introspection for hash conversion,
enumerating
properties, etc.
* libnm-util/nm-setting-connection.[ch]
* libnm-util/nm-setting-ip4-config.[ch]
* libnm-util/nm-setting-ppp.[ch]
* libnm-util/nm-setting-vpn.[ch]
* libnm-util/nm-setting-vpn-properties.[ch]
* libnm-util/nm-setting-wired.[ch]
* libnm-util/nm-setting-wireless.[ch]
* libnm-util/nm-setting-wireless-security.[ch]
New files, each containing a setting.
* libnm-util/nm-setting-template.[ch]: A template for creating
* new
settings. To use it, just replace 'template' with the new
setting
name, and you're half-way done.
* libnm-util/nm-setting.c: Convert to GObject and use GObject
introspection instead of internal types and tables.
* libnm-util/nm-connection.c: Adapt the new NMSetting work.
* libnm-util/nm-param-spec-specialized.[ch]: Implement. Handles
GValue types defined by dbus-glib for composed types like
collections,
structures and maps.
* src/*: The API of NMSetting and NMConnection changed a bit:
* Getting
a setting from connection takes the setting type now. Also,
since
the settings are in multiple files, include relevant settings.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3068 4912f4e0-d625-0410-9fb7-b9a5a253dbdc