Re: Question about ipip implementation

From: Olaf Titz (olaf@bigred.inka.de)
Date: Sun May 13 2001 - 08:16:28 EST


> I read net/ipv4/ipip.c. It seems to me that ipip_rcv() function after
> "unwrapping" tunelled IP packet creates "virtual Ethernet header" and submit

Does it? ipip_rcv() does this:

        iph = skb->nh.iph;
        skb->mac.raw = skb->nh.raw;

i.e. the "MAC header" pointer of the packet is the same as the IP
header, iow. no MAC header available

        skb->nh.raw = skb->data;

Although I don't exactly understand this :-) it does not add a header

        memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));

this must be cleared before processing the packet

        skb->protocol = __constant_htons(ETH_P_IP);
        skb->pkt_type = PACKET_HOST;

mark it as an IP packet

        read_lock(&ipip_lock);
        if ((tunnel = ipip_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
                tunnel->stat.rx_packets++;
                tunnel->stat.rx_bytes += skb->len;
                skb->dev = tunnel->dev;

mark the incoming device

                dst_release(skb->dst);
                skb->dst = NULL;
#ifdef CONFIG_NETFILTER
                nf_conntrack_put(skb->nfct);
                skb->nfct = NULL;
#ifdef CONFIG_NETFILTER_DEBUG
                skb->nf_debug = 0;
#endif
#endif

more clearing of fields / release of resources associated with the packet

                ipip_ecn_decapsulate(iph, skb);

handle ECN flags

                netif_rx(skb);

The packet as submitted starts with the IP header and the skb pointers
are set up so that the MAC header has zero size.

Olaf
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 15 2001 - 21:00:31 EST