Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char *fw_policy="DIVERT";
- char *fw_chain="output";
- struct ip_fw fw;
- struct ip_fwuser ipfu;
- struct ip_fwchange ipfc;
- int fw_sock;
- /* remove the firewall rule when exit */
- void intHandler (int signo) {
- if (setsockopt(fw_sock, IPPROTO_IP, IP_FW_DELETE, &ipfc, sizeof(ipfc))==-1) {
- fprintf(stderr, "%s: could not remove rule: %s\n", progname, strerror(errno));
- exit(2);
- }
- close(fw_sock);
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement