All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT net] Open vSwitch
@ 2013-03-15  0:15 Jesse Gross
  2013-03-15  0:15 ` [PATCH net 1/6] openvswitch: Fix ovs_vport_cmd_del return value on success Jesse Gross
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA

A few different bug fixes, including several for issues with userspace
communication that have gone unnoticed up until now.  These are intended
for net/3.9.

The following changes since commit 19f949f52599ba7c3f67a5897ac6be14bfcb1200:

  Linux 3.8 (2013-02-18 15:58:34 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git fixes

for you to fetch changes up to d176ca2a48ff2b5d7becfacdcbd1d72c73bd22d1:

  openvswitch: remove some useless comments (2013-02-22 17:02:49 -0800)

----------------------------------------------------------------
Cong Wang (2):
      openvswitch: fix the calculation of checksum for vlan header
      openvswitch: remove some useless comments

Rich Lane (4):
      openvswitch: Fix ovs_vport_cmd_del return value on success
      openvswitch: Fix ovs_vport_cmd_new return value on success
      openvswitch: Call genlmsg_end in queue_userspace_packet
      openvswitch: Fix parsing invalid LLC/SNAP ethertypes

 net/openvswitch/actions.c      |    4 ++--
 net/openvswitch/datapath.c     |    3 +++
 net/openvswitch/flow.c         |    6 +++++-
 net/openvswitch/vport-netdev.c |    3 +--
 net/openvswitch/vport.c        |    3 +--
 5 files changed, 12 insertions(+), 7 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 1/6] openvswitch: Fix ovs_vport_cmd_del return value on success
  2013-03-15  0:15 [GIT net] Open vSwitch Jesse Gross
@ 2013-03-15  0:15 ` Jesse Gross
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
  2013-03-15 13:01 ` [GIT net] Open vSwitch David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, dev, Rich Lane, Jesse Gross

From: Rich Lane <rlane@bigswitch.com>

If the pointer does not represent an error then the PTR_ERR macro may still
return a nonzero value. The fix is the same as in ovs_vport_cmd_set.

Signed-off-by: Rich Lane <rlane@bigswitch.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
 net/openvswitch/datapath.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index f996db3..5e275b9 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1772,6 +1772,7 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
 	if (IS_ERR(reply))
 		goto exit_unlock;
 
+	err = 0;
 	ovs_dp_detach_port(vport);
 
 	genl_notify(reply, genl_info_net(info), info->snd_portid,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 2/6] openvswitch: Fix ovs_vport_cmd_new return value on success
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
@ 2013-03-15  0:15   ` Jesse Gross
  2013-03-15  0:15   ` [PATCH net 3/6] openvswitch: Call genlmsg_end in queue_userspace_packet Jesse Gross
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA

From: Rich Lane <rlane-oPdFNf9WwoK1Z/+hSey0Gg@public.gmane.org>

If the pointer does not represent an error then the PTR_ERR
macro may still return a nonzero value.

Signed-off-by: Rich Lane <rlane-oPdFNf9WwoK1Z/+hSey0Gg@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
 net/openvswitch/datapath.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 5e275b9..a2cd3e6 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1691,6 +1691,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
 	if (IS_ERR(vport))
 		goto exit_unlock;
 
+	err = 0;
 	reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq,
 					 OVS_VPORT_CMD_NEW);
 	if (IS_ERR(reply)) {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 3/6] openvswitch: Call genlmsg_end in queue_userspace_packet
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
  2013-03-15  0:15   ` [PATCH net 2/6] openvswitch: Fix ovs_vport_cmd_new " Jesse Gross
@ 2013-03-15  0:15   ` Jesse Gross
  2013-03-15  0:15   ` [PATCH net 4/6] openvswitch: Fix parsing invalid LLC/SNAP ethertypes Jesse Gross
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA

From: Rich Lane <rlane-oPdFNf9WwoK1Z/+hSey0Gg@public.gmane.org>

Without genlmsg_end the upcall message ends (according to nlmsg_len)
after the struct ovs_header.

Signed-off-by: Rich Lane <rlane-oPdFNf9WwoK1Z/+hSey0Gg@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
 net/openvswitch/datapath.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index a2cd3e6..cae1062 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -395,6 +395,7 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
 
 	skb_copy_and_csum_dev(skb, nla_data(nla));
 
+	genlmsg_end(user_skb, upcall);
 	err = genlmsg_unicast(net, user_skb, upcall_info->portid);
 
 out:
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 4/6] openvswitch: Fix parsing invalid LLC/SNAP ethertypes
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
  2013-03-15  0:15   ` [PATCH net 2/6] openvswitch: Fix ovs_vport_cmd_new " Jesse Gross
  2013-03-15  0:15   ` [PATCH net 3/6] openvswitch: Call genlmsg_end in queue_userspace_packet Jesse Gross
@ 2013-03-15  0:15   ` Jesse Gross
  2013-03-15  0:15   ` [PATCH net 5/6] openvswitch: fix the calculation of checksum for vlan header Jesse Gross
  2013-03-15  0:15   ` [PATCH net 6/6] openvswitch: remove some useless comments Jesse Gross
  4 siblings, 0 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA

From: Rich Lane <rlane-oPdFNf9WwoK1Z/+hSey0Gg@public.gmane.org>

Before this patch, if an LLC/SNAP packet with OUI 00:00:00 had an
ethertype less than 1536 the flow key given to userspace in the upcall
would contain the invalid ethertype (for example, 3). If userspace
attempted to insert a kernel flow for this key it would be rejected
by ovs_flow_from_nlattrs.

This patch allows OVS to pass the OFTest pktact.DirectBadLlcPackets.

Signed-off-by: Rich Lane <rlane-oPdFNf9WwoK1Z/+hSey0Gg@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
 net/openvswitch/flow.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index c3294ce..0c98d40 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -484,7 +484,11 @@ static __be16 parse_ethertype(struct sk_buff *skb)
 		return htons(ETH_P_802_2);
 
 	__skb_pull(skb, sizeof(struct llc_snap_hdr));
-	return llc->ethertype;
+
+	if (ntohs(llc->ethertype) >= 1536)
+		return llc->ethertype;
+
+	return htons(ETH_P_802_2);
 }
 
 static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 5/6] openvswitch: fix the calculation of checksum for vlan header
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-03-15  0:15   ` [PATCH net 4/6] openvswitch: Fix parsing invalid LLC/SNAP ethertypes Jesse Gross
@ 2013-03-15  0:15   ` Jesse Gross
  2013-03-15  0:15   ` [PATCH net 6/6] openvswitch: remove some useless comments Jesse Gross
  4 siblings, 0 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

