Commit graph

2920 commits

Author SHA1 Message Date
Dan Williams
002155fb09 modem: get modem properties using GetAll
More efficient and less error-prone; get all the properties
in one call instead of individually.
2012-02-17 15:32:27 -06:00
Aleksander Morgado
b574524da4 modem: query desired IP timeout value
Different modem implementations in ModemManager are now able to specify specific
maximum durations of the IP configuration setup. This is useful when specific
modems need durations greater than the default 20s (for example, for Satellite
network based modems, where delays are pretty high).
2012-02-17 15:32:22 -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
Dan Williams
46eee484f9 core: fix matching VLAN connections to interfaces
The check for virtual interface name was too loose, so
restrict it to VLAN only which is what actually uses it,
and ensure we have an interface name to compare against
the device.

Found by Weiping Pan <wpan@redhat.com>
2012-02-16 15:20:51 -06:00
Dan Williams
0c61a51614 bond: move bond master interfaces to NMDeviceBond
This way clients know it's a bond master, and it allows us to more
cleanly separate the code for bonding and non-bonding cases.
2012-02-16 15:20:50 -06:00
Dan Williams
fdd44b8e00 core: handle explicit device creation on connection activation
If the connection describing the virtual device isn't set to
autoconnect, the device may not yet have been created.  In that
case, create it.
2012-02-16 15:20:50 -06:00
Dan Williams
b35afe4d0f core: automatically create VLAN interfaces when needed 2012-02-16 15:20:50 -06:00
Dan Williams
13c8d2c51e core: add NMDevice hwaddr_matches() class method
Match the device's hardware address with a connection.
2012-02-16 15:20:50 -06:00
Dan Williams
c1a66936f3 core: don't create virtual interfaces we already have
Make sure we don't already have an NMDevice for this interface
before creating it, and also when creating the interface, make
a new NMDevice for it immediately to prevent a race between
telling the kernel to create the interface via netlink, and when
udev later tells us about it.  In between there we could be
triggered to try creating the interface again.
2012-02-16 15:20:50 -06:00
Dan Williams
add5f97b38 core: make the Ethernet class aware of VLAN interfaces
Also track the VLAN ID and master interface index and validate
connections using those.
2012-02-16 15:20:50 -06:00
Dan Williams
fcce9daa15 core: add utility function nm_utils_is_uuid() 2012-02-16 15:20:50 -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
Dan Williams
0c3efb1787 vlan: rework VLAN interface creation/deletion
First make it build on libnl1/2.  Second, the VLAN
virtual interface name might not always be given in the
NMConnection (if the master is a UUID and thus the name
is determined automatically) so just take the interface
name instead.  And make sure we verify it's a VLAN
interface before deleting it.

Lastly, construct the VLAN interface name if it's not
given in the NMConnection.  This means we need to know
the master interface name when creating the connection,
which we always will since you can't create the VLAN
interface without it's master being present.  That also
means we need to return the name to the caller so it
can be used to create the NMDevice for the VLAN interface
after we've created it in the kernel.
2012-02-16 15:05:55 -06:00
Weiping Pan
ab43b7b41d vlan: create/delete kernel vlan device
We make use of libnl (>=3.2.1) to create/delete kernel vlan device,
and it can set vlan id, vlan flags and ingress/egress priority mapping.

V3:
1 nm_netlink_iface_to_index() should use slave name

V2:
1 use existing nm_netlink_iface_to_index()

Signed-off-by: Weiping Pan <wpan@redhat.com>
2012-02-16 15:05:55 -06:00
Dan Williams
b2d9fa2ecd ifcfg-rh: fix parsing of REORDER_HDR
It's a boolean value not a string.  Second, apparently the
kernel turns it on by default these days, so if it's missing
then assume it's supposed to be TRUE.
2012-02-16 15:05:55 -06:00
Dan Williams
ca689a0287 ifcfg-rh: clean up master interface/connection handling
VLAN and bonding both need it so putting these bits in the
code that creates the NMSettingConnection isn't quite right.
2012-02-16 15:05:55 -06:00
Weiping Pan
ee4b05cfc6 ifcfg-rh: add ifcfg-vlan parser
The example of ifcfg-vlan is as followed:

