History

openvswitch: Add support for matching on OAM packets.

Some tunnel formats have mechanisms for indicating that packets are OAM frames that should be handled specially (either as high priority or not forwarded beyond an endpoint). This provides support for allowing those types of packets to be matched.

Jesse Gross committed 12 years ago

Commit 67fa0341 parent 07148123 files · +14 −5Browse files

Unified · Split

3 files
  1. include/uapi/linux/openvswitch.h +1 −0
  2. net/openvswitch/datapath.c +1 −0
  3. net/openvswitch/flow_netlink.c +12 −5
include/uapi/linux/openvswitch.h+1−0
@@ -309,6 +309,7 @@ enum ovs_tunnel_key_attr { · 308 unmodified lines
309309 OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */
310310 OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */
311311 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
312+ OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */
312313 __OVS_TUNNEL_KEY_ATTR_MAX
313314 };
314315
net/openvswitch/datapath.c+1−0
@@ -369,6 +369,7 @@ static size_t key_attr_size(void) · 368 unmodified lines
369369 + nla_total_size(1) /* OVS_TUNNEL_KEY_ATTR_TTL */
370370 + nla_total_size(0) /* OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT */
371371 + nla_total_size(0) /* OVS_TUNNEL_KEY_ATTR_CSUM */
372+ + nla_total_size(0) /* OVS_TUNNEL_KEY_ATTR_OAM */
372373 + nla_total_size(4) /* OVS_KEY_ATTR_IN_PORT */
373374 + nla_total_size(4) /* OVS_KEY_ATTR_SKB_MARK */
374375 + nla_total_size(12) /* OVS_KEY_ATTR_ETHERNET */
net/openvswitch/flow_netlink.c+12−5
@@ -346,6 +346,7 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr, · 345 unmodified lines
346346 [OVS_TUNNEL_KEY_ATTR_TTL] = 1,
347347 [OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT] = 0,
348348 [OVS_TUNNEL_KEY_ATTR_CSUM] = 0,
349+ [OVS_TUNNEL_KEY_ATTR_OAM] = 0,
349350 };
350351
351352 if (type > OVS_TUNNEL_KEY_ATTR_MAX) {
@@ -390,6 +391,9 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr, · 38 unmodified lines
390391 case OVS_TUNNEL_KEY_ATTR_CSUM:
391392 tun_flags |= TUNNEL_CSUM;
392393 break;
394+ case OVS_TUNNEL_KEY_ATTR_OAM:
395+ tun_flags |= TUNNEL_OAM;
396+ break;
393397 default:
394398 return -EINVAL;
395399 }
@@ -431,21 +435,24 @@ static int ipv4_tun_to_nlattr(struct sk_buff *skb, · 35 unmodified lines
431435 nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id))
432436 return -EMSGSIZE;
433437 if (output->ipv4_src &&
434− nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_IPV4_SRC, output->ipv4_src))
438+ nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_IPV4_SRC, output->ipv4_src))
435439 return -EMSGSIZE;
436440 if (output->ipv4_dst &&
437− nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_IPV4_DST, output->ipv4_dst))
441+ nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_IPV4_DST, output->ipv4_dst))
438442 return -EMSGSIZE;
439443 if (output->ipv4_tos &&
440− nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->ipv4_tos))
444+ nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->ipv4_tos))
441445 return -EMSGSIZE;
442446 if (nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TTL, output->ipv4_ttl))
443447 return -EMSGSIZE;
444448 if ((output->tun_flags & TUNNEL_DONT_FRAGMENT) &&
445− nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT))
449+ nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT))
446450 return -EMSGSIZE;
447451 if ((output->tun_flags & TUNNEL_CSUM) &&
448− nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_CSUM))
452+ nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_CSUM))
453+ return -EMSGSIZE;
454+ if ((output->tun_flags & TUNNEL_OAM) &&
455+ nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_OAM))
449456 return -EMSGSIZE;
450457
451458 nla_nest_end(skb, nla);