Hello all.
I need an advice, because I'm a bit puzzled:
I'm writing a netfilter module that hooks the pre routing table to do some custom actions. The whole module works fine in different platforms/installation, but I'm now trying to compile it for LinkIT Smart 7688 (OpenWRT Chaos Calmer). I found the toolchain (https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/firmware-and-bootloader/build-the-firmware-from-source-codes) and I was able to compile it successfully for kernel 3.18.23.
The module installs successfully and everything seems to be fine, but there is an issue: it looks the net structures used are not correct. For example, the code:
if (!skb)
{
return NF_DROP;
}
iph = ip_hdr(skb);
if (iph->protocol == IPPROTO_ICMP)
{
return NF_DROP;
}
if (iph->protocol == IPPROTO_TCP)
{
[...snip...]
does not work, because the "iph->protocol" field does not contain the data I was expecting, and the same happens for other fields of the skb. So the module is not recognizing the protocols. Most of the time the value is set to 0 instead having 6 or other valid ID.
I feel I'm missing something, but I can not figure out what. Could you please help me?
Thanks a lot,
cips