Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. Re: ofono: cellular service disconnect makes it disappear
      (Andr? Draszik)
   2. Wi-Fi specific information in connman (Saurav Babu)
   3. [PATCH v5 0/8] session: Add per-interface routing (Lukasz Nowak)
   4. [PATCH v5 1/8] session: Fix default route for ppp services
      (Lukasz Nowak)
   5. [PATCH v5 2/8] session: Add AllowedInterface config parameter
      (Lukasz Nowak)


----------------------------------------------------------------------

Message: 1
Date: Fri, 03 Feb 2017 09:13:52 +0000
From: Andr? Draszik <[email protected]>
To: [email protected]
Subject: Re: ofono: cellular service disconnect makes it disappear
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"

On Fri, 2017-02-03 at 07:58 +0100, Daniel Wagner wrote:
> Hi Daryl,
> 
> On 02/02/2017 03:45 PM, Daryl Nebrich wrote:
> > Hi,
> > 
> > I'm using connman tip, ofono 1.18 with a Telit LE920 modem.??I don't
> > see the service go away.??When first connected, the cellular service
> > shows up in connmanctl as *AO or *AR.??After disconnecting it, it's
> > still listed as *A.??I can then reconnect it.
> > 
> > However, I've made a change to src/config.c in connman to auto-connect
> > cellular.??This might explain the different behavior I'm seeing.??Not
> > sure if my change is the right way, but cellular wasn't auto
> > connecting without it, which is what I need.??When searching the old
> > forum messages, I recall seeing discussion of changes in cellular
> > connect behavior.??Not sure of the back story.??I pasted my unofficial
> > local patch below.
> 
> Cellular should also autoconnect if you ask me. So if that snippet below?
> is needed to get it rolling, I suggest to send it as proper patch and I?
> will review it :)

Might be a regression, because cellular autoconnect actually works for meusing 
connman 1.33 

Cheers,
Andre'



------------------------------

Message: 2
Date: Fri, 03 Feb 2017 15:27:08 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected], Saurav Babu <[email protected]>
Subject: Wi-Fi specific information in connman
Message-ID:
        <[email protected]>

Hello Daniel,
Sorry for the late reply, it got lost somewhere.
> On 01/11/2017 02:04 PM, Patrik Flykt wrote:
>> On Wed, 2017-01-11 at 16:43 +0530, Saurav Babu wrote:
>>> There are few applications which require Wi-Fi specific informations
>>> like MAC Address, Frequency/Channel of AP. Is there any specific
>>> reason that these informations are not stored by connman?

> Can you elaborate a bit on your use case? I'd like to understand why you 
> want that information. One thing which comes to my mind is that you want 
> to show it to the user.

For WPS PBC and PIN connection wpa_supplicant allows BSSID to be passed as
argument. If BSSID is passed as argument to WPS Connection and any other device
tries to use PBC then negotiation is rejected by wpa_supplicant.

Currently ConnMan doesn't provide any way to perform channel based scan. It
always performs full channel scan which takes more time compared to single
channel scan. With knowledge of frequency application can decide to trigger
full channel or channel based scan for greater authority in connection
mechanism.

>>> Will you accept patches which provides these specific informations to
>>> applications at upper layer?
>>
>> Let's ping Marcel about this, I suppose.

> You need to do a proper rain dance for summing Marcel, you know that? :)

Thanks,
Saurav


------------------------------

Message: 3
Date: Fri,  3 Feb 2017 10:43:26 +0000
From: Lukasz Nowak <[email protected]>
To: [email protected]
Subject: [PATCH v5 0/8] session: Add per-interface routing
Message-ID: <[email protected]>

From: Lukasz Nowak <[email protected]>

changes from v4:
- replaced "0 == g_strcmp0" with "!g_strcmp0"
- fixed the last compiler warning

changes from v3:
- fixed compiler warnings
- marked new session config fields as experimental

changes from v2:
- implemented source IP rule in firewall-nftables
- using "*" or "" for AllowedInterface allows any interface

changes from v1:
- added documentation
- split firewall and session changes into separate commits
- cosmetic updates after v1 review

Adding a new feature to the sessions, which allows applications to direct
routed traffic to a specific network interface.

This requires that multiple default routes with gateways are set up, one
for each interface. And then iproute and iptables rules need to be added
to direct traffic based on source ip address, to the correct routing table.
Applications can use bind before connect mechanism, to bind sockets to
required interfaces.

The application side can be tested with:
ping -I <interface_ip> <target_ip>

Use case for this is to have multiple network interfaces available for
external traffic at the same time. It can be used to validate that a full
path to an external server is working properly, by maintaining multiple
tcp connections, one for each interface.

Lukasz Nowak (8):
  session: Fix default route for ppp services
  session: Add AllowedInterface config parameter
  client: Add session AllowedInterface config
  firewall: Add fwmark based on source ip address
  session: Add source ip rule
  session: Remove old session rules and routes after a config change
  client: Add session source ip rule
  doc: Session multi-interface routing

 client/commands.c        |  39 ++++++++++++
 doc/session-api.txt      |  23 +++++++
 doc/session-overview.txt |  31 +++++++++
 include/session.h        |   2 +
 src/connman.h            |   3 +-
 src/firewall-iptables.c  |  11 +++-
 src/firewall-nftables.c  | 108 ++++++++++++++++++++++++++-----
 src/session.c            | 163 ++++++++++++++++++++++++++++++++++++++++++++---
 8 files changed, 354 insertions(+), 26 deletions(-)

-- 
2.7.4



------------------------------

Message: 4
Date: Fri,  3 Feb 2017 10:43:27 +0000
From: Lukasz Nowak <[email protected]>
To: [email protected]
Subject: [PATCH v5 1/8] session: Fix default route for ppp services
Message-ID: <[email protected]>

From: Lukasz Nowak <[email protected]>

When a session is connected to a ppp service, ipconfig
will not contain a gateway IP address. Currently setting up
of the session routing table fails, due to
__connman_inet_add_default_to_table returning an error.

In that scenario, INADDR_ANY needs to be used as a gateway.
---
 src/session.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/session.c b/src/session.c
