10.3.2 Fireware内核空间架构实现
一:设计检测规则IP协议函数实现
static bool check_port_rule(__ul6 port, struct port_rule rule);
static bool check_ip_rule(__be32 ip, struct ip_rule rule);
static bool check_rule_match(struct packet_info packet, struct firewall_rule rule);
二:检查权限及规则函数实现
static bool check_permission(void);
三:数据包出入站过滤器实现
unsigned int firewall int firewall_hook_func(void *priv, struct sk_buff *skb, const struct nf_hook_state *state);
四:读写规则/检查规则匹配实现
void add_firewall_rule(struct firewall_rule rule);
void list_firewall_ruless();
五:删除规则/模块加载和卸载
void delete_firewall_rule(int index);
module_init\(firewall_init);
module_exit(firewall_exit);
参考链接:0voice · GitHub