ovh/overthebox-feeds

dig returns 0 even if the packet is malformed

Closed this issue · 0 comments

Huawei's USB LTE key responds to DNS queries with invalid data when it doesn't get any signal.
The tracker only checks the exit status of the dig command to tell if the query was successful, but our version of dig returns 0 if the packet is malformed...

root@glenn:~# dig @51.254.49.132 -b 192.168.8.130 +time=1 +tries=1 +short tracker.overthebox.ovh
;; Got bad packet: FORMERR
67 bytes
93 de 81 20 00 01 00 01 00 00 00 01 07 74 72 61          .............tra
63 6b 65 72 0a 6f 76 65 72 74 68 65 62 6f 78 03          cker.overthebox.
6f 76 68 00 00 01 00 01 c0 0c 00 01 00 01 00 00          ovh.............
00 00 00 04 c0 a8 08 01 00 00 00 00 00 00 00 00          ................
00 00 00                                                 ...
root@glenn:~# echo $?
0

We might need to check the result of the dig command, the exit status doesn't seem to be enough.