aboutsummaryrefslogtreecommitdiff
path: root/datapath/flow.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-10-19 21:33:44 -0700
committerBen Pfaff <blp@nicira.com>2011-10-21 15:07:36 -0700
commit7257b535ab8e5fafd811c5f6788205eefdd44948 (patch)
tree75072ea003837f756ce6910fb5e0ba3113db30be /datapath/flow.h
parent4edb9ae90e4092f5f56b9d914d2b88783c49860d (diff)
Implement new fragment handling policy.
Until now, OVS has handled IP fragments more awkwardly than necessary. It has not been possible to match on L4 headers, even in fragments with offset 0 where they are actually present. This means that there was no way to implement ACLs that treat, say, different TCP ports differently, on fragmented traffic; instead, all decisions for fragment forwarding had to be made on the basis of L2 and L3 headers alone. This commit improves the situation significantly. It is still not possible to match on L4 headers in fragments with nonzero offset, because that information is simply not present in such fragments, but this commit adds the ability to match on L4 headers for fragments with zero offset. This means that it becomes possible to implement ACLs that drop such "first fragments" on the basis of L4 headers. In practice, that effectively blocks even fragmented traffic on an L4 basis, because the receiving IP stack cannot reassemble a full packet when the first fragment is missing. This commit works by adding a new "fragment type" to the kernel flow match and making it available through OpenFlow as a new NXM field named NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields are always 0 for IP fragments, it adds a new OpenFlow fragment handling mode that fills in the L4 fields for "first fragments". It also enhances ovs-ofctl to allow users to configure this new fragment handling mode and to parse the new field. Signed-off-by: Ben Pfaff <blp@nicira.com> Bug #7557.
Diffstat (limited to 'datapath/flow.h')
-rw-r--r--datapath/flow.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/datapath/flow.h b/datapath/flow.h
index 96b3b4fe..484ea626 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -20,6 +20,7 @@
#include <linux/jiffies.h>
#include <linux/time.h>
#include <linux/flex_array.h>
+#include <net/inet_ecn.h>
struct sk_buff;
@@ -29,6 +30,10 @@ struct sw_flow_actions {
struct nlattr actions[];
};
+/* Mask for the OVS_FRAG_TYPE_* value in the low 2 bits of ip.tos_frag in
+ * struct sw_flow_key. */
+#define OVS_FRAG_TYPE_MASK INET_ECN_MASK
+
struct sw_flow_key {
struct {
__be64 tun_id; /* Encapsulating tunnel ID. */
@@ -40,7 +45,8 @@ struct sw_flow_key {
} eth;
struct {
u8 proto; /* IP protocol or lower 8 bits of ARP opcode. */
- u8 tos; /* IP ToS (DSCP field, 6 bits). */
+ u8 tos_frag; /* IP ToS DSCP in high 6 bits,
+ * OVS_FRAG_TYPE_* in low 2 bits. */
} ip;
union {
struct {
@@ -123,7 +129,7 @@ void flow_hold(struct sw_flow *);
void flow_put(struct sw_flow *);
int flow_extract(struct sk_buff *, u16 in_port, struct sw_flow_key *,
- int *key_lenp, bool *is_frag);
+ int *key_lenp);
void flow_used(struct sw_flow *, struct sk_buff *);
u64 flow_used_time(unsigned long flow_jiffies);