[ovs-dev] [PATCH net-next 06/12] ip_tunnel: push generic protocol handling to ip_tunnel module.
Jesse Gross
jesse at nicira.com
Sat Jun 15 00:20:53 UTC 2013
On Thu, Jun 13, 2013 at 11:24 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
> static int gre_cisco_rcv(struct sk_buff *skb)
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index b7b8d15..c41faf8 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -442,23 +435,6 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
> tunnel->i_seqno = ntohl(tpi->seq) + 1;
> }
>
> - /* Warning: All skb pointers will be invalidated! */
> - if (tunnel->dev->type == ARPHRD_ETHER) {
> - if (!pskb_may_pull(skb, ETH_HLEN)) {
> - tunnel->dev->stats.rx_length_errors++;
> - tunnel->dev->stats.rx_errors++;
> - goto drop;
> - }
> -
> - iph = ip_hdr(skb);
> - skb->protocol = eth_type_trans(skb, tunnel->dev);
> - skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
> - }
> -
> - skb->pkt_type = PACKET_HOST;
> - __skb_tunnel_rx(skb, tunnel->dev);
> -
> - skb_reset_network_header(skb);
> err = IP_ECN_decapsulate(iph, skb);
> if (unlikely(err)) {
> if (log_ecn_error)
> @@ -477,6 +453,12 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
> tstats->rx_bytes += skb->len;
> u64_stats_update_end(&tstats->syncp);
>
> + if (tunnel->dev->type == ARPHRD_ETHER) {
> + skb->protocol = eth_type_trans(skb, tunnel->dev);
> + skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
> + } else {
> + skb->dev = tunnel->dev;
> + }
Why don't we set the tunnel device in the case of an L2 packet? This
appears related to the removal of __skb_tunnel_rx() but it seems there
is now less consistency between L2 and L3 tunnels.
More information about the dev
mailing list