VLAN=yes
TYPE=Vlan
DEVICE=vlan43  or "DEVICE=eth9.43"
PHYSDEV=eth9
REORDER_HDR=0
VLAN_FLAGS=GVRP,LOOSE_BINDING
VLAN_INGRESS_PRIORITY_MAP=0:1,2:5
VLAN_EGRESS_PRIORITY_MAP=12:3,14:7
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.43.149
NETMASK=255.255.255.0

And we try to make it compitable with the format used by initscripts,
and there is no need to change anything in ifcfg-eth9.

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

(dcbw: complete VLAN testcase)
2012-02-16 15:05:55 -06:00
Dan Williams
3f963d308a build: fix distcheck due to missing ifcfg-rh test files 2012-02-16 15:05:26 -06:00
Dan Williams
836f7d177e wifi: fix removal of APs from the scan list when it doesn't change
Due to an omission in the port to the new supplicant D-Bus API
during the 0.9 cycle, if the scan list didn't change, APs may
not have been removed properly from the scan list.
2012-02-16 12:54:42 -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
Thomas Graf
5a3e1caec1 ifcfg-rh: add bonding test cases
Adds two simple test cases for bonding masters and bonding slaves.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-02-15 21:28:33 -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
Ryan Lortie
227f36d3d5 core: #include <netinet/in.h> for struct in6_addr
commit ae34fa900b introduced a new
function nm_netlink_route6_add().  Its declaration in the header
includes a parameter with type 'struct in6_addr', but the proper
system header for that type was not included.
2012-02-13 17:44:07 -05:00
Jiri Popelka
1e4ccb39d4 firewall: add remove_from_zone()
nm_firewall_manager_remove_from_zone() is called from
nm_device_deactivate()

Also fix nm_firewall_manager_add_to_zone() to the latest
FirewallD1.zone.addInterface signature.
2012-02-13 13:23:20 -06:00
Jiri Popelka
dc385c25cf firewall: update FirewallD DBus service & path & interface 2012-02-13 13:12:01 -06:00
Dan Williams
ae34fa900b core: fix erroneous IPv6 routes by making route addition typesafe
Add two helper functions, one for IPv4 and one for IPv6, to ensure
that the core code benefits from compiler type checking when adding
routes.  Previously nm_netlink_route_add() took a void* which meant
we messed up adding IPv6 routes sometimes due to confusion over
what was supposed to be passed to it.  Also fixes what appears to
be a C&P error with add_ip6_route_to_gateway().

