Skip to contentSkip to conversation

Open vSwitch

GIT net New Jesse Gross 3 participants 5 messages Sep 4, 2012 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

A few bug fixes intended for net/3.6.

The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee:

Linux 3.6-rc1 (2012-08-02 16:38:10 -0700)

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 c303aa94cdae483a7577230e61720e126e600a52:

openvswitch: Fix FLOW_BUFSIZE definition. (2012-09-03 19:06:27 -0700)

----------------------------------------------------------------
Jesse Gross (2):
openvswitch: Relax set header validation.
openvswitch: Fix FLOW_BUFSIZE definition.

Joe Stringer (1):
openvswitch: Fix typo

 net/openvswitch/actions.c  |    2 +-
 net/openvswitch/datapath.c |    6 +++---
 net/openvswitch/flow.h     |    8 +++++---
 3 files changed, 9 insertions(+), 7 deletions(-)

A message that is not in the archive (sent off-list or not yet received): 1346785688-2910-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH 1/3 openvswitch: Relax set header validation.

When installing a flow with an action to set a particular field we need to validate that the packets that are part of the flow actually contain that header. With IP we use zeroed addresses and with TCP/UDP the check is for zeroed ports. This check is overly broad and can catch packets like DHCP requests that have a zero source address in a legitimate header. This changes the check to look for a zeroed protocol number for IP or for both ports be zero for TCP/UDP before considering the header to not exist.

---
 net/openvswitch/datapath.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/openvswitch/datapath.c +3 -3
index d8277d2..cf58ced 100644
@@ -425,10 +425,10 @@ static int validate_sample(const struct nlattr *attr,
 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)
+		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)
+		if (flow_key->ipv6.tp.src || flow_key->ipv6.tp.dst)
 			return 0;
 	}
 
@@ -460,7 +460,7 @@ static int validate_set(const struct nlattr *a,
 		if (flow_key->eth.type != htons(ETH_P_IP))
 			return -EINVAL;
 
-		if (!flow_key->ipv4.addr.src || !flow_key->ipv4.addr.dst)
+		if (!flow_key->ip.proto)
 			return -EINVAL;
 
 		ipv4_key = nla_data(ovs_key);
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 2/3 openvswitch: Fix typo

In reply to a message not in the archive

From: Joe Stringer <[email protected]>

---
 net/openvswitch/actions.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/actions.c +1 -1
index f3f96ba..954405c 100644
@@ -45,7 +45,7 @@ static int make_writable(struct sk_buff *skb, int write_len)
 	return pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
 }
 
-/* remove VLAN header from packet and update csum accrodingly. */
+/* remove VLAN header from packet and update csum accordingly. */
 static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci)
 {
 	struct vlan_hdr *vhdr;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/3 openvswitch: Fix FLOW_BUFSIZE definition.

In reply to a message not in the archive

The vlan encapsulation fields in the maximum flow defintion were never updated when the representation changed before upstreaming. In theory this could cause a kernel panic when a maximum length flow is used. In practice this has never happened (to my knowledge) because skb allocations are padded out to a cache line so you would need the right combination of flow and packet being sent to userspace.

---
 net/openvswitch/flow.h |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/openvswitch/flow.h +5 -3
index 9b75617..c30df1a 100644
@@ -145,15 +145,17 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies);
  *  OVS_KEY_ATTR_PRIORITY      4    --     4      8
  *  OVS_KEY_ATTR_IN_PORT       4    --     4      8
  *  OVS_KEY_ATTR_ETHERNET     12    --     4     16
+ *  OVS_KEY_ATTR_ETHERTYPE     2     2     4      8  (outer VLAN ethertype)
  *  OVS_KEY_ATTR_8021Q         4    --     4      8
- *  OVS_KEY_ATTR_ETHERTYPE     2     2     4      8
+ *  OVS_KEY_ATTR_ENCAP         0    --     4      4  (VLAN encapsulation)
+ *  OVS_KEY_ATTR_ETHERTYPE     2     2     4      8  (inner VLAN ethertype)
  *  OVS_KEY_ATTR_IPV6         40    --     4     44
  *  OVS_KEY_ATTR_ICMPV6        2     2     4      8
  *  OVS_KEY_ATTR_ND           28    --     4     32
  *  -------------------------------------------------
- *  total                                       132
+ *  total                                       144
  */
-#define FLOW_BUFSIZE 132
+#define FLOW_BUFSIZE 144
 
 int ovs_flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *);
 int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
Signature · 1 line
1.7.9.5
#5 lore raw
In reply to a message not in the archive

From: Jesse Gross <[email protected]>
Date: Tue, 4 Sep 2012 12:08:05 -0700

Quoted 6 lines

A few bug fixes intended for net/3.6.

The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee:

Linux 3.6-rc1 (2012-08-02 16:38:10 -0700)

Quoted 7 lines

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 c303aa94cdae483a7577230e61720e126e600a52:

openvswitch: Fix FLOW_BUFSIZE definition. (2012-09-03 19:06:27 -0700)

Pulled, thanks Jesse.