[ovs-dev] [PATCH 4/5] datapath lisp: use iptunnel_pull_header().

Pravin Shelar pshelar at nicira.com
Mon Aug 12 18:37:10 UTC 2013


On Wed, Aug 7, 2013 at 1:54 PM, Lori Jakab <lojakab at cisco.com> wrote:
> On 7/30/13 1:47 AM, Pravin B Shelar wrote:
>>
>> CC: Lori Jakab <lojakab at cisco.com>
>> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
>> ---
>>   datapath/vport-lisp.c |   48
>> ++----------------------------------------------
>>   1 files changed, 2 insertions(+), 46 deletions(-)
>>
>> diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
>> index 6e37b2f..847cb39 100644
>> --- a/datapath/vport-lisp.c
>> +++ b/datapath/vport-lisp.c
>> @@ -206,48 +206,6 @@ static void lisp_build_header(const struct vport
>> *vport,
>>         lisph->u2.word2.locator_status_bits = 1;
>>   }
>>   -/**
>> - *     ovs_tnl_rcv - ingress point for generic tunnel code
>> - *
>> - * @vport: port this packet was received on
>> - * @skb: received packet
>> - * @tos: ToS from encapsulating IP packet, used to copy ECN bits
>> - *
>> - * Must be called with rcu_read_lock.
>> - *
>> - * Packets received by this function are in the following state:
>> - * - skb->data points to the inner Ethernet header.
>> - * - The inner Ethernet header is in the linear data area.
>> - * - skb->csum does not include the inner Ethernet header.
>> - * - The layer pointers are undefined.
>> - */
>> -static void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb,
>> -                       struct ovs_key_ipv4_tunnel *tun_key)
>> -{
>> -       struct ethhdr *eh;
>> -
>> -       skb_reset_mac_header(skb);
>> -       eh = eth_hdr(skb);
>> -
>> -       if (likely(ntohs(eh->h_proto) >= ETH_P_802_3_MIN))
>> -               skb->protocol = eh->h_proto;
>> -       else
>> -               skb->protocol = htons(ETH_P_802_2);
>> -
>> -       skb_dst_drop(skb);
>> -       nf_reset(skb);
>> -       skb_clear_rxhash(skb);
>> -       secpath_reset(skb);
>> -       vlan_set_tci(skb, 0);
>> -
>> -       if (unlikely(compute_ip_summed(skb, false))) {
>> -               kfree_skb(skb);
>> -               return;
>> -       }
>> -
>> -       ovs_vport_receive(vport, skb, tun_key);
>> -}
>> -
>>   /* Called with rcu_read_lock and BH disabled. */
>>   static int lisp_rcv(struct sock *sk, struct sk_buff *skb)
>>   {
>> @@ -263,13 +221,11 @@ static int lisp_rcv(struct sock *sk, struct sk_buff
>> *skb)
>>         if (unlikely(!lisp_port))
>>                 goto error;
>>   -     if (unlikely(!pskb_may_pull(skb, LISP_HLEN)))
>> +       if (iptunnel_pull_header(skb, LISP_HLEN, htons(ETH_P_TEB)))
>
>
> Why use ETH_P_TEB for the inner_proto ?  That will make
> iptunnel_pull_header() assume there is an Ethernet header after the LISP
> header and try to extract the inner Ethertype.  It does not affect
> functionality, since we explicitly determine and set it later on, but if we
> use an arbitrary value here, we might as well use ETH_P_IP.  The other
> option would be to determine the inner Ethertype before the
> iptunnel_pull_header() call, and use the correct one.
>
>
ok, I will pass zero as undefined protocol. Then will set protocol
later once it is determined.

>>                 goto error;
>>         lisph = lisp_hdr(skb);
>>   -     skb_pull_rcsum(skb, LISP_HLEN);
>> -
>>         if (lisph->instance_id_present != 1)
>>                 key = 0;
>>         else
>> @@ -301,7 +257,7 @@ static int lisp_rcv(struct sock *sk, struct sk_buff
>> *skb)
>>         ovs_skb_postpush_rcsum(skb, skb->data, ETH_HLEN);
>>   -     ovs_tnl_rcv(vport_from_priv(lisp_port), skb, &tun_key);
>> +       ovs_vport_receive(vport_from_priv(lisp_port), skb, &tun_key);
>>         goto out;
>>     error:
>
>



More information about the dev mailing list