Reported by Tomáš Trnka <tomastrnka@gmx.com>
2012-02-13 13:10:23 -06:00
Alexandre Rostovtsev
fe29aa967c ifnet: properly unquote hostnames with g_shell_unquote() (bgo #669148)
If /etc/conf.d/hostname contains "hostname='foo'", then the hostname
needs to be set to "foo", not "'foo'".

https://bugzilla.gnome.org/show_bug.cgi?id=669148
2012-02-13 11:03:28 +01:00
Dan Williams
643f0a151c build: fix build breakage caused by b378c3089c 2012-02-10 14:56:35 -06:00
Dan Williams
4041ca7e3e core: trivial device creation cleanup
We really need an NMDevice here, so just call it that instead of
GObject.
2012-02-10 12:21:10 -06:00
Dan Williams
d721d02c18 ifcfg-rh: sub filename characters that are annoying to type
Since people apparently hate any extra typing, and tools just can't
find it in them to deal with human readable file names, escape some
of the more annoying characters in shell-land.

Suggested by David Lutterkort
2012-02-09 18:38:27 -06:00
Dan Williams
b378c3089c core: make NMActiveConnection a base class for NMActRequest and NMVPNConnection
That was always the goal, but never got there.  This time we need it
for real to abstract handling of dependent connections so bite the
bullet and make it happen.
2012-02-09 17:54:26 -06:00
Dan Williams
8fd900c2dc core: let nm_system_get_iface_type() take an interface index
We prefer indexes to names in the core since indexes don't change.
2012-02-09 17:16:30 -06:00
Dan Williams
0a18078b73 settings: add nm_settings_get_connection_by_uuid() 2012-02-09 17:10:44 -06:00
Weiping Pan
c50def68ff trivial: remove unused prototype 2012-02-09 17:09:38 -06:00
Benjamin Franzke
c24c4d489f core: fix undefined reference to assert in session-monitor-{systemd, null}
assert.h is not included, that results in an undefined
reference to assert, just use g_assert instead.
2012-02-09 10:48:20 -06:00
Benjamin Franzke
49173e9a3a core: report username in systemd uid_has_session
For nm_auth_uid_in_acl to be successfull its required that
nm_session_monitor_uid_has_session returns a user_name.
2012-02-09 10:48:20 -06:00
Dan Williams
5581114726 supplicant: early exit if EAP-FAST is not supported by the supplicant
EAP-FAST used to require some patches to OpenSSL which aren't always
applied.  We can't depend on the supplicant supporting EAP-FAST like
we can for EAP methods that don't require any special support from
external libraries.  To ensure the error gets reported correctly and
early, fail the configuration step if EAP-FAST isn't supported by
the supplicant but the connection requests it.
2012-02-07 23:46:12 -06:00
Dan Williams
d501b6a9f6 modem: delay connect a bit after sending the PIN
Modems take a bit of time, and ModemManager may not quite be
ready for immediate connect after sending the PIN since the
modem isn't enabled.  The specific issue was that MM is still
closing serial ports, so if we try to enable too soon we'll
get an error about serial ports being closed.
2012-02-07 23:00:23 -06:00
Dan Williams
d8dd385a67 wifi: fix nl80211 periodic signal reporting to be more frequent
BSS info apparently doesn't get updated that often since it's
based on scan information, so instead use the AP info which updates
with every beacon.  Using the BSS info caused the signal to
be the same value over long periods of time even when moving far
away from the AP.
2012-02-07 10:23:54 -06:00
Thomas Bechtold
49106d8845 core: fix singleton handling in NULL/systemd session monitor 2012-02-07 13:42:18 +01:00
Dan Williams
95b0b72211 core: move device creation into the manager
Consolidate device creation in the manager object; bluetooth and
modem devices were already handled by it, so it makes sense to do
it all from one place.  Furthermore we'll be creating virtual devices
in the manager too.  It also reduces indirection (no need to send
device_creator() in the DEVICE_ADDED signal) and makes the code
flow clearer.
2012-02-05 23:18:32 -06:00
Dan Winship
c79b8085ee ifcfg-rh: belatedly add writer support for infiniband (and tests) 2012-02-02 12:24:03 -06:00
Evan Broder
8b107e9ee8 dns: make caching DNS server config files readable by everyone
All of the information in the configuration files for local caching
dnsmasq or BIND servers are accessible already over the D-Bus
interface, so there's no sensitive information here.
2012-02-02 12:02:11 -06:00
Thomas Bechtold
775ec828b9 core: add device property "StateReason"
Allows clients to retrieve the reason a device changed to
the given state along with the state itself, preventing
race conditions if the state were retrieved separately
from the reason.  Reason codes were not previously
accessible without listening to the StateChanged signal.
2012-02-02 12:02:11 -06:00
Dan Williams
f900522308 build: easier selection of session tracking
Using --with-session-tracking=xxx you can select the backend
you want from among CK, systemd, or none.
2012-02-01 16:50:44 -06:00
Dan Williams
20035ad443 core: add NULL session monitor
Allows all access; used when neither ConsoleKit or systemd are
selected.
2012-02-01 16:50:44 -06:00
Dan Williams
e133405a29 core: combine common session management utility code
And reformat the systemd session manager for NM code style.
2012-02-01 16:50:44 -06:00
Matthias Clasen
3b75a97ab0 core: optionally use systemd for session tracking instead of ConsoleKit
When configured with --enable-systemd, this patch makes
NetworkManager use systemd for session tracking instead
of ConsoleKit.
2012-02-01 15:09:46 -06:00
Jiří Klimeš
b127fda19f supplicant: fix crash when connecting without both 'password' and 'password-raw'
It is the case e.g. for EAP-TLS. This regression was caused by commit
b08e2b8932.
2012-01-30 18:29:13 +01:00
Jiří Klimeš
2c52303f59 supplicant: fix checking config for EAP-FAST authentication
We do not want to break other methods, when EAP-FAST specific error condition
is detected: no PAC file provided and automatic PAC provisioning is disabled.
2012-01-30 18:07:35 +01:00