static int __init nf_conntrack_sane_init(void) { int i, j = -1, ret = 0; char *tmpname; sane_buffer = kmalloc(65536, GFP_KERNEL); if (!sane_buffer) return -ENOMEM; if (ports_c == 0) ports[ports_c++] = SANE_PORT; /* FIXME should be configurable whether IPv4 and IPv6 connections are tracked or not - YK */ for (i = 0; i < ports_c; i++) { sane[i][0].tuple.src.l3num = PF_INET; sane[i][1].tuple.src.l3num = PF_INET6; for (j = 0; j < 2; j++) { sane[i][j].tuple.src.u.tcp.port = htons(ports[i]); sane[i][j].tuple.dst.protonum = IPPROTO_TCP; sane[i][j].mask.src.u.tcp.port = 0xFFFF; sane[i][j].mask.dst.protonum = 0xFF; sane[i][j].max_expected = 1; sane[i][j].timeout = 5 * 60; /* 5 Minutes */ sane[i][j].me = THIS_MODULE; sane[i][j].help = help; tmpname = &sane_names[i][j][0]; if (ports[i] == SANE_PORT) sprintf(tmpname, "sane"); else sprintf(tmpname, "sane-%d", ports[i]); sane[i][j].name = tmpname; DEBUGP("nf_ct_sane: registering helper for pf: %d " "port: %d\n", sane[i][j].tuple.src.l3num, ports[i]); ret = nf_conntrack_helper_register(&sane[i][j]); if (ret) { printk(KERN_ERR "nf_ct_sane: failed to " "register helper for pf: %d port: %d\n", sane[i][j].tuple.src.l3num, ports[i]); nf_conntrack_sane_fini(); return ret; } } } return 0; }
static int __init nf_conntrack_sane_init(void) { int i, j = -1, ret = 0; char *tmpname; sane_buffer = kmalloc(65536, GFP_KERNEL); if (!sane_buffer) return -ENOMEM; if (ports_c == 0) ports[ports_c++] = SANE_PORT; for (i = 0; i < ports_c; i++) { sane[i][0].tuple.src.l3num = PF_INET; sane[i][1].tuple.src.l3num = PF_INET6; for (j = 0; j < 2; j++) { sane[i][j].tuple.src.u.tcp.port = htons(ports[i]); sane[i][j].tuple.dst.protonum = IPPROTO_TCP; sane[i][j].expect_policy = &sane_exp_policy; sane[i][j].me = THIS_MODULE; sane[i][j].help = help; tmpname = &sane_names[i][j][0]; if (ports[i] == SANE_PORT) sprintf(tmpname, "sane"); else sprintf(tmpname, "sane-%d", ports[i]); sane[i][j].name = tmpname; pr_debug("nf_ct_sane: registering helper for pf: %d " "port: %d\n", sane[i][j].tuple.src.l3num, ports[i]); ret = nf_conntrack_helper_register(&sane[i][j]); if (ret) { printk(KERN_ERR "nf_ct_sane: failed to " "register helper for pf: %d port: %d\n", sane[i][j].tuple.src.l3num, ports[i]); nf_conntrack_sane_fini(); return ret; } } } return 0; }