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: disconnect_code == 1 from wpa_s results in wrong state in
      wifi tech (Daniel Wagner)
   2. [PATCH] gsupplicant: Switch to different BSSID of same SSID
      in case of signal bss removed (Rahul Jain)
   3. [PATCH 1/1] service: Sanitize hostname and domainname
      (Henrik Persson)


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

Message: 1
Date: Fri, 15 Mar 2019 09:22:23 +0100
From: Daniel Wagner <[email protected]>
To: Henrik Persson <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: disconnect_code == 1 from wpa_s results in wrong state in
        wifi tech
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Hi Henrik,

> > The patch applied, I'll test it and see if it improves things. That
> > disconnect reason doesn't happen very often though, so might take a
> > while.. It doesn't seem to break anything in the happy-flow-case so
> > that's a good start. :)
> 
> I've attached a log of when I forced reason=1 to disconnect, and 
> verified that technology/wifi/ seems to have switched state properly and 
> from the looks of everything in the log everything else seems to work as 
> it should (agent gets notified about error, etc). So I think that patch 
> would be nice to have on HEAD. :)

Patch applied. Thanks a lot for reporting and testing!

Cheers,
Daniel


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

Message: 2
Date: Fri, 15 Mar 2019 15:05:21 +0530
From: Rahul Jain <[email protected]>
To: "[email protected]" <[email protected]>
Cc: AMIT KUMAR JAISWAL <[email protected]>
Subject: [PATCH] gsupplicant: Switch to different BSSID of same SSID
        in case of signal bss removed
Message-ID:
        <20190315093521epcms5p3ec669acc8fde6cb9495bcc85c123de98@epcms5p3>
Content-Type: text/plain; charset="utf-8"

[PATCH]?gsupplicant:?Switch?to?different?BSSID?of?same?SSID?in?case?of?
signal?bss?removed
?
[Cause]?2?AP?(same?name?&?security)?was?used?in?testing,?2.4?Ghz?and?5Ghz.
TV?was?connected?with?2.4?Ghz?AP.?Now?Tester?switch?off(soft)?that
AP?from?router?webpage.Now?supplicant?send?bss_removed?signal?to
connman?for?that?AP?and?tester?switch?on?5GHz?AP?from?router?page.
But?within?few?time,?supplicant?again?send?bss_removed?signal?to
connman(as?AP?was?switch?of?from?router?web?page),?so?took?few?time
to?go?down.?When?connman?get?bss_added?signal?for?2.4?AP,?then?make
addNetwork?connection?request?to?supplicant,?but?that?time,?2.4?AP
was?already?switched?off.So?supplicant?keeps?to?trying?to?find?that
AP.?Meanwhile?supplicant?sent?bss_added?signal?for?5Ghz?AP?as?that
was?switched?on.?Now?in?connman?under?same?AP?2?BSSID?is?there.?After
few?retry?&?time?(~10?milisecond)?during?connection?retry?with?2.4,
when?supplicant?did?not?found?that?2.4?AP,?then?send?bss_removed?signal
to?connman?and?connman?remove?that?bSS?from?g_supplicant?network?hash
table.?After?120?sec?connman?connect_timeout?hit?and?connection?with
2.4?AP?disconnected.?Now?connman?again?try?connection?with?2.4?AP?and
send?addNetwork?for?2.4?though?supplicant?send?bss_removed.?This?is?an
issue,?whereas?connman?should?try?connection?with?5ghz?there.
?
[Solution]
After?few?retry?&?time?(~10?milisecond)?during?connection?retry?with
2.4,?when?supplicant?did?not?found?that?2.4?AP,?then?supplicant
send?bss_removed?signal?to?connman?and?connman?remove?that?bSS?from
g_supplicant?network?hash?table?and?should?update?next?available?BSS
i.e.?5Ghz?as?best_bss?and?notify?wifi.c:network_change,?so?that
same?will?be?upated?in?connman_network.
So?when?next?request?for?addNetwork?will?go?to?supplicant?that?will?be?for
5Ghz.
?
---
?gsupplicant/supplicant.c?|?6?++++++
?1?file?changed,?6?insertions(+)
?
diff?--git?a/gsupplicant/supplicant.c?b/gsupplicant/supplicant.c
index?da8c52e..623e424?100644
---?a/gsupplicant/supplicant.c
+++?b/gsupplicant/supplicant.c
@@?-2206,6?+2206,7?@@?static?void?interface_bss_removed(DBusMessageIter?*iter,?void?*user_data)
?????????GSupplicantNetwork?*network;
?????????struct?g_supplicant_bss?*bss?=?NULL;
?????????const?char?*path?=?NULL;
+????????bool?isCurrentNetworkBss=false;
?
?????????dbus_message_iter_get_basic(iter,?&path);
?????????if?(!path)
@@?-2219,6?+2220,7?@@?static?void?interface_bss_removed(DBusMessageIter?*iter,?void?*user_data)
?????????if?(network->best_bss?==?bss)?{
?????????????????network->best_bss?=?NULL;
?????????????????network->signal?=?BSS_UNKNOWN_STRENGTH;
+????????????????isCurrentNetworkBss=true;
?????????}
?
?????????g_hash_table_remove(bss_mapping,?path);
@@?-2230,6?+2232,10?@@?static?void?interface_bss_removed(DBusMessageIter?*iter,?void?*user_data)
?
?????????if?(g_hash_table_size(network->bss_table)?==?0)
?????????????????g_hash_table_remove(interface->network_table,?network->group);
+????????else?{
+?????????????????if(isCurrentNetworkBss?&&?network->best_bss)
+????????????????????????callback_network_changed(network,?"");
+????????}
?}
?
?static?void?set_config_methods(DBusMessageIter?*iter,?void?*user_data)
--?
2.7.4
?
?


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

Message: 3
Date: Fri, 15 Mar 2019 13:57:10 +0000
From: Henrik Persson <[email protected]>
To: "[email protected]" <[email protected]>
Cc: Konrad Beckmann <[email protected]>
Subject: [PATCH 1/1] service: Sanitize hostname and domainname
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

From: Henrik Persson <[email protected]>

If a DHCP ACK is received with non-UTF-8 data set as hostname or 
domain-name option connman will crash on a D-Bus assert. This patch 
sanitizes data in service.c and only allows ASCII characters (since they 
shouldn't be anything else) for __connman_service_set_hostname() and 
__connman_service_set_domainname().

This scapy script will trigger the crash:

$ cat dhcp-poc.py
from scapy.all import DHCP_am
from scapy.base_classes import Net
dhcp_server = DHCP_am(iface='eth1', domain='\xff\xff\xff\xff',
pool=Net('192.168.10.0/24'),
network='192.168.10.0/24',
gw='192.168.10.254',
renewal_time=600, lease_time=3600)
dhcp_server()

producing a backtrace along the lines of (for 1.35, but have verified on 
later versions as well):

#0  __libc_do_syscall () at 
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
#1  0x76c8b0a4 in __libc_signal_restore_set (set=0x7ea82c60) at 
/usr/src/debug/glibc/2.26-r0/git/sysdeps/unix/sysv/linux/nptl-signals.h:80
#2  __GI_raise (sig=sig@entry=6) at 
/usr/src/debug/glibc/2.26-r0/git/sysdeps/unix/sysv/linux/raise.c:48
#3  0x76c8bcce in __GI_abort () at 
/usr/src/debug/glibc/2.26-r0/git/stdlib/abort.c:90
#4  0x76ed83d4 in _dbus_abort () at 
/usr/src/debug/dbus/1.10.20-r0/dbus-1.10.20/dbus/dbus-sysdeps.c:91
#5  0x76ed270a in _dbus_warn_check_failed (
     format=0x76ede0ac "arguments to %s() were incorrect, assertion 
\"%s\" failed in file %s line %d.\nThis is normally a bug in some 
application using the D-Bus library.\n")
     at 
/usr/src/debug/dbus/1.10.20-r0/dbus-1.10.20/dbus/dbus-internals.c:275
#6  0x76ec8636 in dbus_message_iter_append_basic (iter=<optimized out>, 
type=115, value=0x1ee6d40) at 
/usr/src/debug/dbus/1.10.20-r0/dbus-1.10.20/dbus/dbus-message.c:2753
#7  0x005274d4 in connman_dbus_property_append_array 
(iter=iter@entry=0x7ea82fa4, key=<optimized out>, key@entry=0x54a8f8 
"Domains", type=type@entry=115,
     function=function@entry=0x50b2b5 <append_domain>, 
user_data=user_data@entry=0x1ee6cd0) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/src/dbus.c:224
#8  0x00527654 in connman_dbus_property_changed_array (path=<optimized 
out>, interface=<optimized out>, key=0x54a8f8 "Domains", 
type=type@entry=115, function=0x50b2b5 <append_domain>,
     user_data=user_data@entry=0x1ee6cd0) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/src/dbus.c:291
#9  0x0050b3de in domain_changed (service=0x1ee6cd0) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/src/service.c:2040
#10 0x0051f6c2 in apply_lease_available_on_network (dhcp=0x1ef7d40, 
dhcp_client=0x1eeab80) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/src/dhcp.c:368
#11 lease_available_cb (dhcp_client=0x1eeab80, user_data=0x1ef7d40) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/src/dhcp.c:515
#12 0x004e9a24 in listener_event (channel=<optimized out>, 
condition=<optimized out>, user_data=<optimized out>) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/gdhcp/client.c:2422
#13 0x76f29508 in g_main_dispatch (context=0x1ed4b90) at 
/usr/src/debug/glib-2.0/1_2.52.3-r0/glib-2.52.3/glib/gmain.c:3234
#14 g_main_context_dispatch (context=context@entry=0x1ed4b90) at 
/usr/src/debug/glib-2.0/1_2.52.3-r0/glib-2.52.3/glib/gmain.c:3899
#15 0x76f29798 in g_main_context_iterate (context=0x1ed4b90, 
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
     at /usr/src/debug/glib-2.0/1_2.52.3-r0/glib-2.52.3/glib/gmain.c:3972
#16 0x76f29a1a in g_main_loop_run (loop=0x1eba1e8) at 
/usr/src/debug/glib-2.0/1_2.52.3-r0/glib-2.52.3/glib/gmain.c:4168
#17 0x004e7a90 in main (argc=<optimized out>, argv=<optimized out>) at 
/usr/src/debug/connman/1.35-r0/connman-1.35/src/main.c:780

---
diff --git a/src/service.c b/src/service.c
index f6fe81bf..42b5449a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2637,7 +2637,11 @@ void __connman_service_set_hostname(struct 
connman_service *service,
                return;

        g_free(service->hostname);
-       service->hostname = g_strdup(hostname);
+
+       if (g_str_is_ascii(hostname))
+               service->hostname = g_strdup(hostname);
+       else
+               service->hostname = NULL;
  }

  const char *__connman_service_get_hostname(struct connman_service 
*service)
@@ -2655,7 +2659,11 @@ void __connman_service_set_domainname(struct 
connman_service *service,
                return;

        g_free(service->domainname);
-       service->domainname = g_strdup(domainname);
+
+       if (g_str_is_ascii(domainname))
+               service->domainname = g_strdup(domainname);
+       else
+               service->domainname = NULL;

        domain_changed(service);
  }

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

Subject: Digest Footer

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


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

End of connman Digest, Vol 41, Issue 17
***************************************

Reply via email to