aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/flow_netlink.c
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2014-10-03 18:35:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 00:32:20 -0400
commit67fa034194bf82a3d5ca841759d921297daa63ca (patch)
treed0d958e2d444853ef3a785abc8044a3ddc16225f /net/openvswitch/flow_netlink.c
parent0714812134d7dcadeb7ecfbfeb18788aa7e1eaac (diff)
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. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/flow_netlink.c')
-rw-r--r--net/openvswitch/flow_netlink.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index f4c8daa73965..22c855fa0bc2 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -346,6 +346,7 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr,
346 [OVS_TUNNEL_KEY_ATTR_TTL] = 1, 346 [OVS_TUNNEL_KEY_ATTR_TTL] = 1,
347 [OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT] = 0, 347 [OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT] = 0,
348 [OVS_TUNNEL_KEY_ATTR_CSUM] = 0, 348 [OVS_TUNNEL_KEY_ATTR_CSUM] = 0,
349 [OVS_TUNNEL_KEY_ATTR_OAM] = 0,
349 }; 350 };
350 351
351 if (type > OVS_TUNNEL_KEY_ATTR_MAX) { 352 if (type > OVS_TUNNEL_KEY_ATTR_MAX) {
@@ -390,6 +391,9 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr,
390 case OVS_TUNNEL_KEY_ATTR_CSUM: 391 case OVS_TUNNEL_KEY_ATTR_CSUM:
391 tun_flags |= TUNNEL_CSUM; 392 tun_flags |= TUNNEL_CSUM;
392 break; 393 break;
394 case OVS_TUNNEL_KEY_ATTR_OAM:
395 tun_flags |= TUNNEL_OAM;
396 break;
393 default: 397 default:
394 return -EINVAL; 398 return -EINVAL;
395 } 399 }
@@ -431,21 +435,24 @@ static int ipv4_tun_to_nlattr(struct sk_buff *skb,
431 nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id)) 435 nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id))
432 return -EMSGSIZE; 436 return -EMSGSIZE;
433 if (output->ipv4_src && 437 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))
435 return -EMSGSIZE; 439 return -EMSGSIZE;
436 if (output->ipv4_dst && 440 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))
438 return -EMSGSIZE; 442 return -EMSGSIZE;
439 if (output->ipv4_tos && 443 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))
441 return -EMSGSIZE; 445 return -EMSGSIZE;
442 if (nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TTL, output->ipv4_ttl)) 446 if (nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TTL, output->ipv4_ttl))
443 return -EMSGSIZE; 447 return -EMSGSIZE;
444 if ((output->tun_flags & TUNNEL_DONT_FRAGMENT) && 448 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))
446 return -EMSGSIZE; 450 return -EMSGSIZE;
447 if ((output->tun_flags & TUNNEL_CSUM) && 451 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))
449 return -EMSGSIZE; 456 return -EMSGSIZE;
450 457
451 nla_nest_end(skb, nla); 458 nla_nest_end(skb, nla);