示例#1
0
文件: flow.c 项目: TCSOpenVSwitch/ovs
int ovs_flow_key_extract(const struct ovs_tunnel_info *tun_info,
			 struct sk_buff *skb, struct sw_flow_key *key)
{
	/* Extract metadata from packet. */
	if (tun_info) {
		memcpy(&key->tun_key, &tun_info->tunnel, sizeof(key->tun_key));

		BUILD_BUG_ON(((1 << (sizeof(tun_info->options_len) * 8)) - 1) >
			     sizeof(key->tun_opts));

		if (tun_info->options) {
			memcpy(GENEVE_OPTS(key, tun_info->options_len),
			       tun_info->options, tun_info->options_len);
			key->tun_opts_len = tun_info->options_len;
		} else {
			key->tun_opts_len = 0;
		}
	} else {
		key->tun_opts_len = 0;
		memset(&key->tun_key, 0, sizeof(key->tun_key));
	}

	key->phy.priority = skb->priority;
	key->phy.in_port = OVS_CB(skb)->input_vport->port_no;
	key->phy.skb_mark = skb->mark;
	key->ovs_flow_hash = 0;
	key->recirc_id = 0;

	return key_extract(skb, key);
}
示例#2
0
int ovs_flow_key_extract_recirc(u32 recirc_id,
				const struct sw_flow_key *key,
				struct sk_buff *skb,
				struct sw_flow_key *new_key)
{
	memset(new_key, 0, sizeof(*new_key));
	memcpy(new_key, key, OVS_SW_FLOW_KEY_METADATA_SIZE);
	new_key->recirc_id = recirc_id;
	return key_extract(skb, new_key);
}
示例#3
0
文件: flow.c 项目: TCSOpenVSwitch/ovs
int ovs_flow_key_extract_userspace(const struct nlattr *attr,
				   struct sk_buff *skb,
				   struct sw_flow_key *key, bool log)
{
	int err;

	/* Extract metadata from netlink attributes. */
	err = ovs_nla_get_flow_metadata(attr, key, log);
	if (err)
		return err;

	return key_extract(skb, key);
}
示例#4
0
int ovs_flow_key_extract(struct sk_buff *skb, struct sw_flow_key *key)
{
	/* Extract metadata from packet. */

	memset(key, 0, sizeof(*key));
	if (OVS_CB(skb)->tun_key)
		memcpy(&key->tun_key, OVS_CB(skb)->tun_key, sizeof(key->tun_key));

	key->phy.priority = skb->priority;
	key->phy.in_port = OVS_CB(skb)->input_vport->port_no;
	key->phy.skb_mark = skb->mark;

	return key_extract(skb, key);
}
示例#5
0
文件: flow.c 项目: 19Dan01/linux
int ovs_flow_key_extract_userspace(const struct nlattr *attr,
				   struct sk_buff *skb,
				   struct sw_flow_key *key, bool log)
{
	int err;

	memset(key, 0, OVS_SW_FLOW_KEY_METADATA_SIZE);

	/* Extract metadata from netlink attributes. */
	err = ovs_nla_get_flow_metadata(attr, key, log);
	if (err)
		return err;

	return key_extract(skb, key);
}
示例#6
0
文件: flow.c 项目: TCSOpenVSwitch/ovs
int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key)
{
	return key_extract(skb, key);
}
示例#7
0
 bool operator()(const Value& lhs, const Value& rhs) const
 {
    KeyOfValue key_extract;
    return Compare::operator()(key_extract(lhs), key_extract(rhs));
 }