[ovs-dev] [PATCH v3 2/2] conntrack: Use 'maybe_related' insted of 'related'.
Daniele Di Proietto
diproiettod at vmware.com
Sat Dec 24 01:31:41 UTC 2016
This is just a naming change. When we extract the key of an ICMP error
message we suspect that it might be related, but we're not sure until we
perform a lookup in the connection table.
Suggested-by: Darrell Ball <dball at vmware.com>
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
Acked-by: Darrell Ball <dlu998 at gmail.com>
---
lib/conntrack.c | 52 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/lib/conntrack.c b/lib/conntrack.c
index d2b5f3a..a9627f9 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -49,7 +49,7 @@ struct conn_lookup_ctx {
struct conn *conn;
uint32_t hash;
bool reply;
- bool related;
+ bool maybe_related;
};
enum key_status {
@@ -236,7 +236,7 @@ process_one(struct conntrack *ct, struct dp_packet *pkt,
uint16_t state = 0;
if (conn) {
- if (ctx->related) {
+ if (ctx->maybe_related) {
state |= CS_RELATED;
if (ctx->reply) {
state |= CS_REPLY_DIR;
@@ -269,7 +269,7 @@ process_one(struct conntrack *ct, struct dp_packet *pkt,
}
}
} else {
- if (ctx->related) {
+ if (ctx->maybe_related) {
state |= CS_INVALID;
} else {
conn = conn_not_found(ct, pkt, ctx, &state, commit, now);
@@ -721,7 +721,7 @@ extract_l4_udp(struct conn_key *key, const void *data, size_t size)
static inline enum key_status extract_l4(struct conn_key *key,
const void *data,
size_t size,
- bool *related,
+ bool *maybe_related,
const void *l3);
static uint8_t
@@ -747,14 +747,14 @@ reverse_icmp_type(uint8_t type)
}
}
-/* If 'related' is not NULL and the function is processing an ICMP
+/* If 'maybe_related' is not NULL and the function is processing an ICMP
* error packet, extract the l3 and l4 fields from the nested header
- * instead and set *related to true. If 'related' is NULL we're
+ * instead and set *maybe_related to true. If 'maybe_related' is NULL we're
* already processing a nested header and no such recursion is
* possible */
static inline enum key_status
extract_l4_icmp(struct conn_key *key, const void *data, size_t size,
- bool *related)
+ bool *maybe_related)
{
const struct icmp_header *icmp = data;
@@ -793,7 +793,7 @@ extract_l4_icmp(struct conn_key *key, const void *data, size_t size,
enum key_status res;
bool ok;
- if (!related) {
+ if (!maybe_related) {
return KEY_INVALID;
}
@@ -817,7 +817,7 @@ extract_l4_icmp(struct conn_key *key, const void *data, size_t size,
res = extract_l4(key, l4, tail - l4, NULL, l3);
if (res != KEY_INVALID) {
conn_key_reverse(key);
- *related = true;
+ *maybe_related = true;
}
return res;
}
@@ -839,14 +839,14 @@ reverse_icmp6_type(uint8_t type)
}
}
-/* If 'related' is not NULL and the function is processing an ICMP
+/* If 'maybe_related' is not NULL and the function is processing an ICMP
* error packet, extract the l3 and l4 fields from the nested header
- * instead and set *related to true. If 'related' is NULL we're
+ * instead and set *maybe_related to true. If 'maybe_related' is NULL we're
* already processing a nested header and no such recursion is
* possible */
static inline enum key_status
extract_l4_icmp6(struct conn_key *key, const void *data, size_t size,
- bool *related)
+ bool *maybe_related)
{
const struct icmp6_header *icmp6 = data;
@@ -882,7 +882,7 @@ extract_l4_icmp6(struct conn_key *key, const void *data, size_t size,
enum key_status res;
bool ok;
- if (!related) {
+ if (!maybe_related) {
return KEY_INVALID;
}
@@ -908,7 +908,7 @@ extract_l4_icmp6(struct conn_key *key, const void *data, size_t size,
res = extract_l4(key, l4, tail - l4, NULL, l3);
if (res != KEY_INVALID) {
conn_key_reverse(key);
- *related = true;
+ *maybe_related = true;
}
return res;
}
@@ -929,33 +929,33 @@ extract_l4_icmp6(struct conn_key *key, const void *data, size_t size,
/* Extract l4 fields into 'key', which must already contain valid l3
* members.
*
- * If 'related' is not NULL and an ICMP error packet is being
+ * If 'maybe_related' is not NULL and an ICMP error packet is being
* processed, the function will extract the key from the packet nested
- * in the ICMP paylod and set '*related' to true.
+ * in the ICMP paylod and set '*maybe_related' to true.
*
- * If 'related' is NULL, it means that we're already parsing a header nested
+ * If 'maybe_related' is NULL, it means that we're already parsing a header nested
* in an ICMP error. In this case, we skip checksum and length validation. */
static inline enum key_status
-extract_l4(struct conn_key *key, const void *data, size_t size, bool *related,
- const void *l3)
+extract_l4(struct conn_key *key, const void *data, size_t size,
+ bool *maybe_related, const void *l3)
{
if (key->nw_proto == IPPROTO_TCP) {
- return (!related || check_l4_tcp(key, data, size, l3))
+ return (!maybe_related || check_l4_tcp(key, data, size, l3))
? extract_l4_tcp(key, data, size)
: KEY_INVALID;
} else if (key->nw_proto == IPPROTO_UDP) {
- return (!related || check_l4_udp(key, data, size, l3))
+ return (!maybe_related || check_l4_udp(key, data, size, l3))
? extract_l4_udp(key, data, size)
: KEY_INVALID;
} else if (key->dl_type == htons(ETH_TYPE_IP)
&& key->nw_proto == IPPROTO_ICMP) {
- return (!related || check_l4_icmp(data, size))
- ? extract_l4_icmp(key, data, size, related)
+ return (!maybe_related || check_l4_icmp(data, size))
+ ? extract_l4_icmp(key, data, size, maybe_related)
: KEY_INVALID;
} else if (key->dl_type == htons(ETH_TYPE_IPV6)
&& key->nw_proto == IPPROTO_ICMPV6) {
- return (!related || check_l4_icmp6(key, data, size, l3))
- ? extract_l4_icmp6(key, data, size, related)
+ return (!maybe_related || check_l4_icmp6(key, data, size, l3))
+ ? extract_l4_icmp6(key, data, size, maybe_related)
: KEY_INVALID;
} else {
return KEY_INVALID;
@@ -1024,7 +1024,7 @@ conn_key_extract(struct conntrack *ct, struct dp_packet *pkt, ovs_be16 dl_type,
if (ok) {
enum key_status res;
- res = extract_l4(&ctx->key, l4, tail - l4, &ctx->related, l3);
+ res = extract_l4(&ctx->key, l4, tail - l4, &ctx->maybe_related, l3);
if (res == KEY_OK) {
ctx->hash = conn_key_hash(&ctx->key, ct->hash_basis);
}
--
2.10.2
More information about the dev
mailing list