Commit graph

285 commits

Author SHA1 Message Date
Dan Winship
3324bd2cdf ifcfg-rh: ignore IP config on bond slaves
NM was requiring that bond slaves have either no IP config or an
explicit "none"/"disabled" config. But the system scripts just ignore
any IP config that is present on a slave, so change NM to do that too
(but warn about it).

https://bugzilla.redhat.com/show_bug.cgi?id=838907
2012-07-23 12:52:32 -04:00
Jiří Klimeš
974c39fe3e ifcfg-rh: fix a segfault when unescaping a string (rh #841391)
The crash occured for variables like these:
VAR="
VAR='
2012-07-19 14:30:29 +02:00
Jiří Klimeš
21fa0f8349 settings: fix keyfile plugin priority when explicitly configured (bgo #679655)
The regression was introduced by b38f39cfc6 that
built keyfile plugin into NM (instead of using .so).
2012-07-10 16:04:14 +02:00
Dan Williams
74e262b303 agents: add a "user-requested" flag to secret agent requests
Allows agents to provide different behavior depending on whether the
secrets request was initiated by a user (eg by picking a connection
from a UI menu or by 'nmcli con up') or was automatically started by
NetworkManager.

See https://bugzilla.gnome.org/show_bug.cgi?id=660293
2012-06-27 09:42:47 -05:00
Jiří Klimeš
4938996973 ifcfg-rh: fix unescaping single quotes in WPA passphrases (WPA_PSK) (rh #833616)
When the last character of the PSK was a backslash and the whole PSK was
enclosed in single quotes, the unquoting/unescaping code mistakenly took
trailing \' as an escaped quote and thus changed \ to '.

See also 79757f10f3 (that introduced the code).
2012-06-22 13:04:18 +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
9039c24bf5 adsl: carrier handling and PPPoA support
This is the "juice" of the patch series. Initial cut at carrier handling
(by polling /sys/class/atm/$iface/carrier) and also support for calling
pppd with the proper command-line to achieve a connection.

Also implement the necessary boilerplate for the NM state machine to
be happy with our device.

This is a "duct tape and gum" implementation, i.e., prefer copy&paste
over proper refactoring, due to limited time, but the foundations are
now there, so we can make it work right slowly-slowly :)

With this patch, you can already test carrier management but not yet
make a complete connection.

Relevant extract from logs:
<info> (ueagle-atm0): carrier now ON (device state 20)
<info> (ueagle-atm0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:55 -05:00
Jiří Klimeš
57bb91f7f0 ifnet: handle 'biosdevname' interface names better (bgo #674765) (lp:962587)
Finding out interface type from interface name string is fragile. It is easily
broken, e.g. by biosdevname changing interface names to em<n> or p<n>*p<n>.
Sadly, Gentoo network configuration scripts are rather stupid, using format:
variable_${interface|mac|essid|apmac}.
http://www.gentoo.org/doc/en/handbook/2007.0/handbook-x86.xml?full=1#book_part4_chap2
The entries interface|mac|essid|apmac are basically indistinguishable. It's not
possible to say whether 'p1p1' is an interface or SSID, for example.

Fix the current behaviour a bit by checking whether the string is an interface.
If so, and it is not a Wi-Fi one, set the connection type as wired. Else it is
regarded as wireless.
2012-05-18 10:19:13 +02:00
Dan Williams
75257f5d7e core: move connection provider interface to src/ 2012-05-17 13:21:47 -05:00
Dan Williams
682cd73524 keyfile: be more helpful about the property that's invalid or missing 2012-05-15 09:19:31 -05:00
Dan Williams
9a3995daf6 settings: fix example plugin LDFLAGS
C&P error.
2012-05-14 15:51:31 -05:00
Dan Williams
a5df15d75a settings: add nm_connection_provider_get_connections() to connection provider interface
Will be used by some other stuff.
2012-05-14 10:46:32 -05:00
Dan Williams
5c0607d522 examples: add an example system settings plugin 2012-05-07 15:19:09 -05:00
Dan Williams
4fe48b1273 core: add connection provider interface
Allows better encapsulation of the functionality of the NMSettings
object that we want to expose to the device class.  They don't need
the whole object so to keep things simple and contained we'll just
give them a smaller interface to use.
2012-05-02 17:33:17 -05:00
Dan Winship
f378457f25 ifcfg-rh: fix vlan DEVICE parsing
A vlan DEVICE name must be either $(OTHERDEVICE).$(VLAN_ID) or
vlan$(VLAN_ID). Enforce that. In particular, don't:
(a) crash if the name has no "." and doesn't start with "vlan",
(b) loop forever if the $(VLAN_ID) part is non-numeric, or
(c) silently ignore non-numberic characters after the $(VLAN_ID).
2012-04-25 14:56:51 -04:00
Jiří Klimeš
21bc3ab517 ifnet: do not call g_strv_length() on NULL 2012-04-12 13:45:58 +02:00
Mu Qiao
5f4d238baa ifnet: fix quote handling for global data (bgo #673548) 2012-04-12 13:45:31 +02:00
Jiří Klimeš
fe3f010044 ifcfg-rh: clear MACADDR before writing it in wired setting (bgo #672646)
Else it's not possible to delete Cloned MAC (e.g. in the editor).
2012-04-03 14:57:31 +02:00
Jiří Klimeš
876f318ee8 ifupdown: add missing test18-wired-static-verify-ip6 to Makefile.am 2012-03-27 15:55:21 +02:00
Dan Williams
8126947e08 settings: quiet warning when checking for AdHoc WPA connections 2012-03-23 09:59:20 -05:00
Mathieu Trudel-Lapierre
1a531b7ecf keyfile: fix testcases after InfiniBand transport-mode default change 2012-03-19 10:10:36 -05: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
Dan Williams
43ba4eb04b ifcfg-rh: fix testcase after 4abb300c96 2012-03-15 17:56:34 -05: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
Dan Williams
cfa1536fa8 ifcfg-rh: fix distcheck 2012-03-13 14:50:36 -05:00
Jiří Klimeš
a0b658281f ifnet: use nm_connection_get_setting_connection() to get 'connection' setting 2012-03-13 12:23:40 +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
Mu Qiao
e7380561d5 ifnet: remove system prefix
As all connections are system connection so the prefix is meaningless.
Drop it now.
2012-03-09 12:46:49 -06:00
Mu Qiao
e3a1b6e065 ifnet: ignore per-user connections
Ifnet currently does not deal with user agent service. Any connection
that comes with flagged secrets or is not system connection will be
ignored by the plugin. Thanks to David Narvaez for his great help on
this problem.
2012-03-09 12:45:25 -06:00
Jiří Klimeš
79757f10f3 ifcfg-rh: use single quotes when quoting WPA passphrases (WPA_PSK) (rh #798102)
Single quotes ensure we don't break initscripts (bash processing) when the
string contains special characters. Special handling is necessary for single
quotes characters. They have to be escaped and the whole string has to be
prepended with '$' character so that bash is happy.
This change also filters out CR and LF characters as they break WPA_PSK
variable and could pose security issues.
2012-03-07 14:45:37 +01: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 Williams
723bab41ea ifcfg-rh: remove duplicate tests 2012-03-06 00:36:55 -06:00
Dan Winship
51f2bd0198 ifcfg-rh: don't write out a fake minimal IP4 config for bond slaves
The writer had code to fake up a simple IP4 config if the connection
didn't already have one. Make sure we don't do that in the bond case.
2012-03-05 15:55:43 -05:00
Dan Williams
10b32be37b ifcfg-rh: various VLAN cleanups
Add some testcases checking for DEVICE/PHYSDEV/VLAN_ID variations,
and read/write the new VLAN_ID tag, which we can use in
combination with the 'parent' property to determine the interface
name if no interface name/DEVICE is given.
2012-03-01 17:40:17 -06:00
Thomas Graf
cf597e698a ifcfg-rh: writer support for bonding connections
For bonding-master:
  TYPE=bond
  BONDING_MASTER=yes
  DEVICE=<NAME>
  BONDING_OPTS="..."

For bonding-slaves:
  MASTER=<NAME>

v2: Resolved test failures after feedback from Jirka.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-03-01 17:32:51 -06:00
Jiří Klimeš
ff0e71607d build: fix build 2012-03-01 17:48:31 +01:00
Dan Williams
ca3c39abd3 wifi: let WEXT be disabled with --with-wext=no
It's still enabled by default if you don't pass --with-wext=no.
But now it's possible to build without WEXT entirely.
2012-02-29 23:11:04 -06:00
Jiří Klimeš
88dc641e6e ifcfg-rh: read/write IPV6_PRIVACY and IPV6_PRIVACY_PREFER_PUBLIC_IP 2012-02-27 16:28:25 +01:00
Dan Williams
e41218caaa ifnet: misc fixes (constness, error initialization) (bgo #670508) 2012-02-25 20:50:29 -06:00
Mu Qiao
4641649cc1 ifnet: backup configuration files before writing (bgo #670508) 2012-02-25 20:50:27 -06:00
Mu Qiao
cd867534da ifnet: remove wep_tx_keyidx only when necessary (bgo #670508)
Always removing wep_tx_keyidx will cause wpa_supplicant.conf being
written even if nothing has been changed. Now it will be removed only
when wep is not used anymore.
2012-02-25 20:50:24 -06:00
Mu Qiao
28047305db ifnet: fix IP comparison (bgo #670508)
IP comparison was not working due to different IP formats. Now this is
fixed.
2012-02-25 20:50:18 -06:00
Dan Williams
750cb8bb89 ifnet: add testcase for # in passphrase (bgo #670381) 2012-02-25 20:33:00 -06:00
Alexandre Rostovtsev
3feb769efa ifnet: do not truncate WPA passwords at '#' character (bgo #670381)
We need to do the same thing as wpa_supplicant's own config file parser
and ignore '#' characters that occur between the first and last '"'
characters in a config file line.

https://bugzilla.gnome.org/show_bug.cgi?id=670381
2012-02-25 20:32:39 -06:00
Weiping Pan
e8ffca398f ifcfg-rh: add "VLAN=yes" in ifcfg
Check "VLAN=yes" if "TYPE=Vlan" is missing.
They have the same meaning.

This patch is based on NM/vlan branch,
commit 703196fcdb96ad0d4bf8dac572235e65ba02e844

Signed-off-by: Weiping Pan <wpan@redhat.com>
2012-02-24 14:35:15 -06:00
Dan Williams
0109ed62e9 core: const-ify nm_device_wired_get_hwaddr() 2012-02-23 00:03:50 -06:00
Colin Walters
74ec56d956 build: fix srcdir != builddir for new generated headers 2012-02-22 16:27:28 -06:00
Dan Williams
0be930c0fc core: flush timestamp cache to disk only on activate/deactivate
To suppress periodic disk wakeups, only write timestamps to disk
when a device gets activated or deactivated.  Timestamps are
still updated periodically in memory, just not flushed to disk
at that time.
2012-02-17 09:49:35 -06:00
Weiping Pan
ccea442504 ifcfg-rh: add ifcfg-vlan writer
add write_vlan_setting() and modify test-ifcfg-rh.c to test it.

Signed-off-by: Weiping Pan <wpan@redhat.com>

(updates by dcbw for changes made to original patch series)
2012-02-16 15:20:50 -06:00