四、LINUX策略规则
4.1 基本结构体
4.1.1策略规则结构体fib_rule
4.1 基本结构体
4.1.1策略规则结构体fib_rule
struct fib_rule
{
struct list_head list;//策 略 规 则 链 表
atomic_t refcnt;//引 用 计 数
int ifindex;//接 口 index
char ifname[IFNAMSIZ];//接 口 名 称
u32 mark;//mark 值
u32 mark_mask;//mark 掩 码 值
u32 pref;//优先级, 值越小优先级越大
u32 flags;
u32 table;//路由表id
u8 action;//规则
u32 target;
struct fib_rule * ctarget;
struct rcu_head rcu;
struct net * fr_net;
};
Action各宏含义
enum
{
FR_ACT_UNSPEC,
FR_ACT_TO_TBL, /* Pass to fixed table */
FR_ACT_GOTO, /* Jump to another rule */
FR_ACT_NOP, /* No operation */