Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/rules.c b/rules.c
  2. index 181c6b1..6dcdcef 100644
  3. --- a/rules.c
  4. +++ b/rules.c
  5. @@ -420,6 +420,9 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state,
  6.             struct fw3_mac *mac, struct fw3_icmptype *icmptype)
  7.  {
  8.         struct fw3_ipt_rule *r;
  9. +       struct fw3_device *idev, *odev;
  10. +       struct list_head empty;
  11. +       INIT_LIST_HEAD(&empty);
  12.  
  13.         if (!fw3_is_family(sip, handle->family) ||
  14.             !fw3_is_family(dip, handle->family))
  15. @@ -471,6 +474,36 @@ print_rule(struct fw3_ipt_handle *handle, struct fw3_state *state,
  16.                 return;
  17.         }
  18.  
  19. +       if (rule->target == FW3_FLAG_DSCP || rule->target == FW3_FLAG_MARK) {
  20. +               fw3_foreach(idev, rule->_src ? &rule->_src->devices : &empty)
  21. +               fw3_foreach(odev, rule->_dest ? &rule->_dest->devices : &empty)
  22. +               {
  23. +                       r = fw3_ipt_rule_create(handle, proto, idev, odev, sip, dip);
  24. +                       fw3_ipt_rule_sport_dport(r, sport, dport);
  25. +                       fw3_ipt_rule_device(r, rule->device, rule->direction_out);
  26. +                       fw3_ipt_rule_icmptype(r, icmptype);
  27. +                       fw3_ipt_rule_mac(r, mac);
  28. +                       fw3_ipt_rule_ipset(r, &rule->ipset);
  29. +                       fw3_ipt_rule_helper(r, &rule->helper);
  30. +                       fw3_ipt_rule_limit(r, &rule->limit);
  31. +                       fw3_ipt_rule_time(r, &rule->time);
  32. +                       fw3_ipt_rule_mark(r, &rule->mark);
  33. +                       fw3_ipt_rule_dscp(r, &rule->dscp);
  34. +                       set_target(r, rule);
  35. +                       fw3_ipt_rule_extra(r, rule->extra);
  36. +                       set_comment(r, rule->name, num);
  37. +
  38. +                       if ((rule->src.any || rule->_src) && (rule->dest.any || rule->_dest))
  39. +                               fw3_ipt_rule_append(r, "FORWARD");
  40. +                       else if (rule->dest.any || rule->_dest)
  41. +                               fw3_ipt_rule_append(r, "POSTROUTING");
  42. +                       else /* if (rule->src.any || rule->_src) */
  43. +                               fw3_ipt_rule_append(r, "PREROUTING");
  44. +               }
  45. +
  46. +               return;
  47. +       }
  48. +
  49.         r = fw3_ipt_rule_create(handle, proto, NULL, NULL, sip, dip);
  50.         fw3_ipt_rule_sport_dport(r, sport, dport);
  51.         fw3_ipt_rule_device(r, rule->device, rule->direction_out);
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement