X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fdatapath.c;h=e0b0e2c26d861ee541face2b094e5f1df73b65e9;hb=a4fbb689b03ad18651ee119ba5ce0ff8cf8d95b5;hp=14602152cb80b9f8ff57a4fc47f8b65fb86c6b39;hpb=6fa58f7a1533b96d8c958581ed18e0e5a245157b;p=openvswitch diff --git a/datapath/datapath.c b/datapath/datapath.c index 14602152..e0b0e2c2 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -783,7 +783,8 @@ static int validate_actions(const struct sw_flow_actions *actions) break; case ODPAT_SET_VLAN_PCP: - if (a->vlan_pcp.vlan_pcp & ~VLAN_PCP_MASK) + if (a->vlan_pcp.vlan_pcp + & ~(VLAN_PCP_MASK >> VLAN_PCP_SHIFT)) return -EINVAL; break; @@ -1127,6 +1128,7 @@ static int do_execute(struct datapath *dp, const struct odp_execute *executep) struct odp_flow_key key; struct sk_buff *skb; struct sw_flow_actions *actions; + struct ethhdr *eth; int err; err = -EFAULT; @@ -1166,6 +1168,17 @@ static int do_execute(struct datapath *dp, const struct odp_execute *executep) execute.length)) goto error_free_skb; + skb_reset_mac_header(skb); + eth = eth_hdr(skb); + + /* Normally, setting the skb 'protocol' field would be handled by a + * call to eth_type_trans(), but it assumes there's a sending + * device, which we may not have. */ + if (ntohs(eth->h_proto) >= 1536) + skb->protocol = eth->h_proto; + else + skb->protocol = htons(ETH_P_802_2); + flow_extract(skb, execute.in_port, &key); err = execute_actions(dp, skb, &key, actions->actions, actions->n_actions, GFP_KERNEL);