aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/datapath.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2012-05-21 15:39:42 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-05-21 15:39:42 -0400
commit0ad8c6a22d03a1598f7cc6585c65354dadca62ad (patch)
tree1507deef3d55d5f3c71b2f76924fe1f6c6211905 /net/openvswitch/datapath.c
parent8527f8e2934683e53405fbe876a4e6f4a0c46eb8 (diff)
parent76e10d158efb6d4516018846f60c2ab5501900bc (diff)
Merge tag 'v3.4' with SCSI updates, needed for subsequent firewire-sbp2 changes
Linux 3.4
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r--net/openvswitch/datapath.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index e44e631ea952..e66341ec455c 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -321,7 +321,7 @@ static int queue_userspace_packet(int dp_ifindex, struct sk_buff *skb,
321 return -ENOMEM; 321 return -ENOMEM;
322 322
323 nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb)); 323 nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb));
324 if (!skb) 324 if (!nskb)
325 return -ENOMEM; 325 return -ENOMEM;
326 326
327 nskb->vlan_tci = 0; 327 nskb->vlan_tci = 0;
@@ -421,6 +421,19 @@ static int validate_sample(const struct nlattr *attr,
421 return validate_actions(actions, key, depth + 1); 421 return validate_actions(actions, key, depth + 1);
422} 422}
423 423
424static int validate_tp_port(const struct sw_flow_key *flow_key)
425{
426 if (flow_key->eth.type == htons(ETH_P_IP)) {
427 if (flow_key->ipv4.tp.src && flow_key->ipv4.tp.dst)
428 return 0;
429 } else if (flow_key->eth.type == htons(ETH_P_IPV6)) {
430 if (flow_key->ipv6.tp.src && flow_key->ipv6.tp.dst)
431 return 0;
432 }
433
434 return -EINVAL;
435}
436
424static int validate_set(const struct nlattr *a, 437static int validate_set(const struct nlattr *a,
425 const struct sw_flow_key *flow_key) 438 const struct sw_flow_key *flow_key)
426{ 439{
@@ -462,18 +475,13 @@ static int validate_set(const struct nlattr *a,
462 if (flow_key->ip.proto != IPPROTO_TCP) 475 if (flow_key->ip.proto != IPPROTO_TCP)
463 return -EINVAL; 476 return -EINVAL;
464 477
465 if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst) 478 return validate_tp_port(flow_key);
466 return -EINVAL;
467
468 break;
469 479
470 case OVS_KEY_ATTR_UDP: 480 case OVS_KEY_ATTR_UDP:
471 if (flow_key->ip.proto != IPPROTO_UDP) 481 if (flow_key->ip.proto != IPPROTO_UDP)
472 return -EINVAL; 482 return -EINVAL;
473 483
474 if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst) 484 return validate_tp_port(flow_key);
475 return -EINVAL;
476 break;
477 485
478 default: 486 default:
479 return -EINVAL; 487 return -EINVAL;
@@ -1641,10 +1649,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
1641 reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq, 1649 reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
1642 OVS_VPORT_CMD_NEW); 1650 OVS_VPORT_CMD_NEW);
1643 if (IS_ERR(reply)) { 1651 if (IS_ERR(reply)) {
1644 err = PTR_ERR(reply);
1645 netlink_set_err(init_net.genl_sock, 0, 1652 netlink_set_err(init_net.genl_sock, 0,
1646 ovs_dp_vport_multicast_group.id, err); 1653 ovs_dp_vport_multicast_group.id, PTR_ERR(reply));
1647 return 0; 1654 goto exit_unlock;
1648 } 1655 }
1649 1656
1650 genl_notify(reply, genl_info_net(info), info->snd_pid, 1657 genl_notify(reply, genl_info_net(info), info->snd_pid,