From: Justin Pettit Date: Mon, 1 Jul 2013 17:43:18 +0000 (-0700) Subject: odp-util: Always encode mask of 0xffff for dl_type < ETH_TYPE_MIN. X-Git-Tag: sliver-openvswitch-1.10.90-3~4^2~4 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=48432528a53a276d4c75d40bf911ce8c0a24fe66 odp-util: Always encode mask of 0xffff for dl_type < ETH_TYPE_MIN. For non-Ethernet II packets, we don't set an EtherType netlink attribute and set the Ethertype mask attribute to 0xffff. The code was encoding whatever mask was passed in, which could lead to bugs if the caller didn't know the userspace-kernel interface. Found by inspection. Signed-off-by: Justin Pettit Acked-by: Andy Zhou --- diff --git a/lib/odp-util.c b/lib/odp-util.c index 14994a911..c05664c64 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -2373,7 +2373,7 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct flow *data, * 802.3 SNAP packet with valid eth_type). */ if (is_mask) { - nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, data->dl_type); + nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(UINT16_MAX)); } goto unencap; }