diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-16 22:17:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 22:17:37 -0400 |
commit | 028940342a906db8da014a7603a0deddc2c323dd (patch) | |
tree | 688dbc38a3e218f2493d311b1d70a67668837347 /net/openvswitch | |
parent | be3eed2e96340d3c7a4d1ea1d63e7bd6095d1e34 (diff) | |
parent | 0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/openvswitch')
-rw-r--r-- | net/openvswitch/datapath.c | 29 | ||||
-rw-r--r-- | net/openvswitch/flow.c | 3 |
2 files changed, 20 insertions, 12 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index f86de29979ef..2c74daa5aca5 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 | ||
424 | static 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 | |||
424 | static int validate_set(const struct nlattr *a, | 437 | static 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; |
@@ -1647,10 +1655,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) | |||
1647 | reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq, | 1655 | reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq, |
1648 | OVS_VPORT_CMD_NEW); | 1656 | OVS_VPORT_CMD_NEW); |
1649 | if (IS_ERR(reply)) { | 1657 | if (IS_ERR(reply)) { |
1650 | err = PTR_ERR(reply); | ||
1651 | netlink_set_err(init_net.genl_sock, 0, | 1658 | netlink_set_err(init_net.genl_sock, 0, |
1652 | ovs_dp_vport_multicast_group.id, err); | 1659 | ovs_dp_vport_multicast_group.id, PTR_ERR(reply)); |
1653 | return 0; | 1660 | goto exit_unlock; |
1654 | } | 1661 | } |
1655 | 1662 | ||
1656 | genl_notify(reply, genl_info_net(info), info->snd_pid, | 1663 | genl_notify(reply, genl_info_net(info), info->snd_pid, |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 7cb416381e87..6d4d8097cf96 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -183,7 +183,8 @@ void ovs_flow_used(struct sw_flow *flow, struct sk_buff *skb) | |||
183 | u8 tcp_flags = 0; | 183 | u8 tcp_flags = 0; |
184 | 184 | ||
185 | if (flow->key.eth.type == htons(ETH_P_IP) && | 185 | if (flow->key.eth.type == htons(ETH_P_IP) && |
186 | flow->key.ip.proto == IPPROTO_TCP) { | 186 | flow->key.ip.proto == IPPROTO_TCP && |
187 | likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) { | ||
187 | u8 *tcp = (u8 *)tcp_hdr(skb); | 188 | u8 *tcp = (u8 *)tcp_hdr(skb); |
188 | tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK; | 189 | tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK; |
189 | } | 190 | } |