From bf062576fd748fc526903c428ffa847032a7b1d0 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 20 Feb 2014 11:11:00 +0900 Subject: [PATCH] ofp-util: Avoid gcc warning on NetBSD Avoid the following warning caused by the combination of NetBSD's htons implementation and gcc bug. Now --enable-Werror build succeeds on NetBSD-6. lib/ofp-util.c: In function 'ofputil_match_from_ofp10_match': lib/ofp-util.c:174:15: error: integer overflow in expression Signed-off-by: YAMAMOTO Takashi Signed-off-by: Ben Pfaff --- lib/ofp-util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index aa25e67b5..fca18deed 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -169,9 +169,11 @@ ofputil_match_from_ofp10_match(const struct ofp10_match *ofmatch, match->wc.masks.vlan_tci = htons(0xffff); } else { ovs_be16 vid, pcp, tci; + uint16_t hpcp; vid = ofmatch->dl_vlan & htons(VLAN_VID_MASK); - pcp = htons((ofmatch->dl_vlan_pcp << VLAN_PCP_SHIFT) & VLAN_PCP_MASK); + hpcp = (ofmatch->dl_vlan_pcp << VLAN_PCP_SHIFT) & VLAN_PCP_MASK; + pcp = htons(hpcp); tci = vid | pcp | htons(VLAN_CFI); match->flow.vlan_tci = tci & match->wc.masks.vlan_tci; } -- 2.43.0