[ovs-dev] [PATCH] datapath: Properly initialize ovs_skb_cb of packet from userspace.

Ben Pfaff blp at nicira.com
Sat Feb 19 05:01:18 UTC 2011


I pushed this, thanks.

On Fri, Feb 18, 2011 at 5:53 PM, Justin Pettit <jpettit at nicira.com> wrote:
> Looks good to me.  Thanks for tracking this down!
>
> Acked-by: Justin Pettit <jpettit at nicira.com>
>
> --Justin
>
>
> On Feb 18, 2011, at 4:10 PM, Ben Pfaff wrote:
>
>> The ovs_skb_cb in 'packet' in this function is initially a clone of the
>> corresponding area in 'skb', which came from the Netlink layer and thus
>> isn't necessarily all-zeros.  This commit initializes it properly before
>> passing it along to execute_actions().
>>
>> The most common problem caused by failing to initialize the ovs_skb_cb
>> properly was that on Linux 2.6.26 and earlier, where Open vSwitch keeps
>> its own vlan_tci field inside ovs_skb_cb, the first packet of a flow would
>> get sent out tagged with a random VLAN (usually 0x0001 or 0xffff in our
>> testing).  This commit should fix that problem.
>>
>> Another likely problem would be for turning on sFlow to randomly panic the
>> kernel.  That problem would not be kernel version dependent.  We haven't
>> been testing sFlow so we haven't noticed this problem.
>>
>> Signed-off-by: Ben Pfaff <blp at nicira.com>
>> Reported-by: Pankaj Thakkar <thakkar at nicira.com>
>> ---
>> datapath/datapath.c |    9 +++++++++
>> 1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/datapath/datapath.c b/datapath/datapath.c
>> index 940a581..dcff05f 100644
>> --- a/datapath/datapath.c
>> +++ b/datapath/datapath.c
>> @@ -709,6 +709,15 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
>>       if (err)
>>               goto exit;
>>
>> +     /* Initialize OVS_CB (it came from Netlink so might not be zeroed). */
>> +     OVS_CB(packet)->vport = NULL;
>> +     OVS_CB(packet)->flow = NULL;
>> +     /* execute_actions() will reset tun_id to 0 anyhow. */
>> +#ifdef NEED_CSUM_NORMALIZE
>> +     OVS_CB(packet)->ip_summed = OVS_CSUM_NONE;
>> +#endif
>> +     vlan_copy_skb_tci(packet);
>> +
>>       rcu_read_lock();
>>       dp = get_dp(odp_header->dp_ifindex);
>>       err = -ENODEV;
>> --
>> 1.7.1
>>
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>
>



-- 
"I don't normally do acked-by's.  I think it's my way of avoiding
getting blamed when it all blows up."               Andrew Morton




More information about the dev mailing list