Commit Graph

783 Commits

Author SHA1 Message Date
Thomas Graf
b46508b5c6 libnm-util: move dev_valid_name() to libnm-util and make it public
The bridging code needs it as well.
2012-08-29 17:46:54 -05:00
Dan Williams
4e80077cfa libnm-util: handle RSN IBSS in AP/connection compatibility checks 2012-08-27 16:56:57 -05:00
Dan Williams
f19c33b56f docs: clarify byte order of returned value from nm_utils_ip4_prefix_to_netmask() 2012-08-13 11:00:54 -05:00
Dan Williams
4106013753 trivial: fix documentation typo 2012-08-06 19:53:39 -05:00
Dan Williams
ace5cd0138 docs: document OLPC Mesh setting errors 2012-08-06 19:51:23 -05:00
Dan Winship
1814fbca71 libnm-util: remove InfiniBand references in NMSettingVlan
IPoIB doesn't support VLANs (it has something similar done
differently), so remove the references to it in the docs.
2012-07-30 20:36:37 -04:00
Jiří Klimeš
edb85e9720 core: fix NM_IS_*_CLASS(klass) macros
The argument is 'klass' not 'obj'.
2012-07-27 13:15:54 +02:00
Dan Williams
07db961a6a libnm-util: clean up some private symbols
Symbols starting with "nm" are expected to be exported,
even though these are not since they're static.  So don't
prefix them with nm.
2012-07-23 09:17:04 -05:00
Jiří Klimeš
00297f49fb libnm-util: add nm_utils_file_is_pkcs12() for checking PKCS#12 file format 2012-07-16 14:59:59 +02:00
Jiří Klimeš
7c841b901a docs: fix documentation for some VLAN setting functions 2012-07-11 13:10:51 +02:00
Dan Williams
18b0ba499c libnm-util: ensure address/route types are boxed on glib < 2.26 2012-07-02 13:20:21 -05:00
Jiri Popelka
ec821e0783 libnm-util: remove unused zone related code
The test in verify() has been probably result of my
copy-paste-fu. It's wrong and useless anyway.