In vlan_insert_tag(), we insert a 4-byte VLAN header _after_
mac header:

        memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
        ...
        veth->h_vlan_proto = htons(ETH_P_8021Q);
        ...
        veth->h_vlan_TCI = htons(vlan_tci);

so after it, we should recompute the checksum to include these 4 bytes.
skb->data still points to the mac header, therefore VLAN header is at
(2 * ETH_ALEN = 12) bytes after it, not (ETH_HLEN = 14) bytes.

This can also be observed via tcpdump:

         0x0000:  ffff ffff ffff 5254 005d 6f6e 8100 000a
         0x0010:  0806 0001 0800 0604 0001 5254 005d 6f6e
         0x0020:  c0a8 026e 0000 0000 0000 c0a8 0282

Similar for __pop_vlan_tci(), the vlan header we remove is the one
overwritten in:

	memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN);

Therefore the VLAN_HLEN = 4 bytes after 2 * ETH_ALEN is the part
we want to sub from checksum.

Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
 net/openvswitch/actions.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index ac2defe..d4d5363 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -58,7 +58,7 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci)
 
 	if (skb->ip_summed == CHECKSUM_COMPLETE)
 		skb->csum = csum_sub(skb->csum, csum_partial(skb->data
-					+ ETH_HLEN, VLAN_HLEN, 0));
+					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
 
 	vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
 	*current_tci = vhdr->h_vlan_TCI;
@@ -115,7 +115,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
 
 		if (skb->ip_summed == CHECKSUM_COMPLETE)
 			skb->csum = csum_add(skb->csum, csum_partial(skb->data
-					+ ETH_HLEN, VLAN_HLEN, 0));
+					+ (2 * ETH_ALEN), VLAN_HLEN, 0));
 
 	}
 	__vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 6/6] openvswitch: remove some useless comments
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
                     ` (3 preceding siblings ...)
  2013-03-15  0:15   ` [PATCH net 5/6] openvswitch: fix the calculation of checksum for vlan header Jesse Gross
@ 2013-03-15  0:15   ` Jesse Gross
  4 siblings, 0 replies; 8+ messages in thread
From: Jesse Gross @ 2013-03-15  0:15 UTC (permalink / raw)
  To: David Miller
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

These comments are useless in upstream kernel.

Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
 net/openvswitch/vport-netdev.c |    3 +--
 net/openvswitch/vport.c        |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 670cbc3..2130d61 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -43,8 +43,7 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
 
 	/* Make our own copy of the packet.  Otherwise we will mangle the
 	 * packet for anyone who came before us (e.g. tcpdump via AF_PACKET).
-	 * (No one comes after us, since we tell handle_bridge() that we took
-	 * the packet.) */
+	 */
 	skb = skb_share_check(skb, GFP_ATOMIC);
 	if (unlikely(!skb))
 		return;
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 70af0be..6255e48 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -326,8 +326,7 @@ int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb)
  * @skb: skb that was received
  *
  * Must be called with rcu_read_lock.  The packet cannot be shared and
- * skb->data should point to the Ethernet header.  The caller must have already
- * called compute_ip_summed() to initialize the checksumming fields.
+ * skb->data should point to the Ethernet header.
  */
 void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
 {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [GIT net] Open vSwitch
  2013-03-15  0:15 [GIT net] Open vSwitch Jesse Gross
  2013-03-15  0:15 ` [PATCH net 1/6] openvswitch: Fix ovs_vport_cmd_del return value on success Jesse Gross
       [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
@ 2013-03-15 13:01 ` David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-03-15 13:01 UTC (permalink / raw)
  To: jesse; +Cc: netdev, dev

From: Jesse Gross <jesse@nicira.com>
Date: Thu, 14 Mar 2013 17:15:00 -0700

> A few different bug fixes, including several for issues with userspace
> communication that have gone unnoticed up until now.  These are intended
> for net/3.9.

Pulled, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-15 13:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15  0:15 [GIT net] Open vSwitch Jesse Gross
2013-03-15  0:15 ` [PATCH net 1/6] openvswitch: Fix ovs_vport_cmd_del return value on success Jesse Gross
     [not found] ` <1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2013-03-15  0:15   ` [PATCH net 2/6] openvswitch: Fix ovs_vport_cmd_new " Jesse Gross
2013-03-15  0:15   ` [PATCH net 3/6] openvswitch: Call genlmsg_end in queue_userspace_packet Jesse Gross
2013-03-15  0:15   ` [PATCH net 4/6] openvswitch: Fix parsing invalid LLC/SNAP ethertypes Jesse Gross
2013-03-15  0:15   ` [PATCH net 5/6] openvswitch: fix the calculation of checksum for vlan header Jesse Gross
2013-03-15  0:15   ` [PATCH net 6/6] openvswitch: remove some useless comments Jesse Gross
2013-03-15 13:01 ` [GIT net] Open vSwitch David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.