index b1e9e1b..09fc7c3 100644
--- a/src/session.c
+++ b/src/session.c
@@ -351,6 +351,7 @@ static void add_default_route(struct connman_session 
*session)
 {
        struct connman_ipconfig *ipconfig;
        int err;
+       struct in_addr addr = { INADDR_ANY };
 
        if (!session->service)
                return;
@@ -359,6 +360,9 @@ static void add_default_route(struct connman_session 
*session)
        session->index = __connman_ipconfig_get_index(ipconfig);
        session->gateway = g_strdup(__connman_ipconfig_get_gateway(ipconfig));
 
+       if (!session->gateway)
+               session->gateway = g_strdup(inet_ntoa(addr));
+
        DBG("index %d routing table %d default gateway %s",
                session->index, session->mark, session->gateway);
 
-- 
2.7.4



------------------------------

Message: 5
Date: Fri,  3 Feb 2017 10:43:28 +0000
From: Lukasz Nowak <[email protected]>
To: [email protected]
Subject: [PATCH v5 2/8] session: Add AllowedInterface config parameter
Message-ID: <[email protected]>

From: Lukasz Nowak <[email protected]>

In order to be able to bind a session to a specific interface,
AllowedInterface config option has been added. It allows to
bind a session to a service with a specified network interface
name (e.g. eth0).

AllowedInterface is supported through both dbus and session policy.
Policy always overrides dbus.
---
 include/session.h |  1 +
 src/session.c     | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/include/session.h b/include/session.h
index 37dfc4e..e8d7e93 100644
--- a/include/session.h
+++ b/include/session.h
@@ -65,6 +65,7 @@ struct connman_session_config {
        enum connman_session_type type;
        bool ecall;
        GSList *allowed_bearers;
+       char *allowed_interface;
 };
 
 typedef int (* connman_session_config_func_t) (struct connman_session *session,
diff --git a/src/session.c b/src/session.c
index 09fc7c3..24b39e0 100644
--- a/src/session.c
+++ b/src/session.c
@@ -63,6 +63,7 @@ struct connman_session {
        struct connman_service *service_last;
        struct connman_session_config *policy_config;
        GSList *user_allowed_bearers;
+       char *user_allowed_interface;
 
        bool ecall;
 
@@ -467,6 +468,7 @@ static void free_session(struct connman_session *session)
 
        destroy_policy_config(session);
        g_slist_free(session->info->config.allowed_bearers);
+       g_free(session->info->config.allowed_interface);
        g_free(session->owner);
        g_free(session->session_path);
        g_free(session->notify_path);
@@ -505,6 +507,7 @@ static void cleanup_session(gpointer user_data)
        update_session_state(session);
 
        g_slist_free(session->user_allowed_bearers);
+       g_free(session->user_allowed_interface);
 
        free_session(session);
 }
@@ -516,6 +519,7 @@ struct creation_data {
        /* user config */
        enum connman_session_type type;
        GSList *allowed_bearers;
+       char *allowed_interface;
 };
 
 static void cleanup_creation_data(struct creation_data *creation_data)
@@ -527,6 +531,7 @@ static void cleanup_creation_data(struct creation_data 
*creation_data)
                dbus_message_unref(creation_data->pending);
 
        g_slist_free(creation_data->allowed_bearers);
+       g_free(creation_data->allowed_interface);
        g_free(creation_data);
 }
 
@@ -725,6 +730,17 @@ static void apply_policy_on_bearers(GSList 
*policy_bearers, GSList *bearers,
        }
 }
 
+static char * apply_policy_on_interface(const char *policy_interface,
+                               const char *user_interface)
+{
+       if (policy_interface)
+               return g_strdup(policy_interface);
+       else if (user_interface)
+               return g_strdup(user_interface);
+       else
+               return NULL;
+}
+
 const char *connman_session_get_owner(struct connman_session *session)
 {
        return session->owner;
@@ -870,6 +886,17 @@ static void append_notify(DBusMessageIter *dict,
                info_last->config.allowed_bearers = 
info->config.allowed_bearers;
        }
 
+       if (session->append_all ||
+                       info->config.allowed_interface != 
info_last->config.allowed_interface) {
+               char *ifname = info->config.allowed_interface;
+               if (!ifname)
+                       ifname = "*";
+               connman_dbus_dict_append_basic(dict, "AllowedInterface",
+                                               DBUS_TYPE_STRING,
+                                               &ifname);
+               info_last->config.allowed_interface = 
info->config.allowed_interface;
+       }
+
        session->append_all = false;
 }
 
@@ -889,7 +916,8 @@ static bool compute_notifiable_changes(struct 
connman_session *session)
                return true;
 
        if (info->config.allowed_bearers != info_last->config.allowed_bearers ||
-                       info->config.type != info_last->config.type)
+                       info->config.type != info_last->config.type ||
+                       info->config.allowed_interface != 
info_last->config.allowed_interface)
                return true;
 
        return false;
@@ -943,6 +971,7 @@ int connman_session_config_update(struct connman_session 
*session)
 {
        struct session_info *info = session->info;
        GSList *allowed_bearers;
+       char *allowed_interface;
        int err;
 
        DBG("session %p", session);
@@ -968,6 +997,10 @@ int connman_session_config_update(struct connman_session 
*session)
                session->user_allowed_bearers,
                &allowed_bearers);
 
+       allowed_interface = apply_policy_on_interface(
+               session->policy_config->allowed_interface,
+               session->user_allowed_interface);
+
        if (session->active)
                set_active_session(session, false);
 
@@ -977,6 +1010,9 @@ int connman_session_config_update(struct connman_session 
*session)
        g_slist_free(info->config.allowed_bearers);
        info->config.allowed_bearers = allowed_bearers;
 