Those #defines are not used anywhere.
2012-07-02 13:48:17 +02:00
Jiří Klimeš
f8bef2c10b docs: fix a few documentation errors 2012-06-29 11:49:51 +02:00
Colin Walters
c9aa5f76cf Fix various bits of broken gtk-doc
There was some duplication, syntax errors, etc.
2012-06-14 13:56:48 -04:00
Dan Williams
4366fd2f84 docs: fix some annotations and documentation 2012-06-12 12:12:35 -05:00
Alberto Ruiz
9966ac45fa introspection: fix wrong symbol prefix in the Makefile (bgo #677498)
While the python and JS bindings don't have an issue with "nm_",
the Vala ones apparently do.
2012-06-11 15:03:01 -05:00
Jiří Klimeš
0fb4f259e6 libnm-util: fix return values in g_return_val_if_fail() 2012-06-07 11:32:33 +02:00
Dan Williams
ad72966169 tests: fix libnm-util testcase on 32-bit platforms
On 32-bit, gulong is 32-bits, so we need to use guint64 here,
which we should have been using anyway.
2012-06-03 15:48:35 -05:00
Alberto Ruiz
ddb28d3e1a introspection: removes redudant package names from gir files (bgo #677296)
Currently the .gir files for NetworkManager-1.0 and NMClient-1.0 declare
their dependencies twice, once with the GIR name and another one with
the pkg-config name. This causes problems with Vala bindings generation.
2012-06-01 13:57:00 -05:00
Pantelis Koukousoulas
8039dd30d8 adsl: add libnm-glib and nmcli code
For the finale, this is the libnm-glib and nmcli part of the support,
with this you can now make a full pppoatm connection from NetworkManager
by configuring it in system scope in a keyfile.

As an example, here is mine:
(password and username snipped for obvious reasons)

[connection]
id=MYISP
uuid=34d04e69-fdd9-4231-af2c-25ed1f34dc1e
type=adsl
timestamp=1304621332

[adsl]
username=user@myisp.com
password=mypassword
vpi=8
vci=35
encapsulation=vcmux
protocol=pppoa

[ipv6]
method=ignore

[ipv4]
method=auto

Extract from logs:
NetworkManager[29155]: <info> Activation (ueagle-atm0) starting connection 'MYISP'
NetworkManager[29155]: <info> (ueagle-atm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) starting...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: prepare -> config (reason 'none') [40 50 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) successful.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: config -> ip-config (reason 'none') [50 70 0]
NetworkManager[29155]: <info> starting PPP connection
NetworkManager[29155]: <debug> [1304671146.590156] [nm-ppp-manager.c:1047] nm_ppp_manager_start(): command line: /usr/sbin/pppd nodetach lock nodefaultroute user user@myisp.com plugin pppoatm.so 8.35 noipdefault noauth usepeerdns lcp-echo-failure 0 lcp-echo-interval 0 ipparam /org/freedesktop/NetworkManager/PPP/0 plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so
NetworkManager[29155]: <info> pppd started with pid 29175
NetworkManager[29155]: <debug> [1304671146.591235] [NetworkManagerUtils.c:816] nm_utils_get_proc_sys_net_value(): (ueagle-atm0): error reading /proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra: (4) Failed to open file '/proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra': No such file or directory
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) complete.
Plugin pppoatm.so loaded.
Plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so loaded.
** Message: nm-ppp-plugin: (plugin_init): initializing
** Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
NetworkManager[29155]: <debug> [1304671146.612937] [nm-udev-manager.c:621] handle_uevent(): UDEV event: action 'add' subsys 'net' device 'ppp0'
NetworkManager[29155]: <debug> [1304671146.613134] [nm-udev-manager.c:525] net_add(): ignoring interface with type 512
NetworkManager[29155]: <debug> [1304671146.617308] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x1090
Using interface ppp0
Connect: ppp0 <--> 8.35
** Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
** Message: nm-ppp-plugin: (nm_phasechange): status 6 / phase 'authenticate'
** Message: nm-ppp-plugin: (get_credentials): passwd-hook, requesting credentials...
NetworkManager[29155]: <debug> [1304671149.639511] [nm-agent-manager.c:1044] nm_agent_manager_get_secrets(): Secrets requested for connection /org/freedesktop/NetworkManager/Settings/0 (adsl)
NetworkManager[29155]: <debug> [1304671149.639684] [nm-settings-connection.c:717] nm_settings_connection_get_secrets(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets requested flags 0x1 hint 'password'
NetworkManager[29155]: <debug> [1304671149.640950] [nm-agent-manager.c:959] get_start(): (0x9b4ad10/adsl) system settings secrets sufficient
NetworkManager[29155]: <debug> [1304671149.641332] [nm-settings-connection.c:573] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) existing secrets returned
NetworkManager[29155]: <debug> [1304671149.641541] [nm-settings-connection.c:579] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets request completed
NetworkManager[29155]: <debug> [1304671149.643074] [nm-settings-connection.c:618] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) new agent secrets processed
** Message: nm-ppp-plugin: (get_credentials): got credentials from NetworkManager
PAP authentication succeeded
** Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
local  IP address 94.70.90.201
remote IP address 80.106.108.12
primary   DNS address 195.170.0.1
secondary DNS address 195.170.2.2
** Message: nm-ppp-plugin: (nm_phasechange): status 9 / phase 'running'
** Message: nm-ppp-plugin: (nm_ip_up): ip-up event
** Message: nm-ppp-plugin: (nm_ip_up): sending Ip4Config to NetworkManager...
NetworkManager[29155]: <debug> [1304671150.607440] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x110D1
NetworkManager[29155]: <info> PPP manager(IP Config Get) reply received.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager[29155]: <debug> [1304671150.608918] [nm-system.c:222] sync_addresses(): (ppp0): syncing addresses (family 2)
NetworkManager[29155]: <info> (ueagle-atm0): device state change: ip-config -> activated (reason 'none') [70 100 0]
NetworkManager[29155]: <info> Policy set 'MYISP' (ppp0) as default for IPv4 routing and DNS.
NetworkManager[29155]: <info> Activation (ueagle-atm0) successful, device activated.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) complete.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:56 -05:00
Pantelis Koukousoulas
0e6f5ce38e adsl: settings and initial "scaffolding"
This patch adds the settings code (NMSettingAdsl) and the initial
"scaffolding" i.e., a tiny stub version of NMDeviceAdsl and the
udev handler code to get the device detected.

With this patch you should be able to see an atm device being detected
by networkmanager in the logs, although of course it doesn't
do anything useful yet.

Extract from the logs:

 [1304668252.341354] [nm-udev-manager.c:562] adsl_add(): adsl_add: ATM Device detected from udev. Adding ..
