int AcIoctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) #endif { struct ac_args *opt=(struct ac_args *)arg; AcPlcyNode node; MacReverse(opt->mac); memcpy(node.Mac,opt->mac,ETH_ALEN); node.IpS=opt->ip_s; node.IpE=opt->ip_e; node.Type=AcParam[cmd].Type; node.RuleType=AcParam[cmd].RuleType; switch(cmd) { case AC_ADD_MAC_UL_ENTRY: case AC_ADD_MAC_DL_ENTRY: case AC_ADD_IP_UL_ENTRY: case AC_ADD_IP_DL_ENTRY: opt->result=AcBndryCheck(&node); if(opt->result!=AC_TBL_FULL) { opt->result=AcAddNode(&node); } break; case AC_DEL_MAC_UL_ENTRY: case AC_DEL_MAC_DL_ENTRY: case AC_DEL_IP_UL_ENTRY: case AC_DEL_IP_DL_ENTRY: opt->result=AcDelNode(&node); break; case AC_GET_MAC_UL_PKT_CNT: case AC_GET_IP_UL_PKT_CNT: case AC_GET_MAC_DL_PKT_CNT: case AC_GET_IP_DL_PKT_CNT: opt->cnt=AcGetCnt(&node, AC_PKT_CNT); break; case AC_GET_MAC_UL_BYTE_CNT: case AC_GET_IP_UL_BYTE_CNT: case AC_GET_MAC_DL_BYTE_CNT: case AC_GET_IP_DL_BYTE_CNT: opt->cnt=AcGetCnt(&node, AC_BYTE_CNT); break; case AC_CLEAN_TBL: AcCleanTbl(); break; default: break; } return 0; }
int AclIoctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { struct acl_args *opt=(struct acl_args *)arg; AclPlcyNode node; MacReverse(opt->mac); memcpy(node.Mac,opt->mac,ETH_ALEN); node.Method=opt->method; node.RuleType=cmd; node.SipS=opt->sip_s; node.SipE=opt->sip_e; node.DipS=opt->dip_s; node.DipE=opt->dip_e; node.DpS=opt->dp_s; node.DpE=opt->dp_e; switch(cmd) { case ACL_ADD_SMAC_DIP_ANY: case ACL_ADD_SIP_DIP_ANY: opt->result = RunIoctlAddHandler(&node, ACL_PROTO_ANY); break; case ACL_DEL_SMAC_DIP_ANY: case ACL_DEL_SIP_DIP_ANY: opt->result = RunIoctlDelHandler(&node, ACL_PROTO_ANY); break; case ACL_ADD_SMAC_DIP_TCP: case ACL_ADD_SIP_DIP_TCP: opt->result = RunIoctlAddHandler(&node, ACL_PROTO_TCP); break; case ACL_DEL_SMAC_DIP_TCP: case ACL_DEL_SIP_DIP_TCP: opt->result = RunIoctlDelHandler(&node, ACL_PROTO_TCP); break; case ACL_ADD_SMAC_DIP_UDP: case ACL_ADD_SIP_DIP_UDP: opt->result = RunIoctlAddHandler(&node, ACL_PROTO_UDP); case ACL_DEL_SMAC_DIP_UDP: case ACL_DEL_SIP_DIP_UDP: opt->result = RunIoctlDelHandler(&node, ACL_PROTO_UDP); break; case ACL_CLEAN_TBL: AclCleanTbl(); break; default: break; } return 0; }