-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add P4 Switches/APs #295
Comments
Hi @ramonfontes 😄 , Right now I was trying to get something similar. My idea was to try to port the BMV2 to Mininet-Wifi. Only for my own requirements I needed to manage directly with the wifi headers (802.11). The "problem" I had is that in Mininet-Wifi, the interfaces that are created, are the physical emulated card ( These virtual interfaces that hang are generally of the Ethernet type, therefore in the reception of a wifi data packet, these are received by the physical emulated card, then the 802.11 to 802.3 headers are parsed and delivered to the virtual interface. The only virtual interfaces that handle wifi headers are those in monitor mode. But the monitor mode is intended exclusively for listening, not for transmitting. But it is possible to do a packet injection, as long as those packets already have the wifi header built in, open a raw socket with the virtual interface in monitor mode and send it. My idea was to try to make this integration between BMV2 and Mininet-Wifi, and give the softswitch the capacity to handle wireless headers. What do you think? How viable do you think it is? Thank you very much for your time! |
Hi @davidcawork ;) , Are you doing something similar to the tutorials I've added in https://github.com/ramonfontes/tutorials/tree/master/exercises by any chance? Could you clarify this -> the interfaces that are created, are the physical emulated card (mn00sXX) from you can hang virtual interfaces, and those virtual interfaces which operate with ethernet. In my opinion and I can be wrong the only way to handle 802.11 headers is through the monitor interfaces. Most of the P4 tutorials use scapy and we can use it with the monitor interfaces in order to handle 802.11 headers. The idea around BMV2 is very interesting. I was looking for a virtual switch (like ofsoftswitch) that allows us to run them in their own NS. Do you know if we can make BMV2 run in its NS? I just found p4lang/behavioral-model#672 and I was thinking to have a full control over adhoc scenarios. Unfortunately, we cannot do this if all the nodes are running in the root NS. |
Hi @ramonfontes First of all, feel free to correct me at any time, I still have a lot to learn and you probably went through this learning curve a long time ago! I'm going to go in parts to organize the answer and make it all more clear. Let's go with the first part:
Yes! exactly, I usually always collect information and developments already made so as not to try to re-invent the wheel. Inspecting your code I saw that none of the p4 programs parse wifi headers, so I didn't know to what extent this was due to a limitation by Mininet-Wifi or a design decision. Currently, my plan was to thoroughly analyze the interface that the P4Lang organization has set up between Mininet and P4 ( P4Switch, PI, P4Runtime..), analyze Mininet-Wifi and understand in depth its internal workings, and finally, try to integrate it in such a way that the BMV2 could handle the wifi headers (I planned to do this by using the interfaces in monitor mode). So I decided to use the P4 tutorials that you created for the last step or make a new integration depending on the possible limitations that I found. Everything I've just explained here is explained in this repository, where I mention and reference everything you've created (Thanks a lot!). It's a pity since it's all written in Spanish and not in English, but it was mandatory for me since in my end of degree project all the documentation must be in my native language. Let's go with the second part:
Yes, of course, I'm sorry for not explaining myself properly. As far as I could find out, Mininet-Wifi always ends up using the module This is usually done by making use of the module itself by loading it with $ hwsim_mgmt -c -n mn00s00
This would create an emulated wifi card, physical layer, with the name If I don't explain myself correctly, I will try again! Let's go with the third part:
I completely agree! That would be the way to receive the packets with the 802.11 headers. To get the transmission going I thought I would do a packet injection into the interfaces in monitor mode. I do this by using scpay, where I form the Wifi + RadioTap headers, open a raw socket with the monitor interface and send it. Here I have a tool that I made just to check the operation of the packet injection. What do you think? Let's go with the final part 😄
I managed to run the BMV2 in their own Network namespaces some time ago. As I have the code in a VM I'm going to fork the P4 tutorials, modify it and upload it so you can see it. I will post again in this issue when everything is ready, explaining the changes that had to be made! I hope it will help to solve the problems with the by-passes of the Ad-Hoc scenarios. Again, thank you very much for your time! |
Hi again @ramonfontes 😄 ! As I told you, here I am again with the repository mounted and ready! The repository can be found here: github.com/davidcawork/P4Tutorial You can see the changes better in this commit,
nsenter -t {PID} -n netstat -altun | grep {gRPC_port}
Things I'd like to improve on in the future:
Best, |
You're welcome! I have to say thanks a lot too! I'm really happy to hear about this work. I was feeling let's say like a fish out of water when it comes to the P4lang-wireless Implementation. 😄. It's great to know that I'm not alone.
Wmediumd can process frames coming from the kernel via Netlink and mac80211_hwsim has many functions developed especially for it. Try to look for the wmediumd word at https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mac80211_hwsim.c.
Got it! While you were doing that I was playing with P4 in Mininet-WiFi ;). P4 APs (and P4Switches) are supported right now. Please take a look at the p4 branch, in particular 5e688aa. A simple topology (examples/p4/p4.py) with 2 APs, 2 Stations and 2 Hosts has been added. You can find the rules at commands_ap1.txt and commands_ap2.txt. I was wondering if you cannot apply your solution for NS in this branch. What do you think?
Not sure, but perhaps the p4 branch can make your life easier. From my side I'm thinking about automating the P4 installation. My concern is that the P4 installation has not been so trivial. It sucks when there are package dependency issues. How has your experience been with this? |
P4 dependencies can be installed with |
Thank you very much for the resource! I'll take a look at future 😄
Amazing work, @ramonfontes . From what I've been seeing and analyzing the implementation, it's based on github.com/ANTLab-polimi/FOP4 work in part. I've only had time to look at the code, but I'd like to play with it these days! What it is true, and there is a thing that doesn't convince me completely, is the hierarchy of classes that they have made. Since class Of course, i will try to carry out the implementation to supportrunning BMV2 into NS. To do this, I would like to ask you a question, as probably the years you have been maintaining this repository would have a clearer opinion. Doubt: Where would be possible to add a class to manage the NS? I had thought of creating a As for the installation process, if it's quite annoying, I'm glad you already found a solution I also had to make my own for my own machine, since the two shellscript provided from the P4 Tutorials repository were choking me... |
Actually I think that the FOP4 guys are reusing Regarding NS, in my opinion you can either create the class in
https://github.com/jafingerhut/p4-guide works fine for Ubuntu 16.04 and 18.04. However, I had to create a patch because it installs |
Hello @ramonfontes , I'm sorry for my absence these days I was quite sick, today I will take up where I was going.. thank you very much for your work. I'll start testing the code to handle the NS! I will make a Mininet-Wifi fork and pull-request as much as possible every time I have something consistent and valuable. Stay safe 😄! |
Hi @davidcawork, I'm excited to see this feature. I've added Stratum in |
Hi @davidcawork, 666b66e enables inNamespace ;) |
Cool! Thank you so much for your work! 😄 |
Hi @ramonfontes , I have just made a pull-request #302 with two new generic classes to control the BMv2 with support for execution in Network namespaces. I hope they are useful 😃 Stay safe! |
Mininet-WiFi should support classes for P4 Switches. This project (https://github.com/ANTLab-polimi/FOP4) seems to be a great kick-off. Since it works with Containernet we can also consider https://github.com/ramonfontes/containernet
The text was updated successfully, but these errors were encountered: