X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fflow.c;h=9a94d0ba8d28971e5430e9bdc3dbc1c0657a03b9;hb=883b106184656ff004f15c7872de31433918c94f;hp=b2de023408a5496e979dfe89e86feb696e697d33;hpb=58fda1dab104041fc693032475ec4662c1a52849;p=openvswitch diff --git a/datapath/flow.c b/datapath/flow.c index b2de0234..9a94d0ba 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -1,12 +1,13 @@ /* * Distributed under the terms of the GNU GPL version 2. - * Copyright (c) 2007, 2008, 2009 Nicira Networks. + * Copyright (c) 2007, 2008, 2009, 2010 Nicira Networks. * * Significant portions of this file may be copied from parts of the Linux * kernel, by Linus Torvalds and others. */ #include "flow.h" +#include "datapath.h" #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include #include "compat.h" @@ -231,6 +233,7 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) struct vlan_hdr *vh = (struct vlan_hdr*)(skb->data + nh_ofs); key->dl_type = vh->h_vlan_encapsulated_proto; key->dl_vlan = vh->h_vlan_TCI & htons(VLAN_VID_MASK); + key->dl_vlan_pcp = (ntohs(vh->h_vlan_TCI) & VLAN_PCP_MASK) >> VLAN_PCP_SHIFT; nh_ofs += sizeof(struct vlan_hdr); } memcpy(key->dl_src, eth->h_source, ETH_ALEN); @@ -243,6 +246,7 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) int th_ofs = nh_ofs + nh->ihl * 4; key->nw_src = nh->saddr; key->nw_dst = nh->daddr; + key->nw_tos = nh->tos & ~INET_ECN_MASK; key->nw_proto = nh->protocol; skb_set_transport_header(skb, th_ofs); @@ -293,7 +297,7 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) arp = (struct arp_eth_header *)skb_network_header(skb); - if (arp->ar_hrd == htons(1) + if (arp->ar_hrd == htons(ARPHRD_ETHER) && arp->ar_pro == htons(ETH_P_IP) && arp->ar_hln == ETH_ALEN && arp->ar_pln == 4) {