int rule_replace(inet_prefix * from, inet_prefix * to, char *dev, int prio, u_int fwmark, u_char table) { rule_del(from, to, dev, prio, fwmark, table); return rule_add(from, to, dev, prio, fwmark, table); }
//--------------------------------------------------------------------------------------------------------------------- void pmip_cleanup(void) //--------------------------------------------------------------------------------------------------------------------- { // Anh Khuong: add if (is_lma()) { #ifdef LMA_BUFFERING pmip_buffering_cleanup(); #endif #ifdef USE_PMIP_RO if (!undefined_RO) pmip_ro_cleanup(); #endif } if (is_mag()) { #ifdef NAMYEONG_PAPER pmip_buffering_cleanup(); #endif } // Anh Khuong: end //Release the pmip cache ==> deletes the routes and rules and "default route on PMIP" and tunnels created. dbg("Release all occupied resources...\n"); //delete the default rule. dbg("Remove default rule...\n"); rule_del(NULL, RT6_TABLE_MIP6, IP6_RULE_PRIO_MIP6_FWD, RTN_UNICAST, &in6addr_any, 0, &in6addr_any, 0, 0); dbg("Release pmip_cache...\n"); pmip_cache_iterate(pmip_cache_delete_each, NULL); //#undef HAVE_PCAP_BREAKLOOP #define HAVE_PCAP_BREAKLOOP #ifdef HAVE_PCAP_BREAKLOOP /* * We have "pcap_breakloop()"; use it, so that we do as little * as possible in the signal handler (it's probably not safe * to do anything with standard I/O streams in a signal handler - * the ANSI C standard doesn't say it is). */ if (is_mag()) { pcap_breakloop(pcap_descr); } #endif }