int AclRegIoctlHandler(void) { #ifdef CONFIG_DEVFS_FS if(devfs_register_chrdev(acl_major, ACL_DEVNAME , &acl_fops)) { NAT_PRINT(KERN_WARNING " acl: can't create device node - %s\n",ACL_DEVNAME); return -EIO; } devfs_handle = devfs_register(NULL, ACL_DEVNAME, DEVFS_FL_DEFAULT, acl_major, 0, S_IFCHR | S_IRUGO | S_IWUGO, &acl_fops, NULL); #else int result=0; result = register_chrdev(acl_major, ACL_DEVNAME, &acl_fops); if (result < 0) { NAT_PRINT(KERN_WARNING "acl: can't get major %d\n",acl_major); return result; } if (acl_major == 0) { acl_major = result; /* dynamic */ } #endif return 0; }
int PpeRegIoctlHandler(void) { int result = 0; result = register_chrdev(HW_NAT_MAJOR, HW_NAT_DEVNAME, &hw_nat_fops); if (result < 0) { NAT_PRINT(KERN_WARNING "hw_nat: can't get major %d\n", HW_NAT_MAJOR); return result; } if (HW_NAT_MAJOR == 0) { printk("HNAT Major num=%d\n", result); } return 0; }
void FoeDumpEntry(uint32_t Index) { struct FoeEntry *entry = &PpeFoeBase[Index]; uint32_t *p = (uint32_t *)entry; uint32_t i = 0; NAT_PRINT("==========<Flow Table Entry=%d (%p)>===============\n", Index, entry); for(i=0; i < 16; i++) { // 64 bytes per entry printk("%02d: %08X\n", i,*(p+i)); } NAT_PRINT("-----------------<Flow Info>------------------\n"); NAT_PRINT("Information Block 1: %08X\n", entry->ipv4_hnapt.info_blk1); if (IS_IPV4_HNAPT(entry)) { NAT_PRINT("Information Block 2: %08X\n", entry->ipv4_hnapt.info_blk2); NAT_PRINT("Create IPv4 HNAPT entry\n"); NAT_PRINT ("IPv4 Org IP/Port: %u.%u.%u.%u:%d->%u.%u.%u.%u:%d\n", IP_FORMAT(entry->ipv4_hnapt.sip), entry->ipv4_hnapt.sport, IP_FORMAT(entry->ipv4_hnapt.dip), entry->ipv4_hnapt.dport); NAT_PRINT ("IPv4 New IP/Port: %u.%u.%u.%u:%d->%u.%u.%u.%u:%d\n", IP_FORMAT(entry->ipv4_hnapt.new_sip), entry->ipv4_hnapt.new_sport, IP_FORMAT(entry->ipv4_hnapt.new_dip), entry->ipv4_hnapt.new_dport); } else if (IS_IPV4_HNAT(entry)) { NAT_PRINT("Information Block 2: %08X\n", entry->ipv4_hnapt.info_blk2); NAT_PRINT("Create IPv4 HNAT entry\n"); NAT_PRINT("IPv4 Org IP: %u.%u.%u.%u->%u.%u.%u.%u\n", IP_FORMAT(entry->ipv4_hnapt.sip), IP_FORMAT(entry->ipv4_hnapt.dip)); NAT_PRINT("IPv4 New IP: %u.%u.%u.%u->%u.%u.%u.%u\n", IP_FORMAT(entry->ipv4_hnapt.new_sip), IP_FORMAT(entry->ipv4_hnapt.new_dip)); #if defined (CONFIG_RA_HW_NAT_IPV6) } else if (IS_IPV6_1T_ROUTE(entry)) { NAT_PRINT("Information Block 2: %08X\n", entry->ipv6_1t_route.info_blk2); NAT_PRINT("Create IPv6 Route entry\n"); NAT_PRINT("Destination IPv6: %08X:%08X:%08X:%08X", entry->ipv6_1t_route.ipv6_dip3, entry->ipv6_1t_route.ipv6_dip2, entry->ipv6_1t_route.ipv6_dip1, entry->ipv6_1t_route.ipv6_dip0); #endif } if (IS_IPV4_HNAPT(entry) || IS_IPV4_HNAT(entry) || IS_IPV6_1T_ROUTE(entry)) { NAT_PRINT ("DMAC=%02X:%02X:%02X:%02X:%02X:%02X SMAC=%02X:%02X:%02X:%02X:%02X:%02X\n", entry->ipv4_hnapt.dmac_hi[1], entry->ipv4_hnapt.dmac_hi[0], entry->ipv4_hnapt.dmac_lo[3], entry->ipv4_hnapt.dmac_lo[2], entry->ipv4_hnapt.dmac_lo[1], entry->ipv4_hnapt.dmac_lo[0], entry->ipv4_hnapt.smac_hi[1], entry->ipv4_hnapt.smac_hi[0], entry->ipv4_hnapt.smac_lo[3], entry->ipv4_hnapt.smac_lo[2], entry->ipv4_hnapt.smac_lo[1], entry->ipv4_hnapt.smac_lo[0]); NAT_PRINT("=========================================\n\n"); } }