DDoS attacks are on the channel and on the app.
If the attack on the canal - there is nothing you can do in principle.
If the attack is on the app - filter the packets, is a firewall. No need to write any firmware. just configure the firewall.
it is clear that we must fully explore the Internet and other networks, protocols, etc.
But with this and perhaps start.