Re: CSME integration - next steps, network selection

2022-03-08 Thread Emmanuel Grumbach via networkmanager-list
>
> On Tue, 2022-03-08 at 08:35 +0200, Emmanuel Grumbach via
> networkmanager-list wrote:
> > I realized I am missing a piece before this.
> > I need to be able to get and handle nl80211 events, which means that
> > I
> > need a thread or event loop or something that listens to the nl80211
> > channel and parses events. The event I need is the end of the
> > connection from the CSME side. This brings to the fundamental
> > question
> > of the threading model in NetworkManager.
> > Do we have a sort of event loop? Looks like the NetworkManager runs
> > on
> > an event loop and very few things run in a different thread, but I
> > couldn't really see any clear information about it.
>
>
> Hi,
>
>
> we use a glib mainloop. Read
> https://tecnocode.co.uk/2014/03/27/what-is-gmaincontext/
>
> There is only one thread (except, that GDBus spawns a worker thread
> internally and that we might do a blocking write to sysctl on a thread,
> but NM itself is for the most case single threadded).
>
> In this case, you would poll on the file descriptor. So use
> `nm_g_unix_fd_add_source()`.
>
>

I looked into this and basically I'd have to reimplement
event_handler_read_netlink which reads from priv->nlh where I need to
read from genl...
The pick of priv->nlh and very deep in the code.
I guess I could add DELAYED_ACTION_TYPE_READ_NL80211 just like we have
DELAYED_ACTION_TYPE_READ_NETLINK and make that call
event_handler_read_nl80211 which would set a parameter in the platform
so that event_handler_read_netlink will read from genl instead of
priv->nlh? Since everything is single thread, that could work?
OTOH, it'd mean that the handling of the nl82011 messages would be in
nm-linux-platform which isn't desirable either.
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: CSME integration - next steps, network selection

2022-03-08 Thread Thomas Haller via networkmanager-list
On Tue, 2022-03-08 at 08:35 +0200, Emmanuel Grumbach via
networkmanager-list wrote:
> I realized I am missing a piece before this.
> I need to be able to get and handle nl80211 events, which means that
> I
> need a thread or event loop or something that listens to the nl80211
> channel and parses events. The event I need is the end of the
> connection from the CSME side. This brings to the fundamental
> question
> of the threading model in NetworkManager.
> Do we have a sort of event loop? Looks like the NetworkManager runs
> on
> an event loop and very few things run in a different thread, but I
> couldn't really see any clear information about it.


Hi,


we use a glib mainloop. Read
https://tecnocode.co.uk/2014/03/27/what-is-gmaincontext/

There is only one thread (except, that GDBus spawns a worker thread
internally and that we might do a blocking write to sysctl on a thread,
but NM itself is for the most case single threadded).

In this case, you would poll on the file descriptor. So use
`nm_g_unix_fd_add_source()`.


best,
Thomas

> 
> Thoughts?
> 
> Thanks :)
> 
> Emmanuel Grumbach
> egrumb...@gmail.com
> 
> On Mon, Mar 7, 2022 at 5:00 PM Emmanuel Grumbach
>  wrote:
> > 
> > Hi,
> > 
> > Next steps about the CSME integration :)
> > Now the flow I need is to do the following in case os_owner is
> > false:
> > List all the connections configured on wifi
> >     * If none match what we got from CSME - we do nothing and wait
> > until CSME will remove the rfkill
> >     * If there is a match, we need pick that connection  but
> > connect
> > to the same bssid as CSME was connected to
> > Then we can ask for ownership
> > 
> > I saw there is nm_setting_wireless_get_bssid which will tell us if
> > the
> > connection has a bssid (not sure I am correct here) and if there is
> > a
> > bssid, we'll connect to that same AP. Is that something I can use?
> > 
> > Maybe I should create another connection with a specific bssid and
> > "disable" all the others? not sure what's the right way to go here.
> > Another thing we'll need is to limit the scan on the channel on
> > which
> > the AP we look for is working. We don't want to waste time to scan
> > all
> > the channels. The supplicant has a configuration for that.
> > 
> > Any guidance will be appreciated :)
> > 
> > I'll continue digging anyway.
> > 
> > Thanks!
> > 
> > Emmanuel Grumbach
> > egrumb...@gmail.com
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list
> 

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: CSME integration - next steps, network selection

2022-03-07 Thread Emmanuel Grumbach via networkmanager-list
I realized I am missing a piece before this.
I need to be able to get and handle nl80211 events, which means that I
need a thread or event loop or something that listens to the nl80211
channel and parses events. The event I need is the end of the
connection from the CSME side. This brings to the fundamental question
of the threading model in NetworkManager.
Do we have a sort of event loop? Looks like the NetworkManager runs on
an event loop and very few things run in a different thread, but I
couldn't really see any clear information about it.

Thoughts?

Thanks :)

Emmanuel Grumbach
egrumb...@gmail.com

On Mon, Mar 7, 2022 at 5:00 PM Emmanuel Grumbach  wrote:
>
> Hi,
>
> Next steps about the CSME integration :)
> Now the flow I need is to do the following in case os_owner is false:
> List all the connections configured on wifi
> * If none match what we got from CSME - we do nothing and wait
> until CSME will remove the rfkill
> * If there is a match, we need pick that connection  but connect
> to the same bssid as CSME was connected to
> Then we can ask for ownership
>
> I saw there is nm_setting_wireless_get_bssid which will tell us if the
> connection has a bssid (not sure I am correct here) and if there is a
> bssid, we'll connect to that same AP. Is that something I can use?
>
> Maybe I should create another connection with a specific bssid and
> "disable" all the others? not sure what's the right way to go here.
> Another thing we'll need is to limit the scan on the channel on which
> the AP we look for is working. We don't want to waste time to scan all
> the channels. The supplicant has a configuration for that.
>
> Any guidance will be appreciated :)
>
> I'll continue digging anyway.
>
> Thanks!
>
> Emmanuel Grumbach
> egrumb...@gmail.com
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


CSME integration - next steps, network selection

2022-03-07 Thread Emmanuel Grumbach via networkmanager-list
Hi,

Next steps about the CSME integration :)
Now the flow I need is to do the following in case os_owner is false:
List all the connections configured on wifi
* If none match what we got from CSME - we do nothing and wait
until CSME will remove the rfkill
* If there is a match, we need pick that connection  but connect
to the same bssid as CSME was connected to
Then we can ask for ownership

I saw there is nm_setting_wireless_get_bssid which will tell us if the
connection has a bssid (not sure I am correct here) and if there is a
bssid, we'll connect to that same AP. Is that something I can use?

Maybe I should create another connection with a specific bssid and
"disable" all the others? not sure what's the right way to go here.
Another thing we'll need is to limit the scan on the channel on which
the AP we look for is working. We don't want to waste time to scan all
the channels. The supplicant has a configuration for that.

Any guidance will be appreciated :)

I'll continue digging anyway.

Thanks!

Emmanuel Grumbach
egrumb...@gmail.com
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list