(ueagle-atm0): failed to look up interface index
(ueagle-atm0): new ADSL device (driver: 'ueagle-atm' ifindex: -1)
(ueagle-atm0): exported as /org/freedesktop/NetworkManager/Devices/2
(ueagle-atm0): now managed
(ueagle-atm0): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
(ueagle-atm0): deactivating device (reason: 2).
 [1304668252.345102] [nm-system.c:1349] flush_routes(): (ueagle-atm0) failed to lookup interface index
 [1304668252.347821] [nm-device.c:3912] nm_device_state_changed(): (ueagle-atm0): device is available,

In this version, we hack the nm-device.c:nm_device_get_priority() to get better priority
instead of changing the DeviceType enum.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:55 -05:00
Dan Williams
bbd2c6e2e6 libnm-util: add 'hidden' property to the wireless setting
Used as a hint to indicate the network is not broadcasting the SSID
and that workarounds should be used for more reliable connection.
2012-05-02 17:33:17 -05:00
Dan Winship
8a2267ab6b Fix a few misc issues noticed by Coverity 2012-04-05 13:30:09 -04:00
Michael Biebl
546c269f8d Fix format string vulnerability in verify ()
which caused a build failure when compiling with -Werror=format-security
2012-03-24 23:07:56 +01:00
Dan Williams
145b37d6ff libnm-util: bump soname minor 2012-03-23 15:55:21 -05:00
Dan Winship
c4994bba54 libnm-util: improve NMSettingBond:verify()
Add NM_SETTING_BOND_ERROR_INVALID_OPTION and
NM_SETTING_BOND_ERROR_MISSING_OPTION error codes so we can better
distinguish errors in different options, and add checks for various
incompatible sets of options.
2012-03-22 13:12:57 -04:00
Dan Winship
131b434054 libnm-util: fix an NMSettingBond bug
NMSettingBond sets the "miimon" option to "100" by default, but this
means that when reading in a saved configuration with "arp_interval"
set, it would end up with both "miimon" and "arp_interval" set, which
is invalid. Fix this by clearing "miimon" if "arp_interval" is set,
and vice versa.
2012-03-22 13:12:57 -04:00
Dan Williams
69247a00ea wifi: disable Ad-Hoc WPA connections (lp:905748)
The kernel is broken for Ad-Hoc WPA, and creates the connections
as open connections instead.  Yeah, eventually we can use
wpa_supplicant with RSN support, but for now we just have to
disable Ad-Hoc WPA because it's a problem to say we're creating
a protected network but then have the kernel not do that for
us.  Will be re-enabled once all the necessary bits have been
fixed.

Note that Ad-Hoc WPA has been broken since at least 2.6.32 with
mac80211-based drivers, which is what most users will be using.
2012-03-16 17:58:23 -05:00
Dan Winship
04959c39aa Add a workaround for a problem creating InfiniBand connections
It is currently not possible to create a connection where the
connection-type-specific NMSetting has all default values. This hasn't
been a problem in the past because each type had at least one property
that either had no default value or had a default value that didn't
pass verify(). But NMSettingInfiniband didn't have that property, so
it's impossible to create an InfiniBand connection unless you change
the value of at least InfiniBand-specific setting.

Work around this for now by making the default value of
NMSettingInfiniband:transport-mode be NULL, so it needs to be
overridden.
2012-03-16 14:13:52 -04:00
Tore Anderson
4abb300c96 core: allow IPv4 to fail by default
(comments by dcbw)
This allows out-of-the-box connectivity	on IPv6-only networks.
Once caveat is that connections	where the user currently
expects	no IPv4	connectivity to	terminate the connection and
retry will no longer do	so until IPv6 also times out, and if
that network where IPv4	is expected to fail also has an IPv6
router sending advertisements, the connection will succeed
instead	of failing.  That can be resolved by setting the
right bit in the connection's config file; and it's expected
that the number	of users who expect IPv4 failure on a
network	with usable IPv6 connectivity is quite small
compared to the	benefit	of OOB IPv6 connectivity.
2012-03-15 15:58:24 -05:00
Jiří Klimeš
bb6da998b2 libnm-util: do not assert on buggy drivers with no WEP cipher capabilities
The crash happens with ipw2200, kernel 3.2.0 when a user tries to connect
to a hidden network using nm-applet.
g_assert (have_ap); is hit in 'case NMU_SEC_STATIC_WEP:' branch.

