Skip to content

Commit

Permalink
conntrack: Simplify 'ct_addr'.
Browse files Browse the repository at this point in the history
Remove the struct wrapper and remove the unneeded union members.
There may even be a portability benefit here because of the
type punning.

Signed-off-by: Darrell Ball <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
darball1 authored and blp committed Feb 14, 2019
1 parent 763b40b commit cda1b10
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 93 deletions.
6 changes: 3 additions & 3 deletions lib/conntrack-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "dp-packet.h"

struct ct_endpoint {
struct ct_addr addr;
union ct_addr addr;
union {
ovs_be16 port;
struct {
Expand All @@ -44,7 +44,7 @@ struct ct_endpoint {

/* Verify that there is no padding in struct ct_endpoint, to facilitate
* hashing in ct_endpoint_hash_add(). */
BUILD_ASSERT_DECL(sizeof(struct ct_endpoint) == sizeof(struct ct_addr) + 4);
BUILD_ASSERT_DECL(sizeof(struct ct_endpoint) == sizeof(union ct_addr) + 4);

/* Changes to this structure need to be reflected in conn_key_hash()
* and conn_key_cmp(). */
Expand Down Expand Up @@ -77,7 +77,7 @@ struct alg_exp_node {
/* Corresponding key of the control connection. */
struct conn_key master_key;
/* The NAT replacement address to be used by the data connection. */
struct ct_addr alg_nat_repl_addr;
union ct_addr alg_nat_repl_addr;
/* The data connection inherits the master control
* connection label and mark. */
ovs_u128 master_label;
Expand Down
Loading

0 comments on commit cda1b10

Please sign in to comment.