[ovs-discuss] Why the IP is not parsed in function parse_8021q_onward

openvswitcher openvswitcher at 163.com
Fri Sep 18 05:04:08 UTC 2015


Hi, all


I  read the source in kernel mode, the function named 'ovs_nla_put_flow', and I see when the eth.type is ETH_P_8021Q 
but eth.tci is 0, the OVS_KEY_ATTR_ENCAP field will only have a header but no nested fields.
But I don't think this is one correct case because I think if the eth.type is ETH_P_8021Q the tci should not be 0.
Even if the case exists, I think we should also parse the IP and Transport Level header instead of "goto unencap" directly.


Could you explain why?
Looking forward for your reply. Thanks.






int ovs_nla_put_flow(const struct sw_flow_key *swkey,
     const struct sw_flow_key *output, struct sk_buff *skb)
{


        (...skip....)
if (swkey->eth.tci || swkey->eth.type == htons(ETH_P_8021Q)) {
__be16 eth_type;
eth_type = !is_mask ? htons(ETH_P_8021Q) : htons(0xffff);
if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, eth_type) ||
    nla_put_be16(skb, OVS_KEY_ATTR_VLAN, output->eth.tci))
goto nla_put_failure;
encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP);
if (!swkey->eth.tci)
goto unencap;
} else
encap = NULL;
        (...skip....)
unencap:
if (encap)
nla_nest_end(skb, encap);


return 0;


nla_put_failure:
return -EMSGSIZE;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20150918/00a0c151/attachment-0002.html>


More information about the discuss mailing list