Reported by Mathieu Trudel-Lapierre.
See also:
(lp:908516)
(lp:908380)
2012-03-13 15:37:11 +01:00
Jiří Klimeš
19ffe0783f trivial: fix InfiniBand typo 2012-03-13 12:37:09 +01:00
Dan Winship
54ef8f3224 Fix names of error enum values
When NM was registering all of its enum types by hand, it was using
NamesLikeThis rather than the default names-like-this for the "nick"
values. When we switched to using glib-mkenums, this resulted in
dbus-glib using different strings for the D-Bus error names, causing
compatibility problems.

Fix this by using glib-mkenums annotations to manually fix all the
enum values back to what they were before. (This can't be done in a
more automated way, because the old names aren't 100% consistent. Eg,
"UNKNOWN" frequently becomes "UnknownError" rather than just
"Unknown".)
2012-03-12 15:29:52 -04:00
Dan Winship
49214066a4 Fix capitalization of "InfiniBand"
"InfiniBand" has a capital "B". Fix that everywhere it's being used as
a human-readable string.

In particular, the RH initscripts recognize "TYPE=infiniband" and
"TYPE=InfiniBand", but not "TYPE=Infiniband", which is what we were
writing before.
2012-03-06 13:23:29 -05:00
Dan Winship
fb06cda723 libnm-util: fix two bugs in nm_setting_bond_get_option()
The function documents that it returns FALSE if idx is out of range,
so don't g_return_val_if_fail() in that case.

Also, free the return value from g_hash_table_get_keys().
2012-03-02 14:20:55 -05:00
Dan Williams
b9ddbe58f0 libnm-util: add functions for getting valid bond options and defaults
Since the options are a hash table now there wasn't any way to
determine what options were allowed and what their default values
are.  Add some functions to do that.
2012-03-01 17:40:18 -06:00
Dan Williams
e52bf5e172 libnm-util: add 'parent' property to VLAN setting 2012-03-01 17:39:36 -06:00
Jiří Klimeš
788720abec libnm-util: add a property for IPv6 Privacy Extensions to NMSettingIP6Config
ip6-privacy
2012-02-27 16:28:11 +01:00
Colin Walters
74ec56d956 build: fix srcdir != builddir for new generated headers 2012-02-22 16:27:28 -06:00
Dan Winship
258d0b397c libnm-util: fix a docs typo 2012-02-21 11:22:24 -05:00
Jiří Klimeš
7b9c728b85 docs: correct NMSettingBond documentation errors 2012-02-20 12:12:40 +01:00
Dan Williams
552c9959cc libnm-util: various cleanups and documentation fixes
Add documentation so the API spec generator can do something
for the VLAN setting.  Also enforce validation of the ingress
and egress priority maps; 802.1D priorities are limited to
values from 0 - 7 and Linux SKB values are 32 bits.

Also, the 'slave' property is a duplicate of the 'master'
property added to NMSettingConnection in the bonding work
so we can get rid of it and use 'master' instead.
2012-02-16 15:05:55 -06:00
Weiping Pan
23c1b6ad30 libnm-util: add VLAN setting and properties
Signed-off-by: Weiping Pan <wpan@redhat.com>

(dcbw: formatting cleanups and priority map code simplifications)
2012-02-16 15:05:55 -06:00
Thomas Graf
4f166d719b bonding: convert individual bonding options to a dict
Removes all bonding options properties and adds a "options" dict to hold
them all. Accessible via accessor functions. ifcfg interface is
unchanged.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-02-15 21:49:05 -06:00
Dan Winship
839eab5564 Use glib-mkenums to generate enum types
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.
2012-02-15 11:42:15 -05:00
Dan Williams
ca27121ad6 libnm-util: register more GValue transformations for debugging 2012-02-07 12:33:03 -06:00
Thomas Bechtold
3dc965a2cb libnm-util: allow empty number for gsm settings
The documentation said they were allowed, and that's clearly the
correct behavior.
2012-02-02 12:02:10 -06:00
Dan Williams
c09a59da4b docs: update some VPN docs in libnm-util 2012-02-01 15:09:10 -06:00
Jiří Klimeš
0ba66f8272 libnm-util: add 'pac-file' property for 8021x setting (used in EAP-FAST) 2012-01-27 11:46:36 +01:00
Dan Winship
b860c7be4a infiniband: add transport-mode property
Add transport-mode property to NMSettingInfiniband (and parse it
correctly in ifcfg-rh), and set it up properly on the device in
NMDeviceInfiniband.
2012-01-26 09:58:48 -06:00