2019-06-11 03:21:35 +00:00
|
|
|
|
#ifndef _CONNTRACK_API_H
|
|
|
|
|
#define _CONNTRACK_API_H
|
|
|
|
|
#include <net/netfilter/nf_conntrack.h>
|
|
|
|
|
|
|
|
|
|
extern seqcount_t nf_conntrack_generation;
|
|
|
|
|
extern u32 cmhi_seed;
|
|
|
|
|
#define CMHI_EXT_ERR -1
|
|
|
|
|
#define CMHI_EXT_OK 0
|
|
|
|
|
|
|
|
|
|
typedef enum{
|
|
|
|
|
USER_ID,
|
|
|
|
|
USER_VERSION,
|
|
|
|
|
NODE_INDEX,
|
|
|
|
|
APP_ID,
|
|
|
|
|
POLICY_VERSION,
|
|
|
|
|
ACTION,
|
2019-09-18 08:12:10 +00:00
|
|
|
|
AUTH_MARK,
|
|
|
|
|
TC_MARK,
|
|
|
|
|
PBR_MARK,
|
2019-09-20 04:48:37 +00:00
|
|
|
|
BASE_APP_ID,
|
2019-06-11 03:21:35 +00:00
|
|
|
|
}cmhi_ext_type;
|
|
|
|
|
|
2019-09-18 08:26:04 +00:00
|
|
|
|
|
2019-06-11 03:21:35 +00:00
|
|
|
|
//modify cmhi_ext_info u_int32_t status
|
|
|
|
|
typedef enum{
|
|
|
|
|
/*skb pass or not*/
|
|
|
|
|
//CMHI_EXT_PASS_BIT = 0,
|
|
|
|
|
CMHI_EXT_PASS = (1 << 0),
|
|
|
|
|
|
|
|
|
|
/*skb go to dpi or not*/
|
|
|
|
|
//CMHI_EXT_GOTO_DPI_BIT = 1,
|
|
|
|
|
CMHI_EXT_GOTO_DPI = (1 << 1),
|
|
|
|
|
}cmhi_ext_action_bit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct dpi_tuple{
|
|
|
|
|
__be32 sip;
|
|
|
|
|
__be32 dip;
|
|
|
|
|
__be16 sport;
|
|
|
|
|
__be16 dport;
|
|
|
|
|
u_int8_t protonum;
|
|
|
|
|
};
|
|
|
|
|
struct dpi{
|
|
|
|
|
struct dpi_tuple tuple; /* dpi???a<><61><EFBFBD><EFBFBD> */
|
|
|
|
|
uint16_t aid; /* app id */
|
2019-09-20 04:48:37 +00:00
|
|
|
|
uint16_t base_aid; /* base app id */
|
2019-06-11 03:21:35 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int cmhi_set_conntrack_u16(const struct sk_buff *skb, uint16_t value, cmhi_ext_type type);
|
|
|
|
|
int cmhi_set_conntrack_u32(const struct sk_buff *skb, uint32_t value, cmhi_ext_type type);
|
|
|
|
|
int cmhi_set_conntrack_action_by_bit(const struct sk_buff *skb, cmhi_ext_action_bit abit);
|
|
|
|
|
|
|
|
|
|
int cmhi_get_conntrack_u16(const struct sk_buff *skb, uint16_t *value, cmhi_ext_type type);
|
|
|
|
|
int cmhi_get_conntrack_u32(const struct sk_buff *skb, uint32_t *value, cmhi_ext_type type);
|
|
|
|
|
|
|
|
|
|
int cmhi_del_conntrack(const struct sk_buff *skb, cmhi_ext_type type);
|
|
|
|
|
int cmhi_del_conntrack_action_by_bit(const struct sk_buff *skb, cmhi_ext_action_bit abit);
|
|
|
|
|
struct nf_conn *get_conntrack_from_tuple(struct dpi_tuple *dpi_tuple);
|
|
|
|
|
int set_aid_by_dpi_tuple(struct dpi *dpi);
|
|
|
|
|
#endif /* _CONNTRACK_API_H */
|