/* * General entry point. * * Here the NAT64 implementation validates that the * incoming packet is IPv4 or IPv6. If it isn't, it silently drops the packet. * If it's one of those two, it calls it's respective function, since the IPv6 * header is handled differently than an IPv4 header. */ unsigned int nat64_tg(struct sk_buff *skb, const struct xt_action_param *par) { if (par->family == NFPROTO_IPV4) return nat64_tg4(skb, par); else if (par->family == NFPROTO_IPV6) return nat64_tg6(skb, par); else return NF_ACCEPT; }
static netdev_tx_t nat64_netdev_xmit(struct sk_buff *skb, struct net_device *dev) { switch(ntohs(skb->protocol)) { case ETH_P_IP: nat64_tg4(skb); break; case ETH_P_IPV6: nat64_tg6(skb); break; } kfree_skb(skb); return NETDEV_TX_OK; }