Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300196
b: refs/heads/master
c: 072ae63
h: refs/heads/master
v: v3
  • Loading branch information
Pravin B Shelar authored and Jesse Gross committed May 8, 2012
1 parent fd68079 commit 26f30c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4cb6e116bb97c8b87a1f4f95e99d0c8dda2a6e9b
refs/heads/master: 072ae6314a191e3a9fc309b1e4e539ac7abc48ad
22 changes: 15 additions & 7 deletions trunk/net/openvswitch/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,19 @@ static int validate_sample(const struct nlattr *attr,
return validate_actions(actions, key, depth + 1);
}

static int validate_tp_port(const struct sw_flow_key *flow_key)
{
if (flow_key->eth.type == htons(ETH_P_IP)) {
if (flow_key->ipv4.tp.src && flow_key->ipv4.tp.dst)
return 0;
} else if (flow_key->eth.type == htons(ETH_P_IPV6)) {
if (flow_key->ipv6.tp.src && flow_key->ipv6.tp.dst)
return 0;
}

return -EINVAL;
}

static int validate_set(const struct nlattr *a,
const struct sw_flow_key *flow_key)
{
Expand Down Expand Up @@ -462,18 +475,13 @@ static int validate_set(const struct nlattr *a,
if (flow_key->ip.proto != IPPROTO_TCP)
return -EINVAL;

if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst)
return -EINVAL;

break;
return validate_tp_port(flow_key);

case OVS_KEY_ATTR_UDP:
if (flow_key->ip.proto != IPPROTO_UDP)
return -EINVAL;

if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst)
return -EINVAL;
break;
return validate_tp_port(flow_key);

default:
return -EINVAL;
Expand Down

0 comments on commit 26f30c6

Please sign in to comment.