+       g_free(info->config.allowed_interface);
+       info->config.allowed_interface = allowed_interface;
+
        session_activate(session);
 
        info->config.type = apply_policy_on_type(
@@ -1105,6 +1141,26 @@ static DBusMessage *change_session(DBusConnection *conn,
                        info->config.type = apply_policy_on_type(
                                session->policy_config->type,
                                connman_session_parse_connection_type(val));
+               } else if (g_str_equal(name, "AllowedInterface")) {
+                       dbus_message_iter_get_basic(&value, &val);
+                       if (session->active)
+                               set_active_session(session, false);
+
+                       session->active = false;
+                       session_deactivate(session);
+
+                       g_free(session->user_allowed_interface);
+                       /* empty string means allow any interface */
+                       if (!g_strcmp0(val, ""))
+                               session->user_allowed_interface = NULL;
+                       else
+                               session->user_allowed_interface = g_strdup(val);
+
+                       info->config.allowed_interface = 
apply_policy_on_interface(
+                               session->policy_config->allowed_interface,
+                               session->user_allowed_interface);
+
+                       session_activate(session);
                } else {
                        goto err;
                }
@@ -1238,11 +1294,18 @@ static int session_policy_config_cb(struct 
connman_session *session,
        session->user_allowed_bearers = creation_data->allowed_bearers;
        creation_data->allowed_bearers = NULL;
 
+       session->user_allowed_interface = creation_data->allowed_interface;
+       creation_data->allowed_interface = NULL;
+
        apply_policy_on_bearers(
                        session->policy_config->allowed_bearers,
                        session->user_allowed_bearers,
                        &info->config.allowed_bearers);
 
+       info->config.allowed_interface = apply_policy_on_interface(
+               session->policy_config->allowed_interface,
+               session->user_allowed_interface);
+
        g_hash_table_replace(session_hash, session->session_path, session);
 
        DBG("add %s", session->session_path);
@@ -1267,6 +1330,7 @@ static int session_policy_config_cb(struct 
connman_session *session,
        info_last->config.priority = info->config.priority;
        info_last->config.roaming_policy = info->config.roaming_policy;
        info_last->config.allowed_bearers = info->config.allowed_bearers;
+       info_last->config.allowed_interface = info->config.allowed_interface;
 
        session->append_all = true;
 
@@ -1354,6 +1418,9 @@ int __connman_session_create(DBusMessage *msg)
                                        
connman_session_parse_connection_type(val);
 
                                user_connection_type = true;
+                       } else if (g_str_equal(key, "AllowedInterface")) {
+                               dbus_message_iter_get_basic(&value, &val);
+                               creation_data->allowed_interface = 
g_strdup(val);
                        } else {
                                err = -EINVAL;
                                goto err;
@@ -1553,6 +1620,7 @@ static bool session_match_service(struct connman_session 
*session,
        enum connman_service_type bearer_type;
        enum connman_service_type service_type;
        GSList *list;
+       char *ifname;
 
        if (policy && policy->allowed)
                return policy->allowed(session, service);
@@ -1560,9 +1628,16 @@ static bool session_match_service(struct connman_session 
*session,
        for (list = session->info->config.allowed_bearers; list; list = 
list->next) {
                bearer_type = GPOINTER_TO_INT(list->data);
                service_type = connman_service_get_type(service);
-
-               if (bearer_type == service_type)
-                       return true;
+               ifname = connman_service_get_interface(service);
+
+               if (bearer_type == service_type &&
+                       (session->info->config.allowed_interface == NULL ||
+                       !g_strcmp0(session->info->config.allowed_interface, 
"*") ||
+                       !g_strcmp0(session->info->config.allowed_interface, 
ifname))) {
+                               g_free(ifname);
+                               return true;
+               }
+               g_free(ifname);
        }
 
        return false;
-- 
2.7.4



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 16, Issue 4
**************************************

Reply via email to