Lines Matching defs:key
122 sizeof((match)->key->field), is_mask); \
124 (match)->mask->key.field = value; \
126 (match)->key->field = value; \
133 memcpy((u8 *)&(match)->mask->key + offset, value_p, \
136 memcpy((u8 *)(match)->key + offset, value_p, len); \
146 sizeof((match)->key->field), is_mask); \
148 memset((u8 *)&(match)->mask->key.field, value, \
149 sizeof((match)->mask->key.field)); \
151 memset((u8 *)&(match)->key->field, value, \
152 sizeof((match)->key->field)); \
159 u64 mask_allowed = key_attrs; /* At most allow all key attributes */
183 /* Check key attributes. */
184 if (match->key->eth.type == htons(ETH_P_ARP)
185 || match->key->eth.type == htons(ETH_P_RARP)) {
187 if (match->mask && (match->mask->key.eth.type == htons(0xffff)))
191 if (eth_p_mpls(match->key->eth.type)) {
193 if (match->mask && (match->mask->key.eth.type == htons(0xffff)))
197 if (match->key->eth.type == htons(ETH_P_IP)) {
199 if (match->mask && match->mask->key.eth.type == htons(0xffff)) {
204 if (match->key->ip.frag != OVS_FRAG_TYPE_LATER) {
205 if (match->key->ip.proto == IPPROTO_UDP) {
207 if (match->mask && (match->mask->key.ip.proto == 0xff))
211 if (match->key->ip.proto == IPPROTO_SCTP) {
213 if (match->mask && (match->mask->key.ip.proto == 0xff))
217 if (match->key->ip.proto == IPPROTO_TCP) {
220 if (match->mask && (match->mask->key.ip.proto == 0xff)) {
226 if (match->key->ip.proto == IPPROTO_ICMP) {
228 if (match->mask && (match->mask->key.ip.proto == 0xff))
234 if (match->key->eth.type == htons(ETH_P_IPV6)) {
236 if (match->mask && match->mask->key.eth.type == htons(0xffff)) {
241 if (match->key->ip.frag != OVS_FRAG_TYPE_LATER) {
242 if (match->key->ip.proto == IPPROTO_UDP) {
244 if (match->mask && (match->mask->key.ip.proto == 0xff))
248 if (match->key->ip.proto == IPPROTO_SCTP) {
250 if (match->mask && (match->mask->key.ip.proto == 0xff))
254 if (match->key->ip.proto == IPPROTO_TCP) {
257 if (match->mask && (match->mask->key.ip.proto == 0xff)) {
263 if (match->key->ip.proto == IPPROTO_ICMPV6) {
265 if (match->mask && (match->mask->key.ip.proto == 0xff))
268 if (match->key->tp.src ==
270 match->key->tp.src == htons(NDISC_NEIGHBOUR_ADVERTISEMENT)) {
274 * in the key, so both are not allowed
278 if (match->mask && (match->mask->key.tp.src == htons(0xff)))
285 if (match->key->eth.type == htons(ETH_P_NSH)) {
288 match->mask->key.eth.type == htons(0xffff)) {
295 OVS_NLERR(log, "Missing key (keys=%llx, expected=%llx)",
496 OVS_NLERR(log, "Duplicate key (type %d).", type);
540 if (nla_len(a) > sizeof(match->key->tun_opts)) {
542 nla_len(a), sizeof(match->key->tun_opts));
561 * both the key and mask while parsing the
562 * attributes (and by extension assumes the key
570 if (match->key->tun_opts_len != nla_len(a)) {
572 match->key->tun_opts_len, nla_len(a));
594 BUILD_BUG_ON(sizeof(opts) > sizeof(match->key->tun_opts));
648 sizeof(match->key->tun_opts));
650 if (nla_len(a) > sizeof(match->key->tun_opts)) {
652 nla_len(a), sizeof(match->key->tun_opts));
826 if (match->key->tun_key.u.ipv4.src ||
827 match->key->tun_key.u.ipv4.dst ||
828 match->key->tun_key.tp_src ||
829 match->key->tun_key.tp_dst ||
830 match->key->tun_key.ttl ||
831 match->key->tun_key.tos ||
836 } else if (!match->key->tun_key.u.ipv4.dst) {
841 if (ipv6 && ipv6_addr_any(&match->key->tun_key.u.ipv6.dst)) {
969 return __ip_tun_to_nlattr(skb, &tun_info->key,
1042 bool encap_valid = !!(match->key->eth.vlan.tci &
1044 bool i_encap_valid = !!(match->key->eth.cvlan.tci &
1125 encap_valid = !!(match->key->eth.vlan.tci & htons(VLAN_CFI_MASK));
1267 sizeof(match->key->ipv6.ct_orig.src),
1270 sizeof(match->key->ipv6.ct_orig.dst),
1546 } else if (!match->key->eth.type) {
1603 sizeof(match->key->ipv6.addr.src),
1607 sizeof(match->key->ipv6.addr.dst),
1742 sizeof(match->key->ipv6.nd.target),
1752 OVS_NLERR(log, "Unknown key attributes %llx",
1784 * ovs_nla_get_match - parses Netlink attributes into a flow key and
1826 * in 'match->key'. We cannot simply memset
1828 * specified in 'match->key' should be left to 0.
1830 * copied from 'key' and set to 0xff.
1845 if (match->key->tun_proto)
1909 const struct sw_flow_key *key, bool log)
1916 /* If UFID was not provided, use unmasked key. */
1920 memcpy(new_key, key, sizeof(*key));
1932 * ovs_nla_get_flow_metadata - parses Netlink attributes into a flow key.
1934 * @key: Receives extracted in_port, priority, tun_key, skb_mark and conntrack
1943 * This parses a series of Netlink attributes that form a flow key, which must
1945 * get the metadata, that is, the parts of the flow key that cannot be
1948 * This must be called before the packet key fields are filled in 'key'.
1953 u64 attrs, struct sw_flow_key *key, bool log)
1958 match.key = key;
1960 key->ct_state = 0;
1961 key->ct_zone = 0;
1962 key->ct_orig_proto = 0;
1963 memset(&key->ct, 0, sizeof(key->ct));
1964 memset(&key->ipv4.ct_orig, 0, sizeof(key->ipv4.ct_orig));
1965 memset(&key->ipv6.ct_orig, 0, sizeof(key->ipv6.ct_orig));
1967 key->phy.in_port = DP_MAX_PORTS;
2088 * OVS_KEY_ATTR_ETHERTYPE in the flow key attribute, and
2296 return ovs_nla_put_key(&flow->key, &flow->key,
2303 return ovs_nla_put_key(&flow->key, &flow->mask->key,
2546 const struct sw_flow_key *key,
2553 const struct sw_flow_key *key,
2607 err = __ovs_nla_copy_actions(net, actions, key, sfa,
2621 const struct sw_flow_key *key,
2640 OVS_NLERR(log, "Duplicate or invalid key (type %d).",
2667 err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type,
2680 const struct sw_flow_key *key,
2703 err = __ovs_nla_copy_actions(net, attr, key, sfa,
2715 struct sw_flow_key *key,
2720 match->key = key;
2724 memset(key, 0, sizeof(*key));
2727 memset(&mask->key, 0, sizeof(mask->key));
2732 static int validate_geneve_opts(struct sw_flow_key *key)
2735 int opts_len = key->tun_opts_len;
2738 option = (struct geneve_opt *)TUN_METADATA_OPTS(key, key->tun_opts_len);
2755 key->tun_key.tun_flags |= crit_opt ? TUNNEL_CRIT_OPT : 0;
2764 struct sw_flow_key key;
2773 ovs_match_init(&match, &key, true, NULL);
2778 if (key.tun_opts_len) {
2781 err = validate_geneve_opts(&key);
2799 tun_dst = metadata_dst_alloc(key.tun_opts_len, METADATA_IP_TUNNEL,
2823 if (key.tun_proto == AF_INET6)
2825 else if (key.tun_proto == AF_INET && key.tun_key.u.ipv4.dst == 0)
2827 tun_info->key = key.tun_key;
2834 TUN_METADATA_OPTS(&key, key.tun_opts_len),
2835 key.tun_opts_len, dst_opt_type);
2845 struct sw_flow_key key;
2848 ovs_match_init(&match, &key, true, NULL);
2877 /* There can be only one key in a action */
3070 const struct sw_flow_key *key,
3121 err = __ovs_nla_copy_actions(net, acts_if_lesser_eq, key, sfa,
3135 err = __ovs_nla_copy_actions(net, acts_if_greater, key, sfa,
3162 const struct sw_flow_key *key,
3168 u8 mac_proto = ovs_key_mac_proto(key);
3351 err = validate_set(a, key, sfa,
3359 err = validate_set(a, key, sfa,
3369 err = validate_and_copy_sample(net, a, key, sfa,
3380 err = ovs_ct_copy_action(net, a, key, sfa, log);
3423 inner_proto = tun_p_to_eth_p(key->nsh.base.np);
3426 if (key->nsh.base.np == TUN_P_ETHERNET)
3440 err = validate_and_copy_clone(net, a, key, sfa,
3453 err = validate_and_copy_check_pkt_len(net, a, key, sfa,
3466 err = validate_and_copy_dec_ttl(net, a, key, sfa,
3497 /* 'key' must be the masked key. */
3499 const struct sw_flow_key *key,
3509 if (eth_p_mpls(key->eth.type))
3510 mpls_label_count = hweight_long(key->mpls.num_labels_mask);
3513 err = __ovs_nla_copy_actions(net, attr, key, sfa, key->eth.type,
3514 key->eth.vlan.tci, mpls_label_count, log,
3712 err = ip_tun_to_nlattr(skb, &tun_info->key,