Skip to content
  • Yi-Hung Wei's avatar
    ofproto: Add ref counting for variable length mf_fields. · 5c7c16d8
    Yi-Hung Wei authored
    Currently, a controller may potentially trigger a segmentation fault if it
    accidentally removes a TLV mapping that is still used by an active flow.
    To resolve this issue, in this patch, we maintain reference counting for each
    dynamically allocated variable length mf_fields, so that vswitchd can use this
    information to properly remove a TLV mapping, and to return an error if the
    controller tries to remove a TLV mapping that is still used by any active flow.
    
    To keep track of the usage of tun_metadata for each flow, two 'uint64_t'
    bitmaps are introduce for the flow match and flow action respectively. We use
    'uint64_t' as a bitmap since the 64 geneve TLV tunnel metadata are the only
    available variable length mf_fields for now. We shall adopt general bitmap when
    more variable length mf_fields are introduced. The bitmaps are configured
    during the flow decoding process, and vswitchd use these bitmaps to increase or
    decrease the ref counting when the flow is created or deleted.
    
    VMWare-BZ: #1768370
    Fixes: 04f48a68
    
     ("ofp-actions: Fix variable length meta-flow OXMs.")
    Suggested-by: default avatarJarno Rajahalme <jarno@ovn.org>
    Suggested-by: default avatarJoe Stringer <joe@ovn.org>
    Signed-off-by: default avatarYi-Hung Wei <yihung.wei@gmail.com>
    Signed-off-by: default avatarJoe Stringer <joe@ovn.org>
    5c7c16d8