--- ip_conntrack_pptp.old 2004-02-22 12:18:11.000000000 +0100 +++ ip_conntrack_pptp.c 2004-02-22 12:57:42.000000000 +0100 @@ -169,72 +169,74 @@ u_int16_t callid, u_int16_t peer_callid) { - struct ip_conntrack_expect exp; + struct ip_conntrack_expect *exp; struct ip_conntrack_tuple inv_tuple; - memset(&exp, 0, sizeof(exp)); + if (ip_conntrack_expect_alloc(&exp) < 0) + return -ENOMEM; + /* tuple in original direction, PNS->PAC */ - exp.tuple.src.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; - exp.tuple.src.u.gre.key = htonl(ntohs(peer_callid)); - exp.tuple.dst.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; - exp.tuple.dst.u.gre.key = htonl(ntohs(callid)); - exp.tuple.dst.u.gre.protocol = __constant_htons(GRE_PROTOCOL_PPTP); - exp.tuple.dst.u.gre.version = GRE_VERSION_PPTP; - exp.tuple.dst.protonum = IPPROTO_GRE; - - exp.mask.src.ip = 0xffffffff; - exp.mask.src.u.all = 0; - exp.mask.dst.u.all = 0; - exp.mask.dst.u.gre.key = 0xffffffff; - exp.mask.dst.u.gre.version = 0xff; - exp.mask.dst.u.gre.protocol = 0xffff; - exp.mask.dst.ip = 0xffffffff; - exp.mask.dst.protonum = 0xffff; + exp->tuple.src.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; + exp->tuple.src.u.gre.key = htonl(ntohs(peer_callid)); + exp->tuple.dst.ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; + exp->tuple.dst.u.gre.key = htonl(ntohs(callid)); + exp->tuple.dst.u.gre.protocol = __constant_htons(GRE_PROTOCOL_PPTP); + exp->tuple.dst.u.gre.version = GRE_VERSION_PPTP; + exp->tuple.dst.protonum = IPPROTO_GRE; + + exp->mask.src.ip = 0xffffffff; + exp->mask.src.u.all = 0; + exp->mask.dst.u.all = 0; + exp->mask.dst.u.gre.key = 0xffffffff; + exp->mask.dst.u.gre.version = 0xff; + exp->mask.dst.u.gre.protocol = 0xffff; + exp->mask.dst.ip = 0xffffffff; + exp->mask.dst.protonum = 0xffff; - exp.seq = seq; - exp.expectfn = pptp_expectfn; + exp->seq = seq; + exp->expectfn = pptp_expectfn; - exp.help.exp_pptp_info.pac_call_id = ntohs(callid); - exp.help.exp_pptp_info.pns_call_id = ntohs(peer_callid); + exp->help.exp_pptp_info.pac_call_id = ntohs(callid); + exp->help.exp_pptp_info.pns_call_id = ntohs(peer_callid); DEBUGP("calling expect_related "); - DUMP_TUPLE_RAW(&exp.tuple); + DUMP_TUPLE_RAW(&exp->tuple); /* Add GRE keymap entries */ - if (ip_ct_gre_keymap_add(&exp, &exp.tuple, 0) != 0) + if (ip_ct_gre_keymap_add(exp, &exp->tuple, 0) != 0) return 1; - invert_tuplepr(&inv_tuple, &exp.tuple); - if (ip_ct_gre_keymap_add(&exp, &inv_tuple, 1) != 0) { - ip_ct_gre_keymap_destroy(&exp); + invert_tuplepr(&inv_tuple, &exp->tuple); + if (ip_ct_gre_keymap_add(exp, &inv_tuple, 1) != 0) { + ip_ct_gre_keymap_destroy(exp); return 1; } - if (ip_conntrack_expect_related(master, &exp) != 0) { - ip_ct_gre_keymap_destroy(&exp); + if (ip_conntrack_expect_related(master, exp) != 0) { + ip_ct_gre_keymap_destroy(exp); DEBUGP("cannot expect_related()\n"); return 1; } /* tuple in reply direction, PAC->PNS */ - exp.tuple.src.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; - exp.tuple.src.u.gre.key = htonl(ntohs(callid)); - exp.tuple.dst.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; - exp.tuple.dst.u.gre.key = htonl(ntohs(peer_callid)); + exp->tuple.src.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; + exp->tuple.src.u.gre.key = htonl(ntohs(callid)); + exp->tuple.dst.ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip; + exp->tuple.dst.u.gre.key = htonl(ntohs(peer_callid)); DEBUGP("calling expect_related "); - DUMP_TUPLE_RAW(&exp.tuple); + DUMP_TUPLE_RAW(&exp->tuple); /* Add GRE keymap entries */ - ip_ct_gre_keymap_add(&exp, &exp.tuple, 0); - invert_tuplepr(&inv_tuple, &exp.tuple); - ip_ct_gre_keymap_add(&exp, &inv_tuple, 1); + ip_ct_gre_keymap_add(exp, &exp->tuple, 0); + invert_tuplepr(&inv_tuple, &exp->tuple); + ip_ct_gre_keymap_add(exp, &inv_tuple, 1); /* FIXME: cannot handle error correctly, since we need to free * the above keymap :( */ - if (ip_conntrack_expect_related(master, &exp) != 0) { + if (ip_conntrack_expect_related(master, exp) != 0) { /* free the second pair of keypmaps */ - ip_ct_gre_keymap_destroy(&exp); + ip_ct_gre_keymap_destroy(exp); DEBUGP("cannot expect_related():\n"); return 1; }