Netfilter module on LinkIT Smart 7688

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 ( 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)

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,

The MediaTek source and toolchain are not OpenWrt (even if based on an obsolete version OpenWrt) and are supported only by MediaTek resources.

You may have better luck with a careful examination of

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.