Lines Matching defs:key
120 sizeof((match)->key->field), is_mask); \
122 (match)->mask->key.field = value; \
124 (match)->key->field = value; \
131 memcpy((u8 *)&(match)->mask->key + offset, value_p, \
134 memcpy((u8 *)(match)->key + offset, value_p, len); \
144 sizeof((match)->key->field), is_mask); \
146 memset((u8 *)&(match)->mask->key.field, value, \
147 sizeof((match)->mask->key.field)); \
149 memset((u8 *)&(match)->key->field, value, \
150 sizeof((match)->key->field)); \
157 u64 mask_allowed = key_attrs; /* At most allow all key attributes */
181 /* Check key attributes. */
182 if (match->key->eth.type == htons(ETH_P_ARP)
183 || match->key->eth.type == htons(ETH_P_RARP)) {
185 if (match->mask && (match->mask->key.eth.type == htons(0xffff)))
189 if (eth_p_mpls(match->key->eth.type)) {
191 if (match->mask && (match->mask->key.eth.type == htons(0xffff)))
195 if (match->key->eth.type == htons(ETH_P_IP)) {
197 if (match->mask && match->mask->key.eth.type == htons(0xffff)) {
202 if (match->key->ip.frag != OVS_FRAG_TYPE_LATER) {
203 if (match->key->ip.proto == IPPROTO_UDP) {
205 if (match->mask && (match->mask->key.ip.proto == 0xff))
209 if (match->key->ip.proto == IPPROTO_SCTP) {
211 if (match->mask && (match->mask->key.ip.proto == 0xff))
215 if (match->key->ip.proto == IPPROTO_TCP) {
218 if (match->mask && (match->mask->key.ip.proto == 0xff)) {
224 if (match->key->ip.proto == IPPROTO_ICMP) {
226 if (match->mask && (match->mask->key.ip.proto == 0xff))
232 if (match->key->eth.type == htons(ETH_P_IPV6)) {
234 if (match->mask && match->mask->key.eth.type == htons(0xffff)) {
239 if (match->key->ip.frag != OVS_FRAG_TYPE_LATER) {
240 if (match->key->ip.proto == IPPROTO_UDP) {
242 if (match->mask && (match->mask->key.ip.proto == 0xff))
246 if (match->key->ip.proto == IPPROTO_SCTP) {
248 if (match->mask && (match->mask->key.ip.proto == 0xff))
252 if (match->key->ip.proto == IPPROTO_TCP) {
255 if (match->mask && (match->mask->key.ip.proto == 0xff)) {
261 if (match->key->ip.proto == IPPROTO_ICMPV6) {
263 if (match->mask && (match->mask->key.ip.proto == 0xff))
266 if (match->key->tp.src ==
268 match->key->tp.src == htons(NDISC_NEIGHBOUR_ADVERTISEMENT)) {
272 * in the key, so both are not allowed
276 if (match->mask && (match->mask->key.tp.src == htons(0xff)))
283 if (match->key->eth.type == htons(ETH_P_NSH)) {
286 match->mask->key.eth.type == htons(0xffff)) {
293 OVS_NLERR(log, "Missing key (keys=%llx, expected=%llx)",
484 OVS_NLERR(log, "Duplicate key (type %d).", type);
528 if (nla_len(a) > sizeof(match->key->tun_opts)) {
530 nla_len(a), sizeof(match->key->tun_opts));
549 * both the key and mask while parsing the
550 * attributes (and by extension assumes the key
558 if (match->key->tun_opts_len != nla_len(a)) {
560 match->key->tun_opts_len, nla_len(a));
582 BUILD_BUG_ON(sizeof(opts) > sizeof(match->key->tun_opts));
636 sizeof(match->key->tun_opts));
638 if (nla_len(a) > sizeof(match->key->tun_opts)) {
640 nla_len(a), sizeof(match->key->tun_opts));
814 if (match->key->tun_key.u.ipv4.src ||
815 match->key->tun_key.u.ipv4.dst ||
816 match->key->tun_key.tp_src ||
817 match->key->tun_key.tp_dst ||
818 match->key->tun_key.ttl ||
819 match->key->tun_key.tos ||
824 } else if (!match->key->tun_key.u.ipv4.dst) {
829 if (ipv6 && ipv6_addr_any(&match->key->tun_key.u.ipv6.dst)) {
957 return __ip_tun_to_nlattr(skb, &tun_info->key,
1030 bool encap_valid = !!(match->key->eth.vlan.tci &
1032 bool i_encap_valid = !!(match->key->eth.cvlan.tci &
1113 encap_valid = !!(match->key->eth.vlan.tci & htons(VLAN_CFI_MASK));
1255 sizeof(match->key->ipv6.ct_orig.src),
1258 sizeof(match->key->ipv6.ct_orig.dst),
1534 } else if (!match->key->eth.type) {
1591 sizeof(match->key->ipv6.addr.src),
1595 sizeof(match->key->ipv6.addr.dst),
1719 sizeof(match->key->ipv6.nd.target),
1729 OVS_NLERR(log, "Unknown key attributes %llx",
1761 * ovs_nla_get_match - parses Netlink attributes into a flow key and
1803 * in 'match->key'. We cannot simply memset
1805 * specified in 'match->key' should be left to 0.
1807 * copied from 'key' and set to 0xff.
1822 if (match->key->tun_proto)
1886 const struct sw_flow_key *key, bool log)
1893 /* If UFID was not provided, use unmasked key. */
1897 memcpy(new_key, key, sizeof(*key));
1909 * ovs_nla_get_flow_metadata - parses Netlink attributes into a flow key.
1911 * @key: Receives extracted in_port, priority, tun_key, skb_mark and conntrack
1920 * This parses a series of Netlink attributes that form a flow key, which must
1922 * get the metadata, that is, the parts of the flow key that cannot be
1925 * This must be called before the packet key fields are filled in 'key'.
1930 u64 attrs, struct sw_flow_key *key, bool log)
1935 match.key = key;
1937 key->ct_state = 0;
1938 key->ct_zone = 0;
1939 key->ct_orig_proto = 0;
1940 memset(&key->ct, 0, sizeof(key->ct));
1941 memset(&key->ipv4.ct_orig, 0, sizeof(key->ipv4.ct_orig));
1942 memset(&key->ipv6.ct_orig, 0, sizeof(key->ipv6.ct_orig));
1944 key->phy.in_port = DP_MAX_PORTS;
2065 * OVS_KEY_ATTR_ETHERTYPE in the flow key attribute, and
2265 return ovs_nla_put_key(&flow->key, &flow->key,
2272 return ovs_nla_put_key(&flow->key, &flow->mask->key,
2515 const struct sw_flow_key *key,
2522 const struct sw_flow_key *key,
2576 err = __ovs_nla_copy_actions(net, actions, key, sfa,
2590 const struct sw_flow_key *key,
2626 err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type,
2639 const struct sw_flow_key *key,
2662 err = __ovs_nla_copy_actions(net, attr, key, sfa,
2674 struct sw_flow_key *key,
2679 match->key = key;
2683 memset(key, 0, sizeof(*key));
2686 memset(&mask->key, 0, sizeof(mask->key));
2691 static int validate_geneve_opts(struct sw_flow_key *key)
2694 int opts_len = key->tun_opts_len;
2697 option = (struct geneve_opt *)TUN_METADATA_OPTS(key, key->tun_opts_len);
2714 key->tun_key.tun_flags |= crit_opt ? TUNNEL_CRIT_OPT : 0;
2723 struct sw_flow_key key;
2732 ovs_match_init(&match, &key, true, NULL);
2737 if (key.tun_opts_len) {
2740 err = validate_geneve_opts(&key);
2758 tun_dst = metadata_dst_alloc(key.tun_opts_len, METADATA_IP_TUNNEL,
2782 if (key.tun_proto == AF_INET6)
2784 else if (key.tun_proto == AF_INET && key.tun_key.u.ipv4.dst == 0)
2786 tun_info->key = key.tun_key;
2793 TUN_METADATA_OPTS(&key, key.tun_opts_len),
2794 key.tun_opts_len, dst_opt_type);
2804 struct sw_flow_key key;
2807 ovs_match_init(&match, &key, true, NULL);
2836 /* There can be only one key in a action */
3029 const struct sw_flow_key *key,
3080 err = __ovs_nla_copy_actions(net, acts_if_lesser_eq, key, sfa,
3094 err = __ovs_nla_copy_actions(net, acts_if_greater, key, sfa,
3121 const struct sw_flow_key *key,
3127 u8 mac_proto = ovs_key_mac_proto(key);
3307 err = validate_set(a, key, sfa,
3315 err = validate_set(a, key, sfa,
3325 err = validate_and_copy_sample(net, a, key, sfa,
3336 err = ovs_ct_copy_action(net, a, key, sfa, log);
3379 inner_proto = tun_p_to_eth_p(key->nsh.base.np);
3382 if (key->nsh.base.np == TUN_P_ETHERNET)
3396 err = validate_and_copy_clone(net, a, key, sfa,
3409 err = validate_and_copy_check_pkt_len(net, a, key, sfa,
3422 err = validate_and_copy_dec_ttl(net, a, key, sfa,
3448 /* 'key' must be the masked key. */
3450 const struct sw_flow_key *key,
3460 if (eth_p_mpls(key->eth.type))
3461 mpls_label_count = hweight_long(key->mpls.num_labels_mask);
3464 err = __ovs_nla_copy_actions(net, attr, key, sfa, key->eth.type,
3465 key->eth.vlan.tci, mpls_label_count, log,
3663 err = ip_tun_to_nlattr(skb, &tun_info->key,