File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 (sizeof(struct eth_hdr) + sizeof(struct iphdr) + \
4141 offsetof(struct icmphdr, checksum))
4242#define IS_PSEUDO 0x10
43+
44+ /* __attribute__((packed))
45+ * forces alignment for this structure;
46+ * otherwise misaligned read/write could happen
47+ * between userspace and kernel space.
48+ * same attribute should be used in kernel/user space
49+ * structs declaration.
50+ */
4351struct eth_hdr {
4452 __be64 dst : 48 ;
4553 __be64 src : 48 ;
@@ -52,9 +60,9 @@ struct st_k {
5260 uint16_t src_port ;
5361 uint16_t dst_port ;
5462 uint8_t proto ;
55- };
63+ } __attribute__(( packed )) ;
5664struct st_v {
5765 uint32_t new_ip ;
5866 uint16_t new_port ;
5967 uint8_t originating_rule_type ;
60- };
68+ } __attribute__(( packed )) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,14 @@ class Nat;
2525using namespace io ::swagger::server::model;
2626
2727/* definitions copied from datapath */
28+
29+ /* __attribute__((packed))
30+ * forces alignment for this structure;
31+ * otherwise misaligned read/write could happen
32+ * between userspace and kernel space.
33+ * same attribute should be used in kernel/user space
34+ * structs declaration.
35+ */
2836struct st_k {
2937 uint32_t src_ip;
3038 uint32_t dst_ip;
You can’t perform that action at this time.
0 commit comments