The need is to block some DNS requests. For example, block all dns requests to aaa.com
This can be done MANGLE/Mark package as (udp, port 53, content=aaa) then block all the packages with this mark.
However, this will block aaabbb.com also.
So I ran wireshark, and figured out that the DNS package was in fact
03 61 62 63 03 63 6f 6d
means
(len for abc) (hex for abc) (len for com) (hex for com)
So, if I want to block abc.com exactly I need to find some way to set the Content=HEX RAW BYTES
I have tried Content=\03 \61 … \6d
or Content=\03 \61 … \6d
or Content=0x03 0x61 … 0x6d
but none of them works.
Any idea for this ?
Thanks.
SOLVED: Thanks to everyone posting reply here. I finally make it work.
The KEY TRICK to this issue is that, DO NOT enter the content=“\03abc\03com” in the WINBOX Dialogs.
set content=abc then run “nslookup abc.com” I can see the packages logged (I enabled the log)
set content=“\03abc\03com” and run again “nslookup abc.com” no logs appear.
So far I guess that ROS does not support HEX RAW bytes in content. But no documents to prove that so far.
18:42:31 firewall,info DNS catch: prerouting: in:e1_int out:(unknown 0), src-mac 44:8a:5b:88:87:e2, proto UDP, 192.168.1.12:58429->192.168.1.1:53, len 53
If I remember right, the regexp matching in layer 7 rules ignores zero bytes. So \ff may match, but you have to combine it with other substrings to limit false positives.
When I try to use “content” into the rule, not creating a “layer7 specific rule” , I can’t add “\FF” (only “\f\f”), but, even while I’m seeing this traffic, its not matching the amount of traffic that has the query type as ANY (255 decimal).
So, I’m confused about this. When I open into wireshark the packet, the specific part about query type ANY (wireshark calls it *) , hex is 00 FF.
But I’m having trouble matching this.