i have a little issue with my Router running latest OpenWRT.
When i am pinging it (or linux device) with less that half o a seconds intervals, some pings respond with timeouts. Lets say it is around 30% of the pings cannot get back to me.
It is just a simple script to fsst ping router 4 times, then my modem, then internet, just to check if all works fine. Otherwise i would have to wait 12 second to finish the task.
Are you saying that router not responding is some sort of DoS attack prevention?
High-rate ICMP may be considered as an incoming DoS threat and blocked by the firewall and/or TCP stack.
(Edit: since you said "When i am pinging it (or linux device)" I am assuming it is a general, Linux issue beyond hammering a low-end router's SoC too hard.)
Reordering your script might make sense if execution time is an issue. For example
Ping "Internet" at normal rate, three times
Return "success" on first ping returned (typically under 1 sec elapsed)
If fails all three (4 seconds in now), then try the modem
If fails all three (4 seconds in now), then try the router
It's hard to imagine a situation where you can't reach your router or your modem but can reach the Internet, with a single link.