Image made by AI of someone chatting with chatGPT

You trust in AI blindly ? Think again…

I\’ve decided to write my own DHCP server, for a variety of reasons: every time the DHCP of my router have to be resetted, I have to fill again, bit by bit, the manual static entries of every network component.
In other words, having a server of my own making, I can more easily move the software server to everywhere else and can sit on my nas, or on a Raspberry Pi.
From my knowledge, DHCP is a very simple and efficient protocol, specified in a RFC. So I thought, you’ll have to use sockets with all the communication is made through the connectionless UDP protocol.
In the last years, since the advent of chatGPT, I would go to the AI chatbot for advice on a stub code that could be as a starting point.
So I asked the bot, and he suggested a simple piece of code using the scapy library. Never heard about it, so after I informed better about the subject, I understood that was a packet capture library, not a sockets library.
Scapy makes very easy to analyse each packet through the perspective of the multilayered network architecture of the TCP-IP paradigm. It contains automatically ways to fill and parse the network packets received from and sent to the network. On the background, it uses the libpcap library, available in many platforms, used by network inspection tools like tcpdump and wireshark. It auscults every network packet that travels in the network and reaches the computer that is using it. It scans every packet, putting the network interfaces in promiscuous mode if it needs to. So you can imagine easily that is resource-intensive, hogging the CPU and memory. This way, you can create a firewall, monitor and generate reports for business intelligence about the users on your network.
But returning to DHCP, so I decided to follow the ChatGPT and other AI-chat tools, all recommending to use scapy, but after developing and testing on a computer, I decided to apply it on the NAS. At first time, everything was working, but I started to feel strange every time I tried to log in to the NAS, a slowliness was taking place. So I do a htop on the NAS, and discovered that my own made DHCP server was taking almost 100 % CPU time, and filling the entire NAS\’s 1 GB RAM ! And this because scapy was analysing every packet traversing the NAS, since a NAS, as you can imagine easily, is a very active network piece of hardware. So my only alternative was to rewrite the DHCP server using the usual socket approach and up til now, is working smoothly !