Open vSwitch
Subsystems (3)
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(-)
A message that is not in the archive (sent off-list or not yet received): 1363306506-885-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org
PATCH 2/6 openvswitch: Fix ovs_vport_cmd_new return value on success
From: Rich Lane <rlane-oPdFNf9WwoK1Z/[email protected]>
If the pointer does not represent an error then the PTR_ERR macro may still return a nonzero value.
--- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+)
net/openvswitch/datapath.c +1 -0
@@ -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)) {
Signature · 1 line
1.7.10.4
PATCH 3/6 openvswitch: Call genlmsg_end in queue_userspace_packet
In reply to a message not in the archiveFrom: Rich Lane <rlane-oPdFNf9WwoK1Z/[email protected]>
Without genlmsg_end the upcall message ends (according to nlmsg_len) after the struct ovs_header.
--- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+)
net/openvswitch/datapath.c +1 -0
@@ -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:
Signature · 1 line
1.7.10.4
PATCH 4/6 openvswitch: Fix parsing invalid LLC/SNAP ethertypes
In reply to a message not in the archiveFrom: Rich Lane <rlane-oPdFNf9WwoK1Z/[email protected]>
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.
--- net/openvswitch/flow.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/openvswitch/flow.c +5 -1
@@ -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,
Signature · 1 line
1.7.10.4
PATCH 5/6 openvswitch: fix the calculation of checksum for vlan header
In reply to a message not in the archiveFrom: Cong Wang <[email protected]>
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 0282Similar 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.
--- net/openvswitch/actions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/openvswitch/actions.c +2 -2
@@ -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 *vlaif (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 );
Signature · 1 line
1.7.10.4
PATCH 6/6 openvswitch: remove some useless comments
In reply to a message not in the archiveFrom: Cong Wang <[email protected]>
These comments are useless in upstream kernel.
--- net/openvswitch/vport-netdev.c | 3 +-- net/openvswitch/vport.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
net/openvswitch/vport-netdev.c +1 -2
@@ -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 ;
net/openvswitch/vport.c +1 -2
@@ -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) {
Signature · 1 line
1.7.10.4
PATCH 1/6 openvswitch: Fix ovs_vport_cmd_del return value on success
In reply to Jesse GrossFrom: Rich Lane <[email protected]>
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.
--- net/openvswitch/datapath.c | 1 + 1 file changed, 1 insertion(+)
net/openvswitch/datapath.c +1 -0
@@ -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,
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: Jesse Gross <[email protected]>
Date: Thu, 14 Mar 2013 17:15:00 -0700
Quoted 3 lines
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.