mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 22:35:15 +00:00
odp-util: Always export the priority and skb_mark netlink attributes.
The current Netlink protocol allows a default value of zero if either mark or priority is not specified (this is part of the ABI). Until now, when userspace serializes either the value or mask, it looked at the value and omitted the netlink attribute if it is zero. This is a bug because an exact match on zero turns into a wildcard of the field. These two fields (plus input port and EtherType) are special because they can be omitted whereas most other values are required to be fully specified. These protocol variations tend to cause bugs (as above) when we evolve the protocol because an exception that makes sense in one context might not be logical in another. Since the default value for mark and priority are merely shorthands, we can push the protocol in a more consistent direction by ignoring the shortcut and always serializing the values. This is what this commits does. Signed-off-by: Andy Zhou <azhou@nicira.com> [blp@nicira.com added Jesse's text to the commit message] Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -2355,17 +2355,13 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct flow *data,
|
||||
* treat 'data' as a mask. */
|
||||
is_mask = (data != flow);
|
||||
|
||||
if (flow->skb_priority) {
|
||||
nl_msg_put_u32(buf, OVS_KEY_ATTR_PRIORITY, data->skb_priority);
|
||||
}
|
||||
nl_msg_put_u32(buf, OVS_KEY_ATTR_PRIORITY, data->skb_priority);
|
||||
|
||||
if (flow->tunnel.ip_dst || is_mask) {
|
||||
tun_key_to_attr(buf, &data->tunnel);
|
||||
}
|
||||
|
||||
if (flow->skb_mark) {
|
||||
nl_msg_put_u32(buf, OVS_KEY_ATTR_SKB_MARK, data->skb_mark);
|
||||
}
|
||||
nl_msg_put_u32(buf, OVS_KEY_ATTR_SKB_MARK, data->skb_mark);
|
||||
|
||||
/* Add an ingress port attribute if this is a mask or 'odp_in_port'
|
||||
* is not the magical value "ODPP_NONE". */
|
||||
|
Reference in New Issue
Block a user