Skip to content

Commit

Permalink
Merge pull request #137 from polycube-network/pr/fix_nat_session_table
Browse files Browse the repository at this point in the history
pcn-nat: fix natting-tables show
  • Loading branch information
frisso committed Jun 4, 2019
2 parents 0aeaa45 + 9a75f00 commit 8f0e9d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/services/pcn-nat/src/Nat_dp_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
(sizeof(struct eth_hdr) + sizeof(struct iphdr) + \
offsetof(struct icmphdr, checksum))
#define IS_PSEUDO 0x10

/* __attribute__((packed))
* forces alignment for this structure;
* otherwise misaligned read/write could happen
* between userspace and kernel space.
* same attribute should be used in kernel/user space
* structs declaration.
*/
struct eth_hdr {
__be64 dst : 48;
__be64 src : 48;
Expand All @@ -52,9 +60,9 @@ struct st_k {
uint16_t src_port;
uint16_t dst_port;
uint8_t proto;
};
} __attribute__((packed));
struct st_v {
uint32_t new_ip;
uint16_t new_port;
uint8_t originating_rule_type;
};
} __attribute__((packed));
8 changes: 8 additions & 0 deletions src/services/pcn-nat/src/NattingTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ class Nat;
using namespace io::swagger::server::model;

/* definitions copied from datapath */

/* __attribute__((packed))
* forces alignment for this structure;
* otherwise misaligned read/write could happen
* between userspace and kernel space.
* same attribute should be used in kernel/user space
* structs declaration.
*/
struct st_k {
uint32_t src_ip;
uint32_t dst_ip;
Expand Down

0 comments on commit 8f0e9d1

Please sign in to comment.