Commit f153c997 authored by Lorn Potter's avatar Lorn Potter

Merge commit 'c447d841' into next-1.22

Conflicts:
	connman/include/technology.h
	connman/plugins/ofono.c
	connman/src/agent-connman.c
	connman/src/agent.c
	connman/src/dnsproxy.c
	connman/src/ipconfig.c
	connman/src/main.c
	connman/src/manager.c
	connman/src/nfacct.c
	connman/src/service.c
	connman/src/shared/nfacct.c
	connman/src/shared/nfacct.h
	connman/src/shared/nfnetlink_acct_copy.h
	connman/src/technology.c
	connman/tools/netlink-test.c
parents ffa19f8d c447d841
......@@ -64,3 +64,10 @@ Mateusz Potrola <mateuszx.potrola@intel.com>
Jaehyun Kim <jeik01.kim@samsung.com>
Zhang Zhengguang <zhengguang.zhang@intel.com>
Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Alban Crequy <alban.crequy@collabora.co.uk>
Philippe Coval <philippe.coval@open.eurogiciel.org>
Hannu Mallat <hannu.mallat@jollamobile.com>
Glenn Schmottlach <Glenn.Schmottlach@xs-embedded.com>
Jonathan Liu <net147@gmail.com>
Andrew LeCain <electricalpanel@gmail.com>
Maneesh Jain <maneesh.jain@samsung.com>
ver 1.22:
Fix issue with WPS state synchronization.
Fix issue with DNS servers and default service.
Fix issue with DHCP client and rebooting state.
Add support for NTP exponential backoff handling.
Add support for NTP kiss-of-death packet handling.
Add support for Ethernet gadget networking.
ver 1.21:
Fix issue with WiFi networks and zero SSID length.
Fix issue with security details for hidden WiFi networks.
......
......@@ -43,9 +43,7 @@ gweb_sources += gweb/giognutls.h gweb/gionotls.c
endif
shared_sources = src/shared/util.h src/shared/util.c \
src/shared/netlink.h src/shared/netlink.c \
src/shared/nfacct.h src/shared/nfacct.c \
src/shared/nfnetlink_acct_copy.h
src/shared/netlink.h src/shared/netlink.c
if DATAFILES
......@@ -107,7 +105,7 @@ src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) \
src/session.c src/tethering.c src/wpad.c src/wispr.c \
src/stats.c src/iptables.c src/dnsproxy.c src/6to4.c \
src/ippool.c src/bridge.c src/nat.c src/ipaddress.c \
src/inotify.c src/firewall.c src/nfacct.c src/ipv6pd.c
src/inotify.c src/firewall.c src/ipv6pd.c
src_connmand_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ @GNUTLS_LIBS@ \
......@@ -347,7 +345,7 @@ test_scripts = test/get-state test/list-services \
test/test-counter test/set-ipv4-method test/set-ipv6-method \
test/get-services test/get-proxy-autoconfig test/set-proxy \
test/enable-tethering test/disable-tethering test/backtrace \
test/test-session test/test-supplicant \
test/test-session test/p2p-on-supplicant \
test/test-new-supplicant test/service-move-before \
test/set-global-timeservers test/get-global-timeservers \
test/set-nameservers test/set-domains test/set-timeservers \
......@@ -375,7 +373,8 @@ EXTRA_DIST += doc/overview-api.txt doc/behavior-api.txt \
doc/vpn-manager-api.txt doc/vpn-overview.txt \
doc/session-policy-format.txt
EXTRA_DIST += src/main.conf
EXTRA_DIST += src/main.conf \
src/eduroam.config
MANUAL_PAGES += doc/connman.8 doc/connman.conf.5
......
......@@ -16,6 +16,11 @@ builtin_modules += ethernet
builtin_sources += plugins/ethernet.c
endif
if GADGET
builtin_modules += gadget
builtin_sources += plugins/gadget.c
endif
gsupplicant_sources = gsupplicant/gsupplicant.h gsupplicant/dbus.h \
gsupplicant/supplicant.c gsupplicant/dbus.c
......
......@@ -71,6 +71,14 @@ For a working system, certain configuration options need to be enabled:
enabled. This option can be used to build a small daemon
for a specific system if Ethernet support is not required.
--disable-gadget
Disable support for USB Ethernet Gadget devices
By default USB Ethernet Gadget technology support is built-in and
enabled. This option can be used to build a small daemon
for a specific system if USB Ethernet Gadget support is not required.
--disable-wifi
Disable support for WiFi devices
......@@ -286,6 +294,7 @@ options need to be enabled:
CONFIG_USB_GADGET
CONFIG_USB_ETH
wpa_supplicant configuration
============================
......@@ -310,7 +319,7 @@ CONFIG_AUTOSCAN_EXPONENTIAL=y
This will enable the exact same function as bgscan but while being
disconnected.
It is recommended to use wpa_supplicant 1.x or later.
It is recommended to use wpa_supplicant 2.x or later.
If wpa_supplicant is configured to D-Bus autostart, then ConnMan will
trigger the autostart of wpa_supplicant. However please keep in mind
......@@ -351,6 +360,7 @@ Mailing list:
connman@connman.net
For additional information about the project visit ConnMan web site:
https://01.org/connman
http://www.connman.net
You can report bugs at https://01.org/jira/browse/CM
......@@ -1733,11 +1733,6 @@ static int cmd_session(char *args[], int num, struct connman_option *options)
if (!session_path)
return session_create(TRUE);
if (session_connected == true) {
fprintf(stdout, "Session already connected\n");
return 0;
}
return session_connect();
} else if (!strcmp(command, "disconnect")) {
......@@ -1747,12 +1742,6 @@ static int cmd_session(char *args[], int num, struct connman_option *options)
return 0;
}
if (session_connected == false) {
fprintf(stdout, "Session already "
"disconnected\n");
return 0;
}
return session_disconnect();
} else if (!strcmp(command, "config")) {
if (!session_path) {
......
AC_PREREQ(2.60)
AC_INIT(connman, 1.21)
AC_INIT(connman, 1.22)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS([config.h])
......@@ -208,13 +208,6 @@ if (test -z "${stats_max_file_size}"); then
stats_max_file_size="16 * 8 * 128"
fi
AC_ARG_ENABLE(systemd, AC_HELP_STRING([--enable-systemd],
[enable systemd notify on start]), [
if (test "${enableval}" = "yes"); then
CFLAGS="$CFLAGS -DSYSTEMD -lsystemd-daemon"
fi
])
AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
......@@ -298,6 +291,11 @@ AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
[enable_ethernet=${enableval}])
AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
AC_ARG_ENABLE(gadget, AC_HELP_STRING([--disable-gadget],
[disable USB Gadget support]),
[enable_gadget=${enableval}])
AM_CONDITIONAL(GADGET, test "${enable_gadget}" != "no")
AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
[disable WiFi support]),
[enable_wifi=${enableval}])
......@@ -393,4 +391,4 @@ AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
AC_OUTPUT(Makefile include/version.h src/connman.service
vpn/connman-vpn.service vpn/net.connman.vpn.service
scripts/connman connman.pc)
scripts/connman connman.pc src/net.connman.service)
......@@ -91,18 +91,17 @@ The following options are valid if Type is "wifi"
then AP is not hidden.
Example
=======
Examples
========
This is a configuration file for a network providing EAP-TLS, EAP-TTLS and
EAP-PEAP services.
The respective SSIDs are tls_ssid, ttls_ssid and peap_ssid and the file name
is example.config.
EAP-PEAP services. The respective SSIDs are tls_ssid, ttls_ssid and peap_ssid
and the file name is example.config.
Please note that the SSID entry is for hexadecimal encoded SSID (e.g. "SSID =
746c735f73736964"). If your SSID does not contain any exotic character then
you should use the Name entry instead (e.g. "Name = tls_ssid").
example@example:[~]$ cat /var/lib/connman/example.config
[global]
Name = Example
......
......@@ -91,7 +91,7 @@ List of blacklisted network interfaces separated by ",".
Found interfaces will be compared to the list and will
not be handled by connman, if their first characters
match any of the list entries. Default value is
vmnet,vboxnet,virbr.
vmnet,vboxnet,virbr,ifb.
.TP
.B AllowHostnameUpdates=\fPtrue|false\fP
Allow connman to change the system hostname. This can
......
......@@ -39,6 +39,13 @@ Methods dict GetProperties()
Possible Errors: [service].Error.InvalidArguments
array{object,dict} GetPeers() [experimental]
Returns a sorted list of tuples with peer object path
and dictionary of peer properties
Possible Errors: [peer].Error.InvalidArguments
object ConnectProvider(dict provider) [deprecated]
Connect to a VPN specified by the given provider
......@@ -186,6 +193,28 @@ Signals TechnologyAdded(object path, dict properties)
required to watch the PropertyChanged signal of
the service object.
PeersChanged(array{object, dict}) [experimental]
Signals a list of peers that have been changed via the
first array. And a list of peer that have been removed
via the second array.
The list of changed peers is sorted. The dictionary
with the properties might be empty in case none of the
properties have changed. Or only contains the
properties that have changed.
For newly added peers the whole set of properties will
be present.
The list of removed peers can be empty.
This signal will only be triggered when the sort order
of the peer list or the number of peers changes. It
will not be emitted if only a property of the peer
object changes. For that it is required to watch the
PropertyChanged signal of the peer object.
PropertyChanged(string name, variant value)
This signal indicates a changed value of the given
......
Peer hierarchy [EXPERIMENTAL]
=============================
Service net.connman
Interface net.connman.Peer
Object path [variable prefix]/{peer0,peer1,...}
Methods void Connect() [experimental]
Connect this peer.
This method call will only return in case of an error
or when the peer is fully connected. So setting a
longer D-Bus timeout might be a really good idea.
Possible Errors: [service].Error.InvalidArguments
void Disconnect() [experimental]
Disconnect this peer. If the peer is not connected, an
error message will be generated.
Possible Errors: [service].Error.InvalidArguments
Signals PropertyChanged(string name, variant value) [experimental]
This signal indicates a changed value of the given
property.
Properties string State [readonly] [experimental]
The peer state information.
Valid state are "idle", "failure", "association",
"configuration", "ready" and "disconnect".
string Name [readonly] [experimental]
Name of the peer.
dict IPv4 [readonly] [experimental]
string Address [readonly]
The current configured IPv4 address.
string Netmask [readonly]
The current configured IPv4 netmask.
......@@ -5,56 +5,14 @@ Session API
Connection management algorithm basics
======================================
When a session is created, a sorted list of services is added to the
session. The services are filtered and sorted according AllowedBearers.
There are two triggers which lead to evaluate the connect
algorithm:
- Session.Connect()
- Offline
Connect algorithm:
Session.Connect()
|
+------+-------+
+-----+ECall Session ?+-----+
Yes| +--------------+ |No
| |
Connect to +--------------+
first available +---+AvoidHandover?+---+
Service | +--------------+ |
Yes| |No
+----------------+ |
+---+In service_list +---+ |
Yes| |and online? | |No |
| +----------------+ | |
| | |
Take that one Take first in
the service list
and try to connect
Disconnect algorithm
- Session.Disconnect()
Disconnect algorithm:
Session.Disconnect()
|
+--- Session.Change()
|
+-----------------+ Yes
|service not used +-------------+
|by other session?| |
+------.----------+ |
|No |
| |
Service.Disconnect() Do nothing
Session.Disconnect() will be blocked whenever a ongoing
emergency call is active.
The Session core uses the normal auto-connect algorithm for selecting
which services will be connected or disconnected. That means only
Services with AutoConnect to set to true will be used. The Session
core will assign a connected Service to a Session if the Service
is matching the AllowedBearer filter.
By using the normal auto-connect algorithm, it is possible to
use the Session API and the Service API at the same time.
Session States and Transitions
......@@ -110,36 +68,27 @@ match the policy to a session.
See session-policy-format.txt for more details.
Per application routing and statistics
======================================
For each session a policy routing table is maintained. Each
policy routing table contains a default route to the
selected service.
Per application routing
=======================
Furthermore a few iptables rules inserted into the kernel to gather
statistics via NFACCT.
For each session a policy routing table is maintained. Each policy
routing table contains a default route to the selected service.
Per session iptables rules:
iptables -t mangle -A OUTPUT -m owner [--uid-owner|--gid-owner] $OWNER \
-j MARK --set-mark $MARK
iptables -t filter -A INPUT -m mark --mark $MARK \
-m nfacct --nfacct-name session-input-$MARK
iptables -t filter -A OUTPUT -m mark --mark $MARK \
-m nfacct --nfacct-name session-output-$MARK
Global rules for all sessions:
iptables -t mangle -A INPUT -j CONNMARK --restore-mark
iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark
Per application routing and statistics is only available when policy
files are used. Without the policy plugin or a valid configuration,
the default session configuration is applied.
Per application routing is only available when policy files are
used. Without the policy plugin or a valid configuration, the default
session configuration is applied.
The default session configuration does not enable the per application
routing and statistics. Sessions are still useful in this setup,
because the notification of sessions is still available, e.g. the
online/offline notification.
routing. Sessions are still useful in this setup, because the
notification of sessions is still available, e.g. the online/offline
notification.
......@@ -36,6 +36,10 @@ Methods dict GetProperties() [deprecated]
Results will be signaled via the ServicesChanged
signal from the manager interface.
In case of P2P technology, results will be signaled
via the PeersChanged signal from the manager
interface.
Signals PropertyChanged(string name, variant value)
This signal indicates a changed value of the given
......
......@@ -56,6 +56,8 @@ struct GDBusClient {
void *signal_data;
GDBusProxyFunction proxy_added;
GDBusProxyFunction proxy_removed;
GDBusClientFunction ready;
void *ready_data;
GDBusPropertyFunction property_changed;
void *user_data;
GList *proxy_list;
......@@ -982,6 +984,9 @@ static void parse_managed_objects(GDBusClient *client, DBusMessage *msg)
dbus_message_iter_next(&dict);
}
if (client->ready)
client->ready(client, client->ready_data);
}
static void get_managed_objects_reply(DBusPendingCall *call, void *user_data)
......@@ -1243,6 +1248,18 @@ gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
return TRUE;
}
gboolean g_dbus_client_set_ready_watch(GDBusClient *client,
GDBusClientFunction ready, void *user_data)
{
if (client == NULL)
return FALSE;
client->ready = ready;
client->ready_data = user_data;
return TRUE;
}
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
GDBusProxyFunction proxy_added,
GDBusProxyFunction proxy_removed,
......
......@@ -337,6 +337,7 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
GDBusReturnFunction function, void *user_data,
GDBusDestroyFunction destroy);
typedef void (* GDBusClientFunction) (GDBusClient *client, void *user_data);
typedef void (* GDBusProxyFunction) (GDBusProxy *proxy, void *user_data);
typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
DBusMessageIter *iter, void *user_data);
......@@ -359,7 +360,8 @@ gboolean g_dbus_client_set_disconnect_watch(GDBusClient *client,
GDBusWatchFunction function, void *user_data);
gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
GDBusMessageFunction function, void *user_data);
gboolean g_dbus_client_set_ready_watch(GDBusClient *client,
GDBusClientFunction ready, void *user_data);
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
GDBusProxyFunction proxy_added,
GDBusProxyFunction proxy_removed,
......
......@@ -30,8 +30,6 @@
#include "gdbus.h"
#define DISPATCH_TIMEOUT 0
#define info(fmt...)
#define error(fmt...)
#define debug(fmt...)
......@@ -70,8 +68,6 @@ static gboolean message_dispatch(void *data)
{
DBusConnection *conn = data;
dbus_connection_ref(conn);
/* Dispatch messages */
while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
......@@ -84,7 +80,7 @@ static inline void queue_dispatch(DBusConnection *conn,
DBusDispatchStatus status)
{
if (status == DBUS_DISPATCH_DATA_REMAINS)
g_timeout_add(DISPATCH_TIMEOUT, message_dispatch, conn);
g_idle_add(message_dispatch, dbus_connection_ref(conn));
}
static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
......@@ -92,9 +88,6 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
struct watch_info *info = data;
unsigned int flags = 0;
DBusDispatchStatus status;
DBusConnection *conn;
conn = dbus_connection_ref(info->conn);
if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;
if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;
......@@ -103,10 +96,8 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
dbus_watch_handle(info->watch, flags);
status = dbus_connection_get_dispatch_status(conn);
queue_dispatch(conn, status);
dbus_connection_unref(conn);
status = dbus_connection_get_dispatch_status(info->conn);
queue_dispatch(info->conn, status);
return TRUE;
}
......
......@@ -1253,6 +1253,8 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
if (!dbus_connection_register_object_path(connection, path,
&generic_table, data)) {
dbus_connection_unref(data->conn);
g_free(data->path);
g_free(data->introspect);
g_free(data);
return NULL;
......
This diff is collapsed.
......@@ -2278,7 +2278,7 @@ static void signal_wps_event(const char *path, DBusMessageIter *iter)
if (g_strcmp0(name, "success") == 0)
interface->wps_state = G_SUPPLICANT_WPS_STATE_SUCCESS;
else if (g_strcmp0(name, "failed") == 0)
else if (g_strcmp0(name, "fail") == 0)
interface->wps_state = G_SUPPLICANT_WPS_STATE_FAIL;
else
interface->wps_state = G_SUPPLICANT_WPS_STATE_UNKNOWN;
......
......@@ -46,6 +46,7 @@ enum connman_network_type {
CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
CONNMAN_NETWORK_TYPE_CELLULAR = 10,
CONNMAN_NETWORK_TYPE_GADGET = 11,
CONNMAN_NETWORK_TYPE_VENDOR = 10000,
};
......
......@@ -87,11 +87,17 @@ enum connman_service_proxy_method {
CONNMAN_SERVICE_PROXY_METHOD_AUTO = 3,
};
enum connman_service_connect_reason {
CONNMAN_SERVICE_CONNECT_REASON_NONE = 0,
CONNMAN_SERVICE_CONNECT_REASON_AUTO = 1,
CONNMAN_SERVICE_CONNECT_REASON_USER = 2,
CONNMAN_SERVICE_CONNECT_REASON_SESSION = 3,
};
struct connman_service;
struct connman_network;
struct connman_service *connman_service_create(void);
int connman_service_remove(const char *identifier);
#define connman_service_ref(service) \
connman_service_ref_debug(service, __FILE__, __LINE__, __func__)
......
......@@ -74,10 +74,12 @@ typedef int (* connman_session_config_func_t) (struct connman_session *session,
struct connman_session_policy {
const char *name;
int priority;
bool (*autoconnect)(enum connman_service_connect_reason reason);
int (*create)(struct connman_session *session,
connman_session_config_func_t cb,
void *user_data);
void (*destroy)(struct connman_session *session);
};
int connman_session_policy_register(struct connman_session_policy *config);
......
......@@ -29,9 +29,6 @@ extern "C" {
#endif
bool connman_setting_get_bool(const char *key);
#define CONF_STATUS_URL_IPV6 "Ipv6StatusUrl"
#define CONF_STATUS_URL_IPV4 "Ipv4StatusUrl"
char **connman_setting_get_string_list(const char *key);
unsigned int *connman_setting_get_uint_list(const char *key);
......
This diff is collapsed.
/*
*
* Connection Manager
*
* Copyright (C) 2007-2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <net/if.h>
#ifndef IFF_LOWER_UP
#define IFF_LOWER_UP 0x10000
#endif
#include <glib.h>
#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <connman/technology.h>
#include <connman/plugin.h>
#include <connman/device.h>
#include <connman/rtnl.h>
#include <connman/inet.h>
#include <connman/log.h>
static bool gadget_tethering = false;
struct gadget_data {
int index;
unsigned flags;
unsigned int watch;
struct connman_network *network;
};
static int gadget_network_probe(struct connman_network *network)
{
DBG("network %p", network);
return 0;
}
static void gadget_network_remove(struct connman_network *network)
{
DBG("network %p", network);
}
static int gadget_network_connect(struct connman_network *network)
{
DBG("network %p", network);
connman_network_set_connected(network, true);
return 0;
}
static int gadget_network_disconnect(struct connman_network *network)
{
DBG("network %p", network);
connman_network_set_connected(network, false);
return 0;
}
static struct connman_network_driver gadget_network_driver = {
.name = "usb",
.type = CONNMAN_NETWORK_TYPE_GADGET,
.probe = gadget_network_probe,
.remove = gadget_network_remove,
.connect = gadget_network_connect,
.disconnect = gadget_network_disconnect,
};
static void add_network(struct connman_device *device,
struct gadget_data *gadget)
{
struct connman_network *network;
int index;
network = connman_network_create("gadget",
CONNMAN_NETWORK_TYPE_GADGET);
if (!network)
return;
index = connman_device_get_index(device);
connman_network_set_index(network, index);
connman_network_set_name(network, "Wired");
if (connman_device_add_network(device, network) < 0) {
connman_network_unref(network);
return;
}
if (!gadget_tethering)
/*
* Prevent service from starting the reconnect
* procedure as we do not want the DHCP client
* to run when tethering.
*/
connman_network_set_group(network, "usb");
gadget->network = network;
}
static void remove_network(struct connman_device *device,
struct gadget_data *gadget)
{
if (!gadget->network)
return;
connman_device_remove_network(device, gadget->network);
connman_network_unref(gadget->network);
gadget->network = NULL;
}