Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. char *fw_policy="DIVERT";
  2. char *fw_chain="output";
  3. struct ip_fw fw;
  4. struct ip_fwuser ipfu;
  5. struct ip_fwchange ipfc;
  6. int fw_sock;
  7.  
  8. /* remove the firewall rule when exit */
  9. void intHandler (int signo) {
  10.  
  11. if (setsockopt(fw_sock, IPPROTO_IP, IP_FW_DELETE, &ipfc, sizeof(ipfc))==-1) {
  12. fprintf(stderr, "%s: could not remove rule: %s\n", progname, strerror(errno));
  13. exit(2);
  14. }
  15.  
  16. close(fw_sock);
  17. exit(0);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement