Send connman mailing list submissions to connman@lists.01.org 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 connman-requ...@lists.01.org
You can reach the person managing the list at connman-ow...@lists.01.org When replying, please edit your Subject line so it is more specific than "Re: Contents of connman digest..." Today's Topics: 1. [PATCH 5/6] gsupplicant: Add handling of StaAuthorized and StaDeauthorized signals (Vasyl Vavrychuk) 2. [PATCH 6/6] wifi: Register/unregister tethering clients based on notification (Vasyl Vavrychuk) 3. Re: Configuration file issues (Daniel Wagner) 4. Re: Wifi connection make tether interface disappear (USB Gadget) (Daniel Wagner) 5. Re: [PATCH] Force simple wifi scan over dbus Scan (Daniel Wagner) 6. Re: [PATCH] Force simple wifi scan over dbus Scan (Daniel Wagner) ---------------------------------------------------------------------- Message: 1 Date: Fri, 23 Nov 2018 01:36:31 +0200 From: Vasyl Vavrychuk <vasyl.vavryc...@globallogic.com> To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org>, Vasyl Vavrychuk <vasyl.vavryc...@globallogic.com> Subject: [PATCH 5/6] gsupplicant: Add handling of StaAuthorized and StaDeauthorized signals Message-ID: <20181122233632.5292-5-vasyl.vavryc...@globallogic.com> Callback this notifications to wifi plugin which can use them to store list of tethering clients. --- gsupplicant/gsupplicant.h | 4 +++ gsupplicant/supplicant.c | 62 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index db61595b..bfb52db7 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -352,6 +352,10 @@ struct _GSupplicantCallbacks { void (*network_changed) (GSupplicantNetwork *network, const char *property); void (*network_associated) (GSupplicantNetwork *network); + void (*sta_authorized) (GSupplicantInterface *interface, + const char *addr); + void (*sta_deauthorized) (GSupplicantInterface *interface, + const char *addr); void (*peer_found) (GSupplicantPeer *peer); void (*peer_lost) (GSupplicantPeer *peer); void (*peer_changed) (GSupplicantPeer *peer, diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 0cb621b9..be2deaa5 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -614,6 +614,30 @@ static void callback_network_associated(GSupplicantNetwork *network) callbacks_pointer->network_associated(network); } +static void callback_sta_authorized(GSupplicantInterface *interface, + const char *addr) +{ + if (!callbacks_pointer) + return; + + if (!callbacks_pointer->sta_authorized) + return; + + callbacks_pointer->sta_authorized(interface, addr); +} + +static void callback_sta_deauthorized(GSupplicantInterface *interface, + const char *addr) +{ + if (!callbacks_pointer) + return; + + if (!callbacks_pointer->sta_deauthorized) + return; + + callbacks_pointer->sta_deauthorized(interface, addr); +} + static void callback_peer_found(GSupplicantPeer *peer) { if (!callbacks_pointer) @@ -2731,6 +2755,42 @@ static void signal_network_removed(const char *path, DBusMessageIter *iter) interface_network_removed(iter, interface); } +static void signal_sta_authorized(const char *path, DBusMessageIter *iter) +{ + GSupplicantInterface *interface; + const char *addr = NULL; + + SUPPLICANT_DBG(""); + + interface = g_hash_table_lookup(interface_table, path); + if (!interface) + return; + + dbus_message_iter_get_basic(iter, &addr); + if (!addr) + return; + + callback_sta_authorized(interface, addr); +} + +static void signal_sta_deauthorized(const char *path, DBusMessageIter *iter) +{ + GSupplicantInterface *interface; + const char *addr = NULL; + + SUPPLICANT_DBG(""); + + interface = g_hash_table_lookup(interface_table, path); + if (!interface) + return; + + dbus_message_iter_get_basic(iter, &addr); + if (!addr) + return; + + callback_sta_deauthorized(interface, addr); +} + static void signal_bss_changed(const char *path, DBusMessageIter *iter) { GSupplicantInterface *interface; @@ -3505,6 +3565,8 @@ static struct { { SUPPLICANT_INTERFACE ".Interface", "BSSRemoved", signal_bss_removed }, { SUPPLICANT_INTERFACE ".Interface", "NetworkAdded", signal_network_added }, { SUPPLICANT_INTERFACE ".Interface", "NetworkRemoved", signal_network_removed }, + { SUPPLICANT_INTERFACE ".Interface", "StaAuthorized", signal_sta_authorized }, + { SUPPLICANT_INTERFACE ".Interface", "StaDeauthorized", signal_sta_deauthorized }, { SUPPLICANT_INTERFACE ".BSS", "PropertiesChanged", signal_bss_changed }, -- 2.19.1 ------------------------------ Message: 2 Date: Fri, 23 Nov 2018 01:36:32 +0200 From: Vasyl Vavrychuk <vasyl.vavryc...@globallogic.com> To: connman@lists.01.org Cc: Daniel Wagner <w...@monom.org>, Vasyl Vavrychuk <vasyl.vavryc...@globallogic.com> Subject: [PATCH 6/6] wifi: Register/unregister tethering clients based on notification Message-ID: <20181122233632.5292-6-vasyl.vavryc...@globallogic.com> Upon getting StaAuthorized/StaDeauthorized notification from gsupplicant register/unregister client in tethering module. This is used to track list of tethering clients by connman client. --- plugins/wifi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/plugins/wifi.c b/plugins/wifi.c index e437daeb..6fa20312 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -55,6 +55,7 @@ #include <connman/provision.h> #include <connman/utsname.h> #include <connman/machine.h> +#include <connman/tethering.h> #include <gsupplicant/gsupplicant.h> @@ -2985,6 +2986,32 @@ static void network_associated(GSupplicantNetwork *network) interface_state(interface); } +static void sta_authorized(GSupplicantInterface *interface, + const char *addr) +{ + struct wifi_data *wifi = g_supplicant_interface_get_data(interface); + + DBG("wifi %p station %s authorized", wifi, addr); + + if (!wifi || !wifi->tethering) + return; + + __connman_tethering_client_register(addr); +} + +static void sta_deauthorized(GSupplicantInterface *interface, + const char *addr) +{ + struct wifi_data *wifi = g_supplicant_interface_get_data(interface); + + DBG("wifi %p station %s deauthorized", wifi, addr); + + if (!wifi || !wifi->tethering) + return; + + __connman_tethering_client_unregister(addr); +} + static void apply_peer_services(GSupplicantPeer *peer, struct connman_peer *connman_peer) { @@ -3205,6 +3232,8 @@ static const GSupplicantCallbacks callbacks = { .network_removed = network_removed, .network_changed = network_changed, .network_associated = network_associated, + .sta_authorized = sta_authorized, + .sta_deauthorized = sta_deauthorized, .peer_found = peer_found, .peer_lost = peer_lost, .peer_changed = peer_changed, -- 2.19.1 ------------------------------ Message: 3 Date: Fri, 23 Nov 2018 05:30:56 +0100 From: Daniel Wagner <w...@monom.org> To: Nuno Gon?alves <nuno...@gmail.com> Cc: connman@lists.01.org Subject: Re: Configuration file issues Message-ID: <a6d04938-aa2d-4f0a-0a13-94371e78b...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed Hi Nuno, On 04.11.18 12:04, Nuno Gon?alves wrote: > Hi, > > I've noticed 2 issues in the handling of the configuration file on > Connman 1.36. > > I have 2 ethernet devices at this device. I have not applied any > configuration so they default to DHCP on IPv4. Immutable is False for > both as expected. > > I create a configuration file without a MAC address specified: > > $ cat /var/lib/connman/010203040506.config > [service_config] > Type = ethernet > IPv4 = 192.168.1.107/255.255.255.0/192.168.1.1 > <http://192.168.1.107/255.255.255.0/192.168.1.1> > > After I commit this file both ethernet interfaces get the address > 192.168.1.107 and they both display Immutable=True. > > This could actually be expected, since I do not specify to which > interface I want my configuration to apply. But documentation says: > > - MAC: MAC address of the interface where this setting should be applied. > The MAC address is optional and if it is missing, then the first found > interface is used. > > So according to this the configuration should only apply to once interface. ConnMan does not keep track of which config has been applied already. If a Service matches a config it will be used. The current behavior has also the upside we don't have a random outcome which service will be considered when a config matches (the ordering of the interfaces might not be stable). So I tend to say the code is doing the right thing at this moment and the documentation is wrong. > The second issue happens when I remove /var/lib/connman/010203040506.config, > > Connman at this time does not reset the interfaces to the default > configuration and instead they become unconfigured: > > $ connmanctl services ethernet_(...1...)_cable > ... > ? State = idle > ? Favorite = True > ? Immutable = False > ? AutoConnect = True > ... > ? IPv4 = [? ] > ? IPv4.Configuration = [? ] > ... > $ connmanctl services ethernet_(...2...)_cable > ... > ? State = idle > ? Favorite = True > ? Immutable = False > ? AutoConnect = True > ... > ? IPv4 = [? ] > ? IPv4.Configuration = [? ] What you mean with default configuration? I seem to miss the important thing in you listing :) Thanks, Daniel ------------------------------ Message: 4 Date: Fri, 23 Nov 2018 05:48:33 +0100 From: Daniel Wagner <w...@monom.org> To: Lao Hu <hula...@gmail.com> Cc: connman@lists.01.org Subject: Re: Wifi connection make tether interface disappear (USB Gadget) Message-ID: <401932d3-bb5a-2b53-6d1d-7ff9bb903...@monom.org> Content-Type: text/plain; charset=utf-8; format=flowed Hi, On 11/8/18 6:21 AM, Lao Hu wrote: > Hello, > An embedded device with ethernet, usb-otg and wifi is running connman. > 1.- [OK] When the ethernet cable is plugged in, an IP (192.168.0.39)?is > assigned to eth0. > 2.- [OK] When the usb-otg is connected to the host, an IP (192.168.0.2) > is assigned to usb0 (wifi and ethernet are disconnected). Is the device in 1) the uplink and your router (DHCP) server in your network assigns your device running ConnMan the IP 192.168.0.39? Because if the ConnMan tethers the uplink via the device in 2) it should not hand out the 192.168.0.2. > 3.- [?] When the wifi is connected,tether disappear in the device > (ifconfig -a) and the system console show the following message: > ? ? ?Connected wifi_50338b6692d8_636173697461_managed_psk > ? ? ?... > ? ? ?tether: port 1(usb0) entered disabled state > ? ? ?device usb0 left promiscuous mode > ? ? ?tether: port 1(usb0) entered disabled state Is the WiFi interface also attached via USB? Just wondering if ConnMan does that or it is just some device behavior. The last three lines are from the kernel, right? Do you happen to have a ConnMan log? > About the item #3, I tried to find info related with this case, but not > success. Please, may I know if is possible to to have the device > connected to wifi (or ethernet) and the host connected to the device > using usb0 at the same?time? The tethering should not have any side effect on an unrelated interface as long it is not same technology. ConnMan groups all devices with the same technology together and controls them as a group. Hmm, that might actually be your problem if the usb-otg is handled as ethernet device in the upper layers of ConnMan. Thanks, Daniel ------------------------------ Message: 5 Date: Fri, 23 Nov 2018 05:51:03 +0100 From: Daniel Wagner <w...@monom.org> To: ????????? ????? <ostvolody...@gmail.com> Cc: vasyl.vavryc...@globallogic.com, connman@lists.01.org Subject: Re: [PATCH] Force simple wifi scan over dbus Scan Message-ID: <20181123045103.7u3qthgx4wtby...@beryllium.monom.org> Content-Type: text/plain; charset=us-ascii > I will also prepare changes recommended by Daniel except enum. Enum with 2 > types is as bad as bool. ;-) Not really, while a bool will show up as true/false value in gdb an enum (even if defines only single value) will be shown with a prober name. ------------------------------ Message: 6 Date: Fri, 23 Nov 2018 06:10:56 +0100 From: Daniel Wagner <w...@monom.org> To: ????????? ????? <ostvolody...@gmail.com> Cc: Vasyl Vavrychuk <vasyl.vavryc...@globallogic.com>, connman@lists.01.org Subject: Re: [PATCH] Force simple wifi scan over dbus Scan Message-ID: <20181123051056.yl5ojqzi23r6m...@beryllium.monom.org> Content-Type: text/plain; charset=utf-8 Hi, Thanks for inlining, though you would make my life easier if you send a proper patch with commit message etc. Please have a look at coding-style.txt and the kernel documentation on how to send patches. I might have missed something to review on due to hard to read whitespace damage. On Fri, Nov 16, 2018 at 11:58:42PM -0800, ????????? ????? wrote: > Here is modified patch, changes: Please split your patch into a refactoring patch and a patch which adds the new scan flag. > - added enum to device scan function > - changed wifi_scan to fall into ACTIVE scan. Thank you very much Daniel, > it helped me with my other bug. > - renamed functions > > PS. There is another patch coming which fixes > gsupplicant/supplicant.c interface_scan_params() not to fail > wpa_supplicant's scan. Great! > ======================================= > diff --git a/include/device.h b/include/device.h > index 5a3ddc22..a9ffc7a8 100644 > --- a/include/device.h > +++ b/include/device.h > @@ -50,6 +50,17 @@ enum connman_device_type { > #define CONNMAN_DEVICE_PRIORITY_DEFAULT 0 > #define CONNMAN_DEVICE_PRIORITY_HIGH 100 > > +struct scan_parameters { Since this data structure is shared it should be prefixed, maybe struct connman_device_scan_parameters ? > + enum connman_service_type type; > + const char *ssid; > + unsigned int ssid_len; > + const char *identity; > + const char* passphrase; > + const char *security; > + bool force_full_scan; > + void *user_data; > +}; The indention looks wrong (only 4 spaces instead of a tab). It's propably from the inlining. 'git send-email' is your friend :) > + > struct connman_device; > > struct connman_device *connman_device_create(const char *node, > @@ -120,11 +131,8 @@ struct connman_device_driver { > void (*remove) (struct connman_device *device); > int (*enable) (struct connman_device *device); > int (*disable) (struct connman_device *device); > - int (*scan)(enum connman_service_type type, > - struct connman_device *device, > - const char *ssid, unsigned int ssid_len, > - const char *identity, const char* passphrase, > - const char *security, void *user_data); > + int (*scan)(struct connman_device *device, > + struct scan_parameters *parameters); > void (*stop_scan) (enum connman_service_type type, > struct connman_device *device); > int (*set_regdom) (struct connman_device *device, > diff --git a/plugins/wifi.c b/plugins/wifi.c > index e437daeb..b702de16 100644 > --- a/plugins/wifi.c > +++ b/plugins/wifi.c > @@ -1852,11 +1852,8 @@ static int p2p_find(struct connman_device *device) > * Note that the hidden scan is only used when connecting to this specific > * hidden AP first time. It is not used when system autoconnects to hidden > AP. > */ > -static int wifi_scan(enum connman_service_type type, > - struct connman_device *device, > - const char *ssid, unsigned int ssid_len, > - const char *identity, const char* passphrase, > - const char *security, void *user_data) > +static int wifi_scan(struct connman_device *device, > + struct scan_parameters *parameters) > { > struct wifi_data *wifi = connman_device_get_data(device); > GSupplicantScanParams *scan_params = NULL; > @@ -1876,14 +1873,17 @@ static int wifi_scan(enum connman_service_type type, > if (wifi->tethering) > return -EBUSY; > > - if (type == CONNMAN_SERVICE_TYPE_P2P) > + if (parameters->type == CONNMAN_SERVICE_TYPE_P2P) > return p2p_find(device); > > - DBG("device %p wifi %p hidden ssid %s", device, wifi->interface, ssid); > + DBG("device %p wifi %p hidden ssid %s forced full scan %s", device, Drop the 'forced full' from the string > + wifi->interface, parameters->ssid, parameters->force_full_scan ? > + "forced" : "normal"); > > scanning = connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_WIFI); > > - if (!ssid || ssid_len == 0 || ssid_len > 32) { > + if (!parameters->ssid || parameters->ssid_len == 0 || > + parameters->ssid_len > 32) { > if (scanning) > return -EALREADY; > > @@ -1912,8 +1912,8 @@ static int wifi_scan(enum connman_service_type type, > return -ENOMEM; > } > > - memcpy(scan_ssid->ssid, ssid, ssid_len); > - scan_ssid->ssid_len = ssid_len; > + memcpy(scan_ssid->ssid, parameters->ssid, parameters->ssid_len); > + scan_ssid->ssid_len = parameters->ssid_len; > scan_params->ssids = g_slist_prepend(scan_params->ssids, > scan_ssid); > scan_params->num_ssids = 1; > @@ -1929,12 +1929,12 @@ static int wifi_scan(enum connman_service_type type, > wifi->hidden = NULL; > } > > - memcpy(hidden->ssid, ssid, ssid_len); > - hidden->ssid_len = ssid_len; > - hidden->identity = g_strdup(identity); > - hidden->passphrase = g_strdup(passphrase); > - hidden->security = g_strdup(security); > - hidden->user_data = user_data; > + memcpy(hidden->ssid, parameters->ssid, parameters->ssid_len); > + hidden->ssid_len = parameters->ssid_len; > + hidden->identity = g_strdup(parameters->identity); > + hidden->passphrase = g_strdup(parameters->passphrase); > + hidden->security = g_strdup(parameters->security); > + hidden->user_data = parameters->user_data; > wifi->hidden = hidden; > > if (scanning) { > @@ -1947,8 +1947,8 @@ static int wifi_scan(enum connman_service_type type, > } > } else if (wifi->connected) { > g_supplicant_free_scan_params(scan_params); > - return wifi_scan_simple(device); > - } else { > + return wifi_scan_simple(device); > + } else if (!parameters->force_full_scan) { > ret = get_latest_connections(driver_max_ssids, scan_params); > if (ret <= 0) { > g_supplicant_free_scan_params(scan_params); > diff --git a/src/connman.h b/src/connman.h > index c4190fd0..c29de4b2 100644 > --- a/src/connman.h > +++ b/src/connman.h > @@ -566,6 +566,7 @@ void __connman_device_list(DBusMessageIter *iter, void > *user_data); > enum connman_service_type __connman_device_get_service_type(struct > connman_device *device); > struct connman_device *__connman_device_find_device(enum > connman_service_type type); > int __connman_device_request_scan(enum connman_service_type type); > +int __connman_device_request_scan_full(enum connman_service_type type); > int __connman_device_request_hidden_scan(struct connman_device *device, > const char *ssid, unsigned int ssid_len, > const char *identity, const char *passphrase, > diff --git a/src/device.c b/src/device.c > index 5d343ae8..6d9a8374 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -613,10 +613,14 @@ int connman_device_set_powered(struct connman_device > *device, > for (i = 0; i < MAX_CONNMAN_SERVICE_TYPES; i++) > device->scanning[i] = false; > > - if (device->driver && device->driver->scan) > - device->driver->scan(CONNMAN_SERVICE_TYPE_UNKNOWN, device, > - NULL, 0, NULL, NULL, NULL, NULL); > - > + if (device->driver && device->driver->scan) { > + struct scan_parameters parameters; > + memset(¶meters, 0, sizeof(parameters)); > + parameters.type = CONNMAN_SERVICE_TYPE_UNKNOWN; > + parameters.force_full_scan = false; > + > + device->driver->scan(device, ¶meters); > + } > return 0; > } > > @@ -626,7 +630,8 @@ bool connman_device_get_powered(struct connman_device > *device) > } > > static int device_scan(enum connman_service_type type, > - struct connman_device *device) > + struct connman_device *device, > + bool force_full_scan) > { > if (!device->driver || !device->driver->scan) > return -EOPNOTSUPP; > @@ -634,8 +639,12 @@ static int device_scan(enum connman_service_type type, > if (!device->powered) > return -ENOLINK; > > - return device->driver->scan(type, device, NULL, 0, > - NULL, NULL, NULL, NULL); > + struct scan_parameters parameters; > + memset(¶meters, 0, sizeof(parameters)); > + parameters.type = type; > + parameters.force_full_scan = force_full_scan; > + > + return device->driver->scan(device, ¶meters); > } > > int __connman_device_disconnect(struct connman_device *device) > @@ -1080,7 +1089,8 @@ void connman_device_regdom_notify(struct > connman_device *device, > __connman_technology_notify_regdom_by_device(device, result, alpha2); > } > > -int __connman_device_request_scan(enum connman_service_type type) > +static int connman_device_request_scan(enum connman_service_type type, > + bool force_full_scan) When a function is static you can drop the 'connman_device' prefix. We add the prefix to avoid to polute the name space. So static int request_scan() is good enough. > { > bool success = false; > int last_err = -ENOSYS; > @@ -1108,7 +1118,7 @@ int __connman_device_request_scan(enum > connman_service_type type) > if (!device_has_service_type(device, type)) > continue; > > - err = device_scan(type, device); > + err = device_scan(type, device, force_full_scan); > if (err == 0 || err == -EALREADY || err == -EINPROGRESS) { > success = true; > } else { > @@ -1123,6 +1133,16 @@ int __connman_device_request_scan(enum > connman_service_type type) > return last_err; > } > > +int __connman_device_request_scan(enum connman_service_type type) > +{ > + return connman_device_request_scan(type, false); > +} > + > +int __connman_device_request_scan_full(enum connman_service_type type) > +{ > + return connman_device_request_scan(type, true); > +} > + > int __connman_device_request_hidden_scan(struct connman_device *device, > const char *ssid, unsigned int ssid_len, > const char *identity, const char *passphrase, > @@ -1134,9 +1154,17 @@ int __connman_device_request_hidden_scan(struct > connman_device *device, > !device->driver->scan) > return -EINVAL; > > - return device->driver->scan(CONNMAN_SERVICE_TYPE_UNKNOWN, > - device, ssid, ssid_len, identity, > - passphrase, security, user_data); > + struct scan_parameters parameters; > + parameters.type = CONNMAN_SERVICE_TYPE_UNKNOWN; > + parameters.ssid = ssid; > + parameters.ssid_len = ssid_len; > + parameters.identity = identity; > + parameters.passphrase = passphrase; > + parameters.security = security; > + parameters.user_data = user_data; > + parameters.force_full_scan = false; > + > + return device->driver->scan(device, ¶meters); > } > > void __connman_device_stop_scan(enum connman_service_type type) > diff --git a/src/technology.c b/src/technology.c > index 78550f48..4e053fc9 100644 > --- a/src/technology.c > +++ b/src/technology.c > @@ -1087,7 +1087,7 @@ static DBusMessage *scan(DBusConnection *conn, > DBusMessage *msg, void *data) > technology->scan_pending = > g_slist_prepend(technology->scan_pending, msg); > > - err = __connman_device_request_scan(technology->type); > + err = __connman_device_request_scan_full(technology->type); > if (err < 0) > reply_scan_pending(technology, err); > > > Thanks, Daniel ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list connman@lists.01.org https://lists.01.org/mailman/listinfo/connman ------------------------------ End of connman Digest, Vol 37, Issue 11 ***************************************