LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Tweaking and recompiling the code of a WiFi driver for my needs (https://www.linuxquestions.org/questions/linux-kernel-70/tweaking-and-recompiling-the-code-of-a-wifi-driver-for-my-needs-4175729424/)

pintomonde 09-30-2023 09:18 AM

Tweaking and recompiling the code of a WiFi driver for my needs
 
I want to take an existing, standard WiFi driver for Linux and tweak it. I'll inroduce a whitelist into it. That is, to the consumer a driver will show the networks from a whitelist only ignoring all other ones.



It's a PoC. I want to implement it as simply as possible.

Can this be implemented? And how, in a high level?


---

It must be a driver, not a user-space application, because it's a requirement.

A driver, as I've been suggested, is iwlwifi, which is a part of the kernel

https://git.kernel.org/pub/scm/linux...ireless/scan.c

Right?

business_kid 10-01-2023 11:45 AM

Hello, pintomonde & welcome to LQ.

What you suggest is like trying to put a map of one way streets into you car's engine. The WiFi driver just drives the wifi card. There's a whole networking stack that handles routing and IP packets. The job you are describing is a firewall, and you already have one.

These days, firewalls are problematic because spare IPV4 address blocks assigned to one country have been sold and assigned in another. Also, once hackers compromise one apparently innocent box, they can launch attacks from there. But your firewall will let it through. Everyone updated the Solar Winds software a year or two back - which came with a virus attached.

Try seeing if iptables does what you want to do with your wifi driver.

pintomonde 10-01-2023 01:27 PM

Quote:

Originally Posted by business_kid (Post 6456509)
Hello, pintomonde & welcome to LQ.

What you suggest is like trying to put a map of one way streets into you car's engine. The WiFi driver just drives the wifi card.

You haven't undertood.

....a wifi driver drives by a) looking for WiFi networks b) finding them c) creating a list of them d) giving a list of them to the consumer - Linux user level. Correct?

I want to create a modified version of a Wifi driver which would post-process some data in the (c) step thus cutting off some of them the networks off a list, right before passing it to the user level.

That is, it'd simply give out a slightly modified list of the networks

You claim that this wouldn't be possible?

business_kid 10-02-2023 05:36 AM

I don't think so. The wifi driver simply passes network traffic in the form of network packets to the particular wifi card you have. If you swapped your wifi card, you'd need another network driver. Connecting to networks is hardly relevant, as if you could get onto other local networks you'd hardly pay your isp, would you?

There are a host of programs including the kernel involved in deciding what goes into network packets. The wifi driver doesn't decide anything. This is not my strong suit, but I'm sure others will chip in. I imagine running a firewall to exclude social media might be an option but I'm sure it's not a simple task.

The last thing you need is a tweaked wifi driver.

pintomonde 10-02-2023 09:52 AM

Quote:

Originally Posted by business_kid (Post 6456614)
There are a host of programs including the kernel involved in deciding what goes into network packets. The wifi driver doesn't decide anything. This is not my strong suit, but I'm sure others will chip in. I imagine running a firewall to exclude social media might be an option but I'm sure it's not a simple task.

The last thing you need is a tweaked wifi driver.

>>I imagine running a firewall to exclude social media

I'm asking him about Wifi networks, twice already, but he's still telling me about social media - websites - and firewall. What a strange developer.


>>The last thing you need is a tweaked wifi driver.

How do you know what I need to?

TB0ne 10-02-2023 10:09 AM

Quote:

Originally Posted by pintomonde (Post 6456667)
>>I imagine running a firewall to exclude social media
I'm asking him about Wifi networks, twice already, but he's still telling me about social media - websites - and firewall. What a strange developer.

It seems like you're not understanding/liking the answer, despite it being correct. The Wifi driver does one thing: enables the device to talk to things further into the system. This include things like the security pieces (WPA, etc.), along with the rest of the TCP/IP stack. That's it. The list of wifi networks *IS NOT* coming from the wifi driver. And how do you propose to introduce this 'whitelist' into things??? Do you expect people to recompile the network driver each time they travel so they can use a different network?? Or do you plan on using something else...which then takes your driver into user-space, doesn't it???

What's strange is you asking this question; if you're able to modify kernel level drivers, you'd already know these things. If you're unable to do so, why are you doubting what others tell you?? If you can do, please proceed and prove everyone wrong. Feel free to look into any wifi driver module to see how things work, then think about how they do what they do.
Quote:

>>The last thing you need is a tweaked wifi driver.
How do you know what I need to?
Monkeying around with a wifi driver makes things far less secure and stable, which is something that pretty much no one needs.

pintomonde 10-02-2023 01:48 PM

>The list of wifi networks *IS NOT* coming from the wifi driver.

Where does come from then? What is it that builds it?


>Do you expect people to recompile the network driver each time they travel so they can use a different network??

Re-read my question. I'm asking about the implementation only. Of a driver.

You don't need to try to guess a reason or whether it'd all be feasiable, or what to do instead of it. Stupidity.

pintomonde 10-02-2023 01:58 PM

Now tell me

https://git.kernel.org/pub/scm/linux...ireless/scan.c


If you claim that Wifi driver doesn't build a list of Wifi networks itself, what are bssid and ssid there for?

TB0ne 10-02-2023 02:01 PM

Quote:

Originally Posted by pintomonde (Post 6456722)
>The list of wifi networks *IS NOT* coming from the wifi driver.
Where does come from then? What is it that builds it?

Things that aren't in the wifi driver, but further up, as you've been told.
Quote:

>Do you expect people to recompile the network driver each time they travel so they can use a different network??
Re-read my question. You don't and can't know requirements, therefore you're making bizzare guesses. I'm asking about the implementation only. What you're doing though is guessing a reason and whethere it'd be feasiable. Stupidity.
Right, we can't and don't know the requirements, because *YOU HAVE NOT TOLD US WHAT THEY ARE* You keep saying it's a 'requirement', but don't say for what, what purpose, etc. You call people 'strange', tell them they're stupid, yet somehow expect us to give you help. What you're wanting is *NOT* feasible, as you've been told, but again...don't seem to want that answer.

Get any wifi driver you want and look at the source code. Look at the code/github for nmcli and you may find some other things, such as:
Quote:

Originally Posted by NMCLI Docs
The NetworkManager daemon runs as a privileged service (since it must access and control hardware), but provides a D-Bus interface on the system bus to allow for fine-grained control of networking. NetworkManager does not store connections or settings, it is only the mechanism by which those connections are selected and activated.

To store pre-defined network connections, two separate services, the "system settings service" and the "user settings service" store connection information and provide these to NetworkManager, also via D-Bus. Each settings service can determine how and where it persistently stores the connection information; for example, the GNOME applet stores its configuration in GConf, and the system settings service stores it's config in distro-specific formats, or in a distro- agnostic format, depending on user/administrator preference.

Good luck; you'll need it.

pintomonde 10-02-2023 02:16 PM

What does this function do, for instance?

https://git.kernel.org/pub/scm/linux...ss/scan.c#n583

A list of access points. Interesting, isn't it?

What does it do there then if a list of them isn't generated by a Wifi driver?

business_kid 10-03-2023 07:04 AM

Look, all these things are done very well by the gnu utilities and the linux kernel.

This wifi driver thing has got way out of proportion. To block out social media requires analysing the packets, which a wifi driver doesn't do. It can be done by DNS. A good move may be to check opendns.org and see if they have an option to block social media. Even if they don't, there's clever tricks and hacks that your kids will find out about before you.

I ran on the censored version of opendns while my kids were teenagers. But they were not fools. If they wanted porn, all they had to do was go to a torrent site! Fortunately, they didn't want it.
Quote:

Originally Posted by John Perry Barlow
The Internet treats censorship as a malfunction and routes around it

As for your kernel.org link - The kernel knows more about me than I know about it :D.

pintomonde 10-03-2023 08:54 AM

He keeps giving me an advice about what HE THINKS I need. Rather than what I've asked about multiple times. Is he a lunatic or not?

A bunch of stuborn creakers


All times are GMT -5. The time now is 07:29 AM.