For SNAT, don't store the pre-fragment L2 header before actions are applied.
[sliver-openvswitch.git] / datapath / nx_act_snat.h
1 #ifdef SUPPORT_SNAT
2 #ifndef ACT_SNAT_H
3 #define ACT_SNAT_H
4
5 #include <linux/list.h>
6 #include <linux/skbuff.h>
7 #include <linux/rcupdate.h>
8
9 #include "openflow/nicira-ext.h"
10 #include "datapath.h"
11
12 /* Cache of IP->MAC mappings on the side hidden by the SNAT */
13 struct snat_mapping {
14         struct list_head node;
15         uint32_t ip_addr;        /* Stored in network-order */
16         uint8_t hw_addr[ETH_ALEN];
17         unsigned long used;      /* Last used time (in jiffies). */
18
19         struct rcu_head rcu;
20 };
21
22 struct snat_conf {
23         uint32_t ip_addr_start;      /* Stored in host-order */
24         uint32_t ip_addr_end;        /* Stored in host-order */
25         uint16_t mac_timeout;
26
27         uint8_t mac_addr[ETH_ALEN];
28
29         struct list_head mappings;   /* List of snat_mapping entries */
30 };
31
32 #define MAC_TIMEOUT_DEFAULT 120
33
34 void snat_local_in(struct sk_buff *skb);
35 int snat_pre_route(struct sk_buff *skb);
36 void snat_skb(struct datapath *dp, const struct sk_buff *skb, int out_port);
37 void snat_save_header(struct sk_buff *skb);
38 int snat_copy_header(struct sk_buff *skb);
39 void snat_maint(struct net_bridge_port *p);
40 int snat_mod_config(struct datapath *, const struct nx_act_config *);
41 int snat_free_conf(struct net_bridge_port *p);
42
43 #endif
44 #endif